[前][次][番号順一覧][スレッド一覧]

ruby-changes:62225

From: Utkarsh <ko1@a...>
Date: Wed, 15 Jul 2020 16:05:41 +0900 (JST)
Subject: [ruby-changes:62225] b28c6d04d0 (master): [rubygems/rubygems] Make Style/HashSyntax cop happy

https://git.ruby-lang.org/ruby.git/commit/?id=b28c6d04d0

From b28c6d04d0989fa01842435f617e96420a8b4743 Mon Sep 17 00:00:00 2001
From: Utkarsh Gupta <utkarsh@d...>
Date: Sun, 21 Jun 2020 01:42:34 +0530
Subject: [rubygems/rubygems] Make Style/HashSyntax cop happy

Previously, we were using the old syntax like:
`task :default => :spec`, but now this commit
uses the new Ruby 1.9 hash syntax.

Signed-off-by: Utkarsh Gupta <utkarsh@d...>

https://github.com/rubygems/rubygems/commit/b41d0fdb56

diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt
index 46bb01c..57222f8c 100644
--- a/lib/bundler/templates/newgem/Rakefile.tt
+++ b/lib/bundler/templates/newgem/Rakefile.tt
@@ -36,4 +36,4 @@ Rake::ExtensionTask.new("<%= config[:underscored_name] %>") do |ext| https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/newgem/Rakefile.tt#L36
 end
 
 <% end -%>
-task :default => <%= default_task_names.size == 1 ? default_task_names.first.inspect : default_task_names.inspect %>
+task default: <%= default_task_names.size == 1 ? default_task_names.first.inspect : default_task_names.inspect %>
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 91e33bd..f0f55ae 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -155,9 +155,10 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L155
     it "generates a gem skeleton with rubocop" do
       gem_skeleton_assertions
       expect(bundled_app("test-gem/Rakefile")).to read_as(
-        include('require "rubocop/rake_task"').
+        include('# frozen_string_literal: true').
+        and(include('require "rubocop/rake_task"').
         and(include("RuboCop::RakeTask.new").
-        and(match(/:default.+:rubocop/)))
+        and(match(/default:.+:rubocop/))))
       )
     end
 
@@ -182,7 +183,6 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L183
       realworld_system_gems gems, :path => path
       bundle "install", :dir => bundled_app("#{gem_name}")
       bundle "exec rubocop", :dir => bundled_app("#{gem_name}")
-
       expect($?.exitstatus).to eq(0) if exitstatus
     end
   end
@@ -555,7 +555,7 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L555
             t.test_files = FileList["test/**/*_test.rb"]
           end
 
-          task :default => :test
+          task default: :test
         RAKEFILE
 
         expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
@@ -613,7 +613,7 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L613
             t.test_files = FileList["test/**/*_test.rb"]
           end
 
-          task :default => :test
+          task default: :test
         RAKEFILE
 
         expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
@@ -914,7 +914,7 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L914
             ext.lib_dir = "lib/#{gem_name}"
           end
 
-          task :default => [:clobber, :compile]
+          task default: [:clobber, :compile]
         RAKEFILE
 
         expect(bundled_app("#{gem_name}/Rakefile").read).to eq(rakefile)
@@ -1010,7 +1010,7 @@ Usage: "bundle gem NAME [OPTIONS]" https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L1010
 
         RSpec::Core::RakeTask.new(:spec)
 
-        task :default => :spec
+        task default: :spec
       RAKEFILE
 
       expect(bundled_app("foobar/Rakefile").read).to eq(rakefile)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]