From 714a18093b38661508737a6849fc7168f28829a1 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Mon, 20 Aug 2018 14:50:48 +0200 Subject: [PATCH 1/8] Fixed bug: Task raises previous exception on second invokation after beeing reenable-d. --- lib/rake/task.rb | 3 ++- test/test_rake_task.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/rake/task.rb b/lib/rake/task.rb index c56118f01..5f5254c84 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -141,7 +141,8 @@ def arg_names # Reenable the task, allowing its tasks to be executed if the task # is invoked again. def reenable - @already_invoked = false + @already_invoked = false + @invocation_exception = nil end # Clear the existing prerequisites, actions, comments, and arguments of a rake task. diff --git a/test/test_rake_task.rb b/test/test_rake_task.rb index 380f59b4f..dca594329 100644 --- a/test/test_rake_task.rb +++ b/test/test_rake_task.rb @@ -117,6 +117,33 @@ def test_can_double_invoke_with_reenable assert_equal ["t1", "t1"], runlist end + def test_can_triple_invoke_after_exception_with_reenable + raise_exception = true + invoked = 0 + + t1 = task(:t1) do |t| + invoked += 1 + next if !raise_exception + + raise_exception = false + raise 'Some error' + end + + assert_raises(RuntimeError) { t1.invoke } + assert_equal 1, invoked + + t1.reenable + + # actually invoke second time + t1.invoke + assert_equal 2, invoked + + # recognize already invoked and + # don't raise pre-reenable exception + t1.invoke + assert_equal 2, invoked + end + def test_clear desc "a task" t = task("t", ["b"] => "a") {} From 282b0d31586c7b723f6ba7d5103f874adec1bdb9 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 22 Aug 2018 09:04:08 +0200 Subject: [PATCH 2/8] Applied requested changes of @yuki24: Chose clean git blame over nice looking indentaiton. --- lib/rake/task.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rake/task.rb b/lib/rake/task.rb index 5f5254c84..2255b5c43 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -141,7 +141,7 @@ def arg_names # Reenable the task, allowing its tasks to be executed if the task # is invoked again. def reenable - @already_invoked = false + @already_invoked = false @invocation_exception = nil end From 00aacdcf70309a17de2580fb380ed29f2d0fb6f7 Mon Sep 17 00:00:00 2001 From: Matthew Bellantoni Date: Fri, 27 Sep 2019 16:18:12 -0400 Subject: [PATCH 3/8] Fix an incorrectly resolved arg pattern --- lib/rake/task_manager.rb | 4 ++-- test/test_rake_task_manager_argument_resolution.rb | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb index 1d3cb1cfa..6da31f97f 100644 --- a/lib/rake/task_manager.rb +++ b/lib/rake/task_manager.rb @@ -133,8 +133,8 @@ def resolve_args_with_dependencies(args, hash) # :nodoc: deps = value || [] else task_name = args.shift - arg_names = key - deps = value + arg_names = key || args.shift|| [] + deps = value || [] end deps = [deps] unless deps.respond_to?(:to_ary) [task_name, arg_names, deps, order_only] diff --git a/test/test_rake_task_manager_argument_resolution.rb b/test/test_rake_task_manager_argument_resolution.rb index 6539343ac..21e28a951 100644 --- a/test/test_rake_task_manager_argument_resolution.rb +++ b/test/test_rake_task_manager_argument_resolution.rb @@ -8,9 +8,16 @@ def test_good_arg_patterns assert_equal [:t, [], [:x], nil], task(t: :x) assert_equal [:t, [], [:x, :y], nil], task(t: [:x, :y]) + assert_equal [:t, [], [], [:m]], task(:t, order_only: [:m]) + assert_equal [:t, [], [:x, :y], [:m, :n]], task(t: [:x, :y], order_only: [:m, :n]) + assert_equal [:t, [:a, :b], [], nil], task(:t, [:a, :b]) assert_equal [:t, [:a, :b], [:x], nil], task(:t, [:a, :b] => :x) assert_equal [:t, [:a, :b], [:x, :y], nil], task(:t, [:a, :b] => [:x, :y]) + + assert_equal [:t, [:a, :b], [], [:m]], task(:t, [:a, :b], order_only: [:m]) + assert_equal [:t, [:a, :b], [:x], [:m]], task(:t, [:a, :b] => :x, order_only: [:m]) + assert_equal [:t, [:a, :b], [:x, :y], [:m, :n]], task(:t, [:a, :b] => [:x, :y], order_only: [:m, :n]) end def task(*args) From 46a8f7cbd4072431eb16e8e0858d556797ce677e Mon Sep 17 00:00:00 2001 From: Matthew Bellantoni Date: Fri, 27 Sep 2019 16:23:58 -0400 Subject: [PATCH 4/8] Update comments to reflect the current state --- lib/rake/task_manager.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb index 6da31f97f..97e3b9459 100644 --- a/lib/rake/task_manager.rb +++ b/lib/rake/task_manager.rb @@ -83,8 +83,8 @@ def synthesize_file_task(task_name) # :nodoc: define_task(Rake::FileTask, task_name) end - # Resolve the arguments for a task/rule. Returns a triplet of - # [task_name, arg_name_list, prerequisites]. + # Resolve the arguments for a task/rule. Returns a tuple of + # [task_name, arg_name_list, prerequisites, order_only_prerequisites]. def resolve_args(args) if args.last.is_a?(Hash) deps = args.pop @@ -118,8 +118,11 @@ def resolve_args_without_dependencies(args) # # The patterns recognized by this argument resolving function are: # + # task :t, order_only: [:e] # task :t => [:d] + # task :t => [:d], order_only: [:e] # task :t, [a] => [:d] + # task :t, [a] => [:d], order_only: [:e] # def resolve_args_with_dependencies(args, hash) # :nodoc: fail "Task Argument Error" if From c3953d4b2935895e1bb4596c435653d3a865711a Mon Sep 17 00:00:00 2001 From: Orien Madgwick <_@orien.io> Date: Wed, 2 Oct 2019 23:06:46 +1000 Subject: [PATCH 5/8] Add project metadata to the gemspec As per https://guides.rubygems.org/specification-reference/#metadata, add metadata to the gemspec file. This'll allow people to more easily access the source code, raise issues and read the changelog. These `bug_tracker_uri`, `changelog_uri`, `documentation_uri`, and `source_code_uri` links will appear on the rubygems page at https://rubygems.org/gems/rake and be available via the Rubygems API after the next release. --- rake.gemspec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rake.gemspec b/rake.gemspec index 20591cb36..ecdec7299 100644 --- a/rake.gemspec +++ b/rake.gemspec @@ -23,6 +23,13 @@ Rake has the following features: s.homepage = "https://github.com/ruby/rake".freeze s.licenses = ["MIT".freeze] + s.metadata = { + "bug_tracker_uri" => "https://github.com/ruby/rake/issues", + "changelog_uri" => "https://github.com/ruby/rake/blob/v#{s.version}/History.rdoc", + "documentation_uri" => "https://ruby.github.io/rake", + "source_code_uri" => "https://github.com/ruby/rake/tree/v#{s.version}", + } + s.files = %x[git ls-files -z].split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - %w[.rubocop.yml .gitignore .travis.yml appveyor.yml] s.bindir = "exe" From 4dc6282eb24c0117a012d07744ea1bbcae1b3a79 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 4 Oct 2019 09:06:44 -0700 Subject: [PATCH 6/8] Skip a taint test on Ruby 2.7 Ruby 2.7 is deprecating taint, and taint will no longer have an effect. See https://bugs.ruby-lang.org/issues/16131. This just skips the test for FileList#clone and #dup copying the taint flag on Ruby 2.7+. --- test/test_rake_file_list.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/test_rake_file_list.rb b/test/test_rake_file_list.rb index 853ebc8d9..eda55d29f 100644 --- a/test/test_rake_file_list.rb +++ b/test/test_rake_file_list.rb @@ -496,13 +496,15 @@ def test_clone_and_dup assert_equal ["a", "b", "c"], d end - def test_dup_and_clone_replicate_taint - a = FileList["a", "b", "c"] - a.taint - c = a.clone - d = a.dup - assert c.tainted?, "Clone should be tainted" - assert d.tainted?, "Dup should be tainted" + if RUBY_VERSION < '2.7' + def test_dup_and_clone_replicate_taint + a = FileList["a", "b", "c"] + a.taint + c = a.clone + d = a.dup + assert c.tainted?, "Clone should be tainted" + assert d.tainted?, "Dup should be tainted" + end end def test_duped_items_will_thaw From 8edd860cd0fc9035bda472ef45110a40889b9627 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 12 Nov 2019 12:27:50 +0900 Subject: [PATCH 7/8] Fixed build failure of the latest GitHub Actions --- .github/workflows/macos.yml | 4 ++-- .github/workflows/ubuntu-rvm.yml | 2 +- .github/workflows/ubuntu.yml | 4 ++-- .github/workflows/windows.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 1c52cc0c3..2dbc56a36 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -7,13 +7,13 @@ jobs: runs-on: macos-latest strategy: matrix: - ruby: [ '2.6.x', '2.5.x', '2.4.x', '2.3.x' ] + ruby: [ '2.6.x', '2.5.x', '2.4.x' ] steps: - uses: actions/checkout@master - name: Set up Ruby uses: actions/setup-ruby@v1 with: - version: ${{ matrix.ruby }} + ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: gem install minitest - name: Run test diff --git a/.github/workflows/ubuntu-rvm.yml b/.github/workflows/ubuntu-rvm.yml index 5b5cf8391..cf3d1d05b 100644 --- a/.github/workflows/ubuntu-rvm.yml +++ b/.github/workflows/ubuntu-rvm.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: [ 'jruby-head', 'jruby-9.2.8.0', 'ruby-head', '2.2.10' ] + ruby: [ 'jruby-head', 'jruby-9.2.9.0', 'ruby-head', '2.3.8', '2.2.10' ] steps: - uses: actions/checkout@master - name: Set up RVM diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index e42be3dda..b67130ad8 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: [ '2.6.x', '2.5.x', '2.4.x', '2.3.x' ] + ruby: [ '2.6.x', '2.5.x', '2.4.x' ] steps: - uses: actions/checkout@master - name: Set up Ruby uses: actions/setup-ruby@v1 with: - version: ${{ matrix.ruby }} + ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: gem install minitest - name: Run test diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6fea96fb7..5ced11c45 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Ruby uses: actions/setup-ruby@v1 with: - version: ${{ matrix.ruby }} + ruby-version: ${{ matrix.ruby }} - name: Install dependencies run: gem install minitest - name: Run test From c8251e2299616d8126e4ac7426e0bb87df7e6922 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Tue, 12 Nov 2019 12:28:15 +0900 Subject: [PATCH 8/8] Bump version to 13.0.1 --- History.rdoc | 9 +++++++++ lib/rake/version.rb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/History.rdoc b/History.rdoc index 3d0b53d1d..119747c66 100644 --- a/History.rdoc +++ b/History.rdoc @@ -1,3 +1,12 @@ +=== 13.0.1 + +==== Bug fixes + +* Fixed bug: Reenabled task raises previous exception on second invokation + Pull Request #271 by thorsteneckel +* Fix an incorrectly resolved arg pattern + Pull Request #327 by mjbellantoni + === 13.0.0 ==== Enhancements diff --git a/lib/rake/version.rb b/lib/rake/version.rb index 7f47740c1..b5486ba79 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true module Rake - VERSION = "13.0.0" + VERSION = "13.0.1" module Version # :nodoc: all MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split "."