Skip to content

Commit

Permalink
make 'install' and 'build' tasks depend on 'build'
Browse files Browse the repository at this point in the history
This patch attempts to fix issue rubygems#2121 in Bundler.
  • Loading branch information
sunaku authored and indirect committed Mar 2, 2013
1 parent 4880143 commit 71e14bc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/bundler/gem_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ def initialize(base = nil, name = nil)
end

def install
built_gem_path = nil

desc "Build #{name}-#{version}.gem into the pkg directory."
task 'build' do
build_gem
built_gem_path = build_gem
end

desc "Build and install #{name}-#{version}.gem into system gems."
task 'install' do
install_gem
task 'install' => 'build' do
install_gem(built_gem_path)
end

desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems"
task 'release' do
release_gem
task 'release' => 'build' do
release_gem(built_gem_path)
end

GemHelper.instance = self
Expand All @@ -62,16 +64,16 @@ def build_gem
File.join(base, 'pkg', file_name)
end

def install_gem
built_gem_path = build_gem
def install_gem(built_gem_path=nil)
built_gem_path ||= build_gem
out, _ = sh_with_code("gem install '#{built_gem_path}' --local")
raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/]
Bundler.ui.confirm "#{name} (#{version}) installed."
end

def release_gem
def release_gem(built_gem_path=nil)
guard_clean
built_gem_path = build_gem
built_gem_path ||= build_gem
tag_version { git_push } unless already_tagged?
rubygem_push(built_gem_path) if gem_push?
end
Expand Down

0 comments on commit 71e14bc

Please sign in to comment.