@fakefs Feature: Gemfiles Scenario: Process a pure Ruby gemfile Given I have the file "Gemfile.penchant" with the content: """ source :rubygems gemspec 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 gemspec 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 gemspec 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" """ Scenario: Single gem gets processed like a gems list Given I have the file "Gemfile.penchant" with the content: """ gem 'one', '1.2.3', :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", "1.2.3", {:path=>"../one"} """ @mocha 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 """ 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 | 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: """ 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"} """ 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"} """