Skip to content

Commit

Permalink
Merge pull request #5731 from tnir/tnir-rubygems-Style/StringLiterals
Browse files Browse the repository at this point in the history
RubyGems: Enable Style/StringLiterals cop
  • Loading branch information
deivid-rodriguez committed Jul 20, 2022
2 parents 16db218 + dca5fa7 commit 74da4df
Show file tree
Hide file tree
Showing 298 changed files with 7,445 additions and 7,442 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Expand Up @@ -163,6 +163,9 @@ Style/BlockDelimiters:
Style/PercentLiteralDelimiters:
Enabled: true

Style/StringLiterals:
EnforcedStyle: double_quotes

# Having these make it easier to *not* forget to add one when adding a new
# value and you can simply copy the previous line.
Style/TrailingCommaInArrayLiteral:
Expand Down
156 changes: 78 additions & 78 deletions Rakefile
@@ -1,7 +1,7 @@
RakeFileUtils.verbose_flag = false

require 'rubygems'
require 'rubygems/package_task'
require "rubygems"
require "rubygems/package_task"
require "rake/testtask"

desc "Setup Rubygems dev environment"
Expand Down Expand Up @@ -55,32 +55,32 @@ end

Rake::TestTask.new do |t|
t.ruby_opts = %w[-w]
t.ruby_opts << '-rdevkit' if RbConfig::CONFIG['host_os'].include?('mingw')
t.ruby_opts << "-rdevkit" if RbConfig::CONFIG["host_os"].include?("mingw")

t.libs << "test"
t.libs << "bundler/lib"

t.test_files = FileList['test/**/test_*.rb']
t.test_files = FileList["test/**/test_*.rb"]
end

namespace 'test' do
desc 'Run each test isolatedly by specifying the relative test file path'
task 'isolated' do
FileList['test/**/test_*.rb'].each do |file|
sh Gem.ruby, '-Ilib:test:bundler/lib', file
namespace "test" do
desc "Run each test isolatedly by specifying the relative test file path"
task "isolated" do
FileList["test/**/test_*.rb"].each do |file|
sh Gem.ruby, "-Ilib:test:bundler/lib", file
end
end
end

task :default => :test

spec = Gem::Specification.load('rubygems-update.gemspec')
spec = Gem::Specification.load("rubygems-update.gemspec")
v = spec.version

require 'rdoc/task'
require "rdoc/task"

RDoc::Task.new :rdoc => 'docs', :clobber_rdoc => 'clobber_docs' do |doc|
doc.main = 'README.md'
RDoc::Task.new :rdoc => "docs", :clobber_rdoc => "clobber_docs" do |doc|
doc.main = "README.md"
doc.title = "RubyGems #{v} API Documentation"

rdoc_files = Rake::FileList.new %w[lib bundler/lib]
Expand All @@ -91,7 +91,7 @@ RDoc::Task.new :rdoc => 'docs', :clobber_rdoc => 'clobber_docs' do |doc|

doc.rdoc_files = rdoc_files

doc.rdoc_dir = 'doc'
doc.rdoc_dir = "doc"
end

# No big deal if Automatiek is not available. This might be just because
Expand Down Expand Up @@ -218,12 +218,12 @@ Gem::PackageTask.new(spec) {}
Rake::Task["package"].enhance ["pkg/rubygems-#{v}.tgz", "pkg/rubygems-#{v}.zip"]

file "pkg/rubygems-#{v}" => "pkg/rubygems-update-#{v}" do |t|
require 'find'
require "find"

dest_root = File.expand_path t.name

cd t.source do
Find.find '.' do |file|
Find.find "." do |file|
dest = File.expand_path file, dest_root

if File.directory? file
Expand All @@ -237,7 +237,7 @@ file "pkg/rubygems-#{v}" => "pkg/rubygems-update-#{v}" do |t|
end

file "pkg/rubygems-#{v}.zip" => "pkg/rubygems-#{v}" do
cd 'pkg' do
cd "pkg" do
if Gem.win_platform?
sh "7z a rubygems-#{v}.zip rubygems-#{v}"
else
Expand All @@ -247,8 +247,8 @@ file "pkg/rubygems-#{v}.zip" => "pkg/rubygems-#{v}" do
end

file "pkg/rubygems-#{v}.tgz" => "pkg/rubygems-#{v}" do
cd 'pkg' do
if Gem.win_platform? && RUBY_VERSION < '2.4'
cd "pkg" do
if Gem.win_platform? && RUBY_VERSION < "2.4"
sh "7z a -ttar rubygems-#{v}.tar rubygems-#{v}"
sh "7z a -tgzip rubygems-#{v}.tgz rubygems-#{v}.tar"
else
Expand All @@ -275,80 +275,80 @@ desc "Upload release to S3"
task :upload_to_s3 do
require "aws-sdk-s3"

s3 = Aws::S3::Resource.new(region:'us-west-2')
s3 = Aws::S3::Resource.new(region:"us-west-2")
%w[zip tgz].each do |ext|
obj = s3.bucket('oregon.production.s3.rubygems.org').object("rubygems/rubygems-#{v}.#{ext}")
obj.upload_file("pkg/rubygems-#{v}.#{ext}", acl: 'public-read')
obj = s3.bucket("oregon.production.s3.rubygems.org").object("rubygems/rubygems-#{v}.#{ext}")
obj.upload_file("pkg/rubygems-#{v}.#{ext}", acl: "public-read")
end
end

desc "Upload release to rubygems.org"
task :upload => %w[upload_to_github upload_to_s3]

directory '../guides.rubygems.org' do
sh 'git', 'clone',
'https://github.com/rubygems/guides.git',
'../guides.rubygems.org'
directory "../guides.rubygems.org" do
sh "git", "clone",
"https://github.com/rubygems/guides.git",
"../guides.rubygems.org"
end

namespace 'guides' do
task 'pull' => %w[../guides.rubygems.org] do
chdir '../guides.rubygems.org' do
sh 'git', 'pull'
namespace "guides" do
task "pull" => %w[../guides.rubygems.org] do
chdir "../guides.rubygems.org" do
sh "git", "pull"
end
end

task 'update' => %w[../guides.rubygems.org] do
lib_dir = File.join Dir.pwd, 'lib'
task "update" => %w[../guides.rubygems.org] do
lib_dir = File.join Dir.pwd, "lib"

chdir '../guides.rubygems.org' do
ruby '-I', lib_dir, '-S', 'rake', 'command_guide'
ruby '-I', lib_dir, '-S', 'rake', 'spec_guide'
chdir "../guides.rubygems.org" do
ruby "-I", lib_dir, "-S", "rake", "command_guide"
ruby "-I", lib_dir, "-S", "rake", "spec_guide"
end
end

task 'commit' => %w[../guides.rubygems.org] do
chdir '../guides.rubygems.org' do
task "commit" => %w[../guides.rubygems.org] do
chdir "../guides.rubygems.org" do
begin
sh 'git', 'diff', '--quiet'
sh "git", "diff", "--quiet"
rescue
sh 'git', 'commit', 'command-reference.md', 'specification-reference.md',
'-m', "Rebuild for RubyGems #{v}"
sh "git", "commit", "command-reference.md", "specification-reference.md",
"-m", "Rebuild for RubyGems #{v}"
end
end
end

task 'push' => %w[../guides.rubygems.org] do
chdir '../guides.rubygems.org' do
sh 'git', 'push'
task "push" => %w[../guides.rubygems.org] do
chdir "../guides.rubygems.org" do
sh "git", "push"
end
end

desc 'Updates and publishes the guides for the just-released RubyGems'
task 'publish'
desc "Updates and publishes the guides for the just-released RubyGems"
task "publish"

