rake 12.0.0.beta1 → 13.0.0.pre.1

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.
Files changed (65) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/macos.yml +22 -0
  3. data/.github/workflows/ubuntu-rvm.yml +28 -0
  4. data/.github/workflows/ubuntu.yml +20 -0
  5. data/.github/workflows/windows.yml +20 -0
  6. data/CONTRIBUTING.rdoc +11 -4
  7. data/Gemfile +7 -0
  8. data/History.rdoc +124 -11
  9. data/README.rdoc +7 -8
  10. data/Rakefile +7 -4
  11. data/bin/bundle +105 -0
  12. data/bin/rake +29 -0
  13. data/bin/rdoc +29 -0
  14. data/bin/rubocop +29 -0
  15. data/doc/jamis.rb +1 -0
  16. data/doc/rakefile.rdoc +1 -1
  17. data/lib/rake.rb +1 -0
  18. data/lib/rake/application.rb +54 -15
  19. data/lib/rake/backtrace.rb +1 -0
  20. data/lib/rake/clean.rb +4 -3
  21. data/lib/rake/cloneable.rb +1 -0
  22. data/lib/rake/cpu_counter.rb +2 -1
  23. data/lib/rake/default_loader.rb +1 -0
  24. data/lib/rake/dsl_definition.rb +4 -3
  25. data/lib/rake/early_time.rb +1 -0
  26. data/lib/rake/ext/core.rb +1 -0
  27. data/lib/rake/ext/string.rb +2 -1
  28. data/lib/rake/file_creation_task.rb +2 -1
  29. data/lib/rake/file_list.rb +5 -4
  30. data/lib/rake/file_task.rb +11 -3
  31. data/lib/rake/file_utils.rb +10 -12
  32. data/lib/rake/file_utils_ext.rb +7 -17
  33. data/lib/rake/invocation_chain.rb +1 -0
  34. data/lib/rake/invocation_exception_mixin.rb +1 -0
  35. data/lib/rake/late_time.rb +1 -0
  36. data/lib/rake/linked_list.rb +1 -0
  37. data/lib/rake/loaders/makefile.rb +1 -0
  38. data/lib/rake/multi_task.rb +2 -37
  39. data/lib/rake/name_space.rb +1 -0
  40. data/lib/rake/packagetask.rb +18 -6
  41. data/lib/rake/phony.rb +1 -0
  42. data/lib/rake/private_reader.rb +1 -0
  43. data/lib/rake/promise.rb +3 -2
  44. data/lib/rake/pseudo_status.rb +1 -0
  45. data/lib/rake/rake_module.rb +29 -0
  46. data/lib/rake/rake_test_loader.rb +17 -11
  47. data/lib/rake/rule_recursion_overflow_error.rb +1 -0
  48. data/lib/rake/scope.rb +2 -1
  49. data/lib/rake/task.rb +59 -16
  50. data/lib/rake/task_argument_error.rb +1 -0
  51. data/lib/rake/task_arguments.rb +2 -0
  52. data/lib/rake/task_manager.rb +42 -17
  53. data/lib/rake/tasklib.rb +1 -0
  54. data/lib/rake/testtask.rb +3 -1
  55. data/lib/rake/thread_history_display.rb +1 -0
  56. data/lib/rake/thread_pool.rb +1 -0
  57. data/lib/rake/trace_output.rb +1 -0
  58. data/lib/rake/version.rb +2 -1
  59. data/lib/rake/win32.rb +1 -0
  60. data/rake.gemspec +4 -7
  61. metadata +13 -52
  62. data/.gitignore +0 -14
  63. data/.rubocop.yml +0 -57
  64. data/.travis.yml +0 -21
  65. data/appveyor.yml +0 -21
@@ -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")
@@ -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")
@@ -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")
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module RDoc
2
3
  module Page
3
4
 
@@ -410,7 +410,7 @@ display a list of tasks that have a description. If you use +desc+ to
410
410
  describe your major tasks, you have a semi-automatic way of generating
411
411
  a summary of your Rake file.
412
412
 
413
- traken$ rake -T
413
+ $ rake -T
414
414
  (in /home/.../rake)
415
415
  rake clean # Remove any temporary products.
416
416
  rake clobber # Remove any generated file.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  #--
2
3
  # Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
3
4
  #
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "optparse"
2
3
 
3
4
  require "rake/task_manager"
@@ -61,6 +62,8 @@ module Rake
61
62
  add_loader("rake", DefaultLoader.new)
62
63
  @tty_output = STDOUT.tty?
63
64
  @terminal_columns = ENV["RAKE_COLUMNS"].to_i
65
+
66
+ set_default_options
64
67
  end
65
68
 
66
69
  # Run the Rake application. The run method performs the following
@@ -73,19 +76,24 @@ module Rake
73
76
  # If you wish to build a custom rake command, you should call
74
77
  # +init+ on your application. Then define any tasks. Finally,
75
78
  # call +top_level+ to run your top level tasks.
76
- def run
79
+ def run(argv = ARGV)
77
80
  standard_exception_handling do
78
- init
81
+ init "rake", argv
79
82
  load_rakefile
80
83
  top_level
81
84
  end
82
85
  end
83
86
 
84
87
  # Initialize the command line parameters and app name.
85
- def init(app_name="rake")
88
+ def init(app_name="rake", argv = ARGV)
86
89
  standard_exception_handling do
87
90
  @name = app_name
88
- args = handle_options
91
+ begin
92
+ args = handle_options argv
93
+ rescue ArgumentError
94
+ # Backward compatibility for capistrano
95
+ args = handle_options
96
+ end
89
97
  collect_command_line_tasks(args)
90
98
  end
91
99
  end
@@ -164,7 +172,7 @@ module Rake
164
172
  args = []
165
173
 
166
174
  begin
167
- /((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
175
+ /\s*((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
168
176
 
169
177
  remaining_args = $2
170
178
  args << $1.gsub(/\\(.)/, '\1')
@@ -204,13 +212,22 @@ module Rake
204
212
  end
205
213
 
206
214
  def display_exception_details(ex) # :nodoc:
207
- seen = Thread.current[:rake_display_exception_details_seen] ||= []
208
- return if seen.include? ex
209
- seen << ex
215
+ display_exception_details_seen << ex
210
216
 
211
217
  display_exception_message_details(ex)
212
218
  display_exception_backtrace(ex)
213
- display_exception_details(ex.cause) if has_cause?(ex)
219
+ display_cause_details(ex.cause) if has_cause?(ex)
220
+ end
221
+
222
+ def display_cause_details(ex) # :nodoc:
223
+ return if display_exception_details_seen.include? ex
224
+
225
+ trace "\nCaused by:"
226
+ display_exception_details(ex)
227
+ end
228
+
229
+ def display_exception_details_seen # :nodoc:
230
+ Thread.current[:rake_display_exception_details_seen] ||= []
214
231
  end
215
232
 
216
233
  def has_cause?(ex) # :nodoc:
@@ -375,7 +392,7 @@ module Rake
375
392
 
376
393
  def sort_options(options) # :nodoc:
377
394
  options.sort_by { |opt|
378
- opt.select { |o| o =~ /^-/ }.map(&:downcase).sort.reverse
395
+ opt.select { |o| o.is_a?(String) && o =~ /^-/ }.map(&:downcase).sort.reverse
379
396
  }
380
397
  end
381
398
  private :sort_options
@@ -617,9 +634,8 @@ module Rake
617
634
  # Read and handle the command line options. Returns the command line
618
635
  # arguments that we didn't understand, which should (in theory) be just
619
636
  # task names and env vars.
620
- def handle_options # :nodoc:
621
- options.rakelib = ["rakelib"]
622
- options.trace_output = $stderr
637
+ def handle_options(argv) # :nodoc:
638
+ set_default_options
623
639
 
624
640
  OptionParser.new do |opts|
625
641
  opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
@@ -633,7 +649,7 @@ module Rake
633
649
 
634
650
  standard_rake_options.each { |args| opts.on(*args) }
635
651
  opts.environment("RAKEOPT")
636
- end.parse(ARGV)
652
+ end.parse(argv)
637
653
  end
638
654
 
639
655
  # Similar to the regular Ruby +require+ command, but will check
@@ -671,7 +687,7 @@ module Rake
671
687
 
672
688
  def raw_load_rakefile # :nodoc:
673
689
  rakefile, location = find_rakefile_location
674
- if (! options.ignore_system) &&
690
+ if (!options.ignore_system) &&
675
691
  (options.load_system || rakefile.nil?) &&
676
692
  system_dir && File.directory?(system_dir)
677
693
  print_rakefile_directory(location)
@@ -781,5 +797,28 @@ module Rake
781
797
  backtrace.find { |str| str =~ re } || ""
782
798
  end
783
799
 
800
+ def set_default_options # :nodoc:
801
+ options.always_multitask = false
802
+ options.backtrace = false
803
+ options.build_all = false
804
+ options.dryrun = false
805
+ options.ignore_deprecate = false
806
+ options.ignore_system = false
807
+ options.job_stats = false
808
+ options.load_system = false
809
+ options.nosearch = false
810
+ options.rakelib = %w[rakelib]
811
+ options.show_all_tasks = false
812
+ options.show_prereqs = false
813
+ options.show_task_pattern = nil
814
+ options.show_tasks = nil
815
+ options.silent = false
816
+ options.suppress_backtrace_pattern = nil
817
+ options.thread_pool_size = Rake.suggested_thread_count
818
+ options.trace = false
819
+ options.trace_output = $stderr
820
+ options.trace_rules = false
821
+ end
822
+
784
823
  end
785
824
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
  module Backtrace # :nodoc: all
3
4
  SYS_KEYS = RbConfig::CONFIG.keys.grep(/(?:[a-z]prefix|libdir)\z/)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
2
3
  # two rake tasks (:clean and :clobber).
3
4
  #
@@ -27,10 +28,10 @@ module Rake
27
28
  end
28
29
  end
29
30
 
30
- def cleanup(file_name, opts={})
31
+ def cleanup(file_name, **opts)
31
32
  begin
32
- opts = {:verbose => Rake.application.options.trace}.merge(opts)
33
- rm_r file_name, opts
33
+ opts = { verbose: Rake.application.options.trace }.merge(opts)
34
+ rm_r file_name, **opts
34
35
  rescue StandardError => ex
35
36
  puts "Failed to remove #{file_name}: #{ex}" unless file_already_gone?(file_name)
36
37
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
  ##
3
4
  # Mixin for creating easily cloned objects.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
 
3
4
  # Based on a script at:
@@ -31,7 +32,7 @@ unless Rake::CpuCounter.method_defined?(:count)
31
32
  require 'rbconfig'
32
33
 
33
34
  def count
34
- if defined?(Java::Java)
35
+ if RUBY_PLATFORM == 'java'
35
36
  count_via_java_runtime
36
37
  else
37
38
  case RbConfig::CONFIG['host_os']
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
 
3
4
  # Default Rakefile loader used by +import+.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Rake DSL functions.
2
3
  require "rake/file_utils_ext"
3
4
 
@@ -25,9 +26,9 @@ module Rake
25
26
  private
26
27
 
27
28
  # :call-seq:
28
- # task task_name
29
- # task task_name: dependencies
30
- # task task_name, arguments => dependencies
29
+ # task(task_name)
30
+ # task(task_name: dependencies)
31
+ # task(task_name, arguments => dependencies)
31
32
  #
32
33
  # Declare a basic task. The +task_name+ is always the first argument. If
33
34
  # the task name contains a ":" it is defined in that namespace.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Rake
2
3
 
3
4
  # EarlyTime is a fake timestamp that occurs _before_ any other time value.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Module
2
3
  # Check for an existing method in the current class before extending. If
3
4
  # the method already exists, then a warning is printed and the extension is
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "rake/ext/core"
2
3
 
3
4
  class String
@@ -136,7 +137,7 @@ class String
136
137
  # This String extension comes from Rake
137
138
  def pathmap(spec=nil, &block)
138
139
  return self if spec.nil?
139
- result = ""
140
+ result = "".dup
140
141
  spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
141
142
  case frag
142
143
  when "%f"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "rake/file_task"
2
3
  require "rake/early_time"
3
4
 
@@ -11,7 +12,7 @@ module Rake
11
12
  class FileCreationTask < FileTask
12
13
  # Is this file task needed? Yes if it doesn't exist.
13
14
  def needed?
14
- ! File.exist?(name)
15
+ !File.exist?(name)
15
16
  end
16
17
 
17
18
  # Time stamp for file creation task. This time stamp is earlier
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "rake/cloneable"
2
3
  require "rake/file_utils_ext"
3
4
  require "rake/ext/string"
@@ -293,7 +294,7 @@ module Rake
293
294
  matched = 0
294
295
  each do |fn|
295
296
  begin
296
- open(fn, "r", *options) do |inf|
297
+ File.open(fn, "r", *options) do |inf|
297
298
  count = 0
298
299
  inf.each do |line|
299
300
  count += 1
@@ -317,14 +318,14 @@ module Rake
317
318
  # Return a new file list that only contains file names from the current
318
319
  # file list that exist on the file system.
319
320
  def existing
320
- select { |fn| File.exist?(fn) }
321
+ select { |fn| File.exist?(fn) }.uniq
321
322
  end
322
323
 
323
324
  # Modify the current file list so that it contains only file name that
324
325
  # exist on the file system.
325
326
  def existing!
326
327
  resolve
327
- @items = @items.select { |fn| File.exist?(fn) }
328
+ @items = @items.select { |fn| File.exist?(fn) }.uniq
328
329
  self
329
330
  end
330
331
 
@@ -384,7 +385,7 @@ module Rake
384
385
  /~$/
385
386
  ]
386
387
  DEFAULT_IGNORE_PROCS = [
387
- proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
388
+ proc { |fn| fn =~ /(^|[\/\\])core$/ && !File.directory?(fn) }
388
389
  ]
389
390
 
390
391
  def import(array) # :nodoc:
@@ -1,4 +1,5 @@
1
- require "rake/task.rb"
1
+ # frozen_string_literal: true
2
+ require "rake/task"
2
3
  require "rake/early_time"
3
4
 
4
5
  module Rake
@@ -13,7 +14,7 @@ module Rake
13
14
  # Is this file task needed? Yes if it doesn't exist, or if its time stamp
14
15
  # is out of date.
15
16
  def needed?
16
- ! File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all
17
+ !File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all
17
18
  end
18
19
 
19
20
  # Time stamp for file task.
@@ -29,7 +30,14 @@ module Rake
29
30
 
30
31
  # Are there any prerequisites with a later time than the given time stamp?
31
32
  def out_of_date?(stamp)
32
- @prerequisites.any? { |n| application[n, @scope].timestamp > stamp }
33
+ all_prerequisite_tasks.any? { |prereq|
34
+ prereq_task = application[prereq, @scope]
35
+ if prereq_task.instance_of?(Rake::FileTask)
36
+ prereq_task.timestamp > stamp || @application.options.build_all
37
+ else
38
+ prereq_task.timestamp > stamp
39
+ end
40
+ }
33
41
  end
34
42
 
35
43
  # ----------------------------------------------------------------
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "rbconfig"
2
3
  require "fileutils"
3
4
 
@@ -34,7 +35,7 @@ module FileUtils
34
35
  #
35
36
  # # check exit status after command runs
36
37
  # sh %{grep pattern file} do |ok, res|
37
- # if ! ok
38
+ # if !ok
38
39
  # puts "pattern not found (status = #{res.exitstatus})"
39
40
  # end
40
41
  # end
@@ -50,7 +51,7 @@ module FileUtils
50
51
  Rake.rake_output_message sh_show_command cmd if verbose
51
52
 
52
53
  unless noop
53
- res = system(*cmd, options)
54
+ res = (Hash === cmd.last) ? system(*cmd) : system(*cmd, options)
54
55
  status = $?
55
56
  status = Rake::PseudoStatus.new(1) if !res && status.nil?
56
57
  shell_runner.call(res, status)
@@ -96,12 +97,11 @@ module FileUtils
96
97
  # Example:
97
98
  # ruby %{-pe '$_.upcase!' <README}
98
99
  #
99
- def ruby(*args, &block)
100
- options = (Hash === args.last) ? args.pop : {}
100
+ def ruby(*args, **options, &block)
101
101
  if args.length > 1
102
- sh(*([RUBY] + args + [options]), &block)
102
+ sh(RUBY, *args, **options, &block)
103
103
  else
104
- sh("#{RUBY} #{args.first}", options, &block)
104
+ sh("#{RUBY} #{args.first}", **options, &block)
105
105
  end
106
106
  end
107
107
 
@@ -109,17 +109,15 @@ module FileUtils
109
109
 
110
110
  # Attempt to do a normal file link, but fall back to a copy if the link
111
111
  # fails.
112
- def safe_ln(*args)
113
- if ! LN_SUPPORTED[0]
114
- cp(*args)
115
- else
112
+ def safe_ln(*args, **options)
113
+ if LN_SUPPORTED[0]
116
114
  begin
117
- ln(*args)
115
+ return options.empty? ? ln(*args) : ln(*args, **options)
118
116
  rescue StandardError, NotImplementedError
119
117
  LN_SUPPORTED[0] = false
120
- cp(*args)
121
118
  end
122
119
  end
120
+ options.empty? ? cp(*args) : cp(*args, **options)
123
121
  end
124
122
 
125
123
  # Split a file path into individual directory names.