rake 12.3.3 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bdd2e72f2f0ed9bd143e9f691203343bc430717dde81d9928807ce267c60d49
4
- data.tar.gz: 77a5a8acd239396ac98ae54b146d70e1c8407d18109010eaa495f4fb15310f6b
3
+ metadata.gz: 9da686fceba23353d1a9b4263d039b67c5e1ac76055165091a21e9c0cddbeffa
4
+ data.tar.gz: 3e650670e2aa77cd440555ac8283f14df42e465e3771c2a5e1da961de2dde444
5
5
  SHA512:
6
- metadata.gz: 3c47fee4f4436744de8cf095683f5298920128a12bd6415c689ca815626bbf36330015bed62e758324ee4762a018294695f6106f9c29883330cea7915787b957
7
- data.tar.gz: 5d9c91f228cb06f6ebbb3b3aaae13664f4d12b04cfdd3413e4c0d1c6083ec5de2c3b89a5bf9e62a9a82105a7411ac2cb2bdb84cb36ca033a4b710d10a5661312
6
+ metadata.gz: 4d555cfe77533730f79bad9d9a430dadd800df2986a32d8885dc078f0c4b481b1c4b9ea99d4a637c662e860ec75a8a74f10a4374d7b00aaf6631f09666b1720b
7
+ data.tar.gz: '03820d6035572fa9f3805f3190672265acd52dcfbc8bf8558351e1f4124031178ba70345647fae34a5770eaf32accb4ea337154f57055efbed2758c8862357f0'
@@ -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/Gemfile CHANGED
@@ -1,3 +1,10 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ group :development do
6
+ gem "bundler"
7
+ gem "minitest"
8
+ gem "coveralls"
9
+ gem "rubocop"
10
+ end
@@ -1,3 +1,18 @@
1
+ === 13.0.0
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
+
1
16
  === 12.3.3
2
17
 
3
18
  ==== Bug fixes
@@ -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
 
@@ -28,10 +28,10 @@ module Rake
28
28
  end
29
29
  end
30
30
 
31
- def cleanup(file_name, opts={})
31
+ def cleanup(file_name, **opts)
32
32
  begin
33
33
  opts = { verbose: Rake.application.options.trace }.merge(opts)
34
- rm_r file_name, opts
34
+ rm_r file_name, **opts
35
35
  rescue StandardError => ex
36
36
  puts "Failed to remove #{file_name}: #{ex}" unless file_already_gone?(file_name)
37
37
  end
@@ -97,12 +97,11 @@ module FileUtils
97
97
  # Example:
98
98
  # ruby %{-pe '$_.upcase!' <README}
99
99
  #
100
- def ruby(*args, &block)
101
- options = (Hash === args.last) ? args.pop : {}
100
+ def ruby(*args, **options, &block)
102
101
  if args.length > 1
103
- sh(*([RUBY] + args + [options]), &block)
102
+ sh(RUBY, *args, **options, &block)
104
103
  else
105
- sh("#{RUBY} #{args.first}", options, &block)
104
+ sh("#{RUBY} #{args.first}", **options, &block)
106
105
  end
107
106
  end
108
107
 
@@ -110,17 +109,15 @@ module FileUtils
110
109
 
111
110
  # Attempt to do a normal file link, but fall back to a copy if the link
112
111
  # fails.
113
- def safe_ln(*args)
114
- if !LN_SUPPORTED[0]
115
- cp(*args)
116
- else
112
+ def safe_ln(*args, **options)
113
+ if LN_SUPPORTED[0]
117
114
  begin
118
- ln(*args)
115
+ return options.empty? ? ln(*args) : ln(*args, **options)
119
116
  rescue StandardError, NotImplementedError
120
117
  LN_SUPPORTED[0] = false
121
- cp(*args)
122
118
  end
123
119
  end
120
+ options.empty? ? cp(*args) : cp(*args, **options)
124
121
  end
125
122
 
126
123
  # Split a file path into individual directory names.
@@ -23,19 +23,18 @@ module Rake
23
23
  opts = FileUtils.options_of name
24
24
  default_options = []
25
25
  if opts.include?("verbose")
26
- default_options << ":verbose => FileUtilsExt.verbose_flag"
26
+ default_options << "verbose: FileUtilsExt.verbose_flag"
27
27
  end
28
28
  if opts.include?("noop")
29
- default_options << ":noop => FileUtilsExt.nowrite_flag"
29
+ default_options << "noop: FileUtilsExt.nowrite_flag"
30
30
  end
31
31
 
32
32
  next if default_options.empty?
33
33
  module_eval(<<-EOS, __FILE__, __LINE__ + 1)
34
- def #{name}( *args, &block )
35
- super(
36
- *rake_merge_option(args,
37
- #{default_options.join(', ')}
38
- ), &block)
34
+ def #{name}(*args, **options, &block)
35
+ super(*args,
36
+ #{default_options.join(', ')},
37
+ **options, &block)
39
38
  end
40
39
  EOS
41
40
  end
@@ -113,16 +112,6 @@ module Rake
113
112
  end
114
113
  end
115
114
 
116
- # Merge the given options with the default values.
117
- def rake_merge_option(args, defaults)
118
- if Hash === args.last
119
- defaults.update(args.last)
120
- args.pop
121
- end
122
- args.push defaults
123
- args
124
- end
125
-
126
115
  # Send the message to the default rake output (which is $stderr).
127
116
  def rake_output_message(message)
128
117
  $stderr.puts(message)
@@ -79,6 +79,9 @@ module Rake
79
79
  # Zip command for zipped archives. The default is 'zip'.
80
80
  attr_accessor :zip_command
81
81
 
82
+ # True if parent directory should be omited (default is false)
83
+ attr_accessor :without_parent_dir
84
+
82
85
  # Create a Package Task with the given name and version. Use +:noversion+
83
86
  # as the version to build a package without a version or to provide a
84
87
  # fully-versioned package name.
@@ -102,6 +105,7 @@ module Rake
102
105
  @need_zip = false
103
106
  @tar_command = "tar"
104
107
  @zip_command = "zip"
108
+ @without_parent_dir = false
105
109
  end
106
110
 
107
111
  # Create the tasks defined by this task library.
@@ -132,7 +136,8 @@ module Rake
132
136
  task package: ["#{package_dir}/#{file}"]
133
137
  file "#{package_dir}/#{file}" =>
134
138
  [package_dir_path] + package_files do
135
- chdir(package_dir) { sh @tar_command, "#{flag}cvf", file, package_name }
139
+ chdir(working_dir) { sh @tar_command, "#{flag}cvf", file, target_dir }
140
+ mv "#{package_dir_path}/#{target_dir}", package_dir if without_parent_dir
136
141
  end
137
142
  end
138
143
  end
@@ -141,7 +146,8 @@ module Rake
141
146
  task package: ["#{package_dir}/#{zip_file}"]
142
147
  file "#{package_dir}/#{zip_file}" =>
143
148
  [package_dir_path] + package_files do
144
- chdir(package_dir) { sh @zip_command, "-r", zip_file, package_name }
149
+ chdir(working_dir) { sh @zip_command, "-r", zip_file, target_dir }
150
+ mv "#{package_dir_path}/#{zip_file}", package_dir if without_parent_dir
145
151
  end
146
152
  end
147
153
 
@@ -202,6 +208,15 @@ module Rake
202
208
  def zip_file
203
209
  "#{package_name}.zip"
204
210
  end
211
+
212
+ def working_dir
213
+ without_parent_dir ? package_dir_path : package_dir
214
+ end
215
+
216
+ # target directory relative to working_dir
217
+ def target_dir
218
+ without_parent_dir ? "." : package_name
219
+ end
205
220
  end
206
221
 
207
222
  end
@@ -17,6 +17,9 @@ module Rake
17
17
  attr_reader :prerequisites
18
18
  alias prereqs prerequisites
19
19
 
20
+ # List of order only prerequisites for a task.
21
+ attr_reader :order_only_prerequisites
22
+
20
23
  # List of actions attached to a task.
21
24
  attr_reader :actions
22
25
 
@@ -56,7 +59,7 @@ module Rake
56
59
 
57
60
  # List of prerequisite tasks
58
61
  def prerequisite_tasks
59
- prerequisites.map { |pre| lookup_prerequisite(pre) }
62
+ (prerequisites + order_only_prerequisites).map { |pre| lookup_prerequisite(pre) }
60
63
  end
61
64
 
62
65
  def lookup_prerequisite(prerequisite_name) # :nodoc:
@@ -105,6 +108,7 @@ module Rake
105
108
  @arg_names = nil
106
109
  @locations = []
107
110
  @invocation_exception = nil
111
+ @order_only_prerequisites = []
108
112
  end
109
113
 
110
114
  # Enhance a task with prerequisites or actions. Returns self.
@@ -270,7 +274,11 @@ module Rake
270
274
  end
271
275
  application.trace "** Execute #{name}" if application.options.trace
272
276
  application.enhance_with_matching_rule(name) if @actions.empty?
273
- @actions.each { |act| act.call(self, args) }
277
+ if opts = Hash.try_convert(args) and !opts.empty?
278
+ @actions.each { |act| act.call(self, args, **opts)}
279
+ else
280
+ @actions.each { |act| act.call(self, args)}
281
+ end
274
282
  end
275
283
 
276
284
  # Is this task needed?
@@ -360,6 +368,18 @@ module Rake
360
368
  return result
361
369
  end
362
370
 
371
+ # Format dependencies parameter to pass to task.
372
+ def self.format_deps(deps)
373
+ deps = [deps] unless deps.respond_to?(:to_ary)
374
+ deps.map { |d| Rake.from_pathname(d).to_s }
375
+ end
376
+
377
+ # Add order only dependencies.
378
+ def |(deps)
379
+ @order_only_prerequisites |= Task.format_deps(deps) - @prerequisites
380
+ self
381
+ end
382
+
363
383
  # ----------------------------------------------------------------
364
384
  # Rake Module Methods
365
385
  #
@@ -15,13 +15,13 @@ module Rake
15
15
  end
16
16
 
17
17
  def create_rule(*args, &block) # :nodoc:
18
- pattern, args, deps = resolve_args(args)
18
+ pattern, args, deps, order_only = resolve_args(args)
19
19
  pattern = Regexp.new(Regexp.quote(pattern) + "$") if String === pattern
20
- @rules << [pattern, args, deps, block]
20
+ @rules << [pattern, args, deps, order_only, block]
21
21
  end
22
22
 
23
23
  def define_task(task_class, *args, &block) # :nodoc:
24
- task_name, arg_names, deps = resolve_args(args)
24
+ task_name, arg_names, deps, order_only = resolve_args(args)
25
25
 
26
26
  original_scope = @scope
27
27
  if String === task_name and
@@ -31,15 +31,15 @@ module Rake
31
31
  end
32
32
 
33
33
  task_name = task_class.scope_name(@scope, task_name)
34
- deps = [deps] unless deps.respond_to?(:to_ary)
35
- deps = deps.map { |d| Rake.from_pathname(d).to_s }
36
34
  task = intern(task_class, task_name)
37
35
  task.set_arg_names(arg_names) unless arg_names.empty?
38
36
  if Rake::TaskManager.record_task_metadata
39
37
  add_location(task)
40
38
  task.add_description(get_description(task))
41
39
  end
42
- task.enhance(deps, &block)
40
+ task.enhance(Task.format_deps(deps), &block)
41
+ task | order_only unless order_only.nil?
42
+ task
43
43
  ensure
44
44
  @scope = original_scope
45
45
  end
@@ -109,7 +109,7 @@ module Rake
109
109
  else
110
110
  arg_names = args
111
111
  end
112
- [task_name, arg_names, []]
112
+ [task_name, arg_names, [], nil]
113
113
  end
114
114
  private :resolve_args_without_dependencies
115
115
 
@@ -122,7 +122,10 @@ module Rake
122
122
  # task :t, [a] => [:d]
123
123
  #
124
124
  def resolve_args_with_dependencies(args, hash) # :nodoc:
125
- fail "Task Argument Error" if hash.size != 1
125
+ fail "Task Argument Error" if
126
+ hash.size != 1 &&
127
+ (hash.size != 2 || !hash.key?(:order_only))
128
+ order_only = hash.delete(:order_only)
126
129
  key, value = hash.map { |k, v| [k, v] }.first