task 'publish' => %w[
task "publish" => %w[
guides:pull
guides:update
guides:commit
guides:push
]
end

directory '../blog.rubygems.org' do
sh 'git', 'clone',
'https://github.com/rubygems/rubygems.github.io.git',
'../blog.rubygems.org'
directory "../blog.rubygems.org" do
sh "git", "clone",
"https://github.com/rubygems/rubygems.github.io.git",
"../blog.rubygems.org"
end

namespace 'blog' do
date = Time.now.strftime '%Y-%m-%d'
namespace "blog" do
date = Time.now.strftime "%Y-%m-%d"
post_page = "_posts/#{date}-#{v}-released.md"
checksums = ''
checksums = ""

task 'checksums' => 'package' do
require 'net/http'
Dir['pkg/*{tgz,zip,gem}'].each do |file|
task "checksums" => "package" do
require "net/http"
Dir["pkg/*{tgz,zip,gem}"].each do |file|
digest = OpenSSL::Digest::SHA256.file(file).hexdigest
basename = File.basename(file)

Expand All @@ -372,26 +372,26 @@ namespace 'blog' do
end
end

task 'pull' => %w[../blog.rubygems.org] do
chdir '../blog.rubygems.org' do
sh 'git', 'pull'
task "pull" => %w[../blog.rubygems.org] do
chdir "../blog.rubygems.org" do
sh "git", "pull"
end
end

path = File.join '../blog.rubygems.org', post_page
path = File.join "../blog.rubygems.org", post_page

task 'update' => [path]
task "update" => [path]

file path => 'checksums' do
file path => "checksums" do
name = `git config --get user.name`.strip
email = `git config --get user.email`.strip

require_relative "util/changelog"
history = Changelog.for_rubygems(v.to_s)

require 'tempfile'
require "tempfile"

Tempfile.open 'blog_post' do |io|
Tempfile.open "blog_post" do |io|
io.write <<-ANNOUNCEMENT
---
title: #{v} Released
Expand Down Expand Up @@ -420,28 +420,28 @@ SHA256 Checksums:

io.flush

sh(ENV['EDITOR'] || 'vim', io.path)
sh(ENV["EDITOR"] || "vim", io.path)

FileUtils.cp io.path, path
end
end

task 'commit' => %w[../blog.rubygems.org] do
chdir '../blog.rubygems.org' do
sh 'git', 'add', post_page
sh 'git', 'commit', post_page,
'-m', "Added #{v} release announcement"
task "commit" => %w[../blog.rubygems.org] do
chdir "../blog.rubygems.org" do
sh "git", "add", post_page
sh "git", "commit", post_page,
"-m", "Added #{v} release announcement"
end
end

task 'push' => %w[../blog.rubygems.org] do
chdir '../blog.rubygems.org' do
sh 'git', 'push'
task "push" => %w[../blog.rubygems.org] do
chdir "../blog.rubygems.org" do
sh "git", "push"
end
end

desc 'Updates and publishes the blog for the just-released RubyGems'
task 'publish' => %w[
desc "Updates and publishes the blog for the just-released RubyGems"
task "publish" => %w[
blog:pull
blog:update
blog:commit
Expand Down Expand Up @@ -471,7 +471,7 @@ end

desc "Update the manifest to reflect what's on disk"
task :update_manifest do
File.open('Manifest.txt', 'w') {|f| f.puts(Rubygems::ProjectFiles.all) }
File.open("Manifest.txt", "w") {|f| f.puts(Rubygems::ProjectFiles.all) }
end

desc "Check the manifest is up to date"
Expand All @@ -488,12 +488,12 @@ end

namespace :bundler do
task :build_metadata do
chdir('bundler') { sh "rake build_metadata" }
chdir("bundler") { sh "rake build_metadata" }
end

namespace :build_metadata do
task :clean do
chdir('bundler') { sh "rake build_metadata:clean" }
chdir("bundler") { sh "rake build_metadata:clean" }
end
end
end
4 changes: 2 additions & 2 deletions bin/gem
Expand Up @@ -5,8 +5,8 @@
# See LICENSE.txt for permissions.
#++

require 'rubygems'
require 'rubygems/gem_runner'
require "rubygems"
require "rubygems/gem_runner"

args = ARGV.clone

Expand Down
8 changes: 4 additions & 4 deletions bin/update_rubygems
Expand Up @@ -5,9 +5,9 @@
# See LICENSE.txt for permissions.
#++

require 'rubygems'
require "rubygems"

if ARGV.include? '-h' or ARGV.include? '--help'
if ARGV.include? "-h" or ARGV.include? "--help"
$stderr.puts "rubygems_update [options]"
$stderr.puts
$stderr.puts "This will install the latest version of RubyGems."
Expand All @@ -17,7 +17,7 @@ if ARGV.include? '-h' or ARGV.include? '--help'
end

unless ARGV.grep(/--version=([\d\.]*)/).empty?
exec Gem.ruby, '-S', $PROGRAM_NAME, "_#{$1}_"
exec Gem.ruby, "-S", $PROGRAM_NAME, "_#{$1}_"
end

update_dir = $LOAD_PATH.find {|dir| dir =~ /rubygems-update/ }
Expand All @@ -32,5 +32,5 @@ else
update_dir = File.dirname(update_dir)
Dir.chdir update_dir
ENV["GEM_PREV_VER"] = Gem::VERSION
abort unless system(Gem.ruby, 'setup.rb', *ARGV)
abort unless system(Gem.ruby, "setup.rb", *ARGV)
end

0 comments on commit 74da4df

Please sign in to comment.