Skip to content

Commit c809244

Browse files
simideivid-rodriguez
authored andcommitted
Merge pull request #5126 from casperisfine/github-pr-url
Accept pull request URLs as github source (cherry picked from commit 112b3b9)
1 parent 741a677 commit c809244

28 files changed

+116
-28
lines changed

bundler/lib/bundler/dsl.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def self.evaluate(gemfile, lockfile, unlock)
1818
VALID_KEYS = %w[group groups git path glob name branch ref tag require submodules
1919
platform platforms type source install_if gemfile].freeze
2020

21+
GITHUB_PULL_REQUEST_URL = %r{\Ahttps://github\.com/([A-Za-z0-9_\-\.]+/[A-Za-z0-9_\-\.]+)/pull/(\d+)\z}.freeze
22+
2123
attr_reader :gemspecs
2224
attr_accessor :dependencies
2325

@@ -278,8 +280,17 @@ def add_git_sources
278280
warn_deprecated_git_source(:github, <<-'RUBY'.strip, 'Change any "reponame" :github sources to "username/reponame".')
279281
"https://github.com/#{repo_name}.git"
280282
RUBY
281-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
282-
"https://github.com/#{repo_name}.git"
283+
if repo_name =~ GITHUB_PULL_REQUEST_URL
284+
{
285+
"git" => "https://github.com/#{$1}.git",
286+
"branch" => "refs/pull/#{$2}/head",
287+
"ref" => nil,
288+
"tag" => nil,
289+
}
290+
else
291+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
292+
"https://github.com/#{repo_name}.git"
293+
end
283294
end
284295

285296
git_source(:gist) do |repo_name|
@@ -365,7 +376,11 @@ def normalize_options(name, version, opts)
365376

366377
git_name = (git_names & opts.keys).last
367378
if @git_sources[git_name]
368-
opts["git"] = @git_sources[git_name].call(opts[git_name])
379+
git_opts = @git_sources[git_name].call(opts[git_name])
380+
git_opts = { "git" => git_opts } if git_opts.is_a?(String)
381+
opts.merge!(git_opts) do |key, _gemfile_value, _git_source_value|
382+
raise GemfileError, %(The :#{key} option can't be used with `#{git_name}: #{opts[git_name].inspect}`)
383+
end
369384
end
370385

371386
%w[git path].each do |type|

bundler/lib/bundler/man/bundle-add.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-ADD" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-ADD" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install

bundler/lib/bundler/man/bundle-binstubs.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-BINSTUBS" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-BINSTUBS" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems

bundler/lib/bundler/man/bundle-cache.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-CACHE" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-CACHE" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application

bundler/lib/bundler/man/bundle-check.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-CHECK" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-CHECK" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems

bundler/lib/bundler/man/bundle-clean.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-CLEAN" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-CLEAN" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory

bundler/lib/bundler/man/bundle-config.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-CONFIG" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-CONFIG" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-config\fR \- Set bundler configuration options

bundler/lib/bundler/man/bundle-doctor.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-DOCTOR" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-DOCTOR" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-doctor\fR \- Checks the bundle for common problems

bundler/lib/bundler/man/bundle-exec.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-EXEC" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-EXEC" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-exec\fR \- Execute a command in the context of the bundle

bundler/lib/bundler/man/bundle-gem.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "BUNDLE\-GEM" "1" "November 2021" "" ""
4+
.TH "BUNDLE\-GEM" "1" "December 2021" "" ""
55
.
66
.SH "NAME"
77
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem

0 commit comments

Comments
 (0)