rake 12.3.0 → 12.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2b718e4a254e7cf9aa20eafd30a425fa232d4b7949279198ce96585dfb0d276
4
- data.tar.gz: 8470eefb329a55718ab467caddac13baa467fee4f1ec98c89d5465cf769c98f9
3
+ metadata.gz: 8bdd2e72f2f0ed9bd143e9f691203343bc430717dde81d9928807ce267c60d49
4
+ data.tar.gz: 77a5a8acd239396ac98ae54b146d70e1c8407d18109010eaa495f4fb15310f6b
5
5
  SHA512:
6
- metadata.gz: c76eafa2e92c5ddcc9ee9e47136e1e265c14b482361e256715aefd454c79223eedeacf2886560996769e0050501bd9780c85b699192f0f6fb074eeb01a1d5641
7
- data.tar.gz: 72562540e4ef42e556ede99ea8ecc8f0488da248b58bd1432e6834b6297f823af3518e0d358fd18054c0347e863aabe7a30ce4f7c9eff7850ddeb233c609af1c
6
+ metadata.gz: 3c47fee4f4436744de8cf095683f5298920128a12bd6415c689ca815626bbf36330015bed62e758324ee4762a018294695f6106f9c29883330cea7915787b957
7
+ data.tar.gz: 5d9c91f228cb06f6ebbb3b3aaae13664f4d12b04cfdd3413e4c0d1c6083ec5de2c3b89a5bf9e62a9a82105a7411ac2cb2bdb84cb36ca033a4b710d10a5661312
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
- git://github.com/ruby/rake.git
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
- * Type one of the following:
17
+ * Run the test suite
18
18
 
19
- rake # If you have run rake's tests
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/History.rdoc CHANGED
@@ -1,11 +1,56 @@
1
+ === 12.3.3
2
+
3
+ ==== Bug fixes
4
+
5
+ * Use the application's name in error message if a task is not found.
6
+ Pull Request #303 by tmatilai
7
+
8
+ ==== Enhancements:
9
+
10
+ * Use File.open explicitly.
11
+
12
+ === 12.3.2
13
+
14
+ ==== Bug fixes
15
+
16
+ * Fixed test fails caused by 2.6 warnings.
17
+ Pull Request #297 by hsbt
18
+
19
+ ==== Enhancements:
20
+
21
+ * Rdoc improvements.
22
+ Pull Request #293 by colby-swandale
23
+ * Improve multitask performance.
24
+ Pull Request #273 by jsm
25
+ * Add alias `prereqs`.
26
+ Pull Request #268 by take-cheeze
27
+
28
+ === 12.3.1
29
+
30
+ ==== Bug fixes
31
+
32
+ * Support did_you_mean >= v1.2.0 which has a breaking change on formatters.
33
+ Pull request #262 by FUJI Goro.
34
+
35
+ ==== Enhancements:
36
+
37
+ * Don't run task if it depends on already invoked but failed task.
38
+ Pull request #252 by Gonzalo Rodriguez.
39
+ * Make space trimming consistent for all task arguments.
40
+ Pull request #259 by Gonzalo Rodriguez.
41
+ * Removes duplicated inclusion of Rake::DSL in tests.
42
+ Pull request #254 by Gonzalo Rodriguez.
43
+ * Re-raise a LoadError that didn't come from require in the test loader.
44
+ Pull request #250 by Dylan Thacker-Smith.
45
+
1
46
  === 12.3.0
2
47
 
3
48
  ==== Compatibility Changes
4
49
 
5
- * Bump `required_ruby_verion` to Ruby 2.0.0. Rake was already
6
- removed to support for Ruby 1.9.x.
50
+ * Bump `required_ruby_version` to Ruby 2.0.0. Rake has already
51
+ removed support for Ruby 1.9.x.
7
52
 
8
- === Enhancements:
53
+ ==== Enhancements:
9
54
 
10
55
  * Support `test-bundled-gems` task on ruby core.
11
56
 
data/README.rdoc CHANGED
@@ -25,8 +25,8 @@ Rake has the following features:
25
25
 
26
26
  * A library of prepackaged tasks to make building rakefiles easier. For example,
27
27
  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 respectively.)
28
+ tasks for building RDoc, Gems, and publishing to FTP were included in rake but they're now
29
+ available in RDoc, RubyGems, and rake-contrib respectively.)
30
30
 
31
31
  * Supports parallel execution of tasks.
32
32
 
@@ -75,10 +75,10 @@ Type "rake --help" for all available options.
75
75
 
76
76
  === Rake Information
77
77
 
78
- * {Rake command-line}[rdoc-ref:doc/command_line_usage.rdoc]
79
- * {Writing Rakefiles}[rdoc-ref:doc/rakefile.rdoc]
80
- * The original {Rake announcement}[rdoc-ref:doc/rational.rdoc]
81
- * Rake {glossary}[rdoc-ref:doc/glossary.rdoc]
78
+ * {Rake command-line}[link:doc/command_line_usage.rdoc]
79
+ * {Writing Rakefiles}[link:doc/rakefile.rdoc]
80
+ * The original {Rake announcement}[link:doc/rational.rdoc]
81
+ * Rake {glossary}[link:doc/glossary.rdoc]
82
82
 
83
83
  === Presentations and Articles about Rake
84
84
 
@@ -130,7 +130,7 @@ Rake is available under an MIT-style license.
130
130
  = Other stuff
131
131
 
132
132
  Author:: Jim Weirich <jim.weirich@gmail.com>
133
- Requires:: Ruby 1.9.3 or later
133
+ Requires:: Ruby 2.0.0 or later
134
134
  License:: Copyright Jim Weirich.
135
135
  Released under an MIT-style license. See the MIT-LICENSE
136
136
  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
- require "bundler/gem_tasks"
13
- require "rake/testtask"
14
- require "rdoc/task"
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
- `git checkout gh-pages`
33
+ %x[git checkout gh-pages]
31
34
  require "fileutils"
32
35
  FileUtils.rm_rf "/tmp/html"
33
36
  FileUtils.mv "html", "/tmp"
@@ -0,0 +1,11 @@
1
+ jobs:
2
+ - job: macOS
3
+ pool:
4
+ vmImage: 'macos-10.13'
5
+ steps:
6
+ - script: |
7
+ gem install bundler
8
+ bundle install --retry=3 --jobs=4
9
+ displayName: 'bundle install'
10
+ - script: ruby -Ilib exe/rake
11
+ displayName: 'ruby -Ilib exe/rake'
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
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/rdoc ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rdoc' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rdoc", "rdoc")
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
@@ -91,7 +91,7 @@ module Rake
91
91
  begin
92
92
  args = handle_options argv
93
93
  rescue ArgumentError
94
- # Backword compatibility for capistrano
94
+ # Backward compatibility for capistrano
95
95
  args = handle_options
96
96
  end
97
97
  collect_command_line_tasks(args)
@@ -172,7 +172,7 @@ module Rake
172
172
  args = []
173
173
 
174
174
  begin
175
- /((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
175
+ /\s*((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
176
176
 
177
177
  remaining_args = $2
178
178
  args << $1.gsub(/\\(.)/, '\1')
@@ -392,7 +392,7 @@ module Rake
392
392
 
393
393
  def sort_options(options) # :nodoc:
394
394
  options.sort_by { |opt|
395
- opt.select { |o| o =~ /^-/ }.map(&:downcase).sort.reverse
395
+ opt.select { |o| o.is_a?(String) && o =~ /^-/ }.map(&:downcase).sort.reverse
396
396
  }
397
397
  end
398
398
  private :sort_options
@@ -687,7 +687,7 @@ module Rake
687
687
 
688
688
  def raw_load_rakefile # :nodoc:
689
689
  rakefile, location = find_rakefile_location
690
- if (! options.ignore_system) &&
690
+ if (!options.ignore_system) &&
691
691
  (options.load_system || rakefile.nil?) &&
692
692
  system_dir && File.directory?(system_dir)
693
693
  print_rakefile_directory(location)
@@ -797,7 +797,7 @@ module Rake
797
797
  backtrace.find { |str| str =~ re } || ""
798
798
  end
799
799
 
800
- def set_default_options
800
+ def set_default_options # :nodoc:
801
801
  options.always_multitask = false
802
802
  options.backtrace = false
803
803
  options.build_all = false
@@ -32,7 +32,7 @@ unless Rake::CpuCounter.method_defined?(:count)
32
32
  require 'rbconfig'
33
33
 
34
34
  def count
35
- if defined?(Java::Java)
35
+ if RUBY_PLATFORM == 'java'
36
36
  count_via_java_runtime
37
37
  else
38
38
  case RbConfig::CONFIG['host_os']
@@ -26,9 +26,9 @@ module Rake
26
26
  private
27
27
 
28
28
  # :call-seq:
29
- # task task_name
30
- # task task_name: dependencies
31
- # task task_name, arguments => dependencies
29
+ # task(task_name)
30
+ # task(task_name: dependencies)
31
+ # task(task_name, arguments => dependencies)
32
32
  #
33
33
  # Declare a basic task. The +task_name+ is always the first argument. If
34
34
  # the task name contains a ":" it is defined in that namespace.
@@ -12,7 +12,7 @@ module Rake
12
12
  class FileCreationTask < FileTask
13
13
  # Is this file task needed? Yes if it doesn't exist.
14
14
  def needed?
15
- ! File.exist?(name)
15
+ !File.exist?(name)
16
16
  end
17
17
 
18
18
  # Time stamp for file creation task. This time stamp is earlier
@@ -294,7 +294,7 @@ module Rake
294
294
  matched = 0
295
295
  each do |fn|
296
296
  begin
297
- open(fn, "r", *options) do |inf|
297
+ File.open(fn, "r", *options) do |inf|
298
298
  count = 0
299
299
  inf.each do |line|
300
300
  count += 1
@@ -385,7 +385,7 @@ module Rake
385
385
  /~$/
386
386
  ]
387
387
  DEFAULT_IGNORE_PROCS = [
388
- proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
388
+ proc { |fn| fn =~ /(^|[\/\\])core$/ && !File.directory?(fn) }
389
389
  ]
390
390
 
391
391
  def import(array) # :nodoc:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require "rake/task.rb"
2
+ require "rake/task"
3
3
  require "rake/early_time"
4
4
 
5
5
  module Rake
@@ -14,7 +14,7 @@ module Rake
14
14
  # Is this file task needed? Yes if it doesn't exist, or if its time stamp
15
15
  # is out of date.
16
16
  def needed?
17
- ! File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all
17
+ !File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all
18
18
  end
19
19
 
20
20
  # Time stamp for file task.
@@ -35,7 +35,7 @@ module FileUtils
35
35
  #
36
36
  # # check exit status after command runs
37
37
  # sh %{grep pattern file} do |ok, res|
38
- # if ! ok
38
+ # if !ok
39
39
  # puts "pattern not found (status = #{res.exitstatus})"
40
40
  # end
41
41
  # end
@@ -111,7 +111,7 @@ module FileUtils
111
111
  # Attempt to do a normal file link, but fall back to a copy if the link
112
112
  # fails.
113
113
  def safe_ln(*args)
114
- if ! LN_SUPPORTED[0]
114
+ if !LN_SUPPORTED[0]
115
115
  cp(*args)
116
116
  else
117
117
  begin
@@ -5,46 +5,10 @@ module Rake
5
5
  # parallel using Ruby threads.
6
6
  #
7
7
  class MultiTask < Task
8
-
9
- # Same as invoke, but explicitly pass a call chain to detect
10
- # circular dependencies. This is largely copied from Rake::Task
11
- # but has been updated such that if multiple tasks depend on this
12
- # one in parallel, they will all fail if the first execution of
13
- # this task fails.
14
- def invoke_with_call_chain(task_args, invocation_chain)
15
- new_chain = Rake::InvocationChain.append(self, invocation_chain)
16
- @lock.synchronize do
17
- begin
18
- if @already_invoked
19
- if @invocation_exception
20
- if application.options.trace
21
- application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
22
- end
23
- raise @invocation_exception
24
- else
25
- return
26
- end
27
- end
28
-
29
- if application.options.trace
30
- application.trace "** Invoke #{name} #{format_trace_flags}"
31
- end
32
- @already_invoked = true
33
-
34
- invoke_prerequisites(task_args, new_chain)
35
- execute(task_args) if needed?
36
- rescue Exception => ex
37
- add_chain_to(ex, new_chain)
38
- @invocation_exception = ex
39
- raise
40
- end
41
- end
42
- end
43
-
44
8
  private
9
+
45
10
  def invoke_prerequisites(task_args, invocation_chain) # :nodoc:
46
11
  invoke_prerequisites_concurrently(task_args, invocation_chain)
47
12
  end
48
13
  end
49
-
50
14
  end
@@ -132,9 +132,7 @@ module Rake
132
132
  task package: ["#{package_dir}/#{file}"]
133
133
  file "#{package_dir}/#{file}" =>
134
134
  [package_dir_path] + package_files do
135
- chdir(package_dir) do
136
- sh @tar_command, "#{flag}cvf", file, package_name
137
- end
135
+ chdir(package_dir) { sh @tar_command, "#{flag}cvf", file, package_name }
138
136
  end
139
137
  end
140
138
  end
@@ -143,9 +141,7 @@ module Rake
143
141
  task package: ["#{package_dir}/#{zip_file}"]
144
142
  file "#{package_dir}/#{zip_file}" =>
145
143
  [package_dir_path] + package_files do
146
- chdir(package_dir) do
147
- sh @zip_command, "-r", zip_file, package_name
148
- end
144
+ chdir(package_dir) { sh @zip_command, "-r", zip_file, package_name }
149
145
  end
150
146
  end
151
147
 
data/lib/rake/promise.rb CHANGED
@@ -71,12 +71,12 @@ module Rake
71
71
 
72
72
  # Do we have a result for the promise
73
73
  def result?
74
- ! @result.equal?(NOT_SET)
74
+ !@result.equal?(NOT_SET)
75
75
  end
76
76
 
77
77
  # Did the promise throw an error
78
78
  def error?
79
- ! @error.equal?(NOT_SET)
79
+ !@error.equal?(NOT_SET)
80
80
  end
81
81
 
82
82
  # Are we done with the promise
@@ -19,6 +19,7 @@ argv = ARGV.select do |argument|
19
19
  false
20
20
  end
21
21
  rescue LoadError => e
22
+ raise unless e.path
22
23
  abort "\nFile does not exist: #{e.path}\n\n"
23
24
  end
24
25
  end
data/lib/rake/scope.rb CHANGED
@@ -16,7 +16,7 @@ module Rake
16
16
  # this trim beyond the toplevel scope.
17
17
  def trim(n)
18
18
  result = self
19
- while n > 0 && ! result.empty?
19
+ while n > 0 && !result.empty?
20
20
  result = result.tail
21
21
  n -= 1
22
22
  end
data/lib/rake/task.rb CHANGED
@@ -15,6 +15,7 @@ module Rake
15
15
  class Task
16
16
  # List of prerequisites for a task.
17
17
  attr_reader :prerequisites
18
+ alias prereqs prerequisites
18
19
 
19
20
  # List of actions attached to a task.
20
21
  attr_reader :actions
@@ -103,6 +104,7 @@ module Rake
103
104
  @scope = app.current_scope
104
105
  @arg_names = nil
105
106
  @locations = []
107
+ @invocation_exception = nil
106
108
  end
107
109
 
108
110
  # Enhance a task with prerequisites or actions. Returns self.
@@ -183,20 +185,39 @@ module Rake
183
185
 
184
186
  # Same as invoke, but explicitly pass a call chain to detect
185
187
  # circular dependencies.
186
- def invoke_with_call_chain(task_args, invocation_chain) # :nodoc:
187
- new_chain = InvocationChain.append(self, invocation_chain)
188
+ #
189
+ # If multiple tasks depend on this
190
+ # one in parallel, they will all fail if the first execution of
191
+ # this task fails.
192
+ def invoke_with_call_chain(task_args, invocation_chain)
193
+ new_chain = Rake::InvocationChain.append(self, invocation_chain)
188
194
  @lock.synchronize do
189
- if application.options.trace
190
- application.trace "** Invoke #{name} #{format_trace_flags}"
195
+ begin
196
+ if application.options.trace
197
+ application.trace "** Invoke #{name} #{format_trace_flags}"
198
+ end
199
+
200
+ if @already_invoked
201
+ if @invocation_exception
202
+ if application.options.trace
203
+ application.trace "** Previous invocation of #{name} failed #{format_trace_flags}"
204
+ end
205
+ raise @invocation_exception
206
+ else
207
+ return
208
+ end
209
+ end
210
+
211
+ @already_invoked = true
212
+
213
+ invoke_prerequisites(task_args, new_chain)
214
+ execute(task_args) if needed?
215
+ rescue Exception => ex
216
+ add_chain_to(ex, new_chain)
217
+ @invocation_exception = ex
218
+ raise ex
191
219
  end
192
- return if @already_invoked
193
- @already_invoked = true
194
- invoke_prerequisites(task_args, new_chain)
195
- execute(task_args) if needed?
196
220
  end
197
- rescue Exception => ex
198
- add_chain_to(ex, new_chain)
199
- raise ex
200
221
  end
201
222
  protected :invoke_with_call_chain
202
223
 
@@ -227,7 +248,8 @@ module Rake
227
248
  r.invoke_with_call_chain(prereq_args, invocation_chain)
228
249
  end
229
250
  end
230
- futures.each(&:value)
251
+ # Iterate in reverse to improve performance related to thread waiting and switching
252
+ futures.reverse_each(&:value)
231
253
  end
232
254
 
233
255
  # Format the trace flags for display.
@@ -267,7 +289,7 @@ module Rake
267
289
  def add_description(description)
268
290
  return unless description
269
291
  comment = description.strip
270
- add_comment(comment) if comment && ! comment.empty?
292
+ add_comment(comment) if comment && !comment.empty?
271
293
  end
272
294
 
273
295
  def comment=(comment) # :nodoc:
@@ -60,17 +60,22 @@ module Rake
60
60
  end
61
61
 
62
62
  def generate_message_for_undefined_task(task_name)
63
- message = "Don't know how to build task '#{task_name}' (see --tasks)"
63
+ message = "Don't know how to build task '#{task_name}' "\
64
+ "(See the list of available tasks with `#{Rake.application.name} --tasks`)"
65
+ message + generate_did_you_mean_suggestions(task_name)
66
+ end
64
67
 
65
- suggestion_message = \
66
- if defined?(::DidYouMean::SpellChecker) && defined?(::DidYouMean::Formatter)
67
- suggestions = ::DidYouMean::SpellChecker.new(dictionary: @tasks.keys).correct(task_name.to_s)
68
- ::DidYouMean::Formatter.new(suggestions).to_s
69
- else
70
- ""
71
- end
68
+ def generate_did_you_mean_suggestions(task_name)
69
+ return "" unless defined?(::DidYouMean::SpellChecker)
72
70
 
73
- message + suggestion_message
71
+ suggestions = ::DidYouMean::SpellChecker.new(dictionary: @tasks.keys).correct(task_name.to_s)
72
+ if ::DidYouMean.respond_to?(:formatter)# did_you_mean v1.2.0 or later
73
+ ::DidYouMean.formatter.message_for(suggestions)
74
+ elsif defined?(::DidYouMean::Formatter) # before did_you_mean v1.2.0
75
+ ::DidYouMean::Formatter.new(suggestions).to_s
76
+ else
77
+ ""
78
+ end
74
79
  end
75
80
 
76
81
  def synthesize_file_task(task_name) # :nodoc:
data/lib/rake/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Rake
3
- VERSION = "12.3.0"
3
+ VERSION = "12.3.3"
4
4
 
5
5
  module Version # :nodoc: all
6
6
  MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split "."
data/rake.gemspec CHANGED
@@ -5,7 +5,6 @@ require 'rake/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "rake".freeze
7
7
  s.version = Rake::VERSION
8
- s.date = "2017-10-25"
9
8
  s.authors = ["Hiroshi SHIBATA".freeze, "Eric Hodel".freeze, "Jim Weirich".freeze]
10
9
  s.email = ["hsbt@ruby-lang.org".freeze, "drbrain@segment7.net".freeze, "".freeze]
11
10
 
@@ -24,8 +23,8 @@ Rake has the following features:
24
23
  s.homepage = "https://github.com/ruby/rake".freeze
25
24
  s.licenses = ["MIT".freeze]
26
25
 
27
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } -
28
- %w[.rubocop.yml .travis.yml appveyor.yml]
26
+ s.files = %x[git ls-files -z].split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } -
27
+ %w[.rubocop.yml .gitignore .travis.yml appveyor.yml]
29
28
  s.bindir = "exe"
30
29
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
30
  s.require_paths = ["lib".freeze]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.3.0
4
+ version: 12.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi SHIBATA
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2017-10-25 00:00:00.000000000 Z
13
+ date: 2019-07-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -101,14 +101,18 @@ executables:
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - ".gitignore"
105
104
  - CONTRIBUTING.rdoc
106
105
  - Gemfile
107
106
  - History.rdoc
108
107
  - MIT-LICENSE
109
108
  - README.rdoc
110
109
  - Rakefile
110
+ - azure-pipelines.yml
111
+ - bin/bundle
111
112
  - bin/console
113
+ - bin/rake
114
+ - bin/rdoc
115
+ - bin/rubocop
112
116
  - bin/setup
113
117
  - doc/command_line_usage.rdoc
114
118
  - doc/example/Rakefile1
@@ -188,8 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
192
  - !ruby/object:Gem::Version
189
193
  version: 1.3.2
190
194
  requirements: []
191
- rubyforge_project:
192
- rubygems_version: 2.7.2
195
+ rubygems_version: 3.0.3
193
196
  signing_key:
194
197
  specification_version: 4
195
198
  summary: Rake is a Make-like program implemented in Ruby
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- *.bak
2
- *.rbc
3
- *.swp
4
- *~
5
- .#*
6
- .DS_Store
7
- .idea
8
- .rbx
9
- /.rdoc
10
- /TAGS
11
- /coverage
12
- /html
13
- /pkg
14
- Gemfile.lock