make penchant gemfile pass through to bundler when possible, for drop-in replacement

This commit is contained in:
John Bintz 2011-08-19 14:01:34 -04:00
parent 7f97c10cd3
commit 2a29b24477
3 changed files with 12 additions and 4 deletions

View File

@ -26,8 +26,17 @@ class PenchantCLI < Thor
desc "gemfile ENV", "Switch the gemfile environment, or rebuild the current environment if not given"
def gemfile(env = get_current_env)
if env
puts "[penchant] Rebunding for #{env} environment..."
Penchant::Gemfile.do_full_env_switch!(env)
!Penchant::Gemfile.do_full_env_switch!(env)
end
gemfile = Penchant::Gemfile.new
if !gemfile.has_gemfile?
puts "No Gemfile or Gemfile.erb, exiting."
exit 1
end
system %{bundle}
end
desc "gemfile-env", "Get the gemfile environment"

View File

@ -8,12 +8,10 @@ module Penchant
def do_full_env_switch!(env)
gemfile = Penchant::Gemfile.new
if !gemfile.has_gemfile_erb?
puts "Not using Gemfile.erb, exiting."
return false
end
gemfile.switch_to!(env)
system %{bundle}
end
end

View File

@ -4,6 +4,7 @@ require 'rubygems'
require 'penchant'
if Penchant::Gemfile.do_full_env_switch!(ARGV[0])
system %{bundle}
puts "Gemfile switched to #{ARGV[0]}"
else
exit 0