fix a bug with command order

This commit is contained in:
John Bintz 2012-10-04 10:43:38 -04:00
parent a1e9874b30
commit 55e31dd47f
2 changed files with 34 additions and 1 deletions

View File

@ -322,6 +322,36 @@ Feature: Gemfiles
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
Given I have the file "Gemfile.penchant" with the content:
"""

View File

@ -197,7 +197,10 @@ module Penchant
def defaults_for(*args)
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
protected