fix a bug with command order
This commit is contained in:
parent
a1e9874b30
commit
55e31dd47f
|
@ -322,6 +322,36 @@ Feature: Gemfiles
|
||||||
gem "two", {:require=>nil}
|
gem "two", {:require=>nil}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
Scenario: Define a pair of opposites in the other order
|
||||||
|
Given I have the file "Gemfile.penchant" with the content:
|
||||||
|
"""
|
||||||
|
opposites :local, :remote
|
||||||
|
defaults_for env(:local), :path => '../%s'
|
||||||
|
|
||||||
|
property(:github) { |name| { :git => "git://github.com/#{name}/%s.git" } }
|
||||||
|
|
||||||
|
env :remote do
|
||||||
|
gem 'one', :github => 'johnbintz', :require => nil
|
||||||
|
end
|
||||||
|
env :local do
|
||||||
|
gem 'two', :path => '../%s', :require => nil
|
||||||
|
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", :require=>nil}
|
||||||
|
gem "two", {:path=>"../two", :require=>nil}
|
||||||
|
"""
|
||||||
|
When I rebuild the Gemfile for "remote" mode
|
||||||
|
Then the file "Gemfile" should have the following content:
|
||||||
|
"""
|
||||||
|
# generated by penchant, environment: remote
|
||||||
|
gem "one", {:git=>"git://github.com/johnbintz/one.git", :require=>nil}
|
||||||
|
gem "two", {:require=>nil}
|
||||||
|
"""
|
||||||
|
|
||||||
Scenario: Override defaults for an environment
|
Scenario: Override defaults for an environment
|
||||||
Given I have the file "Gemfile.penchant" with the content:
|
Given I have the file "Gemfile.penchant" with the content:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -197,7 +197,10 @@ module Penchant
|
||||||
def defaults_for(*args)
|
def defaults_for(*args)
|
||||||
defaults = args.pop
|
defaults = args.pop
|
||||||
|
|
||||||
args.flatten.each { |gem| @defaults[gem.to_s] = defaults.dup }
|
args.flatten.each do |gem|
|
||||||
|
@defaults[gem.to_s] ||= {}
|
||||||
|
@defaults[gem.to_s].merge!(defaults)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
Loading…
Reference in New Issue