Created
March 11, 2012 14:37
-
-
Save myabc/2016633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :bundle do | |
def with_gemfile(gemfile) | |
old_gemfile = ENV['BUNDLE_GEMFILE'] | |
ENV['BUNDLE_GEMFILE'] = gemfile | |
yield | |
ENV['BUNDLE_GEMFILE'] = old_gemfile | |
end | |
task :install do | |
`bundle install` | |
end | |
desc 'Create or update Gemfile.local, to work against locally checked out repos' | |
task :local_gemfile do | |
gemfile = File.read('Gemfile') | |
gemfile.gsub!(/git: ["']git@github\.com:payango\/([\w-]+)\.git["']/, 'path: \'../\1\'') | |
File.open('Gemfile.local', 'w') { |file| file.write(gemfile) } | |
end | |
desc 'Run bundle install with Gemfile.local' | |
task local_install: :local_gemfile do | |
with_gemfile('Gemfile.local') do | |
`bundle install` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment