diff options
author | Vyacheslav Alexeev <alexeev.corp@gmail.com> | 2021-12-10 15:40:58 +0800 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-12-11 00:13:25 +0900 |
commit | 1a62a50c4f9c835dee5d6bc17ca45914daea1bbd (patch) | |
tree | dd5628eaa2030aa2783c50e00a75093f1e2594a2 /lib/bundler | |
parent | 5f1975a454dd9a6743bfa196111a4fde62366798 (diff) |
[rubygems/rubygems] Add `github` and `ref` options to `bundle add`
https://github.com/rubygems/rubygems/commit/c3e54acab0
Diffstat (limited to 'lib/bundler')
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/dependency.rb | 4 | ||||
-rw-r--r-- | lib/bundler/injector.rb | 4 | ||||
-rw-r--r-- | lib/bundler/man/bundle-add.1 | 10 | ||||
-rw-r--r-- | lib/bundler/man/bundle-add.1.ronn | 8 |
5 files changed, 24 insertions, 4 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 9046c0115c..36d0472c62 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -369,7 +369,9 @@ module Bundler method_option "source", :aliases => "-s", :type => :string method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string." method_option "git", :type => :string + method_option "github", :type => :string method_option "branch", :type => :string + method_option "ref", :type => :string method_option "skip-install", :type => :boolean, :banner => "Adds gem to the Gemfile but does not install it" method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem" diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index 27206b1bac..94e85053dd 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -7,7 +7,7 @@ require_relative "rubygems_ext" module Bundler class Dependency < Gem::Dependency attr_reader :autorequire - attr_reader :groups, :platforms, :gemfile, :git, :branch + attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref PLATFORM_MAP = { :ruby => Gem::Platform::RUBY, @@ -82,7 +82,9 @@ module Bundler @groups = Array(options["group"] || :default).map(&:to_sym) @source = options["source"] @git = options["git"] + @github = options["github"] @branch = options["branch"] + @ref = options["ref"] @platforms = Array(options["platforms"]) @env = options["env"] @should_include = options.fetch("should_include", true) diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index 5e5dfca02e..42f837a919 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -112,10 +112,12 @@ module Bundler source = ", :source => \"#{d.source}\"" unless d.source.nil? git = ", :git => \"#{d.git}\"" unless d.git.nil? + github = ", :github => \"#{d.github}\"" unless d.github.nil? branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil? + ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil? require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil? - %(gem #{name}#{requirement}#{group}#{source}#{git}#{branch}#{require_path}) + %(gem #{name}#{requirement}#{group}#{source}#{git}#{github}#{branch}#{ref}#{require_path}) end.join("\n") end diff --git a/lib/bundler/man/bundle-add.1 b/lib/bundler/man/bundle-add.1 index a94467e25f..6c462ba839 100644 --- a/lib/bundler/man/bundle-add.1 +++ b/lib/bundler/man/bundle-add.1 @@ -7,7 +7,7 @@ \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install . .SH "SYNOPSIS" -\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-branch=BRANCH] [\-\-skip\-install] [\-\-strict] [\-\-optimistic] +\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic] . .SH "DESCRIPTION" Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\. @@ -49,10 +49,18 @@ Specify the source for the added gem\. Specify the git source for the added gem\. . .TP +\fB\-\-github\fR +Specify the github source for the added gem\. +. +.TP \fB\-\-branch\fR Specify the git branch for the added gem\. . .TP +\fB\-\-ref\fR +Specify the git ref for the added gem\. +. +.TP \fB\-\-skip\-install\fR Adds the gem to the Gemfile but does not install it\. . diff --git a/lib/bundler/man/bundle-add.1.ronn b/lib/bundler/man/bundle-add.1.ronn index 26cbe55647..6547297c86 100644 --- a/lib/bundler/man/bundle-add.1.ronn +++ b/lib/bundler/man/bundle-add.1.ronn @@ -3,7 +3,7 @@ bundle-add(1) -- Add gem to the Gemfile and run bundle install ## SYNOPSIS -`bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--branch=BRANCH] [--skip-install] [--strict] [--optimistic] +`bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic] ## DESCRIPTION Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`. @@ -33,9 +33,15 @@ bundle add rails --group "development, test" * `--git`: Specify the git source for the added gem. +* `--github`: + Specify the github source for the added gem. + * `--branch`: Specify the git branch for the added gem. +* `--ref`: + Specify the git ref for the added gem. + * `--skip-install`: Adds the gem to the Gemfile but does not install it. |