figaro 0.1.1 → 0.2.0
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/.gitignore +2 -0
- data/.travis.yml +5 -1
- data/Appraisals +11 -0
- data/README.md +7 -9
- data/Rakefile +1 -0
- data/features/rails.feature +26 -0
- data/features/step_definitions/common_steps.rb +8 -0
- data/features/step_definitions/rails_steps.rb +2 -1
- data/features/support/aruba.rb +5 -1
- data/figaro.gemspec +2 -1
- data/gemfiles/rails30.gemfile +7 -0
- data/gemfiles/rails31.gemfile +7 -0
- data/gemfiles/rails32.gemfile +7 -0
- data/lib/figaro/railtie.rb +1 -1
- data/lib/generators/figaro/install/install_generator.rb +23 -0
- data/lib/generators/figaro/install/templates/application.yml +7 -0
- metadata +24 -2
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Appraisals
ADDED
data/README.md
CHANGED
@@ -28,17 +28,15 @@ Okay. Add Figaro to your bundle:
|
|
28
28
|
gem "figaro"
|
29
29
|
```
|
30
30
|
|
31
|
-
Next up,
|
32
|
-
|
33
|
-
```
|
34
|
-
|
35
|
-
PUSHER_KEY: 7381a978f7dd7f9a1117
|
36
|
-
PUSHER_SECRET: abdc3b896a0ffb85d373
|
37
|
-
STRIPE_API_KEY: EdAvEPVEC3LuaTg5Q3z6WbDVqZlcBQ8Z
|
38
|
-
STRIPE_PUBLIC_KEY: pk_BRgD57O8fHja9HxduJUszhef6jCyS
|
31
|
+
Next up, install Figaro:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
rails generate figaro:install
|
39
35
|
```
|
40
36
|
|
41
|
-
|
37
|
+
This generates a commented `config/application.yml` file and ignores it in your `.gitignore`. Add your own configuration to this file and you're done!
|
38
|
+
|
39
|
+
Your configuration will be available as key/value pairs in `ENV`. For example, here's `config/initializers/pusher.rb`:
|
42
40
|
|
43
41
|
```ruby
|
44
42
|
Pusher.app_id = ENV["PUSHER_APP_ID"]
|
data/Rakefile
CHANGED
data/features/rails.feature
CHANGED
@@ -22,6 +22,21 @@ Feature: Rails
|
|
22
22
|
And I run "bundle exec rake hello"
|
23
23
|
Then the output should be "Hello!"
|
24
24
|
|
25
|
+
Scenario: Has blank application.yml
|
26
|
+
When I create "config/application.yml" with:
|
27
|
+
"""
|
28
|
+
"""
|
29
|
+
And I run "bundle exec rake hello"
|
30
|
+
Then the output should be "Hello!"
|
31
|
+
|
32
|
+
Scenario: Has commented application.yml
|
33
|
+
When I create "config/application.yml" with:
|
34
|
+
"""
|
35
|
+
# Comment
|
36
|
+
"""
|
37
|
+
And I run "bundle exec rake hello"
|
38
|
+
Then the output should be "Hello!"
|
39
|
+
|
25
40
|
Scenario: Has application.yml with requested key
|
26
41
|
When I create "config/application.yml" with:
|
27
42
|
"""
|
@@ -29,3 +44,14 @@ Feature: Rails
|
|
29
44
|
"""
|
30
45
|
And I run "bundle exec rake hello"
|
31
46
|
Then the output should be "Hello, world!"
|
47
|
+
|
48
|
+
Scenario: Generator creates and ignores application.yml file
|
49
|
+
When I run "bundle exec rails generate figaro:install"
|
50
|
+
Then "config/application.yml" should exist
|
51
|
+
And ".gitignore" should contain "/config/application.yml"
|
52
|
+
|
53
|
+
Scenario: Generator only creates application.yml if not using Git
|
54
|
+
Given I run "rm .gitignore"
|
55
|
+
When I run "bundle exec rails generate figaro:install"
|
56
|
+
Then "config/application.yml" should exist
|
57
|
+
But ".gitignore" should not exist
|
@@ -9,3 +9,11 @@ end
|
|
9
9
|
Then /^the output should be "([^"]*)"$/ do |output|
|
10
10
|
assert_exact_output(output, output_from(@commands.last).strip)
|
11
11
|
end
|
12
|
+
|
13
|
+
Then /^"([^"]+)" should ?(not)? exist$/ do |path, negative|
|
14
|
+
check_file_presence([path], !negative)
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^"([^"]+)" should contain "([^"]*)"$/ do |path, content|
|
18
|
+
check_file_content(path, content, true)
|
19
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
Given "a new Rails app" do
|
2
|
-
|
2
|
+
in_current_dir{ FileUtils.rm_rf("example") }
|
3
|
+
run_simple("bundle exec rails new example --skip-bundle --skip-active-record --skip-sprockets --skip-javascript --skip-test-unit")
|
3
4
|
cd("example")
|
4
5
|
end
|
data/features/support/aruba.rb
CHANGED
data/figaro.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "figaro"
|
5
|
-
gem.version = "0.
|
5
|
+
gem.version = "0.2.0"
|
6
6
|
|
7
7
|
gem.authors = ["Steve Richert"]
|
8
8
|
gem.email = ["steve.richert@gmail.com"]
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
|
13
13
|
gem.add_dependency "rails", "~> 3.0"
|
14
14
|
|
15
|
+
gem.add_development_dependency "appraisal", "~> 0.4"
|
15
16
|
gem.add_development_dependency "aruba", "~> 0.4"
|
16
17
|
gem.add_development_dependency "cucumber", "~> 1.0"
|
17
18
|
gem.add_development_dependency "rake", ">= 0.8.7"
|
data/lib/figaro/railtie.rb
CHANGED
@@ -5,7 +5,7 @@ module Figaro
|
|
5
5
|
class Railtie < ::Rails::Railtie
|
6
6
|
config.before_configuration do
|
7
7
|
path = Rails.root.join("config/application.yml")
|
8
|
-
ENV.update(YAML.
|
8
|
+
ENV.update(YAML.load(File.read(path)) || {}) if File.exist?(path)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Figaro
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
|
6
|
+
def create_configuration
|
7
|
+
copy_file "application.yml", "config/application.yml"
|
8
|
+
end
|
9
|
+
|
10
|
+
def ignore_configuration
|
11
|
+
if File.exists?(".gitignore")
|
12
|
+
append_to_file ".gitignore" do
|
13
|
+
<<-EOF.strip_heredoc
|
14
|
+
|
15
|
+
# Ignore application configuration
|
16
|
+
/config/application.yml
|
17
|
+
EOF
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add application configuration variables here, as shown below.
|
2
|
+
#
|
3
|
+
# PUSHER_APP_ID: "2954"
|
4
|
+
# PUSHER_KEY: 7381a978f7dd7f9a1117
|
5
|
+
# PUSHER_SECRET: abdc3b896a0ffb85d373
|
6
|
+
# STRIPE_API_KEY: EdAvEPVEC3LuaTg5Q3z6WbDVqZlcBQ8Z
|
7
|
+
# STRIPE_PUBLIC_KEY: pk_BRgD57O8fHja9HxduJUszhef6jCyS
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figaro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: appraisal
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.4'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.4'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: aruba
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,6 +101,7 @@ extra_rdoc_files: []
|
|
85
101
|
files:
|
86
102
|
- .gitignore
|
87
103
|
- .travis.yml
|
104
|
+
- Appraisals
|
88
105
|
- Gemfile
|
89
106
|
- LICENSE
|
90
107
|
- README.md
|
@@ -96,8 +113,13 @@ files:
|
|
96
113
|
- features/support/aruba.rb
|
97
114
|
- features/support/env.rb
|
98
115
|
- figaro.gemspec
|
116
|
+
- gemfiles/rails30.gemfile
|
117
|
+
- gemfiles/rails31.gemfile
|
118
|
+
- gemfiles/rails32.gemfile
|
99
119
|
- lib/figaro.rb
|
100
120
|
- lib/figaro/railtie.rb
|
121
|
+
- lib/generators/figaro/install/install_generator.rb
|
122
|
+
- lib/generators/figaro/install/templates/application.yml
|
101
123
|
homepage: https://github.com/laserlemon/figaro
|
102
124
|
licenses: []
|
103
125
|
post_install_message:
|