Skip to content

Commit

Permalink
Support running with frozen string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Jan 31, 2016
1 parent 20e09cf commit 45966be
Show file tree
Hide file tree
Showing 308 changed files with 342 additions and 40 deletions.
1 change: 1 addition & 0 deletions lib/gauntlet_rubygems.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems'
require 'gauntlet'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/available_set.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Gem::AvailableSet

include Enumerable
Expand Down
8 changes: 4 additions & 4 deletions lib/rubygems/basic_specification.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# BasicSpecification is an abstract class which implements some common code
# used by both Specification and StubSpecification.
Expand Down Expand Up @@ -124,9 +125,9 @@ def full_gem_path

def full_name
if platform == Gem::Platform::RUBY or platform.nil? then
"#{name}-#{version}".untaint
"#{name}-#{version}".dup.untaint
else
"#{name}-#{version}-#{platform}".untaint
"#{name}-#{version}-#{platform}".dup.untaint
end
end

Expand Down Expand Up @@ -281,7 +282,7 @@ def lib_dirs_glob
self.require_paths.first
end

"#{self.full_gem_path}/#{dirs}".untaint
"#{self.full_gem_path}/#{dirs}".dup.untaint
end

##
Expand Down Expand Up @@ -325,4 +326,3 @@ def have_file? file, suffixes
end

end

4 changes: 2 additions & 2 deletions lib/rubygems/command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down Expand Up @@ -153,7 +154,7 @@ def execute

def show_lookup_failure(gem_name, version, errors, domain)
if errors and !errors.empty?
msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n"
msg = "Could not find a valid gem '#{gem_name}' (#{version}), here is why:\n".dup
errors.each { |x| msg << " #{x.wordy}\n" }
alert_error msg
else
Expand Down Expand Up @@ -584,4 +585,3 @@ def wrap(text, width) # :doc:

module Gem::Commands
end

1 change: 1 addition & 0 deletions lib/rubygems/command_manager.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/build_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/cert_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/security'
begin
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/check_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/validator'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/cleanup_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/dependency_list'
require 'rubygems/uninstaller'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/contents_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'English'
require 'rubygems/command'
require 'rubygems/version_option'
Expand Down
5 changes: 3 additions & 2 deletions lib/rubygems/commands/dependency_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
Expand Down Expand Up @@ -99,7 +100,7 @@ def display_pipe specs # :nodoc:
end

def display_readable specs, reverse # :nodoc:
response = ''
response = String.new

specs.each do |spec|
response << print_dependencies(spec)
Expand Down Expand Up @@ -152,7 +153,7 @@ def ensure_specs specs # :nodoc:
end

def print_dependencies(spec, level = 0) # :nodoc:
response = ''
response = String.new
response << ' ' * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty? then
spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
Expand Down
6 changes: 3 additions & 3 deletions lib/rubygems/commands/environment_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

class Gem::Commands::EnvironmentCommand < Gem::Command
Expand Down Expand Up @@ -71,7 +72,7 @@ def usage # :nodoc:
end

def execute
out = ''
out = String.new
arg = options[:args][0]
out <<
case arg
Expand Down Expand Up @@ -103,7 +104,7 @@ def add_path out, path
end

def show_environment # :nodoc:
out = "RubyGems Environment:\n"
out = "RubyGems Environment:\n".dup

out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"

Expand Down Expand Up @@ -157,4 +158,3 @@ def show_environment # :nodoc:
end

end

1 change: 1 addition & 0 deletions lib/rubygems/commands/fetch_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/generate_index_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/indexer'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/help_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

class Gem::Commands::HelpCommand < Gem::Command
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/install_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/install_update_options'
require 'rubygems/dependency_installer'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/list_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/lock_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

class Gem::Commands::LockCommand < Gem::Command
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/mirror_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

