make sure git repo discovery digs into any environment [ice cream]

This commit is contained in:
John Bintz 2012-06-21 15:25:46 -04:00
parent dfbe5a7ccf
commit 3fc02e9180
2 changed files with 22 additions and 4 deletions

View File

@ -182,6 +182,18 @@ Feature: Gemfiles
Then I should get the following repositories:
| git://github.cats/two.git |
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 |
Scenario: Propose defaults for a gem
Given I have the file "Gemfile.penchant" with the content:
"""

View File

@ -102,6 +102,8 @@ module Penchant
class FileProcessor
attr_reader :environment, :is_deployment, :available_environments, :defined_git_repos
ANY_ENVIRONMENT = :any_environment
def self.result(data, *args)
new(data).result(*args)
end
@ -138,7 +140,7 @@ module Penchant
@available_environments += args
if block_given?
if args.include?(environment)
if for_environment?(args)
@_current_env_defaults = _defaults_for(Env.new(environment))
yield
@_current_env_defaults = {}
@ -148,6 +150,10 @@ module Penchant
end
end
def for_environment?(envs)
envs.include?(environment) || environment == ANY_ENVIRONMENT
end
def no_deployment
yield if !is_deployment
end
@ -330,7 +336,7 @@ module Penchant
end
def defined_git_repos
process
process(FileProcessor::ANY_ENVIRONMENT)
builder.defined_git_repos
end
@ -369,8 +375,8 @@ module Penchant
File.join(@path, file)
end
def process
builder.result(@env, @is_deployment)
def process(env = @env)
builder.result(env, @is_deployment)
end
def builder