fig_newton 0.2 → 0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +4 -0
- data/README.md +9 -0
- data/config/yaml/sample.yml +1 -0
- data/features/fig_newton.feature +5 -0
- data/features/step_definitions/fig_newton_steps.rb +4 -0
- data/lib/fig_newton.rb +1 -0
- data/lib/fig_newton/missing.rb +5 -0
- data/lib/fig_newton/version.rb +1 -1
- metadata +9 -8
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -30,6 +30,15 @@ class MyPage
|
|
30
30
|
end
|
31
31
|
````
|
32
32
|
|
33
|
+
If you have an environment variable `FIG_NEWTON_FILE` set then it will read that file by default. This makes it easy to set the environment via your `cucumber.yml` file like this:
|
34
|
+
|
35
|
+
````
|
36
|
+
default: FIG_NEWTON_FILE=local.yml --color --format pretty
|
37
|
+
ci: FIG_NEWTON_FILE=ci.yml --color --format pretty
|
38
|
+
test: FIG_NEWTON_FILE=test.yml --color --format pretty
|
39
|
+
staging: FIG_NEWTON_FILE=staging.yml --color --format pretty
|
40
|
+
|
41
|
+
When you run the cucumber command you can easily select the correct profile which in turn will select the correct configuration file for your environment.
|
33
42
|
|
34
43
|
|
35
44
|
## Installation
|
@@ -0,0 +1 @@
|
|
1
|
+
from_the_env_file: read from the env file
|
data/features/fig_newton.feature
CHANGED
@@ -10,6 +10,11 @@ Feature: Functionality of the fig_newton gem
|
|
10
10
|
When I ask for a value that does not exist named "does_not_exist"
|
11
11
|
Then I should raise a NoMethodError exception
|
12
12
|
|
13
|
+
Scenario: Getting the default filename from an environment variable
|
14
|
+
Given I have an environment variable named "FIG_NEWTON_FILE" set to "sample.yml"
|
15
|
+
When I ask for the value for "from_the_env_file"
|
16
|
+
Then I should see "read from the env file"
|
17
|
+
|
13
18
|
Scenario: Requesting data that contains a node of additional data
|
14
19
|
Given I have read the configuration file
|
15
20
|
When I ask for the value for "database"
|
@@ -30,3 +30,7 @@ When /^I ask for the node value for "([^\"]*)"$/ do |key|
|
|
30
30
|
@value = @value.send(key)
|
31
31
|
end
|
32
32
|
|
33
|
+
Given /^I have an environment variable named "([^\"]*)" set to "([^\"]*)"$/ do |env_name, filename|
|
34
|
+
ENV[env_name] = filename
|
35
|
+
FigNewton.instance_variable_set(:@yml, nil)
|
36
|
+
end
|
data/lib/fig_newton.rb
CHANGED
data/lib/fig_newton/missing.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
module FigNewton
|
2
2
|
module Missing
|
3
3
|
def method_missing(*args, &block)
|
4
|
+
read_env_file unless @yml
|
4
5
|
m = args.first
|
5
6
|
value = @yml[m.to_s]
|
6
7
|
super unless value
|
7
8
|
value = FigNewton::Node.new(value) unless value.kind_of? String
|
8
9
|
value
|
9
10
|
end
|
11
|
+
|
12
|
+
def read_env_file
|
13
|
+
@yml = YAML.load_file "#{@yml_directory}/#{ENV['FIG_NEWTON_FILE']}"
|
14
|
+
end
|
10
15
|
end
|
11
16
|
end
|
data/lib/fig_newton/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig_newton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yml_reader
|
16
|
-
requirement: &
|
16
|
+
requirement: &70201006592140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70201006592140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70201006591640 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 2.8.0
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70201006591640
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &70201006591180 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 1.1.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70201006591180
|
47
47
|
description: Provides a simple mechanism to maintain and use different configurations
|
48
48
|
stored in yml files.
|
49
49
|
email:
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- LICENSE
|
63
63
|
- README.md
|
64
64
|
- Rakefile
|
65
|
+
- config/yaml/sample.yml
|
65
66
|
- config/yaml/test_config.yml
|
66
67
|
- cucumber.yml
|
67
68
|
- features/fig_newton.feature
|