fix defaults precedence for gems

This commit is contained in:
John Bintz 2012-07-03 11:14:43 -04:00
parent fbbf14d639
commit 4f15f45492
3 changed files with 17 additions and 2 deletions

View File

@ -234,3 +234,18 @@ Feature: Gemfiles
# generated by penchant, environment: local
gem "one", "1.2.3", {:path=>"../one"}
"""
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"}
"""

View File

@ -193,7 +193,7 @@ module Penchant
def process_options(gem_name, template = {})
Hash[
template.merge(_defaults_for(gem_name)).collect { |key, value|
_defaults_for(gem_name).dup.merge(template).collect { |key, value|
value = value % gem_name if value.respond_to?(:%)
[ key, value ]

View File

@ -1,3 +1,3 @@
module Penchant
VERSION = "0.2.8.1"
VERSION = "0.2.9"
end