diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 2 | ||||
-rw-r--r-- | lib/bundler/endpoint_specification.rb | 1 | ||||
-rw-r--r-- | lib/bundler/fetcher.rb | 14 | ||||
-rw-r--r-- | lib/bundler/gem_helpers.rb | 4 | ||||
-rw-r--r-- | lib/bundler/lockfile_parser.rb | 23 | ||||
-rw-r--r-- | lib/bundler/runtime.rb | 2 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/path.rb | 3 | ||||
-rw-r--r-- | lib/bundler/ui/shell.rb | 2 | ||||
-rw-r--r-- | lib/bundler/version.rb | 3 |
11 files changed, 31 insertions, 27 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index b6eb708f..77eab33d 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -4,7 +4,7 @@ require "bundler/vendored_thor" module Bundler class CLI < Thor include Thor::Actions - AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean) + AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean).freeze def self.start(*) super diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 8c306d5e..343a4587 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -5,7 +5,7 @@ module Bundler TEST_FRAMEWORK_VERSIONS = { "rspec" => "3.0", "minitest" => "5.0" - } + }.freeze attr_reader :options, :gem_name, :thor, :name, :target diff --git a/lib/bundler/endpoint_specification.rb b/lib/bundler/endpoint_specification.rb index a571e0f2..b26fdaf9 100644 --- a/lib/bundler/endpoint_specification.rb +++ b/lib/bundler/endpoint_specification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler # used for Creating Specifications from the Gemcutter Endpoint class EndpointSpecification < Gem::Specification diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 8c9da096..63f61070 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -53,13 +53,13 @@ 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] + 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] + :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) @@ -150,10 +150,10 @@ module Bundler fetchers.shift until fetchers.first.available? - if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint - @use_api = false + @use_api = if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint + false else - @use_api = fetchers.first.api_fetcher? + fetchers.first.api_fetcher? end end @@ -207,7 +207,7 @@ module Bundler private - FETCHERS = [CompactIndex, Dependency, Index] + FETCHERS = [CompactIndex, Dependency, Index].freeze def cis env_cis = { @@ -267,7 +267,7 @@ module Bundler Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Net::HTTP::Persistent::Error, Zlib::BufError - ] + ].freeze def bundler_cert_store store = OpenSSL::X509::Store.new diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb index 14699895..6e43caef 100644 --- a/lib/bundler/gem_helpers.rb +++ b/lib/bundler/gem_helpers.rb @@ -1,6 +1,6 @@ module Bundler module GemHelpers - GENERIC_CACHE = {} + GENERIC_CACHE = {}.freeze GENERICS = [ [Gem::Platform.new("java"), Gem::Platform.new("java")], [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")], @@ -9,7 +9,7 @@ module Bundler [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")], [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")], [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")] - ] + ].freeze def generic(p) return p if p == Gem::Platform::RUBY diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index f802157c..94e88dbd 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "strscan" # Some versions of the Bundler 1.1 RC series introduced corrupted @@ -14,16 +15,16 @@ module Bundler class LockfileParser attr_reader :sources, :dependencies, :specs, :platforms, :bundler_version, :ruby_version - BUNDLED = "BUNDLED WITH" - DEPENDENCIES = "DEPENDENCIES" - PLATFORMS = "PLATFORMS" - RUBY = "RUBY VERSION" - GIT = "GIT" - GEM = "GEM" - PATH = "PATH" - SPECS = " specs:" + BUNDLED = "BUNDLED WITH".freeze + DEPENDENCIES = "DEPENDENCIES".freeze + PLATFORMS = "PLATFORMS".freeze + RUBY = "RUBY VERSION".freeze + GIT = "GIT".freeze + GEM = "GEM".freeze + PATH = "PATH".freeze + SPECS = " specs:".freeze OPTIONS = /^ ([a-z]+): (.*)$/i - SOURCE = [GIT, GEM, PATH] + SOURCE = [GIT, GEM, PATH].freeze def initialize(lockfile) @platforms = [] @@ -89,7 +90,7 @@ module Bundler GIT => Bundler::Source::Git, GEM => Bundler::Source::Rubygems, PATH => Bundler::Source::Path, - } + }.freeze def parse_source(line) case line @@ -134,7 +135,7 @@ module Bundler end end - NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?' + NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?'.freeze NAME_VERSION_2 = /^ {2}#{NAME_VERSION}(!)?$/ NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/ NAME_VERSION_6 = /^ {6}#{NAME_VERSION}$/ diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index a6630262..fff8a748 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -52,7 +52,7 @@ module Bundler /^Missing API definition file in (.+)$/i, /^cannot load such file -- (.+)$/i, /^dlopen\([^)]*\): Library not loaded: (.+)$/i, - ] + ].freeze def require(*groups) groups.map!(&:to_sym) diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 31f1fdd7..8e0c2282 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -4,7 +4,7 @@ module Bundler class Settings BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check disable_shared_gems ignore_messages gem.mit gem.coc silence_root_warning).freeze NUMBER_KEYS = %w(retry timeout redirect ssl_verify_mode).freeze - DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 } + DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 }.freeze def initialize(root = nil) @root = root diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index 605aa5ae..6f2fe2c1 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Bundler class Source class Path < Source @@ -7,7 +8,7 @@ module Bundler attr_writer :name attr_accessor :version - DEFAULT_GLOB = "{,*,*/*}.gemspec" + DEFAULT_GLOB = "{,*,*/*}.gemspec".freeze def initialize(options) @options = options diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb index 2c0076dc..51919a8a 100644 --- a/lib/bundler/ui/shell.rb +++ b/lib/bundler/ui/shell.rb @@ -3,7 +3,7 @@ require "bundler/vendored_thor" module Bundler module UI class Shell - LEVELS = %w(silent error warn confirm info debug) + LEVELS = %w(silent error warn confirm info debug).freeze attr_writer :shell diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb index 9a3c7dde..5ea959b9 100644 --- a/lib/bundler/version.rb +++ b/lib/bundler/version.rb @@ -1,6 +1,7 @@ +# frozen_string_literal: true module Bundler # We're doing this because we might write tests that deal # with other versions of bundler and we are unsure how to # handle this better. - VERSION = "1.12.0.pre" unless defined?(::Bundler::VERSION) + VERSION = "1.12.0.pre".freeze unless defined?(::Bundler::VERSION) end |