diff options
-rw-r--r-- | lib/bundler/repository.rb | 38 | ||||
-rw-r--r-- | spec/bundler/manifest_file_spec.rb | 12 |
2 files changed, 35 insertions, 15 deletions
diff --git a/lib/bundler/repository.rb b/lib/bundler/repository.rb index 15ebcf8cfa..1c1b338529 100644 --- a/lib/bundler/repository.rb +++ b/lib/bundler/repository.rb @@ -35,7 +35,9 @@ module Bundler do_install(bundle, options) valid = bundle end - cleanup(valid) + + generate_bins(valid, options) + cleanup(valid, options) configure(valid, options) end @@ -96,6 +98,25 @@ module Bundler end end + def generate_bins(bundle, options) + bundle.each do |spec| + # HAX -- Generate the bin + bin_dir = @bindir + path = @path + installer = Gem::Installer.allocate + installer.instance_eval do + @spec = spec + @bin_dir = bin_dir + @gem_dir = path.join("gems", "#{spec.full_name}") + @gem_home = path + @wrappers = true + @format_executable = false + @env_shebang = false + end + installer.generate_bin + end + end + def expand_gemfile(spec, options) Bundler.logger.info "Installing #{spec.name} (#{spec.version})" @@ -115,19 +136,6 @@ module Bundler add_spec(spec) FileUtils.mkdir_p(@path.join("gems")) File.symlink(spec.location, @path.join("gems", spec.full_name)) - - # HAX -- Generate the bin - bin_dir = @bindir - path = @path - installer = Gem::Installer.allocate - installer.instance_eval do - @spec = spec - @bin_dir = bin_dir - @gem_dir = path.join("gems", "#{spec.full_name}") - @gem_home = path - @wrappers = true - end - installer.generate_bin end def add_spec(spec) @@ -139,7 +147,7 @@ module Bundler end end - def cleanup(valid) + def cleanup(valid, options) to_delete = gems to_delete.delete_if do |spec| valid.any? { |other| spec.name == other.name && spec.version == other.version } diff --git a/spec/bundler/manifest_file_spec.rb b/spec/bundler/manifest_file_spec.rb index 6b033dfac9..1e2cf347b1 100644 --- a/spec/bundler/manifest_file_spec.rb +++ b/spec/bundler/manifest_file_spec.rb @@ -84,6 +84,18 @@ describe "Bundler::Environment" do File.read("#{bundled_app}/bin/rackup").should_not == "omg" end + it "recreates the bin files if they are missing" do + install_manifest <<-Gemfile + clear_sources + source "file://#{gem_repo1}" + gem "rack" + Gemfile + + bundled_app('bin/rackup').delete + Dir.chdir(bundled_app) { gem_command :bundle } + bundled_app('bin/rackup').should exist + end + it "ensures the source sources contains no duplicate" do build_manifest_file <<-Gemfile source "http://gems.rubyforge.org" |