diff options
-rw-r--r-- | doc/development/README.md | 8 | ||||
-rw-r--r-- | doc/documentation/README.md | 6 | ||||
-rw-r--r-- | lib/bundler/gem_helper.rb | 18 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 2 | ||||
-rw-r--r-- | man/bundle.ronn | 3 | ||||
-rw-r--r-- | spec/install/force_spec.rb | 31 |
7 files changed, 54 insertions, 16 deletions
diff --git a/doc/development/README.md b/doc/development/README.md index 54cb4a3342..0169463478 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -2,18 +2,18 @@ So, you're ready to start contributing to Bundler! You've come to the right place. Here you'll find an overview of how to work on Bundler locally and a description of the process from code to release. -##[Development setup](SETUP.md) +## [Development setup](SETUP.md) Guidelines for setting up your local development environment. -##[Submitting pull requests](PULL_REQUESTS.md) +## [Submitting pull requests](PULL_REQUESTS.md) An overview of our preferred PR process, including how to run the test suite and what to expect when you submit code for review. -##[Adding new features](NEW_FEATURES.md) +## [Adding new features](NEW_FEATURES.md) Guidelines for proposing and writing new features for Bundler. -##[Releasing Bundler](RELEASING.md) +## [Releasing Bundler](RELEASING.md) A broad-strokes overview of the release process adhered to by the Bundler core team. diff --git a/doc/documentation/README.md b/doc/documentation/README.md index 7ebb05401c..43ca6f7587 100644 --- a/doc/documentation/README.md +++ b/doc/documentation/README.md @@ -16,13 +16,13 @@ Not sure where to write documentation? In general, follow these guidelines: If you are unsure where to begin, ping [@feministy](https://github.com/feministy) or [@indirect](https://github.com/indirect) in the Bundler Slack ([get an invite here](../contributing/GETTING_HELP.md)). -## [Writing docs for man pages)](WRITING.md) +## [Writing docs for man pages](WRITING.md) -If you’d like to submit a patch to the man pages, you're in the right place! Details on editing and previewing changes to man pages can be found here. +If you’d like to submit a patch to the man pages, you're in the right place! Details on editing and previewing changes to man pages can be found [here](WRITING.md). ## [Documentation vision](VISION.md) -Just like Bundler, we have a grand plan (really, a wish list of sorts) for Bundler documentation. Preview our hopes and dreams for our documentation here. +Just like Bundler, we have a grand plan (really, a wish list of sorts) for Bundler documentation. Preview our hopes and dreams for our documentation [here](VISION.md). ## Translations diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 3c1680a194..6a0906a200 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -50,7 +50,7 @@ module Bundler install_gem(built_gem_path, :local) end - desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to RubyGems\n" \ + desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to #{gem_push_host}\n" \ "To prevent publishing in RubyGems use `gem_push=no rake release`" task "release", [:remote] => ["build", "release:guard_clean", "release:source_control_push", "release:rubygem_push"] do @@ -92,18 +92,14 @@ module Bundler protected def rubygem_push(path) - allowed_push_host = nil gem_command = "gem push '#{path}'" gem_command += " --key #{gem_key}" if gem_key - if @gemspec.respond_to?(:metadata) - allowed_push_host = @gemspec.metadata["allowed_push_host"] - gem_command += " --host #{allowed_push_host}" if allowed_push_host - end + gem_command += " --host #{allowed_push_host}" if allowed_push_host unless allowed_push_host || Bundler.user_home.join(".gem/credentials").file? raise "Your rubygems.org credentials aren't set. Run `gem push` to set them." end sh(gem_command) - Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}" + Bundler.ui.confirm "Pushed #{name} #{version} to #{gem_push_host}" end def built_gem_path @@ -116,6 +112,14 @@ module Bundler Bundler.ui.confirm "Pushed git commits and tags." end + def allowed_push_host + @gemspec.metadata["allowed_push_host"] if @gemspec.respond_to?(:metadata) + end + + def gem_push_host + allowed_push_host || "rubygems.org" + end + def perform_git_push(options = "") cmd = "git push #{options}" out, code = sh_with_code(cmd) diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index a3e8d3c62d..efad66e202 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -215,7 +215,7 @@ module Bundler end def resolve_if_need(options) - if !options["update"] && !options[:inline] && Bundler.default_lockfile.file? + if !options["update"] && !options[:inline] && !options["force"] && Bundler.default_lockfile.file? local = Bundler.ui.silence do begin tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil) diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index e5edb0a9c9..d7236a5d7e 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -3,7 +3,7 @@ require "shellwords" require "tempfile" module Bundler class Source - class Git < Path + class Git class GitNotInstalledError < GitError def initialize msg = String.new diff --git a/man/bundle.ronn b/man/bundle.ronn index e75d861269..9e42e046a7 100644 --- a/man/bundle.ronn +++ b/man/bundle.ronn @@ -48,6 +48,9 @@ We divide `bundle` subcommands into primary commands and utilities. ## UTILITIES +* `bundle add(1)`: + Add the named gem to the Gemfile and run `bundle install` + * `bundle binstubs(1)`: Generate binstubs for executables in a gem diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb index 2ac7f57399..2bc300597d 100644 --- a/spec/install/force_spec.rb +++ b/spec/install/force_spec.rb @@ -31,5 +31,36 @@ RSpec.describe "bundle install" do expect(out).to include "Installing rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0" end + + context "with a git gem" do + let!(:ref) { build_git("foo", "1.0").ref_for("HEAD", 11) } + + before do + gemfile <<-G + gem "foo", :git => "#{lib_path("foo-1.0")}" + G + end + + it "re-installs installed gems" do + foo_lib = default_bundle_path("bundler/gems/foo-1.0-#{ref}/lib/foo.rb") + + bundle! "install" + foo_lib.open("w") {|f| f.write("blah blah blah") } + bundle! "install --force" + + expect(out).to include "Using bundler" + expect(out).to include "Using foo 1.0 from #{lib_path("foo-1.0")} (at master@#{ref[0, 7]})" + expect(foo_lib.open(&:read)).to eq("FOO = '1.0'\n") + expect(the_bundle).to include_gems "foo 1.0" + end + + it "works on first bundle install" do + bundle! "install --force" + + expect(out).to include "Using bundler" + expect(out).to include "Using foo 1.0 from #{lib_path("foo-1.0")} (at master@#{ref[0, 7]})" + expect(the_bundle).to include_gems "foo 1.0" + end + end end end |