Skip to content

Instantly share code, notes, and snippets.

@stouset
Created February 18, 2010 22:41
Show Gist options
  • Save stouset/308167 to your computer and use it in GitHub Desktop.
Save stouset/308167 to your computer and use it in GitHub Desktop.
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 75da44f..23b993e 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -188,18 +188,19 @@ module Bundler
private
def generate_bin(spec)
- # HAX -- Generate the bin
- bin_dir = "#{Gem.dir}/bin"
- gem_dir = spec.full_gem_path
- installer = Gem::Installer.allocate
- installer.instance_eval do
- @spec = spec
- @bin_dir = bin_dir
- @gem_dir = gem_dir
- @wrappers = true
- @env_shebang = false
- @format_executable = false
+ spec_dir = spec.full_gem_path
+ gem_file = nil # so we have access once after it's set in the block
+
+ Dir.chdir(spec_dir) do
+ gem_file = Gem::Builder.new(spec).build
end
+
+ installer = Gem::Installer.new File.join(spec_dir, gem_file),
+ :bin_dir => "#{Gem.dir}/bin",
+ :wrappers => true,
+ :env_shebang => false,
+ :format_executable => false
+
installer.generate_bin
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment