rake 12.0.0.beta1 → 13.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/macos.yml +22 -0
- data/.github/workflows/ubuntu-rvm.yml +28 -0
- data/.github/workflows/ubuntu.yml +20 -0
- data/.github/workflows/windows.yml +20 -0
- data/CONTRIBUTING.rdoc +11 -4
- data/Gemfile +7 -0
- data/History.rdoc +124 -11
- data/README.rdoc +7 -8
- data/Rakefile +7 -4
- data/bin/bundle +105 -0
- data/bin/rake +29 -0
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/doc/jamis.rb +1 -0
- data/doc/rakefile.rdoc +1 -1
- data/lib/rake.rb +1 -0
- data/lib/rake/application.rb +54 -15
- data/lib/rake/backtrace.rb +1 -0
- data/lib/rake/clean.rb +4 -3
- data/lib/rake/cloneable.rb +1 -0
- data/lib/rake/cpu_counter.rb +2 -1
- data/lib/rake/default_loader.rb +1 -0
- data/lib/rake/dsl_definition.rb +4 -3
- data/lib/rake/early_time.rb +1 -0
- data/lib/rake/ext/core.rb +1 -0
- data/lib/rake/ext/string.rb +2 -1
- data/lib/rake/file_creation_task.rb +2 -1
- data/lib/rake/file_list.rb +5 -4
- data/lib/rake/file_task.rb +11 -3
- data/lib/rake/file_utils.rb +10 -12
- data/lib/rake/file_utils_ext.rb +7 -17
- data/lib/rake/invocation_chain.rb +1 -0
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +1 -0
- data/lib/rake/linked_list.rb +1 -0
- data/lib/rake/loaders/makefile.rb +1 -0
- data/lib/rake/multi_task.rb +2 -37
- data/lib/rake/name_space.rb +1 -0
- data/lib/rake/packagetask.rb +18 -6
- data/lib/rake/phony.rb +1 -0
- data/lib/rake/private_reader.rb +1 -0
- data/lib/rake/promise.rb +3 -2
- data/lib/rake/pseudo_status.rb +1 -0
- data/lib/rake/rake_module.rb +29 -0
- data/lib/rake/rake_test_loader.rb +17 -11
- data/lib/rake/rule_recursion_overflow_error.rb +1 -0
- data/lib/rake/scope.rb +2 -1
- data/lib/rake/task.rb +59 -16
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +2 -0
- data/lib/rake/task_manager.rb +42 -17
- data/lib/rake/tasklib.rb +1 -0
- data/lib/rake/testtask.rb +3 -1
- data/lib/rake/thread_history_display.rb +1 -0
- data/lib/rake/thread_pool.rb +1 -0
- data/lib/rake/trace_output.rb +1 -0
- data/lib/rake/version.rb +2 -1
- data/lib/rake/win32.rb +1 -0
- data/rake.gemspec +4 -7
- metadata +13 -52
- data/.gitignore +0 -14
- data/.rubocop.yml +0 -57
- data/.travis.yml +0 -21
- data/appveyor.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08497cc32815feb4389235e329280cc871478425a9269dc03975b101c6c7ddda'
|
4
|
+
data.tar.gz: 96f4f74705c9ca03e0816641b46a71d6b13573fae70ccd529dd199437a8fd1a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ccd9ab5c4599602669669d449ed5c6398913545a4f445c465a13bce9a77aece4c52fd883eb21b3029e8c8e54940befd11d91e75568ed29115a0df73cd393e0e
|
7
|
+
data.tar.gz: a86e3a39f56b81c05c9c17e64f86b4b619739500b553271292955b48890bd409983a231a3d860235182a3c9030969ae6dbb84e6c4b359484683e0b51b6d8ff0b
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: macos
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: macos-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.6.x', '2.5.x', '2.4.x', '2.3.x' ]
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@master
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
version: ${{ matrix.ruby }}
|
17
|
+
- name: Install dependencies
|
18
|
+
run: gem install minitest
|
19
|
+
- name: Run test
|
20
|
+
env:
|
21
|
+
COVERALLS: "yes"
|
22
|
+
run: ruby -Ilib exe/rake
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: ubuntu-rvm
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ 'jruby-head', 'jruby-9.2.8.0', 'ruby-head', '2.2.10' ]
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@master
|
13
|
+
- name: Set up RVM
|
14
|
+
run: |
|
15
|
+
curl -sSL https://get.rvm.io | bash
|
16
|
+
- name: Set up Ruby
|
17
|
+
run: |
|
18
|
+
source $HOME/.rvm/scripts/rvm
|
19
|
+
rvm install ${{ matrix.ruby }} --binary
|
20
|
+
rvm --default use ${{ matrix.ruby }}
|
21
|
+
- name: Install dependencies
|
22
|
+
run: |
|
23
|
+
source $HOME/.rvm/scripts/rvm
|
24
|
+
gem install minitest
|
25
|
+
- name: Run test
|
26
|
+
run: |
|
27
|
+
source $HOME/.rvm/scripts/rvm
|
28
|
+
ruby -Ilib exe/rake
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: ubuntu
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.6.x', '2.5.x', '2.4.x', '2.3.x' ]
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@master
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
version: ${{ matrix.ruby }}
|
17
|
+
- name: Install dependencies
|
18
|
+
run: gem install minitest
|
19
|
+
- name: Run test
|
20
|
+
run: ruby -Ilib exe/rake
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: windows
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: windows-latest
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby: [ '2.6.x', '2.5.x', '2.4.x' ]
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@master
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: actions/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
version: ${{ matrix.ruby }}
|
17
|
+
- name: Install dependencies
|
18
|
+
run: gem install minitest
|
19
|
+
- name: Run test
|
20
|
+
run: ruby -Ilib exe/rake
|
data/CONTRIBUTING.rdoc
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Rake is currently hosted at github. The github web page is
|
4
4
|
https://github.com/ruby/rake . The public git clone URL is
|
5
5
|
|
6
|
-
|
6
|
+
https://github.com/ruby/rake.git
|
7
7
|
|
8
8
|
= Running the Rake Test Suite
|
9
9
|
|
@@ -12,11 +12,18 @@ If you wish to run the unit and functional tests that come with Rake:
|
|
12
12
|
* +cd+ into the top project directory of rake.
|
13
13
|
* Install gem dependency using bundler:
|
14
14
|
|
15
|
-
bundle install # Install bundler, minitest and rdoc
|
15
|
+
$ bundle install # Install bundler, minitest and rdoc
|
16
16
|
|
17
|
-
*
|
17
|
+
* Run the test suite
|
18
18
|
|
19
|
-
|
19
|
+
$ rake
|
20
|
+
|
21
|
+
= Rubocop
|
22
|
+
|
23
|
+
Rake uses Rubocop to enforce a consistent style on new changes being
|
24
|
+
proposed. You can check your code with Rubocop using:
|
25
|
+
|
26
|
+
$ ./bin/rubocop
|
20
27
|
|
21
28
|
= Issues and Bug Reports
|
22
29
|
|
data/Gemfile
CHANGED
data/History.rdoc
CHANGED
@@ -1,15 +1,128 @@
|
|
1
|
-
===
|
1
|
+
=== 13.0.0.pre.1
|
2
|
+
|
3
|
+
==== Enhancements
|
4
|
+
|
5
|
+
* Follows recent changes on keyword arguments in ruby 2.7.
|
6
|
+
Pull Request #326 by nobu
|
7
|
+
* Make `PackageTask` be able to omit parent directory while packing files
|
8
|
+
Pull Request #310 by tonytonyjan
|
9
|
+
* Add order only dependency
|
10
|
+
Pull Request #269 by take-cheeze
|
11
|
+
|
12
|
+
==== Compatibility changes
|
13
|
+
|
14
|
+
* Drop old ruby versions(< 2.2)
|
15
|
+
|
16
|
+
=== 12.3.3
|
17
|
+
|
18
|
+
==== Bug fixes
|
19
|
+
|
20
|
+
* Use the application's name in error message if a task is not found.
|
21
|
+
Pull Request #303 by tmatilai
|
22
|
+
|
23
|
+
==== Enhancements:
|
24
|
+
|
25
|
+
* Use File.open explicitly.
|
26
|
+
|
27
|
+
=== 12.3.2
|
28
|
+
|
29
|
+
==== Bug fixes
|
30
|
+
|
31
|
+
* Fixed test fails caused by 2.6 warnings.
|
32
|
+
Pull Request #297 by hsbt
|
33
|
+
|
34
|
+
==== Enhancements:
|
35
|
+
|
36
|
+
* Rdoc improvements.
|
37
|
+
Pull Request #293 by colby-swandale
|
38
|
+
* Improve multitask performance.
|
39
|
+
Pull Request #273 by jsm
|
40
|
+
* Add alias `prereqs`.
|
41
|
+
Pull Request #268 by take-cheeze
|
42
|
+
|
43
|
+
=== 12.3.1
|
44
|
+
|
45
|
+
==== Bug fixes
|
46
|
+
|
47
|
+
* Support did_you_mean >= v1.2.0 which has a breaking change on formatters.
|
48
|
+
Pull request #262 by FUJI Goro.
|
49
|
+
|
50
|
+
==== Enhancements:
|
51
|
+
|
52
|
+
* Don't run task if it depends on already invoked but failed task.
|
53
|
+
Pull request #252 by Gonzalo Rodriguez.
|
54
|
+
* Make space trimming consistent for all task arguments.
|
55
|
+
Pull request #259 by Gonzalo Rodriguez.
|
56
|
+
* Removes duplicated inclusion of Rake::DSL in tests.
|
57
|
+
Pull request #254 by Gonzalo Rodriguez.
|
58
|
+
* Re-raise a LoadError that didn't come from require in the test loader.
|
59
|
+
Pull request #250 by Dylan Thacker-Smith.
|
60
|
+
|
61
|
+
=== 12.3.0
|
62
|
+
|
63
|
+
==== Compatibility Changes
|
64
|
+
|
65
|
+
* Bump `required_ruby_version` to Ruby 2.0.0. Rake has already
|
66
|
+
removed support for Ruby 1.9.x.
|
67
|
+
|
68
|
+
==== Enhancements:
|
69
|
+
|
70
|
+
* Support `test-bundled-gems` task on ruby core.
|
71
|
+
|
72
|
+
=== 12.2.1
|
73
|
+
|
74
|
+
==== Bug fixes
|
75
|
+
|
76
|
+
* Fixed to break Capistrano::Application on capistrano3.
|
77
|
+
|
78
|
+
=== 12.2.0
|
79
|
+
|
80
|
+
==== Enhancements:
|
81
|
+
|
82
|
+
* Make rake easier to use as a library
|
83
|
+
Pull request #211 by @drbrain
|
84
|
+
* Fix quadratic performance in FileTask#out_of_date?
|
85
|
+
Pull request #224 by @doudou
|
86
|
+
* Clarify output when printing nested exception traces
|
87
|
+
Pull request #232 by @urbanautomaton
|
88
|
+
|
89
|
+
==== Bug fixes
|
90
|
+
|
91
|
+
* Account for a file that match 2 or more patterns.
|
92
|
+
Pull request #231 by @styd
|
93
|
+
|
94
|
+
=== 12.1.0
|
95
|
+
|
96
|
+
==== Enhancements:
|
97
|
+
|
98
|
+
* Added did_you_mean feature for invalid rake task.
|
99
|
+
Pull request #221 by @xtina-starr
|
100
|
+
* Enabled to dependency chained by extensions. Pull request #39 by Petr Skocik.
|
101
|
+
* Make all of string literals to frozen objects on Ruby 2.4 or later.
|
102
|
+
|
103
|
+
==== Bug fixes
|
104
|
+
|
105
|
+
* Typo fixes in rakefile.rdoc. Pull request #180 by Yuta Kurotaki.
|
106
|
+
* Fix unexpected behavior of file task with dryrun option.
|
107
|
+
Pull request #183 by @aycabta.
|
108
|
+
* Make LoadError from running tests more obvious. Pull request #195
|
109
|
+
by Eric Hodel.
|
110
|
+
* Fix unexpected TypeError with hash style option. Pull request #202
|
111
|
+
by Kuniaki IGARASHI.
|
112
|
+
|
113
|
+
=== 12.0.0
|
2
114
|
|
3
115
|
==== Compatibility Changes
|
4
116
|
|
5
|
-
*
|
117
|
+
* Removed arguments on clear #157 by Jesse Bowes
|
6
118
|
* Removed `rake/contrib` packages. These are extracted to `rake-contrib` gem.
|
7
|
-
* Removed
|
119
|
+
* Removed deprecated method named `last\_comment`.
|
8
120
|
|
9
121
|
==== Enhancements:
|
10
122
|
|
11
123
|
* Re-use trace option on `cleanup` task. #164 by Brian Henderson
|
12
124
|
* Actions adore keyword arguments #174 by Josh Cheek
|
125
|
+
* Rake::TaskArguments#key? alias of #has_key? #175 by Paul Annesley
|
13
126
|
|
14
127
|
=== 11.3.0 / 2016-09-20
|
15
128
|
|
@@ -384,7 +497,7 @@ we'll repeat the changes for versions 0.9.3 through 0.9.5 here.
|
|
384
497
|
programatically add rake task libraries.
|
385
498
|
|
386
499
|
* You can specific backtrace suppression patterns (see
|
387
|
-
--
|
500
|
+
--suppress-backtrace)
|
388
501
|
|
389
502
|
* Directory tasks can now take prerequisites and actions
|
390
503
|
|
@@ -632,7 +745,7 @@ we'll repeat the changes for version 0.9.3 here.
|
|
632
745
|
programatically add rake task libraries.
|
633
746
|
|
634
747
|
* You can specific backtrace suppression patterns (see
|
635
|
-
--
|
748
|
+
--suppress-backtrace)
|
636
749
|
|
637
750
|
* Directory tasks can now take prerequisites and actions
|
638
751
|
|
@@ -842,7 +955,7 @@ a number of bug fixes.
|
|
842
955
|
programatically add rake task libraries.
|
843
956
|
|
844
957
|
* You can specific backtrace suppression patterns (see
|
845
|
-
--
|
958
|
+
--suppress-backtrace)
|
846
959
|
|
847
960
|
* Directory tasks can now take prerequisites and actions
|
848
961
|
|
@@ -1414,7 +1527,7 @@ The first argument is still the name of the task (:name in this case).
|
|
1414
1527
|
The next to argumements are the names of the parameters expected by
|
1415
1528
|
:name (:first_name and :last_name in the example).
|
1416
1529
|
|
1417
|
-
To access the values of the
|
1530
|
+
To access the values of the parameters, the block defining the task
|
1418
1531
|
behaviour can now accept a second parameter:
|
1419
1532
|
|
1420
1533
|
task :name, :first_name, :last_name do |t, args|
|
@@ -1517,7 +1630,7 @@ The first argument is still the name of the task (:name in this case).
|
|
1517
1630
|
The next to argumements are the names of the parameters expected by
|
1518
1631
|
:name (:first_name and :last_name in the example).
|
1519
1632
|
|
1520
|
-
To access the values of the
|
1633
|
+
To access the values of the parameters, the block defining the task
|
1521
1634
|
behaviour can now accept a second parameter:
|
1522
1635
|
|
1523
1636
|
task :name, :first_name, :last_name do |t, args|
|
@@ -1737,7 +1850,7 @@ are, I hope you enjoy them.
|
|
1737
1850
|
* RDoc defaults to internal (in-process) invocation. The old behavior
|
1738
1851
|
is still available by setting the +external+ flag to true.
|
1739
1852
|
* Rakefiles are now loaded with the expanded path to prevent
|
1740
|
-
accidental
|
1853
|
+
accidental pollution from the Ruby load path.
|
1741
1854
|
* Task objects my now be used in prerequisite lists directly.
|
1742
1855
|
* Task objects (in addition to task names) may now be included in the
|
1743
1856
|
prerequisite list of a task.
|
@@ -1750,7 +1863,7 @@ are, I hope you enjoy them.
|
|
1750
1863
|
===== Namespaces
|
1751
1864
|
|
1752
1865
|
Tasks can now be nested inside their own namespaces. Tasks within one
|
1753
|
-
namespace will not
|
1866
|
+
namespace will not accidentally interfer with tasks named in a different
|
1754
1867
|
namespace.
|
1755
1868
|
|
1756
1869
|
For example:
|
@@ -1808,7 +1921,7 @@ As usual, it was input from users that drove a alot of these changes.
|
|
1808
1921
|
The following people either contributed patches, made suggestions or
|
1809
1922
|
made otherwise helpful comments. Thanks to ...
|
1810
1923
|
|
1811
|
-
* Doug Young (
|
1924
|
+
* Doug Young (inspiration for the parallel task)
|
1812
1925
|
* David Heinemeier Hansson (for --trace message enhancement and for
|
1813
1926
|
pushing for namespace support).
|
1814
1927
|
* Ludvig Omholt (for the openAFS fix)
|
data/README.rdoc
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
home :: https://github.com/ruby/rake
|
4
4
|
bugs :: https://github.com/ruby/rake/issues
|
5
5
|
docs :: https://ruby.github.io/rake
|
6
|
-
build status :: {<img src="https://travis-ci.org/ruby/rake.svg?branch=master" alt="travis-ci">}[https://travis-ci.org/ruby/rake] {<img src="https://ci.appveyor.com/api/projects/status/github/ruby/rake?branch=master&svg=true" alt="appveyor">}[https://ci.appveyor.com/project/ruby/rake]
|
7
6
|
|
8
7
|
== Description
|
9
8
|
|
@@ -25,8 +24,8 @@ Rake has the following features:
|
|
25
24
|
|
26
25
|
* A library of prepackaged tasks to make building rakefiles easier. For example,
|
27
26
|
tasks for building tarballs. (Formerly
|
28
|
-
tasks for building RDoc, Gems and publishing to FTP were included in rake but they're now
|
29
|
-
available in RDoc, RubyGems and
|
27
|
+
tasks for building RDoc, Gems, and publishing to FTP were included in rake but they're now
|
28
|
+
available in RDoc, RubyGems, and rake-contrib respectively.)
|
30
29
|
|
31
30
|
* Supports parallel execution of tasks.
|
32
31
|
|
@@ -75,10 +74,10 @@ Type "rake --help" for all available options.
|
|
75
74
|
|
76
75
|
=== Rake Information
|
77
76
|
|
78
|
-
* {Rake command-line}[
|
79
|
-
* {Writing Rakefiles}[
|
80
|
-
* The original {Rake announcement}[
|
81
|
-
* Rake {glossary}[
|
77
|
+
* {Rake command-line}[link:doc/command_line_usage.rdoc]
|
78
|
+
* {Writing Rakefiles}[link:doc/rakefile.rdoc]
|
79
|
+
* The original {Rake announcement}[link:doc/rational.rdoc]
|
80
|
+
* Rake {glossary}[link:doc/glossary.rdoc]
|
82
81
|
|
83
82
|
=== Presentations and Articles about Rake
|
84
83
|
|
@@ -130,7 +129,7 @@ Rake is available under an MIT-style license.
|
|
130
129
|
= Other stuff
|
131
130
|
|
132
131
|
Author:: Jim Weirich <jim.weirich@gmail.com>
|
133
|
-
Requires:: Ruby
|
132
|
+
Requires:: Ruby 2.0.0 or later
|
134
133
|
License:: Copyright Jim Weirich.
|
135
134
|
Released under an MIT-style license. See the MIT-LICENSE
|
136
135
|
file included in the distribution.
|
data/Rakefile
CHANGED
@@ -9,16 +9,19 @@
|
|
9
9
|
lib = File.expand_path("../lib", __FILE__)
|
10
10
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
11
11
|
|
12
|
-
|
13
|
-
require "
|
14
|
-
|
12
|
+
begin
|
13
|
+
require "bundler/gem_tasks"
|
14
|
+
rescue LoadError
|
15
|
+
end
|
15
16
|
|
17
|
+
require "rake/testtask"
|
16
18
|
Rake::TestTask.new(:test) do |t|
|
17
19
|
t.libs << "test"
|
18
20
|
t.verbose = true
|
19
21
|
t.test_files = FileList["test/**/test_*.rb"]
|
20
22
|
end
|
21
23
|
|
24
|
+
require "rdoc/task"
|
22
25
|
RDoc::Task.new do |doc|
|
23
26
|
doc.main = "README.rdoc"
|
24
27
|
doc.title = "Rake -- Ruby Make"
|
@@ -27,7 +30,7 @@ RDoc::Task.new do |doc|
|
|
27
30
|
end
|
28
31
|
|
29
32
|
task ghpages: :rdoc do
|
30
|
-
|
33
|
+
%x[git checkout gh-pages]
|
31
34
|
require "fileutils"
|
32
35
|
FileUtils.rm_rf "/tmp/html"
|
33
36
|
FileUtils.mv "html", "/tmp"
|
data/bin/bundle
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1 || ">= 0.a"
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||= begin
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version || "#{Gem::Requirement.default}.a"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def load_bundler!
|
71
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
72
|
+
|
73
|
+
# must dup string for RG < 1.8 compatibility
|
74
|
+
activate_bundler(bundler_version.dup)
|
75
|
+
end
|
76
|
+
|
77
|
+
def activate_bundler(bundler_version)
|
78
|
+
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new("2.0")
|
79
|
+
bundler_version = "< 2"
|
80
|
+
end
|
81
|
+
gem_error = activation_error_handling do
|
82
|
+
gem "bundler", bundler_version
|
83
|
+
end
|
84
|
+
return if gem_error.nil?
|
85
|
+
require_error = activation_error_handling do
|
86
|
+
require "bundler/version"
|
87
|
+
end
|
88
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
89
|
+
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
90
|
+
exit 42
|
91
|
+
end
|
92
|
+
|
93
|
+
def activation_error_handling
|
94
|
+
yield
|
95
|
+
nil
|
96
|
+
rescue StandardError, LoadError => e
|
97
|
+
e
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
m.load_bundler!
|
102
|
+
|
103
|
+
if m.invoked_as_script?
|
104
|
+
load Gem.bin_path("bundler", "bundle")
|
105
|
+
end
|