unless defined? Gem::Commands::MirrorCommand
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/open_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'English'
require 'rubygems/command'
require 'rubygems/version_option'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/outdated_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/owner_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/pristine_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/package'
require 'rubygems/installer'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/push_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/gemcutter_utilities'
Expand Down
6 changes: 3 additions & 3 deletions lib/rubygems/commands/query_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
Expand Down Expand Up @@ -283,7 +284,7 @@ def make_entry entry_tuples, platforms
end

def spec_authors entry, spec
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: "
authors = "Author#{spec.authors.length > 1 ? 's' : ''}: ".dup
authors << spec.authors.join(', ')
entry << format_text(authors, 68, 4)
end
Expand All @@ -297,7 +298,7 @@ def spec_homepage entry, spec
def spec_license entry, spec
return if spec.license.nil? or spec.license.empty?

licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: "
licenses = "License#{spec.licenses.length > 1 ? 's' : ''}: ".dup
licenses << spec.licenses.join(', ')
entry << "\n" << format_text(licenses, 68, 4)
end
Expand Down Expand Up @@ -347,4 +348,3 @@ def spec_summary entry, spec
end

end

1 change: 1 addition & 0 deletions lib/rubygems/commands/rdoc_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/rdoc'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/search_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/commands/query_command'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/server_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/server'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/setup_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

##
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/sources_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/remote_fetcher'
require 'rubygems/spec_fetcher'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/specification_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/stale_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

class Gem::Commands::StaleCommand < Gem::Command
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/uninstall_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/uninstaller'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/unpack_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/installer'
require 'rubygems/version_option'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/update_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/command_manager'
require 'rubygems/dependency_installer'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/which_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

class Gem::Commands::WhichCommand < Gem::Command
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/commands/yank_command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/compatibility.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# :stopdoc:

#--
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/config_file.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/core_ext/kernel_gem.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# RubyGems adds the #gem method to allow activation of specific gem versions
# and overrides the #require method on Kernel to make gems appear as if they
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/core_ext/kernel_require.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/defaults.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Gem
DEFAULT_HOST = "https://rubygems.org"

Expand Down
5 changes: 3 additions & 2 deletions lib/rubygems/dependency.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# The Dependency class holds a Gem name and a Gem::Requirement.

Expand Down Expand Up @@ -306,9 +307,9 @@ def to_specs

if specs.empty?
total = Gem::Specification.to_a.size
msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n".dup
else
msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n"
msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n".dup
end
msg << "Checked in 'GEM_PATH=#{Gem.path.join(File::PATH_SEPARATOR)}', execute `gem env` for more information"

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/dependency_installer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/dependency_list'
require 'rubygems/package'
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/dependency_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/deprecate.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# Provides a single method +deprecate+ to be used to declare when
# something is going away.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/doctor.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems'
require 'rubygems/user_interaction'

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/errors.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# This file contains all the various exceptions and other errors that are used
# inside of RubyGems.
Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# TODO: the documentation in here is terrible.
#
# Each exception needs a brief description and the scenarios where it is
Expand Down Expand Up @@ -137,7 +138,7 @@ def build_message # :nodoc:
requester = requester ? requester.spec.full_name : 'The user'
dependency = @request.dependency

message = "#{requester} requires #{dependency} but it conflicted:\n"
message = "#{requester} requires #{dependency} but it conflicted:\n".dup

@conflicts.each do |_, conflict|
message << conflict.explanation
Expand Down Expand Up @@ -267,4 +268,3 @@ def version
# Backwards compatible typo'd exception class for early RubyGems 2.0.x

Gem::UnsatisfiableDepedencyError = Gem::UnsatisfiableDependencyError # :nodoc:

1 change: 1 addition & 0 deletions lib/rubygems/ext.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/ext/build_error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# Raised when there is an error while building extensions.

Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/ext/builder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
1 change: 1 addition & 0 deletions lib/rubygems/ext/cmake_builder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems/command'

class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
Expand Down
Loading

0 comments on commit 45966be

Please sign in to comment.