-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
222 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ test/version_tmp | |
tmp | ||
.ruby-version | ||
.ruby-gemset | ||
.ovpnmcgen.rb.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ before_install: | |
rvm: | ||
- 1.9.3 | ||
- 2.0.0 | ||
- 2.1-head | ||
- 2.1 | ||
- ruby-head | ||
- jruby-19mode | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
Feature: Generate Functionality with Configuration File | ||
In order to generate a properly formatted plist mobileconfig with less typing | ||
As a CLI | ||
Some basic inputs are taken from a config file, if available | ||
|
||
Background: | ||
Given a file named "ca.crt" with: | ||
""" | ||
Contents of CA file | ||
With newlines | ||
And more newlines | ||
That should appear as one line | ||
""" | ||
And a file named "p12file.p12" with: | ||
""" | ||
p12file that should appear | ||
In base64 encoding as <data/> | ||
""" | ||
|
||
Scenario: A configuration file supplied should be read, without the need for required flags. | ||
Given a file named ".ovpnmcgen.rb.yml" with: | ||
""" | ||
host: aruba.cucumber.org | ||
""" | ||
When I run `ovpnmcgen.rb g cucumber aruba` | ||
Then the output should contain "error: " | ||
And the output should not contain "error: Host" | ||
|
||
Scenario: A custom configuration file supplied should be read, without the need for required flags. | ||
Given a file named ".custom.yml" with: | ||
""" | ||
host: aruba.cucumber.org | ||
""" | ||
When I run `ovpnmcgen.rb g --config .custom.yml cucumber aruba` | ||
Then the output should contain "error: " | ||
And the output should not contain "error: Host" | ||
|
||
Scenario: Flags should override configuration file options. | ||
Given a file named ".ovpnmcgen.rb.yml" with: | ||
""" | ||
host: file.org | ||
no_vod: true | ||
""" | ||
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --vod --p12file p12file.p12 cucumber aruba` | ||
Then the output should match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>aruba.cucumber.org 1194 udp</string> | ||
""" | ||
And the output should match: | ||
""" | ||
<key>OnDemandEnabled</key> | ||
\s*<integer>1</integer> | ||
""" | ||
And the output should not match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>file.org 1194 udp</string> | ||
""" | ||
|
||
Scenario: Battle between no-vod in the configuration file and the vod flag default. | ||
Given a file named ".ovpnmcgen.rb.yml" with: | ||
""" | ||
no_vod: false | ||
""" | ||
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 cucumber aruba` | ||
Then the output should match: | ||
""" | ||
<key>OnDemandEnabled</key> | ||
\s*<integer>1</integer> | ||
""" | ||
|
||
Scenario: no_vod true in the configuration file. | ||
Given a file named ".ovpnmcgen.rb.yml" with: | ||
""" | ||
no_vod: true | ||
""" | ||
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 cucumber aruba` | ||
Then the output should match: | ||
""" | ||
<key>OnDemandEnabled</key> | ||
\s*<integer>0</integer> | ||
""" | ||
|
||
Scenario: ENV variables set here should work. | ||
Given I set the environment variable "OG_HOST" to "env.org" | ||
When I run `/usr/bin/env` | ||
Then the output should contain "OG_HOST=env.org" | ||
|
||
Scenario: ENV variables should override configuration file options. | ||
Given a file named ".ovpnmcgen.rb.yml" with: | ||
""" | ||
host: file.org | ||
""" | ||
And I set the environment variable "OG_HOST" to "env.org" | ||
When I run `ovpnmcgen.rb g --cafile ca.crt --p12file p12file.p12 cucumber aruba` | ||
Then the output should match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>env.org 1194 udp</string> | ||
""" | ||
And the output should not match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>file.org 1194 udp</string> | ||
""" | ||
|
||
Scenario: Flags should overrride ENV variables, and should also override configuration file options. | ||
Given a file named ".ovpnmcgen.rb.yml" with: | ||
""" | ||
host: file.org | ||
""" | ||
And I set the environment variable "OG_HOST" to "env.org" | ||
When I run `ovpnmcgen.rb g --host aruba.cucumber.org --cafile ca.crt --p12file p12file.p12 cucumber aruba` | ||
Then the output should match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>aruba.cucumber.org 1194 udp</string> | ||
""" | ||
And the output should not match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>env.org 1194 udp</string> | ||
""" | ||
And the output should not match: | ||
""" | ||
<key>remote</key> | ||
\s*<string>file.org 1194 udp</string> | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Given /^I set the environment variable "(\w+)" to "([^"]*)"$/ do |var, value| | ||
ENV[var] = value | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'app_configuration' | ||
|
||
module Ovpnmcgen | ||
@@config_file_name = '.ovpnmcgen.rb.yml' | ||
|
||
# attr_accessor :config, :config_file_name | ||
|
||
def configure(filename = @@config_file_name) | ||
|
||
@@config = AppConfiguration.new filename do | ||
prefix 'og' | ||
end | ||
|
||
# @@config = AppConfiguration[:ovpnmcgen] | ||
end | ||
|
||
def config | ||
@@config | ||
end | ||
|
||
module_function :configure, :config | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module Ovpnmcgen | ||
VERSION = "0.3.0" | ||
VERSION = "0.4.0" | ||
SUMMARY = "An OpenVPN iOS Configuration Profile (.mobileconfig) Utility" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters