diff options
author | Joshua Hull <joshbuddy@gmail.com> | 2010-08-09 17:31:06 -0700 |
---|---|---|
committer | Joshua Hull <joshbuddy@gmail.com> | 2010-08-09 17:31:06 -0700 |
commit | 83c4c6d52c01bc533cd6ef03d6d497c27fd456c3 (patch) | |
tree | 9af09bae7d6a26170bdc11fc1c85e4690d73f7c2 /lib/bundler/gem_helper.rb | |
parent | 323c07c491b32024ad3f9325cfa71df4a75d0925 (diff) | |
download | bundler-83c4c6d52c01bc533cd6ef03d6d497c27fd456c3.tar.gz |
Revert "Revert "work-around for bizarre gem exitcode. use specification to determine name.""
This reverts commit 23e45e2970c37ec846df3da4ce94fcfeebd3c8e3.
Diffstat (limited to 'lib/bundler/gem_helper.rb')
-rw-r--r-- | lib/bundler/gem_helper.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index b86b5738bd..c08c64eb11 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -11,7 +11,7 @@ module Bundler def initialize(base, name = nil) @base = base - @name = name || interpolate_name + @name = name || determine_name or raise("Cannot automatically determine the name of your gem. Use :name => 'gemname' in #install_tasks to manually set it.") @spec_path = File.join(@base, "#{@name}.gemspec") end @@ -34,7 +34,8 @@ module Bundler def build_gem file_name = nil - sh("gem build #{spec_path}") { + sh("gem build #{spec_path}") { |out, err| + raise err if err[/ERROR/] file_name = File.basename(built_gem_path) FileUtils.mkdir_p(File.join(base, 'pkg')) FileUtils.mv(built_gem_path, 'pkg') @@ -65,11 +66,11 @@ module Bundler Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last end - def interpolate_name + def determine_name gemspecs = Dir[File.join(base, "*.gemspec")] raise "Unable to determine name from existing gemspec." unless gemspecs.size == 1 - File.basename(gemspecs.first)[/^(.*)\.gemspec$/, 1] + Gem::Specification.load(File.basename(gemspecs.first)[/^.*\.gemspec$/]).name end def git_push @@ -125,7 +126,7 @@ module Bundler stdin, stdout, stderr = *Open3.popen3(cmd) if $? == 0 output = stdout.read - block.call if block + block.call(output, stderr.read) if block end } [output, $?] |