more cleanup

This commit is contained in:
John Bintz 2011-08-18 13:22:01 -04:00
parent 5e1c05b85f
commit a60758eaf7
4 changed files with 21 additions and 2 deletions

View File

@ -19,6 +19,12 @@ class PenchantCLI < Thor
def gemfile(env) def gemfile(env)
Penchant::Gemfile.do_full_env_switch!(env) Penchant::Gemfile.do_full_env_switch!(env)
end end
desc "gemfile-env", "Get the gemfile environment"
def gemfile_env
gemfile = Penchant::Gemfile.new
puts gemfile.environment
end
end end
PenchantCLI.start PenchantCLI.start

View File

@ -41,7 +41,7 @@ module Penchant
File.readlines(gemfile_path).first.strip[%r{environment: (.*)}, 1] File.readlines(gemfile_path).first.strip[%r{environment: (.*)}, 1]
end end
def switch_to!(gemfile_env) def switch_to!(gemfile_env = nil)
@env = gemfile_env @env = gemfile_env
template = File.read(gemfile_erb_path) template = File.read(gemfile_erb_path)

View File

@ -84,15 +84,25 @@ ERB
subject.switch_to!(:test) subject.switch_to!(:test)
File.read('Gemfile').should include('test') File.read('Gemfile').should include('test')
File.read('Gemfile').should_not include('not')
File.read('Gemfile').should include('all') File.read('Gemfile').should include('all')
end end
it 'should not render test data' do it 'should not render test data' do
subject.switch_to!(:not) subject.switch_to!(:not)
File.read('Gemfile').should_not include('test')
File.read('Gemfile').should include('not') File.read('Gemfile').should include('not')
File.read('Gemfile').should include('all') File.read('Gemfile').should include('all')
end end
it 'should not render either' do
subject.switch_to!
File.read('Gemfile').should_not include('test')
File.read('Gemfile').should_not include('not')
File.read('Gemfile').should include('all')
end
end end
end end
end end

View File

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
OLD_GIT_DIR=$GIT_DIR
unset GIT_DIR unset GIT_DIR
script/gemfile remote penchant gemfile remote
GIT_DIR=$OLD_GIT_DIR
bundle exec rake bundle exec rake
R=$? R=$?