diff options
author | Stefan Lance <stefan@lances.net> | 2015-07-17 08:54:38 -0500 |
---|---|---|
committer | Stefan Lance <stefan@lances.net> | 2015-07-17 12:45:23 -0500 |
commit | 7144b68bc20cb7918a860e92ec85b8e96daa417d (patch) | |
tree | 3123724c8c3b4b26f221c53dadfb2c31563742f4 | |
parent | 4d214d01303419325bb03a2c9266373b6581ba3e (diff) | |
download | bundler-7144b68bc20cb7918a860e92ec85b8e96daa417d.tar.gz |
Merge branch '2-0-dev' of github.com:bundler/bundler into 2-0-dev
Conflicts:
.travis.yml
bin/bundle
bin/bundler
lib/bundler/cli/config.rb
lib/bundler/deployment.rb
lib/bundler/dsl.rb
lib/bundler/settings.rb
lib/bundler/shared_helpers.rb
lib/bundler/source_list.rb
lib/bundler/ui/shell.rb
man/bundle-config.ronn
man/bundle-install.ronn
spec/bundler/source_list_spec.rb
spec/bundler/ui/shell_spec.rb
spec/commands/binstubs_spec.rb
spec/commands/exec_spec.rb
spec/commands/open_spec.rb
spec/commands/package_spec.rb
spec/deprecation_spec.rb
spec/install/bundler_spec.rb
spec/install/gemfile/git_spec.rb
spec/install/gemfile/path_spec.rb
spec/install/gems/flex_spec.rb
spec/install/gems/sources_spec.rb
spec/install/gems/standalone_spec.rb
spec/install/gems/sudo_spec.rb
spec/install/path_spec.rb
spec/other/cli_dispatch_spec.rb
spec/other/platform_spec.rb
spec/quality_spec.rb
spec/runtime/executable_spec.rb
spec/runtime/require_spec.rb
spec/support/matchers.rb
-rw-r--r-- | .travis.yml | 3 | ||||
-rwxr-xr-x | bin/bundle | 11 | ||||
-rwxr-xr-x | bin/bundler | 11 | ||||
-rw-r--r-- | lib/bundler/deployment.rb | 66 | ||||
-rw-r--r-- | man/bundle-config.ronn | 5 | ||||
-rw-r--r-- | man/bundle-install.ronn | 3 | ||||
-rw-r--r-- | spec/bundler/cli_spec.rb | 7 | ||||
-rw-r--r-- | spec/bundler/source_list_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/standalone_spec.rb | 22 | ||||
-rw-r--r-- | spec/other/cli_dispatch_spec.rb | 2 |
10 files changed, 101 insertions, 31 deletions
diff --git a/.travis.yml b/.travis.yml index bbcdb2d791..8bd1cfec76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,7 @@ before_script: travis_retry rake spec:travis:deps branches: only: - master - - /.+-dev$/ - - /.+-stable$/ + - 2-0-dev notifications: email: diff --git a/bin/bundle b/bin/bundle new file mode 100755 index 0000000000..43da771776 --- /dev/null +++ b/bin/bundle @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +# Exit cleanly from an early interrupt +Signal.trap("INT") { exit 1 } + +require 'bundler/friendly_errors' +Bundler.with_friendly_errors do + require 'bundler' + require 'bundler/cli' + Bundler::CLI.start(ARGV, :debug => true) +end diff --git a/bin/bundler b/bin/bundler new file mode 100755 index 0000000000..43da771776 --- /dev/null +++ b/bin/bundler @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +# Exit cleanly from an early interrupt +Signal.trap("INT") { exit 1 } + +require 'bundler/friendly_errors' +Bundler.with_friendly_errors do + require 'bundler' + require 'bundler/cli' + Bundler::CLI.start(ARGV, :debug => true) +end diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb new file mode 100644 index 0000000000..2a76ccc859 --- /dev/null +++ b/lib/bundler/deployment.rb @@ -0,0 +1,66 @@ +$stderr.puts "DEPRECATION: Bundler no longer integrates with " \ + "Capistrano, but Capistrano provides its own integration with " \ + "Bundler via the capistrano-bundler gem. Use it instead." + +module Bundler + class Deployment + def self.define_task(context, task_method = :task, opts = {}) + if defined?(Capistrano) && context.is_a?(Capistrano::Configuration) + context_name = "capistrano" + role_default = "{:except => {:no_release => true}}" + error_type = ::Capistrano::CommandError + else + context_name = "vlad" + role_default = "[:app]" + error_type = ::Rake::CommandFailedError + end + + roles = context.fetch(:bundle_roles, false) + opts[:roles] = roles if roles + + context.send :namespace, :bundle do + send :desc, <<-DESC + Install the current Bundler environment. By default, gems will be \ + installed to the shared/bundle path. Gems in the development and \ + test group will not be installed. The install command is executed \ + with the --deployment and --quiet flags. If the bundle cmd cannot \ + be found then you can override the bundle_cmd variable to specify \ + which one it should use. The base path to the app is fetched from \ + the :latest_release variable. Set it for custom deploy layouts. + + You can override any of these defaults by setting the variables shown below. + + N.B. bundle_roles must be defined before you require 'bundler/#{context_name}' \ + in your deploy.rb file. + + set :bundle_gemfile, "Gemfile" + set :bundle_dir, File.join(fetch(:shared_path), 'bundle') + set :bundle_flags, "--deployment --quiet" + set :bundle_without, [:development, :test] + set :bundle_with, [:mysql] + set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle" + set :bundle_roles, #{role_default} # e.g. [:app, :batch] + DESC + send task_method, :install, opts do + bundle_cmd = context.fetch(:bundle_cmd, "bundle") + bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet") + bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle')) + bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile") + bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact + bundle_with = [*context.fetch(:bundle_with, [])].compact + app_path = context.fetch(:latest_release) + if app_path.to_s.empty? + raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.") + end + args = ["--gemfile #{File.join(app_path, bundle_gemfile)}"] + args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty? + args << bundle_flags.to_s + args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty? + args << "--with #{bundle_with.join(" ")}" unless bundle_with.empty? + + run "cd #{app_path} && #{bundle_cmd} install #{args.join(' ')}" + end + end + end + end +end diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn index 47afd975f6..93b5de5f32 100644 --- a/man/bundle-config.ronn +++ b/man/bundle-config.ronn @@ -50,14 +50,17 @@ The options that can be configured are: enabled in `development` or `test` environments. * `path`: - + The location to install the specified gems to. This defaults to Rubygems' setting. Bundler shares this location with Rubygems, `gem install ...` will have gem installed there, too. Therefore, gems installed without a `--path ...` setting will show up by calling `gem list`. Accodingly, gems installed to other locations will not get listed. * `without`: + A space-separated list of groups referencing gems to skip during installation. +* `with`: + A space-separated list of optional groups to be installed. ## BUILD OPTIONS diff --git a/man/bundle-install.ronn b/man/bundle-install.ronn index 79b5b67799..e8103ed8c1 100644 --- a/man/bundle-install.ronn +++ b/man/bundle-install.ronn @@ -9,7 +9,6 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile [--jobs=NUMBER] [--local] [--deployment] - [--force] [--cache] [--no-prune] [--path PATH] @@ -125,8 +124,6 @@ time `bundle install` is run, use `bundle config` (see bundle-config(1)). * `--without=<list>`: A space-separated list of groups referencing gems to skip during installation. - If a group is given that is in the remembered list of groups given - to --with, it is removed from that list. * `--with=<list>`: A space-separated list of groups referencing gems to install. If an diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb index 26afbcb343..4cb306c731 100644 --- a/spec/bundler/cli_spec.rb +++ b/spec/bundler/cli_spec.rb @@ -31,4 +31,11 @@ describe "bundle executable" do bundle '' expect(out).to eq(help_output) end + + it "prints help when ARGV is empty" do + bundle :help + help_output = out + bundle '' + expect(out).to eq(help_output) + end end diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb index 9fe9a13382..36eb54cff4 100644 --- a/spec/bundler/source_list_spec.rb +++ b/spec/bundler/source_list_spec.rb @@ -50,12 +50,10 @@ describe Bundler::SourceList do end it "passes the provided options to the new source" do - @new_source = source_list.add_git_source("uri" => "git://host/path.git") expect(@new_source.options).to eq("uri" => "git://host/path.git") end it "adds the source to the beginning of git_sources" do - @new_source = source_list.add_git_source("uri" => "git://host/path.git") expect(source_list.git_sources.first).to equal(@new_source) end diff --git a/spec/install/gems/standalone_spec.rb b/spec/install/gems/standalone_spec.rb index 452b4663ae..e9635ceb53 100644 --- a/spec/install/gems/standalone_spec.rb +++ b/spec/install/gems/standalone_spec.rb @@ -235,26 +235,4 @@ describe "bundle install --standalone" do end end end - - describe "with --binstubs" do - before do - install_gemfile <<-G, :standalone => true, :binstubs => true - source "file://#{gem_repo1}" - gem "rails" - G - end - - it "creates stubs that use the standalone load path" do - Dir.chdir(bundled_app) do - expect(`bin/rails -v`.chomp).to eql "2.3.2" - end - end - - it "creates stubs that can be executed from anywhere" do - require "tmpdir" - Dir.chdir(Dir.tmpdir) do - expect(`#{bundled_app}/bin/rails -v`.chomp).to eql "2.3.2" - end - end - end end diff --git a/spec/other/cli_dispatch_spec.rb b/spec/other/cli_dispatch_spec.rb index 69b5e18a09..05e0667dea 100644 --- a/spec/other/cli_dispatch_spec.rb +++ b/spec/other/cli_dispatch_spec.rb @@ -14,7 +14,7 @@ describe "bundle command names" do end it "print a friendly error when ambiguous" do - bundle "i" + bundle "in" expect(out).to eq("") expect(err).to match(/Ambiguous command/) end |