diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 02c3f4240e8..dbc47c8b6cc 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -21,7 +21,9 @@ def run(options) Bundler.ui.debug " * Not in requested group; skipping." next end + spec.source.install(spec) + Bundler.ui.info "" end diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 258a218961b..299a9c607fd 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -118,8 +118,11 @@ def install(spec) Bundler.ui.debug " * Installing from pack" installer = Gem::Installer.new "#{@path}/#{spec.full_name}.gem", - :install_dir => Gem.dir, - :ignore_dependencies => true + :install_dir => Gem.dir, + :ignore_dependencies => true, + :wrappers => true, + :env_shebang => true, + :bin_dir => "#{Gem.dir}/bin" installer.install end @@ -176,10 +179,29 @@ def local_specs def install(spec) Bundler.ui.debug " * Using path #{path}" + generate_bin(spec) end alias specs local_specs + 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 + end + installer.generate_bin + end + end class Git < Path @@ -241,6 +263,7 @@ def install(spec) checkout @installed = true end + generate_bin(spec) end def lock diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 580e3894076..07b041108d3 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -3,9 +3,9 @@ describe "gemfile install with git sources" do describe "when floating on master" do before :each do - in_app_root - - build_git "foo" + build_git "foo" do |s| + s.executables = "foobar" + end install_gemfile <<-G git "#{lib_path('foo-1.0')}" @@ -43,6 +43,11 @@ out.should == "WIN" end end + + it "setups executables" do + bundle "exec foobar" + out.should == "1.0" + end end describe "when specifying a revision" do diff --git a/spec/install/path_spec.rb b/spec/install/path_spec.rb index 3d02348d3b9..b8fbd628e68 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -60,6 +60,20 @@ should_be_installed "foo 1.0" end + it "setups up executables" do + build_lib "foo" do |s| + s.executables = "foobar" + end + + install_gemfile <<-G + path "#{lib_path('foo-1.0')}" + gem 'foo' + G + + bundle "exec foobar" + out.should == "1.0" + end + describe "when locked" do it "keeps source pinning" do build_lib "foo", "1.0", :path => lib_path('foo')