figaro 0.6.1 → 0.6.2
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.
- checksums.yaml +15 -0
- data/.travis.yml +4 -0
- data/Gemfile +8 -4
- data/README.md +6 -1
- data/Rakefile +9 -0
- data/features/rails.feature +1 -39
- data/features/support/env.rb +5 -0
- data/figaro.gemspec +2 -1
- data/gemfiles/rails30.gemfile +8 -4
- data/gemfiles/rails31.gemfile +8 -4
- data/gemfiles/rails32.gemfile +8 -4
- data/gemfiles/rails40.gemfile +8 -4
- data/lib/figaro/tasks.rake +1 -1
- data/lib/figaro/tasks.rb +15 -5
- data/spec/figaro/tasks_spec.rb +49 -39
- data/spec/spec_helper.rb +5 -0
- metadata +7 -10
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MmQ0NjAyZmU3NWMzNTZkY2UzNDAyNTA0NTZjMjkwYTRiZDU3ZGU5ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NmNkMTFlM2UwYzdmZTkxMWRmYTczZjI5NjM4M2Y2ZTY5N2QzY2E3NA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWU3YTgzZmVhYzc2NjhjNTk4YTIyYzdkNzQwZDRiMWU4MzVlYWRiZmIwMDU4
|
10
|
+
OWU2ZTA5ZWQ4Y2RkODI2MmU3NzVmOGUwZTc2MjkyZmI5ODRjYjBkMmVlNDQ1
|
11
|
+
MmNjODFiM2FkNzc2ZjdiMjFjN2RlMmRiODMwNGFkYmRjN2RhODI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MjczZTlkNmI2NTgwNjZjZTkxMTYxODY1MDI2ZWNjNjViZDkyODU3MzMyZTY1
|
14
|
+
MWRlZWM2ODJhZTMyZDI1NmQxYmUyZTBiYjM1NGMzNjVlMDE1ZWJkMDllNWNm
|
15
|
+
OGZhMzcwOGE3YTI1ZGYzZjIwYzkyMTE0MDU4MTAxNjY4YWU2ZDc=
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -4,7 +4,11 @@ gemspec
|
|
4
4
|
|
5
5
|
gem "rails", ">= 3.0.2", "< 5"
|
6
6
|
|
7
|
-
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "
|
7
|
+
group :test do
|
8
|
+
gem "aruba", "~> 0.5"
|
9
|
+
gem "coveralls", "~> 0.6", :require => false
|
10
|
+
gem "cucumber", "~> 1.2"
|
11
|
+
gem "rake", "~> 10.0"
|
12
|
+
gem "rspec", "~> 2.13"
|
13
|
+
gem "simplecov", "~> 0.7", :require => false
|
14
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
# Figaro
|
1
|
+
# Figaro
|
2
|
+
[](http://badge.fury.io/rb/figaro)
|
3
|
+
[](https://travis-ci.org/laserlemon/figaro)
|
4
|
+
[](https://codeclimate.com/github/laserlemon/figaro)
|
5
|
+
[](https://coveralls.io/r/laserlemon/figaro)
|
6
|
+
[](https://gemnasium.com/laserlemon/figaro)
|
2
7
|
|
3
8
|
Simple Rails app configuration
|
4
9
|
|
data/Rakefile
CHANGED
@@ -6,3 +6,12 @@ RSpec::Core::RakeTask.new(:spec)
|
|
6
6
|
Cucumber::Rake::Task.new(:cucumber)
|
7
7
|
|
8
8
|
task :default => [:spec, :cucumber]
|
9
|
+
|
10
|
+
if ENV["COVERAGE"]
|
11
|
+
Rake::Task[:default].enhance do
|
12
|
+
require "simplecov"
|
13
|
+
require "coveralls"
|
14
|
+
|
15
|
+
Coveralls::SimpleCov::Formatter.new.format(SimpleCov.result)
|
16
|
+
end
|
17
|
+
end
|
data/features/rails.feature
CHANGED
@@ -9,10 +9,6 @@ Feature: Rails
|
|
9
9
|
puts ["Hello", ENV["HELLO"]].compact.join(", ") << "!"
|
10
10
|
end
|
11
11
|
|
12
|
-
task :nena => :environment do
|
13
|
-
puts [ENV["LUFTBALLOONS"], "Luftballoons"].compact.join(" ")
|
14
|
-
end
|
15
|
-
|
16
12
|
task :greet => :environment do
|
17
13
|
puts ([Figaro.env.greeting] * 3).join(", ") << "!"
|
18
14
|
end
|
@@ -22,15 +18,7 @@ Feature: Rails
|
|
22
18
|
When I run "rake hello"
|
23
19
|
Then the output should be "Hello!"
|
24
20
|
|
25
|
-
|
26
|
-
Given I create "config/application.yml" with:
|
27
|
-
"""
|
28
|
-
GOODBYE: Ruby Tuesday
|
29
|
-
"""
|
30
|
-
When I run "rake hello"
|
31
|
-
Then the output should be "Hello!"
|
32
|
-
|
33
|
-
Scenario: Has blank application.yml
|
21
|
+
Scenario: Has blank application.yml
|
34
22
|
Given I create "config/application.yml" with:
|
35
23
|
"""
|
36
24
|
"""
|
@@ -45,24 +33,6 @@ Feature: Rails
|
|
45
33
|
When I run "rake hello"
|
46
34
|
Then the output should be "Hello!"
|
47
35
|
|
48
|
-
Scenario: Has application.yml with requested key
|
49
|
-
Given I create "config/application.yml" with:
|
50
|
-
"""
|
51
|
-
HELLO: world
|
52
|
-
"""
|
53
|
-
When I run "rake hello"
|
54
|
-
Then the output should be "Hello, world!"
|
55
|
-
|
56
|
-
Scenario: Has application.yml with RAILS_ENV defaulting to "development"
|
57
|
-
Given I create "config/application.yml" with:
|
58
|
-
"""
|
59
|
-
HELLO: world
|
60
|
-
development:
|
61
|
-
HELLO: developers
|
62
|
-
"""
|
63
|
-
When I run "rake hello"
|
64
|
-
Then the output should be "Hello, developers!"
|
65
|
-
|
66
36
|
Scenario: Has application.yml with RAILS_ENV set
|
67
37
|
Given I create "config/application.yml" with:
|
68
38
|
"""
|
@@ -79,14 +49,6 @@ Feature: Rails
|
|
79
49
|
When I run "rake hello RAILS_ENV=production"
|
80
50
|
Then the output should be "Hello, users!"
|
81
51
|
|
82
|
-
Scenario: Has application.yml with non-string values
|
83
|
-
Given I create "config/application.yml" with:
|
84
|
-
"""
|
85
|
-
LUFTBALLOONS: 99
|
86
|
-
"""
|
87
|
-
When I run "rake nena"
|
88
|
-
Then the output should be "99 Luftballoons"
|
89
|
-
|
90
52
|
Scenario: Generator creates and ignores application.yml file
|
91
53
|
When I run "rails generate figaro:install"
|
92
54
|
Then "config/application.yml" should exist
|
data/features/support/env.rb
CHANGED
data/figaro.gemspec
CHANGED
@@ -2,13 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = "figaro"
|
5
|
-
gem.version = "0.6.
|
5
|
+
gem.version = "0.6.2"
|
6
6
|
|
7
7
|
gem.authors = ["Steve Richert"]
|
8
8
|
gem.email = ["steve.richert@gmail.com"]
|
9
9
|
gem.summary = "Simple Rails app configuration"
|
10
10
|
gem.description = "Simple, Heroku-friendly Rails app configuration using ENV and a single YAML file"
|
11
11
|
gem.homepage = "https://github.com/laserlemon/figaro"
|
12
|
+
gem.license = "MIT"
|
12
13
|
|
13
14
|
gem.add_dependency "rails", ">= 3", "< 5"
|
14
15
|
|
data/gemfiles/rails30.gemfile
CHANGED
@@ -4,7 +4,11 @@ gemspec :path => "../"
|
|
4
4
|
|
5
5
|
gem "rails", "~> 3.0.2"
|
6
6
|
|
7
|
-
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "
|
7
|
+
group :test do
|
8
|
+
gem "aruba", "~> 0.5"
|
9
|
+
gem "coveralls", "~> 0.6", :require => false
|
10
|
+
gem "cucumber", "~> 1.2"
|
11
|
+
gem "rake", "~> 10.0"
|
12
|
+
gem "rspec", "~> 2.13"
|
13
|
+
gem "simplecov", "~> 0.7", :require => false
|
14
|
+
end
|
data/gemfiles/rails31.gemfile
CHANGED
@@ -4,7 +4,11 @@ gemspec :path => "../"
|
|
4
4
|
|
5
5
|
gem "rails", "~> 3.1.0"
|
6
6
|
|
7
|
-
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "
|
7
|
+
group :test do
|
8
|
+
gem "aruba", "~> 0.5"
|
9
|
+
gem "coveralls", "~> 0.6", :require => false
|
10
|
+
gem "cucumber", "~> 1.2"
|
11
|
+
gem "rake", "~> 10.0"
|
12
|
+
gem "rspec", "~> 2.13"
|
13
|
+
gem "simplecov", "~> 0.7", :require => false
|
14
|
+
end
|
data/gemfiles/rails32.gemfile
CHANGED
@@ -4,7 +4,11 @@ gemspec :path => "../"
|
|
4
4
|
|
5
5
|
gem "rails", "~> 3.2.0"
|
6
6
|
|
7
|
-
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "
|
7
|
+
group :test do
|
8
|
+
gem "aruba", "~> 0.5"
|
9
|
+
gem "coveralls", "~> 0.6", :require => false
|
10
|
+
gem "cucumber", "~> 1.2"
|
11
|
+
gem "rake", "~> 10.0"
|
12
|
+
gem "rspec", "~> 2.13"
|
13
|
+
gem "simplecov", "~> 0.7", :require => false
|
14
|
+
end
|
data/gemfiles/rails40.gemfile
CHANGED
@@ -4,7 +4,11 @@ gemspec :path => "../"
|
|
4
4
|
|
5
5
|
gem "rails", ">= 4.0.0.beta", "< 4.1"
|
6
6
|
|
7
|
-
|
8
|
-
gem "
|
9
|
-
gem "
|
10
|
-
gem "
|
7
|
+
group :test do
|
8
|
+
gem "aruba", "~> 0.5"
|
9
|
+
gem "coveralls", "~> 0.6", :require => false
|
10
|
+
gem "cucumber", "~> 1.2"
|
11
|
+
gem "rake", "~> 10.0"
|
12
|
+
gem "rspec", "~> 2.13"
|
13
|
+
gem "simplecov", "~> 0.7", :require => false
|
14
|
+
end
|
data/lib/figaro/tasks.rake
CHANGED
data/lib/figaro/tasks.rb
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
module Figaro
|
2
2
|
module Tasks
|
3
|
-
|
4
|
-
|
3
|
+
class Heroku < Struct.new(:app)
|
4
|
+
def invoke
|
5
|
+
heroku("config:set #{vars}")
|
6
|
+
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
+
def vars
|
9
|
+
Figaro.vars(environment)
|
10
|
+
end
|
8
11
|
|
9
|
-
|
12
|
+
def environment
|
13
|
+
heroku("run 'echo $RAILS_ENV'").chomp[/(\w+)\z/]
|
14
|
+
end
|
15
|
+
|
16
|
+
def heroku(command)
|
17
|
+
with_app = app ? " --app #{app}" : ""
|
18
|
+
`heroku #{command}#{with_app}`
|
19
|
+
end
|
10
20
|
end
|
11
21
|
end
|
12
22
|
end
|
data/spec/figaro/tasks_spec.rb
CHANGED
@@ -1,61 +1,71 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
describe
|
5
|
-
|
6
|
-
Figaro.stub(:vars => "FOO=bar")
|
3
|
+
module Figaro::Tasks
|
4
|
+
describe Heroku do
|
5
|
+
subject(:heroku) { Heroku.new }
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
describe "#invoke" do
|
8
|
+
it "configures Heroku" do
|
9
|
+
heroku.stub(:vars => "FOO=bar")
|
11
10
|
|
12
|
-
|
13
|
-
end
|
11
|
+
heroku.should_receive(:heroku).once.with("config:set FOO=bar")
|
14
12
|
|
15
|
-
|
16
|
-
|
13
|
+
heroku.invoke
|
14
|
+
end
|
15
|
+
end
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
with("heroku config:add FOO=bar --app my-app")
|
17
|
+
describe "#vars" do
|
18
|
+
it "returns Figaro's vars for Heroku's environment" do
|
19
|
+
heroku.stub(:environment => "staging")
|
20
|
+
Figaro.stub(:vars).with("staging").and_return("FOO=bar")
|
23
21
|
|
24
|
-
|
22
|
+
expect(heroku.vars).to eq("FOO=bar")
|
23
|
+
end
|
25
24
|
end
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
describe "#environment" do
|
27
|
+
it "returns Heroku's environment" do
|
28
|
+
heroku.stub(:heroku).with("run 'echo $RAILS_ENV'").and_return(<<-OUT)
|
29
|
+
Running `echo $RAILS_ENV` attached to terminal... up, run.1234
|
30
|
+
staging
|
31
|
+
OUT
|
33
32
|
|
34
|
-
|
33
|
+
expect(heroku.environment).to eq("staging")
|
34
|
+
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
describe "#heroku" do
|
38
|
+
it "runs a command on Heroku" do
|
39
|
+
heroku.should_receive(:`).once.with("heroku info")
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
heroku.heroku("info")
|
42
|
+
end
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
it "runs a command on a specific Heroku app" do
|
45
|
+
heroku = Heroku.new("my-app")
|
46
46
|
|
47
|
-
|
48
|
-
it "configures Heroku" do
|
49
|
-
Figaro::Tasks.should_receive(:heroku).once.with(nil)
|
47
|
+
heroku.should_receive(:`).once.with("heroku info --app my-app")
|
50
48
|
|
51
|
-
|
49
|
+
heroku.heroku("info")
|
52
50
|
end
|
51
|
+
end
|
52
|
+
end
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
describe "figaro:heroku", :rake => true do
|
55
|
+
subject(:heroku) { mock(:heroku) }
|
56
56
|
|
57
|
-
|
58
|
-
|
57
|
+
it "configures Heroku" do
|
58
|
+
Figaro::Tasks::Heroku.stub(:new).with(nil).and_return(heroku)
|
59
|
+
heroku.should_receive(:invoke).once
|
60
|
+
|
61
|
+
task.invoke
|
62
|
+
end
|
63
|
+
|
64
|
+
it "configures a specific Heroku app" do
|
65
|
+
Figaro::Tasks::Heroku.stub(:new).with("my-app").and_return(heroku)
|
66
|
+
heroku.should_receive(:invoke).once
|
67
|
+
|
68
|
+
task.invoke("my-app")
|
59
69
|
end
|
60
70
|
end
|
61
71
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figaro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Steve Richert
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -25,7 +23,6 @@ dependencies:
|
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
27
|
- - ! '>='
|
31
28
|
- !ruby/object:Gem::Version
|
@@ -71,28 +68,28 @@ files:
|
|
71
68
|
- spec/spec_helper.rb
|
72
69
|
- spec/support/rake.rb
|
73
70
|
homepage: https://github.com/laserlemon/figaro
|
74
|
-
licenses:
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
75
74
|
post_install_message:
|
76
75
|
rdoc_options: []
|
77
76
|
require_paths:
|
78
77
|
- lib
|
79
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
79
|
requirements:
|
82
80
|
- - ! '>='
|
83
81
|
- !ruby/object:Gem::Version
|
84
82
|
version: '0'
|
85
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
84
|
requirements:
|
88
85
|
- - ! '>='
|
89
86
|
- !ruby/object:Gem::Version
|
90
87
|
version: '0'
|
91
88
|
requirements: []
|
92
89
|
rubyforge_project:
|
93
|
-
rubygems_version:
|
90
|
+
rubygems_version: 2.0.2
|
94
91
|
signing_key:
|
95
|
-
specification_version:
|
92
|
+
specification_version: 4
|
96
93
|
summary: Simple Rails app configuration
|
97
94
|
test_files:
|
98
95
|
- features/rails.feature
|