Skip to content

Commit

Permalink
Rename :vendored_at to :path with a deprecation notice for :vendored_at
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed Oct 21, 2009
1 parent 189d96f commit 2fd1aee
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
13 changes: 9 additions & 4 deletions lib/bundler/dsl.rb
Expand Up @@ -74,6 +74,11 @@ def gem(name, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
version = args.last

if path = options.delete(:vendored_at)
options[:path] = path
warn "The :vendored_at option is deprecated. Use :path instead.\nFrom #{caller[0]}"
end

options[:only] = _combine_only(options[:only] || options["only"])
options[:except] = _combine_except(options[:except] || options["except"])

Expand All @@ -83,7 +88,7 @@ def gem(name, *args)
# We're using system gems for this one
elsif @git || options[:git]
_handle_git_option(name, version, options)
elsif @directory || options[:vendored_at]
elsif @directory || options[:path]
_handle_vendored_option(name, version, options)
end

Expand All @@ -93,13 +98,13 @@ def gem(name, *args)
private

def _handle_vendored_option(name, version, options)
dir, path = _find_directory_source(options[:vendored_at])
dir, path = _find_directory_source(options[:path])

if dir
dir.required_specs << name
dir.add_spec(path, name, version) if version
else
directory options[:vendored_at] do
directory options[:path] do
_handle_vendored_option(name, version, {})
end
end
Expand Down Expand Up @@ -134,7 +139,7 @@ def _handle_git_option(name, version, options)
end

source.required_specs << name
source.add_spec(Pathname.new(options[:vendored_at] || '.'), name, version) if version
source.add_spec(Pathname.new(options[:path] || '.'), name, version) if version
else
git(git, :ref => ref, :branch => branch) do
_handle_git_option(name, version, options)
Expand Down
24 changes: 12 additions & 12 deletions spec/bundler/directory_spec.rb
Expand Up @@ -12,7 +12,7 @@
install_manifest <<-Gemfile
clear_sources
source "file://#{gem_repo1}"
gem "very-simple", "1.0", :vendored_at => "#{path}"
gem "very-simple", "1.0", :path => "#{path}"
Gemfile
end

Expand Down Expand Up @@ -55,7 +55,7 @@
lambda do
install_manifest <<-Gemfile
clear_sources
gem "very-simple", :vendored_at => "#{fixture_dir.join("very-simple")}"
gem "very-simple", :path => "#{fixture_dir.join("very-simple")}"
Gemfile
end.should raise_error(Bundler::DirectorySourceError, /Please explicitly specify a version/)
end
Expand All @@ -65,7 +65,7 @@
lambda do
install_manifest <<-Gemfile
clear_sources
gem "very-simple", ">= 0.1.0", :vendored_at => "#{fixture_dir.join("very-simple")}"
gem "very-simple", ">= 0.1.0", :path => "#{fixture_dir.join("very-simple")}"
Gemfile
end.should raise_error(ArgumentError, /:at/)
end
Expand All @@ -81,7 +81,7 @@
install_manifest <<-Gemfile
clear_sources
source "file://#{gem_repo1}"
gem "very-simple", "1.0", :vendored_at => "#{path}"
gem "very-simple", "1.0", :path => "#{path}"
Gemfile

tmp_gem_path.should_not include_cached_gem("very-simple-1.0")
Expand All @@ -98,7 +98,7 @@

install_manifest <<-Gemfile
clear_sources
gem "second", :vendored_at => "#{tmp_path('dirs')}"
gem "second", :path => "#{tmp_path('dirs')}"
Gemfile

out = run_in_context <<-RUBY
Expand All @@ -117,7 +117,7 @@
lambda {
install_manifest <<-Gemfile
clear_sources
gem "first", "1.0", :vendored_at => "#{tmp_path('dirs')}"
gem "first", "1.0", :path => "#{tmp_path('dirs')}"
Gemfile
}.should raise_error(Bundler::DirectorySourceError, /The location you specified for first is/)
end
Expand All @@ -130,7 +130,7 @@

install_manifest <<-Gemfile
clear_sources
gem "very-simple", :vendored_at => "#{tmp_path('very-simple')}"
gem "very-simple", :path => "#{tmp_path('very-simple')}"
Gemfile

tmp_bindir('very_simple').should exist
Expand All @@ -155,16 +155,16 @@
install_manifest <<-Gemfile
clear_sources
directory "#{ext}" do
gem "omg", "1.0", :vendored_at => "omg"
gem "hi2u", "1.0", :vendored_at => "hi2u"
gem "omg", "1.0", :path => "omg"
gem "hi2u", "1.0", :path => "hi2u"
end
Gemfile

:default.should have_const("OMG")
:default.should have_const("HI2U")
end

it "can list vendored gems without :vendored_at" do
it "can list vendored gems without :path" do
lib_builder "omg", "1.0", :gemspec => false
install_manifest <<-Gemfile
clear_sources
Expand All @@ -183,8 +183,8 @@
install_manifest <<-Gemfile
clear_sources
directory "#{tmp_path('dirs')}" do
gem "omg", "1.0", :vendored_at => "omg"
gem "lol", "1.0", :vendored_at => "omg"
gem "omg", "1.0", :path => "omg"
gem "lol", "1.0", :path => "omg"
end
Gemfile
}.should raise_error(Bundler::DirectorySourceError, /already have a gem defined for/)
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/git_spec.rb
Expand Up @@ -175,7 +175,7 @@
install_manifest <<-Gemfile
clear_sources
git "#{tmp_path}/dirs" do
gem "omg", "1.0", :vendored_at => "omg"
gem "omg", "1.0", :path => "omg"
end
Gemfile

Expand Down

0 comments on commit 2fd1aee

Please sign in to comment.