summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-01-29 20:45:08 -0800
committerCarl Lerche <carllerche@mac.com>2010-01-29 20:45:08 -0800
commit1b408875f7f53457fd680b97eda66c9fbc969675 (patch)
treed98ffedd642bb51b9bce678ca869d28f0f50d952
parentf329d586cde5a924f1b8e170117e5b6cb96ed9ee (diff)
downloadbundler-1b408875f7f53457fd680b97eda66c9fbc969675.tar.gz
Add support for :ref when using inline git repos
-rw-r--r--bundler.gemspec2
-rw-r--r--lib/bundler/dsl.rb14
-rw-r--r--spec/install/git_spec.rb19
3 files changed, 26 insertions, 9 deletions
diff --git a/bundler.gemspec b/bundler.gemspec
index c56eb1cb99..a6af1e59f5 100644
--- a/bundler.gemspec
+++ b/bundler.gemspec
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.default_executable = %q{bundle}
s.email = ["carlhuda@engineyard.com"]
s.executables = ["bundle"]
- 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/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.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.homepage = %q{http://github.com/carlhuda/bundler}
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.5}
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index d81b7a2dce..2b36843f69 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -15,22 +15,22 @@ module Bundler
end
def gem(name, *args)
- options = Hash === args.last ? args.pop : {}
+ opts = Hash === args.last ? args.pop : {}
version = args.last || ">= 0"
# Normalize the options
- options.each do |k, v|
- options[k.to_s] = v
+ opts.each do |k, v|
+ opts[k.to_s] = v
end
# Set options
- options["group"] ||= @group
+ opts["group"] ||= @group
- if options["git"]
- options["source"] = git(options["git"])
+ if opts["git"]
+ opts["source"] = git(opts["git"], :ref => opts["ref"])
end
- @dependencies << Dependency.new(name, version, options)
+ @dependencies << Dependency.new(name, version, opts)
end
def source(source)
diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb
index 55a4a209f8..c37ba000cf 100644
--- a/spec/install/git_spec.rb
+++ b/spec/install/git_spec.rb
@@ -67,7 +67,7 @@ describe "gemfile install with git sources" do
end
end
- describe "pinning" do
+ describe "specified inline" do
it "installs from git even if a newer gem is available elsewhere" do
build_git "rack", "0.8"
@@ -79,4 +79,21 @@ describe "gemfile install with git sources" do
should_be_installed "rack 0.8"
end
end
+
+ it "uses a ref if specified" do
+ build_git "foo"
+ @revision = revision_for(lib_path("foo-1.0"))
+ update_git "foo"
+
+ install_gemfile <<-G
+ gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{@revision}"
+ G
+
+ run <<-RUBY
+ require 'foo'
+ puts "WIN" unless defined?(FOO_PREV_REF)
+ RUBY
+
+ out.should == "WIN"
+ end
end \ No newline at end of file