Browse files

A first pass of bundle exec

  • Loading branch information...
1 parent 5a5e1d6 commit 0a758202b90c25bbeb748be2616882b4667b8860 Carl Lerche committed Feb 1, 2010
View
1 Rakefile
@@ -59,4 +59,5 @@ task :gemspec do
end
end
+task :package => :gemspec
task :default => [:spec, :gemspec]
View
4 bundler.gemspec
@@ -2,15 +2,15 @@
Gem::Specification.new do |s|
s.name = %q{bundler}
- s.version = "0.9.0.pre"
+ s.version = "0.9.0.pre2"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5") if s.respond_to? :required_rubygems_version=
s.authors = ["Carl Lerche", "Yehuda Katz"]
s.date = %q{2010-01-31}
s.default_executable = %q{bundle}
s.email = ["carlhuda@engineyard.com"]
s.executables = ["bundle"]
- s.files = ["bin/bundle", "lib/bundler/cli.rb", "lib/bundler/definition.rb", "lib/bundler/dependency.rb", "lib/bundler/dsl.rb", "lib/bundler/environment.rb", "lib/bundler/index.rb", "lib/bundler/installer.rb", "lib/bundler/remote_specification.rb", "lib/bundler/resolver.rb", "lib/bundler/rubygems.rb", "lib/bundler/source.rb", "lib/bundler/specification.rb", "lib/bundler/templates/environment.erb", "lib/bundler/templates/Gemfile", "lib/bundler/ui.rb", "lib/bundler/vendor/thor/actions/create_file.rb", "lib/bundler/vendor/thor/actions/directory.rb", "lib/bundler/vendor/thor/actions/empty_directory.rb", "lib/bundler/vendor/thor/actions/file_manipulation.rb", "lib/bundler/vendor/thor/actions/inject_into_file.rb", "lib/bundler/vendor/thor/actions.rb", "lib/bundler/vendor/thor/base.rb", "lib/bundler/vendor/thor/core_ext/file_binary_read.rb", "lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb", "lib/bundler/vendor/thor/core_ext/ordered_hash.rb", "lib/bundler/vendor/thor/error.rb", "lib/bundler/vendor/thor/group.rb", "lib/bundler/vendor/thor/invocation.rb", "lib/bundler/vendor/thor/parser/argument.rb", "lib/bundler/vendor/thor/parser/arguments.rb", "lib/bundler/vendor/thor/parser/option.rb", "lib/bundler/vendor/thor/parser/options.rb", "lib/bundler/vendor/thor/parser.rb", "lib/bundler/vendor/thor/rake_compat.rb", "lib/bundler/vendor/thor/runner.rb", "lib/bundler/vendor/thor/shell/basic.rb", "lib/bundler/vendor/thor/shell/color.rb", "lib/bundler/vendor/thor/shell.rb", "lib/bundler/vendor/thor/task.rb", "lib/bundler/vendor/thor/util.rb", "lib/bundler/vendor/thor/version.rb", "lib/bundler/vendor/thor.rb", "lib/bundler.rb", "LICENSE", "README"]
+ s.files = ["bin/bundle", "lib/bundler", "lib/bundler/cli.rb", "lib/bundler/definition.rb", "lib/bundler/dependency.rb", "lib/bundler/dsl.rb", "lib/bundler/environment.rb", "lib/bundler/index.rb", "lib/bundler/installer.rb", "lib/bundler/remote_specification.rb", "lib/bundler/resolver.rb", "lib/bundler/rubygems.rb", "lib/bundler/setup.rb", "lib/bundler/source.rb", "lib/bundler/specification.rb", "lib/bundler/templates", "lib/bundler/templates/environment.erb", "lib/bundler/templates/Gemfile", "lib/bundler/ui.rb", "lib/bundler/vendor", "lib/bundler/vendor/thor", "lib/bundler/vendor/thor/actions", "lib/bundler/vendor/thor/actions/create_file.rb", "lib/bundler/vendor/thor/actions/directory.rb", "lib/bundler/vendor/thor/actions/empty_directory.rb", "lib/bundler/vendor/thor/actions/file_manipulation.rb", "lib/bundler/vendor/thor/actions/inject_into_file.rb", "lib/bundler/vendor/thor/actions.rb", "lib/bundler/vendor/thor/base.rb", "lib/bundler/vendor/thor/core_ext", "lib/bundler/vendor/thor/core_ext/file_binary_read.rb", "lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb", "lib/bundler/vendor/thor/core_ext/ordered_hash.rb", "lib/bundler/vendor/thor/error.rb", "lib/bundler/vendor/thor/group.rb", "lib/bundler/vendor/thor/invocation.rb", "lib/bundler/vendor/thor/parser", "lib/bundler/vendor/thor/parser/argument.rb", "lib/bundler/vendor/thor/parser/arguments.rb", "lib/bundler/vendor/thor/parser/option.rb", "lib/bundler/vendor/thor/parser/options.rb", "lib/bundler/vendor/thor/parser.rb", "lib/bundler/vendor/thor/rake_compat.rb", "lib/bundler/vendor/thor/runner.rb", "lib/bundler/vendor/thor/shell", "lib/bundler/vendor/thor/shell/basic.rb", "lib/bundler/vendor/thor/shell/color.rb", "lib/bundler/vendor/thor/shell.rb", "lib/bundler/vendor/thor/task.rb", "lib/bundler/vendor/thor/util.rb", "lib/bundler/vendor/thor/version.rb", "lib/bundler/vendor/thor.rb", "lib/bundler.rb", "LICENSE", "README"]
s.homepage = %q{http://github.com/carlhuda/bundler}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
View
13 lib/bundler/cli.rb
@@ -8,6 +8,8 @@
module Bundler
class CLI < Thor
+ ARGV = ::ARGV.dup
+
def self.banner(task)
task.formatted_usage(self, false)
end
@@ -73,6 +75,17 @@ def pack
environment.pack
end
+ desc "exec", "Run the command in context of the bundle"
+ def exec(*)
+ ARGV.delete('exec')
+ ENV["RUBYOPT"] = %W(
+ -I#{File.expand_path('../..', __FILE__)}
+ -rbundler/setup
+ #{ENV["RUBYOPT"]}
+ ).compact.join(' ')
+ Kernel.exec *ARGV
+ end
+
private
def with_rescue
View
3 lib/bundler/setup.rb
@@ -0,0 +1,3 @@
+require 'bundler'
+
+Bundler.setup
View
17 spec/other/exec_spec.rb
@@ -0,0 +1,17 @@
+require File.expand_path('../../spec_helper', __FILE__)
+
+describe "bundle exec" do
+ before :each do
+ system_gems "rack-1.0.0", "rack-0.9.1"
+ end
+
+ it "should have specs" do
+ pending "The paths isn't working right for some reason"
+ gemfile <<-G
+ gem "rack", "0.9.1"
+ G
+
+ bundle :exec, "rackup"
+ out.should == "0.9.1"
+ end
+end
View
2 spec/other/init_spec.rb
@@ -1,6 +1,6 @@
require File.expand_path('../../spec_helper', __FILE__)
-describe "gemfile init" do
+describe "bundle init" do
before :each do
in_app_root
end
View
1 spec/runtime/load_spec.rb
@@ -3,7 +3,6 @@
describe "Bundler.load" do
before :each do
- in_app_root
system_gems "rack-1.0.0"
end
View
2 spec/spec_helper.rb
@@ -23,6 +23,7 @@
config.include Spec::Platforms
original_wd = Dir.pwd
+ original_path = ENV['PATH']
original_gem_home = ENV['GEM_HOME']
config.before :all do
@@ -39,5 +40,6 @@
Gem.platforms = nil
Dir.chdir(original_wd)
ENV['GEM_HOME'] = ENV['GEM_PATH'] = original_gem_home
+ ENV['PATH'] = original_path
end
end
View
4 spec/support/helpers.rb
@@ -94,15 +94,17 @@ def system_gems(*gems)
Gem.clear_paths
- gem_home, gem_path = ENV['GEM_HOME'], ENV['GEM_PATH']
+ gem_home, gem_path, path = ENV['GEM_HOME'], ENV['GEM_PATH'], ENV['PATH']
ENV['GEM_HOME'], ENV['GEM_PATH'] = system_gem_path.to_s, system_gem_path.to_s
+ ENV['PATH'] = "#{system_gem_path}/bin:#{ENV['PATH']}"
install_gems(*gems)
if block_given?
begin
yield
ensure
ENV['GEM_HOME'], ENV['GEM_PATH'] = gem_home, gem_path
+ ENV['PATH'] = path
end
end
end
View
1 spec/support/rubygems.rb
@@ -4,6 +4,7 @@ def self.setup
Gem.clear_paths
ENV['GEM_HOME'] = ENV['GEM_PATH'] = Path.base_system_gems.to_s
+ ENV['PATH'] = "#{Path.system_gem_path}/bin:#{ENV['PATH']}"
unless File.exist?("#{Path.base_system_gems}")
FileUtils.mkdir_p(Path.base_system_gems)

0 comments on commit 0a75820

Please sign in to comment.