diff options
author | Carl Lerche <carllerche@mac.com> | 2010-02-05 22:16:23 -0800 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-02-05 22:16:23 -0800 |
commit | 92847ecb4165b62b78eb9bdbcc23e5d0a43566d3 (patch) | |
tree | ef1178279ff5385da15390f28fa2bb990e65c980 | |
parent | 2d0524273e39d959245ababda612caa2d384c57b (diff) | |
download | bundler-92847ecb4165b62b78eb9bdbcc23e5d0a43566d3.tar.gz |
Install executable wrappers for git and path sources
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source.rb | 27 | ||||
-rw-r--r-- | spec/install/git_spec.rb | 11 | ||||
-rw-r--r-- | spec/install/path_spec.rb | 14 |
4 files changed, 49 insertions, 5 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 02c3f4240e..dbc47c8b6c 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -21,7 +21,9 @@ module Bundler 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 258a218961..299a9c607f 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -118,8 +118,11 @@ module Bundler 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 @@ module Bundler 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 @@ module Bundler 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 580e389407..07b041108d 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -3,9 +3,9 @@ require File.expand_path('../../spec_helper', __FILE__) 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 @@ describe "gemfile install with git sources" do 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 3d02348d3b..b8fbd628e6 100644 --- a/spec/install/path_spec.rb +++ b/spec/install/path_spec.rb @@ -60,6 +60,20 @@ describe "gemfile install with git sources" do 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') |