2012-06-05 11:50:33 +00:00
|
|
|
@fakefs
|
|
|
|
Feature: Gemfiles
|
|
|
|
Scenario: Process a pure Ruby gemfile
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
source :rubygems
|
|
|
|
|
2012-06-06 17:22:28 +00:00
|
|
|
gemspec
|
|
|
|
|
2012-06-05 11:50:33 +00:00
|
|
|
group :cats, :dogs do
|
|
|
|
case environment
|
|
|
|
when :local
|
|
|
|
gem 'test', :path => '../test'
|
|
|
|
when :remote
|
|
|
|
gem 'test', :git => 'git://github.com/johnbintz/test.git'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
source :rubygems
|
2012-06-06 17:22:28 +00:00
|
|
|
gemspec
|
2012-06-05 11:50:33 +00:00
|
|
|
|
|
|
|
group :cats, :dogs do
|
|
|
|
gem "test", {:path=>"../test"}
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "remote" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: remote
|
|
|
|
source :rubygems
|
2012-06-06 17:22:28 +00:00
|
|
|
gemspec
|
2012-06-05 11:50:33 +00:00
|
|
|
|
|
|
|
group :cats, :dogs do
|
|
|
|
gem "test", {:git=>"git://github.com/johnbintz/test.git"}
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Use a gemlist
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
gems 'one', 'two', 'three', :path => '../%s'
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", {:path=>"../one"}
|
|
|
|
gem "two", {:path=>"../two"}
|
|
|
|
gem "three", {:path=>"../three"}
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Use an env block
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
env :local do
|
|
|
|
gems 'one', 'two', 'three', :path => '../%s'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", {:path=>"../one"}
|
|
|
|
gem "two", {:path=>"../two"}
|
|
|
|
gem "three", {:path=>"../three"}
|
|
|
|
"""
|
|
|
|
|
|
|
|
When I rebuild the Gemfile for "remote" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: remote
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Skip deployment blocks
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
no_deployment do
|
|
|
|
gem 'one'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one"
|
|
|
|
"""
|
|
|
|
|
|
|
|
When I rebuild the Gemfile for "local" mode with deployment
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local, deployment mode (was local)
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Peel multiple hashes off a gemlist
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
gems 'one', { :path => '../%s' }, { :require => nil }
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", {:path=>"../one", :require=>nil}
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Don't add an empty hash
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
gems 'one'
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one"
|
|
|
|
"""
|
|
|
|
|
2012-06-05 12:20:48 +00:00
|
|
|
Scenario: Single gem gets processed like a gems list
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
2012-06-11 20:46:34 +00:00
|
|
|
gem 'one', '1.2.3', :path => '../%s'
|
2012-06-05 12:20:48 +00:00
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
2012-06-11 20:46:34 +00:00
|
|
|
gem "one", "1.2.3", {:path=>"../one"}
|
2012-06-05 12:20:48 +00:00
|
|
|
"""
|
|
|
|
|
2012-06-06 17:22:28 +00:00
|
|
|
@mocha
|
2012-06-06 15:20:02 +00:00
|
|
|
Scenario: OS-specific blocks
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
os :darwin do
|
|
|
|
gem 'one', :path => '../%s'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
And I am on the "darwin" platform
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", {:path=>"../one"}
|
|
|
|
"""
|
|
|
|
Given I am on the "linux" platform
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2012-06-07 14:48:27 +00:00
|
|
|
Scenario: Get the list of environments defined
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
env :cat do
|
|
|
|
gem 'one', :path => '../%s'
|
|
|
|
end
|
|
|
|
|
|
|
|
env :dog do
|
|
|
|
gem 'two', :path => '../%s'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I request the list of environments available
|
|
|
|
Then I should get the following environments:
|
|
|
|
| cat |
|
|
|
|
| dog |
|
|
|
|
|
|
|
|
Scenario: Get the list of git repos defined
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
gem 'one', :path => '../%s'
|
|
|
|
gem 'two', :git => 'git://github.cats/%s.git'
|
|
|
|
"""
|
|
|
|
When I request the list of git repositories
|
|
|
|
Then I should get the following repositories:
|
|
|
|
| git://github.cats/two.git |
|
|
|
|
|
2012-06-21 19:25:46 +00:00
|
|
|
Scenario: Get the list of git repos defined, regardless of environment
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
gem 'one', :path => '../%s'
|
|
|
|
env :remote do
|
|
|
|
gem 'two', :git => 'git://github.cats/%s.git'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I request the list of git repositories
|
|
|
|
Then I should get the following repositories:
|
|
|
|
| git://github.cats/two.git |
|
|
|
|
|
2012-06-20 13:34:47 +00:00
|
|
|
Scenario: Propose defaults for a gem
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
defaults_for 'one', :path => '../%s'
|
|
|
|
gem 'one', '1.2.3'
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", "1.2.3", {:path=>"../one"}
|
|
|
|
"""
|
|
|
|
|
|
|
|
Scenario: Propose defaults for an array of gems
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
defaults_for ['one'], :path => '../%s'
|
|
|
|
gem 'one', '1.2.3'
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", "1.2.3", {:path=>"../one"}
|
|
|
|
"""
|
2012-06-20 17:25:43 +00:00
|
|
|
|
|
|
|
Scenario: Propose defaults for an environment
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
defaults_for env(:local), :path => '../%s'
|
|
|
|
env :local do
|
|
|
|
gem 'one', '1.2.3'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", "1.2.3", {:path=>"../one"}
|
|
|
|
"""
|
2012-07-03 15:14:43 +00:00
|
|
|
|
|
|
|
Scenario: Override defaults for an environment
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
defaults_for env(:local), :path => '../%s'
|
|
|
|
env :local do
|
|
|
|
gem 'one', '1.2.3', :path => '../cats'
|
|
|
|
end
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", "1.2.3", {:path=>"../cats"}
|
|
|
|
"""
|
2012-07-05 22:27:59 +00:00
|
|
|
|
|
|
|
Scenario: Define special expansions for properties
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
defaults_for env(:local), :path => '../%s'
|
|
|
|
property(:github) { |name| { :git => "git://github.com/#{name}/%s.git" } }
|
|
|
|
gem 'one', :github => 'john'
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", {:git=>"git://github.com/john/one.git"}
|
|
|
|
"""
|
2012-07-10 10:38:02 +00:00
|
|
|
|
|
|
|
Scenario: Define special expansions for properties as a hash
|
|
|
|
Given I have the file "Gemfile.penchant" with the content:
|
|
|
|
"""
|
|
|
|
defaults_for env(:local), :path => '../%s'
|
|
|
|
property :github, :git => "git://github.com/$1/%s.git"
|
|
|
|
gem 'one', :github => 'john'
|
|
|
|
"""
|
|
|
|
When I rebuild the Gemfile for "local" mode
|
|
|
|
Then the file "Gemfile" should have the following content:
|
|
|
|
"""
|
|
|
|
# generated by penchant, environment: local
|
|
|
|
gem "one", {:git=>"git://github.com/john/one.git"}
|
|
|
|
"""
|
|
|
|
|