figaro 0.4.0 → 0.4.1
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/.travis.yml +3 -0
- data/README.md +1 -1
- data/Rakefile +3 -1
- data/features/rails.feature +8 -38
- data/features/step_definitions/common_steps.rb +0 -4
- data/figaro.gemspec +2 -1
- data/lib/figaro.rb +1 -1
- data/lib/figaro/railtie.rb +1 -1
- data/lib/figaro/{tasks.rb → tasks.rake} +2 -2
- data/spec/figaro/tasks_spec.rb +17 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/rake.rb +11 -0
- metadata +22 -5
- data/features/support/commands.rb +0 -30
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Pusher.key = ENV["PUSHER_KEY"]
|
|
44
44
|
Pusher.secret = ENV["PUSHER_SECRET"]
|
45
45
|
```
|
46
46
|
|
47
|
-
If your app requires Rails-environment-specific configuration, you can also namespace your configuration under a key for `Rails.
|
47
|
+
If your app requires Rails-environment-specific configuration, you can also namespace your configuration under a key for `Rails.env`.
|
48
48
|
|
49
49
|
```yaml
|
50
50
|
HELLO: world
|
data/Rakefile
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
4
5
|
require "cucumber/rake/task"
|
5
6
|
require "appraisal"
|
6
7
|
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
9
|
Cucumber::Rake::Task.new(:cucumber)
|
8
10
|
|
9
|
-
task :default => :cucumber
|
11
|
+
task :default => [:spec, :cucumber]
|
data/features/rails.feature
CHANGED
@@ -45,17 +45,7 @@ Feature: Rails
|
|
45
45
|
When I run "rake hello"
|
46
46
|
Then the output should be "Hello, world!"
|
47
47
|
|
48
|
-
Scenario: Has application.yml with
|
49
|
-
Given I create "config/application.yml" with:
|
50
|
-
"""
|
51
|
-
HELLO: world
|
52
|
-
development:
|
53
|
-
HELLO: developers
|
54
|
-
"""
|
55
|
-
When I run "rake hello RAILS_ENV=development"
|
56
|
-
Then the output should be "Hello, developers!"
|
57
|
-
|
58
|
-
Scenario: Has application.yml without a RAILS_ENV, but has env variables set
|
48
|
+
Scenario: Has application.yml with RAILS_ENV defaulting to "development"
|
59
49
|
Given I create "config/application.yml" with:
|
60
50
|
"""
|
61
51
|
HELLO: world
|
@@ -63,9 +53,9 @@ Feature: Rails
|
|
63
53
|
HELLO: developers
|
64
54
|
"""
|
65
55
|
When I run "rake hello"
|
66
|
-
Then the output should be "Hello,
|
56
|
+
Then the output should be "Hello, developers!"
|
67
57
|
|
68
|
-
Scenario: Has application.yml with
|
58
|
+
Scenario: Has application.yml with RAILS_ENV set
|
69
59
|
Given I create "config/application.yml" with:
|
70
60
|
"""
|
71
61
|
HELLO: world
|
@@ -74,6 +64,8 @@ Feature: Rails
|
|
74
64
|
production:
|
75
65
|
HELLO: users
|
76
66
|
"""
|
67
|
+
When I run "rake hello RAILS_ENV=test"
|
68
|
+
Then the output should be "Hello, world!"
|
77
69
|
When I run "rake hello RAILS_ENV=development"
|
78
70
|
Then the output should be "Hello, developers!"
|
79
71
|
When I run "rake hello RAILS_ENV=production"
|
@@ -90,28 +82,6 @@ Feature: Rails
|
|
90
82
|
Then "config/application.yml" should exist
|
91
83
|
But ".gitignore" should not exist
|
92
84
|
|
93
|
-
Scenario: Rake task
|
94
|
-
|
95
|
-
|
96
|
-
#!/usr/bin/env ruby
|
97
|
-
puts "Attempted: heroku #{ARGV.join(" ")}"
|
98
|
-
"""
|
99
|
-
And I create "config/application.yml" with:
|
100
|
-
"""
|
101
|
-
FOO: bar
|
102
|
-
"""
|
103
|
-
When I run "rake figaro:heroku"
|
104
|
-
Then the output should be "Attempted: heroku config:add FOO=bar"
|
105
|
-
|
106
|
-
Scenario: Rake task attempts to configure a specific Heroku app
|
107
|
-
Given the "heroku" command is:
|
108
|
-
"""
|
109
|
-
#!/usr/bin/env ruby
|
110
|
-
puts "Attempted: heroku #{ARGV.join(" ")}"
|
111
|
-
"""
|
112
|
-
And I create "config/application.yml" with:
|
113
|
-
"""
|
114
|
-
FOO: bar
|
115
|
-
"""
|
116
|
-
When I run "rake figaro:heroku[my-app]"
|
117
|
-
Then the output should be "Attempted: heroku config:add FOO=bar --app my-app"
|
85
|
+
Scenario: Includes Heroku Rake task
|
86
|
+
When I run "rake --tasks figaro:heroku"
|
87
|
+
Then the output should be "rake figaro:heroku[app] # Configure Heroku according to application.yml"
|
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.4.
|
5
|
+
gem.version = "0.4.1"
|
6
6
|
|
7
7
|
gem.authors = ["Steve Richert"]
|
8
8
|
gem.email = ["steve.richert@gmail.com"]
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.add_development_dependency "aruba", "~> 0.4"
|
17
17
|
gem.add_development_dependency "cucumber", "~> 1.0"
|
18
18
|
gem.add_development_dependency "rake", ">= 0.8.7"
|
19
|
+
gem.add_development_dependency "rspec", "~> 2.0"
|
19
20
|
|
20
21
|
gem.files = `git ls-files`.split($\)
|
21
22
|
gem.test_files = gem.files.grep(/^features\//)
|
data/lib/figaro.rb
CHANGED
data/lib/figaro/railtie.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
namespace :figaro do
|
2
2
|
desc "Configure Heroku according to application.yml"
|
3
3
|
task :heroku, [:app] => :environment do |_, args|
|
4
|
-
vars = Figaro.env.map{|k,v| "#{k}=#{v}" }.join(" ")
|
4
|
+
vars = Figaro.env.map{|k,v| "#{k}=#{v}" }.sort.join(" ")
|
5
5
|
command = "heroku config:add #{vars}"
|
6
6
|
command << " --app #{args[:app]}" if args[:app]
|
7
|
-
system(command)
|
7
|
+
Kernel.system(command)
|
8
8
|
end
|
9
9
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Figaro Rake tasks", :rake => true do
|
4
|
+
describe "figaro:heroku" do
|
5
|
+
it "configures Heroku" do
|
6
|
+
Figaro.stub(:env => {"HELLO" => "world", "FOO" => "bar"})
|
7
|
+
Kernel.should_receive(:system).once.with("heroku config:add FOO=bar HELLO=world")
|
8
|
+
task.invoke
|
9
|
+
end
|
10
|
+
|
11
|
+
it "configures a specific Heroku app" do
|
12
|
+
Figaro.stub(:env => {"HELLO" => "world", "FOO" => "bar"})
|
13
|
+
Kernel.should_receive(:system).once.with("heroku config:add FOO=bar HELLO=world --app my-app")
|
14
|
+
task.invoke("my-app")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "rake"
|
2
|
+
|
3
|
+
shared_context "rake", :rake => true do
|
4
|
+
let(:rake){ Rake.application = Rake::Application.new }
|
5
|
+
let(:task){ rake[self.class.description] }
|
6
|
+
|
7
|
+
before do
|
8
|
+
rake.rake_require("lib/figaro/tasks", [ROOT.to_s], [])
|
9
|
+
Rake::Task.define_task(:environment)
|
10
|
+
end
|
11
|
+
end
|
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.
|
4
|
+
version: 0.4.1
|
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-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -91,6 +91,22 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: 0.8.7
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '2.0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.0'
|
94
110
|
description: Simple, Heroku-friendly Rails app configuration using ENV and a single
|
95
111
|
YAML file
|
96
112
|
email:
|
@@ -111,7 +127,6 @@ files:
|
|
111
127
|
- features/step_definitions/common_steps.rb
|
112
128
|
- features/step_definitions/rails_steps.rb
|
113
129
|
- features/support/aruba.rb
|
114
|
-
- features/support/commands.rb
|
115
130
|
- features/support/env.rb
|
116
131
|
- figaro.gemspec
|
117
132
|
- gemfiles/rails30.gemfile
|
@@ -119,9 +134,12 @@ files:
|
|
119
134
|
- gemfiles/rails32.gemfile
|
120
135
|
- lib/figaro.rb
|
121
136
|
- lib/figaro/railtie.rb
|
122
|
-
- lib/figaro/tasks.
|
137
|
+
- lib/figaro/tasks.rake
|
123
138
|
- lib/generators/figaro/install/install_generator.rb
|
124
139
|
- lib/generators/figaro/install/templates/application.yml
|
140
|
+
- spec/figaro/tasks_spec.rb
|
141
|
+
- spec/spec_helper.rb
|
142
|
+
- spec/support/rake.rb
|
125
143
|
homepage: https://github.com/laserlemon/figaro
|
126
144
|
licenses: []
|
127
145
|
post_install_message:
|
@@ -152,5 +170,4 @@ test_files:
|
|
152
170
|
- features/step_definitions/common_steps.rb
|
153
171
|
- features/step_definitions/rails_steps.rb
|
154
172
|
- features/support/aruba.rb
|
155
|
-
- features/support/commands.rb
|
156
173
|
- features/support/env.rb
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module CommandHelpers
|
2
|
-
PATH = ROOT.join("tmp/commands")
|
3
|
-
|
4
|
-
def write_command(command, content)
|
5
|
-
path = PATH.join(command)
|
6
|
-
File.open(path, "w"){|f| f << content }
|
7
|
-
FileUtils.chmod(0755, path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def patch_path
|
11
|
-
FileUtils.mkdir_p(PATH)
|
12
|
-
@original_paths = ENV["PATH"] ? ENV["PATH"].split(File::PATH_SEPARATOR) : []
|
13
|
-
ENV["PATH"] = ([PATH] + @original_paths).join(File::PATH_SEPARATOR)
|
14
|
-
end
|
15
|
-
|
16
|
-
def restore_path
|
17
|
-
ENV["PATH"] = @original_paths.join(File::PATH_SEPARATOR)
|
18
|
-
FileUtils.rm_r(PATH)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
World(CommandHelpers)
|
23
|
-
|
24
|
-
Before do
|
25
|
-
patch_path
|
26
|
-
end
|
27
|
-
|
28
|
-
After do
|
29
|
-
restore_path
|
30
|
-
end
|