diff options
Diffstat (limited to 'lib/bundler')
92 files changed, 127 insertions, 28 deletions
diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb index 12499c7bf4..2a4954d964 100644 --- a/lib/bundler/capistrano.rb +++ b/lib/bundler/capistrano.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Capistrano task for Bundler. # # Just add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 77eab33ddc..2445172321 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler" require "bundler/vendored_thor" diff --git a/lib/bundler/cli/binstubs.rb b/lib/bundler/cli/binstubs.rb index cf9ce02c4d..8452ca3bfe 100644 --- a/lib/bundler/cli/binstubs.rb +++ b/lib/bundler/cli/binstubs.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/cli/common" module Bundler diff --git a/lib/bundler/cli/cache.rb b/lib/bundler/cli/cache.rb index 8bc876baea..c8c63e926c 100644 --- a/lib/bundler/cli/cache.rb +++ b/lib/bundler/cli/cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Cache attr_reader :options diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index fd09425e4a..f6a1022306 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Check attr_reader :options diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb index d70a5b9b89..895b6567fa 100644 --- a/lib/bundler/cli/clean.rb +++ b/lib/bundler/cli/clean.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Clean attr_reader :options diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index b90544ba3a..491ea04a11 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler module CLI::Common def self.without_groups_message diff --git a/lib/bundler/cli/config.rb b/lib/bundler/cli/config.rb index ce1be5eb4f..32724f687d 100644 --- a/lib/bundler/cli/config.rb +++ b/lib/bundler/cli/config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Config attr_reader :name, :options, :scope, :thor @@ -11,7 +12,7 @@ module Bundler @scope = "global" return unless peek && peek.start_with?("--") @name = args.shift - @scope = $' + @scope = peek[2..-1] end def run diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb index 6e4e1b6686..5e72cdbf0f 100644 --- a/lib/bundler/cli/console.rb +++ b/lib/bundler/cli/console.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Console attr_reader :options, :group diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 8b828edf87..4ccc4ba55a 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/current_ruby" module Bundler diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 343a458719..72a1880c52 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "pathname" module Bundler diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index 1d201a90f5..4bbdee1f48 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Init attr_reader :options diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index a17bce036f..e319feb201 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Inject attr_reader :options, :name, :version, :gems diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 559189b314..0e8599963b 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Install attr_reader :options diff --git a/lib/bundler/cli/lock.rb b/lib/bundler/cli/lock.rb index 457826dfb5..e95e9ff636 100644 --- a/lib/bundler/cli/lock.rb +++ b/lib/bundler/cli/lock.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Lock attr_reader :options diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb index 0bf42038d9..d4dba703cd 100644 --- a/lib/bundler/cli/open.rb +++ b/lib/bundler/cli/open.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/cli/common" require "shellwords" diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 179635b803..3c85d0bdcd 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/cli/common" module Bundler diff --git a/lib/bundler/cli/package.rb b/lib/bundler/cli/package.rb index de53cb6d8d..cf65e8a68c 100644 --- a/lib/bundler/cli/package.rb +++ b/lib/bundler/cli/package.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Package attr_reader :options diff --git a/lib/bundler/cli/platform.rb b/lib/bundler/cli/platform.rb index 28641a4c8b..aec08789a9 100644 --- a/lib/bundler/cli/platform.rb +++ b/lib/bundler/cli/platform.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Platform attr_reader :options diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb index 50cf0a97d5..d67b086dd1 100644 --- a/lib/bundler/cli/show.rb +++ b/lib/bundler/cli/show.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/cli/common" module Bundler diff --git a/lib/bundler/cli/update.rb b/lib/bundler/cli/update.rb index 0102bf0e1a..1a76a88c3d 100644 --- a/lib/bundler/cli/update.rb +++ b/lib/bundler/cli/update.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Update attr_reader :options, :gems diff --git a/lib/bundler/cli/viz.rb b/lib/bundler/cli/viz.rb index 8fbc64d5fa..7ccd306d63 100644 --- a/lib/bundler/cli/viz.rb +++ b/lib/bundler/cli/viz.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class CLI::Viz attr_reader :options, :gem_name diff --git a/lib/bundler/constants.rb b/lib/bundler/constants.rb index 704bcac84f..5b1c0a8cb1 100644 --- a/lib/bundler/constants.rb +++ b/lib/bundler/constants.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/ FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/ diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 671171dc37..a7fa2f3a89 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler # Returns current version of Ruby # diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 636d643a94..d98d8b15b6 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/lockfile_parser" require "digest/sha1" require "set" @@ -347,12 +348,13 @@ module Bundler end def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false) - msg = "You are trying to install in deployment mode after changing\n" \ - "your Gemfile. Run `bundle install` elsewhere and add the\n" \ - "updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control." + msg = String.new + msg << "You are trying to install in deployment mode after changing\n" \ + "your Gemfile. Run `bundle install` elsewhere and add the\n" \ + "updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control." unless explicit_flag - msg += "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \ + msg << "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \ "freeze \nby running `bundle install --no-deployment`." end diff --git a/lib/bundler/dep_proxy.rb b/lib/bundler/dep_proxy.rb index 4efd99c9bb..998975bbaf 100644 --- a/lib/bundler/dep_proxy.rb +++ b/lib/bundler/dep_proxy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class DepProxy attr_reader :__platform, :dep diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index a62808d23c..1b1808b40a 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rubygems/dependency" require "bundler/shared_helpers" require "bundler/rubygems_ext" diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb index 163f61eabb..23968e7084 100644 --- a/lib/bundler/deployment.rb +++ b/lib/bundler/deployment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Deployment def self.define_task(context, task_method = :task, opts = {}) diff --git a/lib/bundler/deprecate.rb b/lib/bundler/deprecate.rb index 02eb4b0918..1ab4de1a28 100644 --- a/lib/bundler/deprecate.rb +++ b/lib/bundler/deprecate.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler if defined? ::Deprecate Deprecate = ::Deprecate diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 8a3931e852..b3b6bfdcce 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/dependency" require "bundler/ruby_dsl" @@ -345,7 +346,8 @@ module Bundler def validate_keys(command, opts, valid_keys) invalid_keys = opts.keys - valid_keys if invalid_keys.any? - message = "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " + message = String.new + message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " message << if invalid_keys.size > 1 "as options for #{command}, but they are invalid." else @@ -450,7 +452,7 @@ module Bundler @to_s ||= begin trace_line, description = parse_line_number_from_description - m = "\n[!] " + m = String.new("\n[!] ") m << description m << ". Bundler cannot continue.\n" diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index 93d35900ae..baf6a10f31 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/rubygems_integration" require "bundler/source/git/git_proxy" diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb index 0e4ed37814..4e072602e6 100644 --- a/lib/bundler/environment.rb +++ b/lib/bundler/environment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Environment attr_reader :root diff --git a/lib/bundler/errors.rb b/lib/bundler/errors.rb index 9fc7b6df7b..eec8d00ef5 100644 --- a/lib/bundler/errors.rb +++ b/lib/bundler/errors.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class BundlerError < StandardError def self.status_code(code) diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 63f61070e3..348c29dcbe 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/vendored_persistent" require "cgi" require "securerandom" @@ -53,15 +54,17 @@ module Bundler # Exceptions classes that should bypass retry attempts. If your password didn't work the # first time, it's not going to the third time. - FAIL_ERRORS = [AuthenticationRequiredError, BadAuthenticationError, FallbackError].freeze NET_ERRORS = [:HTTPBadGateway, :HTTPBadRequest, :HTTPFailedDependency, :HTTPForbidden, :HTTPInsufficientStorage, :HTTPMethodNotAllowed, :HTTPMovedPermanently, :HTTPNoContent, :HTTPNotFound, :HTTPNotImplemented, :HTTPPreconditionFailed, :HTTPRequestEntityTooLarge, :HTTPRequestURITooLong, :HTTPUnauthorized, :HTTPUnprocessableEntity, :HTTPUnsupportedMediaType, :HTTPVersionNotSupported].freeze - FAIL_ERRORS << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError) - FAIL_ERRORS.push(*NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact) + FAIL_ERRORS = begin + fail_errors = [AuthenticationRequiredError, BadAuthenticationError, FallbackError] + fail_errors << Gem::Requirement::BadRequirementError if defined?(Gem::Requirement::BadRequirementError) + fail_errors.push(*NET_ERRORS.map {|e| SharedHelpers.const_get_safely(e, Net) }.compact) + end.freeze class << self attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries @@ -161,7 +164,7 @@ module Bundler @user_agent ||= begin ruby = Bundler::RubyVersion.system - agent = "bundler/#{Bundler::VERSION}" + agent = String.new("bundler/#{Bundler::VERSION}") agent << " rubygems/#{Gem::VERSION}" agent << " ruby/#{ruby.version}" agent << " (#{ruby.host})" diff --git a/lib/bundler/fetcher/base.rb b/lib/bundler/fetcher/base.rb index 1d1adc73db..f7210bd03d 100644 --- a/lib/bundler/fetcher/base.rb +++ b/lib/bundler/fetcher/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Fetcher class Base diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index 0dd9b130be..f249ec1835 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/fetcher/base" require "bundler/worker" diff --git a/lib/bundler/fetcher/dependency.rb b/lib/bundler/fetcher/dependency.rb index fdf91c1710..274b34eefd 100644 --- a/lib/bundler/fetcher/dependency.rb +++ b/lib/bundler/fetcher/dependency.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/fetcher/base" require "cgi" diff --git a/lib/bundler/fetcher/downloader.rb b/lib/bundler/fetcher/downloader.rb index 9d8d783c8a..204e33387e 100644 --- a/lib/bundler/fetcher/downloader.rb +++ b/lib/bundler/fetcher/downloader.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Fetcher class Downloader diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index f23811c8c5..d8e212989e 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/fetcher/base" require "rubygems/remote_fetcher" diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index fd98bf55e1..b453e8e625 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +# frozen_string_literal: true require "cgi" require "bundler/vendored_thor" @@ -68,7 +69,7 @@ module Bundler Error details #{e.class}: #{e.message} - #{e.backtrace.join("\n ")} + #{e.backtrace.join("\n ")} #{Bundler::Env.new.report(:print_gemfile => false, :print_gemspecs => false).gsub(/\n/, "\n ").strip} --- TEMPLATE END ---------------------------------------------------------------- diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 30822148b4..41c574bfd2 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/vendored_thor" unless defined?(Thor) require "bundler" @@ -98,7 +99,7 @@ module Bundler gem_command = "gem push '#{path}'" if @gemspec.respond_to?(:metadata) allowed_push_host = @gemspec.metadata["allowed_push_host"] - gem_command << " --host #{allowed_push_host}" if allowed_push_host + gem_command += " --host #{allowed_push_host}" if allowed_push_host end sh(gem_command) Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}" @@ -169,14 +170,15 @@ module Bundler end def sh_with_code(cmd, &block) - cmd << " 2>&1" + cmd += " 2>&1" outbuf = String.new Bundler.ui.debug(cmd) SharedHelpers.chdir(base) do outbuf = `#{cmd}` - block.call(outbuf) if $? == 0 && block + status = $?.exitstatus + block.call(outbuf) if status.zero? && block + [outbuf, status] end - [outbuf, $?] end def gem_push? diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb index 6e43caef1a..5c824ffefc 100644 --- a/lib/bundler/gem_helpers.rb +++ b/lib/bundler/gem_helpers.rb @@ -1,6 +1,7 @@ +# frozen_string_literal: true module Bundler module GemHelpers - GENERIC_CACHE = {}.freeze + GENERIC_CACHE = {} # rubocop:disable MutableConstant GENERICS = [ [Gem::Platform.new("java"), Gem::Platform.new("java")], [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")], diff --git a/lib/bundler/gem_remote_fetcher.rb b/lib/bundler/gem_remote_fetcher.rb index 8a823da963..481838a5e2 100644 --- a/lib/bundler/gem_remote_fetcher.rb +++ b/lib/bundler/gem_remote_fetcher.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rubygems/remote_fetcher" module Bundler diff --git a/lib/bundler/gem_tasks.rb b/lib/bundler/gem_tasks.rb index 0ff383bf8b..230e7f28f2 100644 --- a/lib/bundler/gem_tasks.rb +++ b/lib/bundler/gem_tasks.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rake/clean" CLOBBER.include "pkg" diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index 61c47380ac..c7e957ad7a 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module Bundler class Graph diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index 40ae97d5bd..f2defe1cff 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module Bundler diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index ef98fad888..c27e2499ca 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Injector def self.inject(new_deps) diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 9df19b02ad..da4afd01bb 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Allows for declaring a Gemfile inline in a ruby script, optionally installing # any gems that aren't already installed on the user's system. # diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 4be5403607..3a54a02151 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "erb" require "rubygems/dependency_installer" require "bundler/worker" diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb index f6f865b2ab..441c72108f 100644 --- a/lib/bundler/installer/gem_installer.rb +++ b/lib/bundler/installer/gem_installer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class GemInstaller attr_reader :spec, :standalone, :worker, :force, :installer diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index 674c45af25..0a276aa9ea 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/worker" require "bundler/installer/gem_installer" diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb index 40100b9540..69cfbfc455 100644 --- a/lib/bundler/installer/standalone.rb +++ b/lib/bundler/installer/standalone.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Standalone def initialize(groups, definition) diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index b3d0d4e732..ccaa791cc8 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "uri" require "rubygems/spec_fetcher" require "bundler/match_platform" diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb index f4b9492c25..fed418b593 100644 --- a/lib/bundler/match_platform.rb +++ b/lib/bundler/match_platform.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/gem_helpers" module Bundler diff --git a/lib/bundler/mirror.rb b/lib/bundler/mirror.rb index 45534be035..4978462bb3 100644 --- a/lib/bundler/mirror.rb +++ b/lib/bundler/mirror.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Settings # Class used to build the mirror set and then find a mirror for a given URI diff --git a/lib/bundler/path_preserver.rb b/lib/bundler/path_preserver.rb index c37d7aa087..f5701cd67b 100644 --- a/lib/bundler/path_preserver.rb +++ b/lib/bundler/path_preserver.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler module PathPreserver def self.preserve_path_in_environment(env_var, env) diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb index 429cdb85f2..2c85cb0a53 100644 --- a/lib/bundler/psyched_yaml.rb +++ b/lib/bundler/psyched_yaml.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Psych could be a gem, so try to ask for it begin gem "psych" diff --git a/lib/bundler/remote_specification.rb b/lib/bundler/remote_specification.rb index 2ed4fadadc..29735fc6ab 100644 --- a/lib/bundler/remote_specification.rb +++ b/lib/bundler/remote_specification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "uri" require "rubygems/spec_fetcher" diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index e0a7f186ef..d22ab34e98 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Resolver require "bundler/vendored_molinillo" @@ -12,7 +13,7 @@ module Bundler end def message - conflicts.sort.reduce("") do |o, (name, conflict)| + conflicts.sort.reduce(String.new) do |o, (name, conflict)| o << %(Bundler could not find compatible versions for gem "#{name}":\n) if conflict.locked_requirement o << %( In snapshot (#{Bundler.default_lockfile.basename}):\n) @@ -341,7 +342,7 @@ module Bundler elsif requirement.source name = requirement.name versions = @source_requirements[name][name].map(&:version) - message = "Could not find gem '#{requirement}' in #{requirement.source}.\n" + message = String.new("Could not find gem '#{requirement}' in #{requirement.source}.\n") message << if versions.any? "Source contains '#{name}' at: #{versions.join(", ")}" else diff --git a/lib/bundler/retry.rb b/lib/bundler/retry.rb index 4b0fff4bd5..bf4d6ab7f7 100644 --- a/lib/bundler/retry.rb +++ b/lib/bundler/retry.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler # General purpose class for retrying code that may fail class Retry diff --git a/lib/bundler/ruby_dsl.rb b/lib/bundler/ruby_dsl.rb index 46587e98cf..47f2bcc337 100644 --- a/lib/bundler/ruby_dsl.rb +++ b/lib/bundler/ruby_dsl.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler module RubyDsl def ruby(ruby_version, options = {}) diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb index 71ed828f71..b8f3b8a863 100644 --- a/lib/bundler/ruby_version.rb +++ b/lib/bundler/ruby_version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class RubyVersion attr_reader :version, :patchlevel, :engine, :engine_version @@ -23,7 +24,7 @@ module Bundler end def to_s - output = "ruby #{version}" + output = String.new("ruby #{version}") output << "p#{patchlevel}" if patchlevel output << " (#{engine} #{engine_version})" unless engine == "ruby" diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index e1051a3851..22c22a2dd0 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "pathname" if defined?(Gem::QuickLoader) @@ -78,7 +79,7 @@ module Gem end def to_gemfile(path = nil) - gemfile = "source 'https://rubygems.org'\n" + gemfile = String.new("source 'https://rubygems.org'\n") gemfile << dependencies_to_gemfile(nondevelopment_dependencies) unless development_dependencies.empty? gemfile << "\n" diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb index 5d7be0cb7e..43637e1e60 100644 --- a/lib/bundler/rubygems_gem_installer.rb +++ b/lib/bundler/rubygems_gem_installer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rubygems/installer" module Bundler diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 5818f5b16a..c8ebe2cb9a 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "monitor" require "rubygems" require "rubygems/config_file" diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index fff8a748af..6ef476b9dc 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "digest/sha1" module Bundler diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 8e0c2282ed..634d9dc14a 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "uri" module Bundler diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb index db13967bb1..9aae6478cd 100644 --- a/lib/bundler/setup.rb +++ b/lib/bundler/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/shared_helpers" if Bundler::SharedHelpers.in_bundle? diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 75aaf7c8f8..82b80eaa4a 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "pathname" require "rubygems" diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index 624238552c..e9c1413ea3 100644 --- a/lib/bundler/similarity_detector.rb +++ b/lib/bundler/similarity_detector.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class SimilarityDetector SimilarityScore = Struct.new(:string, :distance) diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index 0bcf9c3cfe..5f1eb130b7 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Source autoload :Rubygems, "bundler/source/rubygems" @@ -17,7 +18,7 @@ module Bundler locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name } locked_spec_version = locked_spec.version if locked_spec if locked_spec_version && spec.version != locked_spec_version - message << " (was #{locked_spec_version})" + message += " (was #{locked_spec_version})" end end diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index b11de1e4bc..90bbd13d34 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "fileutils" require "uri" require "digest/sha1" @@ -35,7 +36,7 @@ module Bundler end def to_lock - out = "GIT\n" + out = String.new("GIT\n") out << " remote: #{@uri}\n" out << " revision: #{revision}\n" %w(ref branch tag submodules).each do |opt| diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index a9f782e8d6..19e0db86fa 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true module Bundler class Source class Git < Path class GitNotInstalledError < GitError def initialize - msg = "You need to install git to be able to use gems from git repositories. " + msg = String.new + msg << "You need to install git to be able to use gems from git repositories. " msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git" super msg end @@ -11,7 +13,8 @@ module Bundler class GitNotAllowedError < GitError def initialize(command) - msg = "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, " + msg = String.new + msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, " msg << "this error message could probably be more useful. Please submit a ticket at http://github.com/bundler/bundler/issues " msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}" super msg @@ -20,7 +23,8 @@ module Bundler class GitCommandError < GitError def initialize(command, path = nil, extra_info = nil) - msg = "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed." + msg = String.new + msg << "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed." msg << "\n#{extra_info}" if extra_info msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist? super msg diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 6f2fe2c1eb..6bfd2e88c7 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -158,7 +158,7 @@ module Bundler end end else - message = "The path `#{expanded_path}` " + message = String.new("The path `#{expanded_path}` ") message << if File.exist?(expanded_path) "is not a directory." else diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb index 74542dd913..0aa27bd564 100644 --- a/lib/bundler/source/path/installer.rb +++ b/lib/bundler/source/path/installer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Source class Path diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 1315677a52..cebb68a700 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "uri" require "rubygems/user_interaction" require "rubygems/spec_fetcher" @@ -118,7 +119,7 @@ module Bundler unless Bundler.settings[:no_install] message = "Installing #{version_message(spec)}" - message << " with native extensions" if spec.extensions.any? + message += " with native extensions" if spec.extensions.any? Bundler.ui.confirm message path = cached_gem(spec) diff --git a/lib/bundler/source/rubygems/remote.rb b/lib/bundler/source/rubygems/remote.rb index 4cd8ea23b8..32265fb600 100644 --- a/lib/bundler/source/rubygems/remote.rb +++ b/lib/bundler/source/rubygems/remote.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Source class Rubygems diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb index c0336bfdd6..dc62c8926a 100644 --- a/lib/bundler/source_list.rb +++ b/lib/bundler/source_list.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class SourceList attr_reader :path_sources, diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 855a6e3317..5ec546e8e3 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "tsort" require "forwardable" diff --git a/lib/bundler/ssl_certs/certificate_manager.rb b/lib/bundler/ssl_certs/certificate_manager.rb index 558bd9ef50..76639a0cf1 100644 --- a/lib/bundler/ssl_certs/certificate_manager.rb +++ b/lib/bundler/ssl_certs/certificate_manager.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "fileutils" require "net/https" require "openssl" diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb index ca5cbe6d9d..f4ee7d0644 100644 --- a/lib/bundler/stub_specification.rb +++ b/lib/bundler/stub_specification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/remote_specification" module Bundler diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable index cc9e06cfec..b72c267dd1 100755 --- a/lib/bundler/templates/Executable +++ b/lib/bundler/templates/Executable @@ -1,4 +1,5 @@ #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG['ruby_install_name'] %> +# frozen_string_literal: true # # This file was generated by Bundler. # diff --git a/lib/bundler/templates/Gemfile b/lib/bundler/templates/Gemfile index 8d5b66ea29..3f953369c3 100644 --- a/lib/bundler/templates/Gemfile +++ b/lib/bundler/templates/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true # A sample Gemfile source "https://rubygems.org" diff --git a/lib/bundler/ui.rb b/lib/bundler/ui.rb index 7400f80ab1..794c000dc4 100644 --- a/lib/bundler/ui.rb +++ b/lib/bundler/ui.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler module UI autoload :RGProxy, "bundler/ui/rg_proxy" diff --git a/lib/bundler/ui/rg_proxy.rb b/lib/bundler/ui/rg_proxy.rb index 1c9c2deaba..95a1ecdf0c 100644 --- a/lib/bundler/ui/rg_proxy.rb +++ b/lib/bundler/ui/rg_proxy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/ui" require "rubygems/user_interaction" diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb index 51919a8a5f..425ffae332 100644 --- a/lib/bundler/ui/shell.rb +++ b/lib/bundler/ui/shell.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "bundler/vendored_thor" module Bundler diff --git a/lib/bundler/ui/silent.rb b/lib/bundler/ui/silent.rb index 3eb3199b5c..9f387d9e9f 100644 --- a/lib/bundler/ui/silent.rb +++ b/lib/bundler/ui/silent.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler module UI class Silent diff --git a/lib/bundler/vendored_molinillo.rb b/lib/bundler/vendored_molinillo.rb index 795d63a3d3..7b231263cb 100644 --- a/lib/bundler/vendored_molinillo.rb +++ b/lib/bundler/vendored_molinillo.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module Bundler; end require "bundler/vendor/molinillo/lib/molinillo" diff --git a/lib/bundler/vendored_persistent.rb b/lib/bundler/vendored_persistent.rb index ef404f35d5..d5ae513c59 100644 --- a/lib/bundler/vendored_persistent.rb +++ b/lib/bundler/vendored_persistent.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # We forcibly require OpenSSL, because net/http/persistent will only autoload # it. On some Rubies, autoload fails but explicit require succeeds. begin diff --git a/lib/bundler/vendored_thor.rb b/lib/bundler/vendored_thor.rb index 114483db02..0d0b45bfba 100644 --- a/lib/bundler/vendored_thor.rb +++ b/lib/bundler/vendored_thor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler; end require "bundler/vendor/thor/lib/thor" require "bundler/vendor/thor/lib/thor/actions" diff --git a/lib/bundler/vlad.rb b/lib/bundler/vlad.rb index 5e20ae6dac..d017ca475a 100644 --- a/lib/bundler/vlad.rb +++ b/lib/bundler/vlad.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Vlad task for Bundler. # # Just add "require 'bundler/vlad'" in your Vlad deploy.rb, and diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb index e74823e202..3ef5addcee 100644 --- a/lib/bundler/worker.rb +++ b/lib/bundler/worker.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "thread" module Bundler |