127
130
  if args.empty?
128
131
  task_name = key
@@ -134,7 +137,7 @@ module Rake
134
137
  deps = value
135
138
  end
136
139
  deps = [deps] unless deps.respond_to?(:to_ary)
137
- [task_name, arg_names, deps]
140
+ [task_name, arg_names, deps, order_only]
138
141
  end
139
142
  private :resolve_args_with_dependencies
140
143
 
@@ -145,9 +148,10 @@ module Rake
145
148
  def enhance_with_matching_rule(task_name, level=0)
146
149
  fail Rake::RuleRecursionOverflowError,
147
150
  "Rule Recursion Too Deep" if level >= 16
148
- @rules.each do |pattern, args, extensions, block|
151
+ @rules.each do |pattern, args, extensions, order_only, block|
149
152
  if pattern && pattern.match(task_name)
150
153
  task = attempt_rule(task_name, pattern, args, extensions, block, level)
154
+ task | order_only unless order_only.nil?
151
155
  return task if task
152
156
  end
153
157
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Rake
3
- VERSION = "12.3.3"
3
+ VERSION = "13.0.0"
4
4
 
5
5
  module Version # :nodoc: all
6
6
  MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split "."
@@ -29,14 +29,8 @@ Rake has the following features:
29
29
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  s.require_paths = ["lib".freeze]
31
31
 
32
- s.required_ruby_version = Gem::Requirement.new(">= 2.0.0".freeze)
32
+ s.required_ruby_version = Gem::Requirement.new(">= 2.2".freeze)
33
33
  s.rubygems_version = "2.6.1".freeze
34
34
  s.required_rubygems_version = Gem::Requirement.new(">= 1.3.2".freeze)
35
35
  s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
36
-
37
- s.add_development_dependency(%q<bundler>.freeze)
38
- s.add_development_dependency(%q<minitest>.freeze)
39
- s.add_development_dependency(%q<rdoc>.freeze)
40
- s.add_development_dependency(%q<coveralls>.freeze)
41
- s.add_development_dependency(%q<rubocop>.freeze)
42
36
  end
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.3
4
+ version: 13.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi SHIBATA
@@ -10,78 +10,8 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-07-22 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: bundler
17
- requirement: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ">="
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- version: '0'
29
- - !ruby/object:Gem::Dependency
30
- name: minitest
31
- requirement: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: '0'
36
- type: :development
37
- prerelease: false
38
- version_requirements: !ruby/object:Gem::Requirement
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: '0'
43
- - !ruby/object:Gem::Dependency
44
- name: rdoc
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: '0'
57
- - !ruby/object:Gem::Dependency
58
- name: coveralls
59
- requirement: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- type: :development
65
- prerelease: false
66
- version_requirements: !ruby/object:Gem::Requirement
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- - !ruby/object:Gem::Dependency
72
- name: rubocop
73
- requirement: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- type: :development
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: '0'
13
+ date: 2019-09-27 00:00:00.000000000 Z
14
+ dependencies: []
85
15
  description: |
86
16
  Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
87
17
  specified in standard Ruby syntax.
@@ -101,13 +31,16 @@ executables:
101
31
  extensions: []
102
32
  extra_rdoc_files: []
103
33
  files:
34
+ - ".github/workflows/macos.yml"
35
+ - ".github/workflows/ubuntu-rvm.yml"
36
+ - ".github/workflows/ubuntu.yml"
37
+ - ".github/workflows/windows.yml"
104
38
  - CONTRIBUTING.rdoc
105
39
  - Gemfile
106
40
  - History.rdoc
107
41
  - MIT-LICENSE
108
42
  - README.rdoc
109
43
  - Rakefile
110
- - azure-pipelines.yml
111
44
  - bin/bundle
112
45
  - bin/console
113
46
  - bin/rake
@@ -185,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
118
  requirements:
186
119
  - - ">="
187
120
  - !ruby/object:Gem::Version
188
- version: 2.0.0
121
+ version: '2.2'
189
122
  required_rubygems_version: !ruby/object:Gem::Requirement
190
123
  requirements:
191
124
  - - ">="
@@ -1,11 +0,0 @@
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'