diff options
Diffstat (limited to 'lib')
64 files changed, 393 insertions, 393 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index d46c4394e2..0928d1a68d 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -1,51 +1,51 @@ -require 'fileutils' -require 'pathname' -require 'rbconfig' -require 'bundler/gem_path_manipulation' -require 'bundler/rubygems_ext' -require 'bundler/rubygems_integration' -require 'bundler/version' -require 'bundler/constants' -require 'bundler/current_ruby' +require "fileutils" +require "pathname" +require "rbconfig" +require "bundler/gem_path_manipulation" +require "bundler/rubygems_ext" +require "bundler/rubygems_integration" +require "bundler/version" +require "bundler/constants" +require "bundler/current_ruby" module Bundler preserve_gem_path ORIGINAL_ENV = ENV.to_hash - autoload :Definition, 'bundler/definition' - autoload :Dependency, 'bundler/dependency' - autoload :DepProxy, 'bundler/dep_proxy' - autoload :Deprecate, 'bundler/deprecate' - autoload :Dsl, 'bundler/dsl' - autoload :EndpointSpecification, 'bundler/endpoint_specification' - autoload :Environment, 'bundler/environment' - autoload :Env, 'bundler/env' - autoload :Fetcher, 'bundler/fetcher' - autoload :GemHelper, 'bundler/gem_helper' - autoload :GemHelpers, 'bundler/gem_helpers' - autoload :GemInstaller, 'bundler/gem_installer' - autoload :Graph, 'bundler/graph' - autoload :Index, 'bundler/index' - autoload :Installer, 'bundler/installer' - autoload :Injector, 'bundler/injector' - autoload :LazySpecification, 'bundler/lazy_specification' - autoload :LockfileParser, 'bundler/lockfile_parser' - autoload :MatchPlatform, 'bundler/match_platform' - autoload :RemoteSpecification, 'bundler/remote_specification' - autoload :Resolver, 'bundler/resolver' - autoload :Retry, 'bundler/retry' - autoload :RubyVersion, 'bundler/ruby_version' - autoload :RubyDsl, 'bundler/ruby_dsl' - autoload :Runtime, 'bundler/runtime' - autoload :Settings, 'bundler/settings' - autoload :SharedHelpers, 'bundler/shared_helpers' - autoload :SpecSet, 'bundler/spec_set' - autoload :StubSpecification, 'bundler/stub_specification' - autoload :Source, 'bundler/source' - autoload :SourceList, 'bundler/source_list' - autoload :Specification, 'bundler/shared_helpers' - autoload :SystemRubyVersion, 'bundler/ruby_version' - autoload :UI, 'bundler/ui' + autoload :Definition, "bundler/definition" + autoload :Dependency, "bundler/dependency" + autoload :DepProxy, "bundler/dep_proxy" + autoload :Deprecate, "bundler/deprecate" + autoload :Dsl, "bundler/dsl" + autoload :EndpointSpecification, "bundler/endpoint_specification" + autoload :Environment, "bundler/environment" + autoload :Env, "bundler/env" + autoload :Fetcher, "bundler/fetcher" + autoload :GemHelper, "bundler/gem_helper" + autoload :GemHelpers, "bundler/gem_helpers" + autoload :GemInstaller, "bundler/gem_installer" + autoload :Graph, "bundler/graph" + autoload :Index, "bundler/index" + autoload :Installer, "bundler/installer" + autoload :Injector, "bundler/injector" + autoload :LazySpecification, "bundler/lazy_specification" + autoload :LockfileParser, "bundler/lockfile_parser" + autoload :MatchPlatform, "bundler/match_platform" + autoload :RemoteSpecification, "bundler/remote_specification" + autoload :Resolver, "bundler/resolver" + autoload :Retry, "bundler/retry" + autoload :RubyVersion, "bundler/ruby_version" + autoload :RubyDsl, "bundler/ruby_dsl" + autoload :Runtime, "bundler/runtime" + autoload :Settings, "bundler/settings" + autoload :SharedHelpers, "bundler/shared_helpers" + autoload :SpecSet, "bundler/spec_set" + autoload :StubSpecification, "bundler/stub_specification" + autoload :Source, "bundler/source" + autoload :SourceList, "bundler/source_list" + autoload :Specification, "bundler/shared_helpers" + autoload :SystemRubyVersion, "bundler/ruby_version" + autoload :UI, "bundler/ui" class BundlerError < StandardError def self.status_code(code) @@ -215,9 +215,9 @@ module Bundler end def app_config_path - ENV['BUNDLE_APP_CONFIG'] ? - Pathname.new(ENV['BUNDLE_APP_CONFIG']).expand_path(root) : - root.join('.bundle') + ENV["BUNDLE_APP_CONFIG"] ? + Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root) : + root.join(".bundle") end def app_cache(custom_path = nil) @@ -250,11 +250,11 @@ module Bundler def with_clean_env with_original_env do - ENV['MANPATH'] = ENV['BUNDLE_ORIG_MANPATH'] - ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' } - if ENV.has_key? 'RUBYOPT' - ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', '' - ENV['RUBYOPT'] = ENV['RUBYOPT'].sub "-I#{File.expand_path('..', __FILE__)}", '' + ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"] + ENV.delete_if { |k,_| k[0,7] == "BUNDLE_" } + if ENV.has_key? "RUBYOPT" + ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", "" + ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-I#{File.expand_path("..", __FILE__)}", "" end yield end @@ -307,7 +307,7 @@ module Bundler bin_dir = bin_dir.parent until bin_dir.exist? # if any directory is not writable, we need sudo - files = [path, bin_dir] | Dir[path.join('build_info/*').to_s] | Dir[path.join('*').to_s] + files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s] sudo_needed = files.any?{|f| !File.writable?(f) } end @@ -326,8 +326,8 @@ module Bundler def which(executable) if File.file?(executable) && File.executable?(executable) executable - elsif ENV['PATH'] - path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p| + elsif ENV["PATH"] + path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |p| abs_path = File.join(p, executable) File.file?(abs_path) && File.executable?(abs_path) end @@ -336,7 +336,7 @@ module Bundler end def sudo(str) - prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, '').strip + " " + prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " " Your user account isn't allowed to install to the system Rubygems. You can cancel this installation and run: @@ -432,9 +432,9 @@ module Bundler end def configure_gem_home_and_path - blank_home = ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty? + blank_home = ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty? if settings[:disable_shared_gems] - ENV['GEM_PATH'] = '' + ENV["GEM_PATH"] = "" elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path] paths = possibles.flatten.compact.uniq.reject(&:empty?) @@ -449,7 +449,7 @@ module Bundler # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602) FileUtils.mkdir_p bundle_path.to_s rescue nil - ENV['GEM_HOME'] = File.expand_path(bundle_path, root) + ENV["GEM_HOME"] = File.expand_path(bundle_path, root) Bundler.rubygems.clear_paths end diff --git a/lib/bundler/capistrano.rb b/lib/bundler/capistrano.rb index e372a1af90..12499c7bf4 100644 --- a/lib/bundler/capistrano.rb +++ b/lib/bundler/capistrano.rb @@ -2,8 +2,8 @@ # # Just add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and # Bundler will be activated after each new deployment. -require 'bundler/deployment' -require 'capistrano/version' +require "bundler/deployment" +require "capistrano/version" if defined?(Capistrano::Version) && Gem::Version.new(Capistrano::Version).release >= Gem::Version.new("3.0") raise "For Capistrano 3.x integration, please use http://github.com/capistrano/bundler" diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index cb930e6f4c..cdccdf8e3e 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -1,5 +1,5 @@ -require 'bundler' -require 'bundler/vendored_thor' +require "bundler" +require "bundler/vendored_thor" module Bundler class CLI < Thor @@ -17,7 +17,7 @@ module Bundler super custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] - ENV['BUNDLE_GEMFILE'] = File.expand_path(custom_gemfile) if custom_gemfile + ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile Bundler.settings[:retry] = options[:retry] if options[:retry] @@ -84,7 +84,7 @@ module Bundler D method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile" def init - require 'bundler/cli/init' + require "bundler/cli/init" Init.new(options.dup).run end @@ -102,7 +102,7 @@ module Bundler "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" map "c" => "check" def check - require 'bundler/cli/check' + require "bundler/cli/check" Check.new(options).run end @@ -151,14 +151,14 @@ module Bundler "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application" method_option "trust-policy", :alias => "P", :type => :string, :banner => "Gem trust policy (like gem install -P). Must be one of " + - Bundler.rubygems.security_policy_keys.join('|') + Bundler.rubygems.security_policy_keys.join("|") method_option "without", :type => :array, :banner => "Exclude gems that are part of the specified named group." method_option "with", :type => :array, :banner => "Include gems that are part of the specified named group." map "i" => "install" def install - require 'bundler/cli/install' + require "bundler/cli/install" Install.new(options.dup).run end @@ -183,7 +183,7 @@ module Bundler method_option "force", :type => :boolean, :banner => "Force downloading every gem." def update(*gems) - require 'bundler/cli/update' + require "bundler/cli/update" Update.new(options, gems).run end @@ -197,7 +197,7 @@ module Bundler method_option "outdated", :type => :boolean, :banner => "Show verbose output including whether gems are outdated." def show(gem_name = nil) - require 'bundler/cli/show' + require "bundler/cli/show" Show.new(options, gem_name).run end map %w(list) => "show" @@ -212,7 +212,7 @@ module Bundler method_option "path", :type => :string, :lazy_default => "bin", :banner => "Binstub destination directory (default bin)" def binstubs(*gems) - require 'bundler/cli/binstubs' + require "bundler/cli/binstubs" Binstubs.new(options, gems).run end @@ -230,7 +230,7 @@ module Bundler method_option "strict", :type => :boolean, :banner => "Only list newer versions allowed by your Gemfile requirements" def outdated(*gems) - require 'bundler/cli/outdated' + require "bundler/cli/outdated" Outdated.new(options, gems).run end @@ -239,7 +239,7 @@ module Bundler method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one" method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." def cache - require 'bundler/cli/cache' + require "bundler/cli/cache" Cache.new(options).run end @@ -261,7 +261,7 @@ module Bundler bundle without having to download any additional gems. D def package - require 'bundler/cli/package' + require "bundler/cli/package" Package.new(options).run end map %w(pack) => :package @@ -275,7 +275,7 @@ module Bundler D map "e" => "exec" def exec(*args) - require 'bundler/cli/exec' + require "bundler/cli/exec" Exec.new(options, args).run end @@ -292,19 +292,19 @@ module Bundler where they were specified. D def config(*args) - require 'bundler/cli/config' + require "bundler/cli/config" Config.new(options, args, self).run end desc "open GEM", "Opens the source directory of the given bundled gem" def open(name) - require 'bundler/cli/open' + require "bundler/cli/open" Open.new(options, name).run end desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded" def console(group = nil) - require 'bundler/cli/console' + require "bundler/cli/console" Console.new(options, group).run end @@ -328,39 +328,39 @@ module Bundler end end - desc 'viz [OPTIONS]', "Generates a visual dependency graph" + desc "viz [OPTIONS]", "Generates a visual dependency graph" long_desc <<-D Viz generates a PNG file of the current Gemfile as a dependency graph. Viz requires the ruby-graphviz gem (and its dependencies). The associated gems must also be installed via 'bundle install'. D - method_option :file, :type => :string, :default => 'gem_graph', :aliases => '-f', :banner => "The name to use for the generated file. see format option" - method_option :format, :type => :string, :default => "png", :aliases => '-F', :banner => "This is output format option. Supported format is png, jpg, svg, dot ..." - method_option :requirements, :type => :boolean, :default => false, :aliases => '-r', :banner => "Set to show the version of each required dependency." - method_option :version, :type => :boolean, :default => false, :aliases => '-v', :banner => "Set to show each gem version." + method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :banner => "The name to use for the generated file. see format option" + method_option :format, :type => :string, :default => "png", :aliases => "-F", :banner => "This is output format option. Supported format is png, jpg, svg, dot ..." + method_option :requirements, :type => :boolean, :default => false, :aliases => "-r", :banner => "Set to show the version of each required dependency." + method_option :version, :type => :boolean, :default => false, :aliases => "-v", :banner => "Set to show each gem version." method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group." def viz - require 'bundler/cli/viz' + require "bundler/cli/viz" Viz.new(options).run end desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem" - method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :desc => "Generate a binary for your library." + method_option :bin, :type => :boolean, :default => false, :aliases => "-b", :desc => "Generate a binary for your library." method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", - :lazy_default => [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }, + :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find{|e| !e.nil? && !e.empty? }, :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code" method_option :mit, :type => :boolean, :desc => "Generate an MIT license file" - method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "rspec", + method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec", :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`." def gem(name) - require 'bundler/cli/gem' + require "bundler/cli/gem" Gem.new(options, name, self).run end def self.source_root - File.expand_path(File.join(File.dirname(__FILE__), 'templates')) + File.expand_path(File.join(File.dirname(__FILE__), "templates")) end desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory" @@ -369,7 +369,7 @@ module Bundler method_option "force", :type => :boolean, :default => false, :banner => "Forces clean even if --path is not set" def clean - require 'bundler/cli/clean' + require "bundler/cli/clean" Clean.new(options.dup).run end @@ -377,13 +377,13 @@ module Bundler method_option "ruby", :type => :boolean, :default => false, :banner => "only display ruby related platform information" def platform - require 'bundler/cli/platform' + require "bundler/cli/platform" Platform.new(options).run end desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile" def inject(name, version, *gems) - require 'bundler/cli/inject' + require "bundler/cli/inject" Inject.new(options, name, version, gems).run end @@ -397,7 +397,7 @@ module Bundler method_option "lockfile", :type => :string, :default => nil, :banner => "the path the lockfile should be written to" def lock - require 'bundler/cli/lock' + require "bundler/cli/lock" Lock.new(options).run end diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index 22fea6e4a9..da00886327 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -8,7 +8,7 @@ module Bundler def run if options[:path] Bundler.settings[:path] = File.expand_path(options[:path]) - Bundler.settings[:disable_shared_gems] = '1' + Bundler.settings[:disable_shared_gems] = "1" end begin definition = Bundler.definition diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index 83315a272e..28dce524eb 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -30,21 +30,21 @@ module Bundler end def self.ask_for_spec_from(specs) - if !$stdout.tty? && ENV['BUNDLE_SPEC_RUN'].nil? + if !$stdout.tty? && ENV["BUNDLE_SPEC_RUN"].nil? raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies) end specs.each_with_index do |spec, index| Bundler.ui.info "#{index.succ} : #{spec.name}", true end - Bundler.ui.info '0 : - exit -', true + Bundler.ui.info "0 : - exit -", true - num = Bundler.ui.ask('> ').to_i + num = Bundler.ui.ask("> ").to_i num > 0 ? specs[num - 1] : nil end def self.gem_not_found_message(missing_gem_name, alternatives) - require 'bundler/similarity_detector' + require "bundler/similarity_detector" message = "Could not find gem '#{missing_gem_name}'." alternate_names = alternatives.map { |a| a.respond_to?(:name) ? a.name : a } suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name) diff --git a/lib/bundler/cli/console.rb b/lib/bundler/cli/console.rb index 92bf848b47..7c7010e7cf 100644 --- a/lib/bundler/cli/console.rb +++ b/lib/bundler/cli/console.rb @@ -10,7 +10,7 @@ module Bundler group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require ARGV.clear - console = get_console(Bundler.settings[:console] || 'irb') + console = get_console(Bundler.settings[:console] || "irb") console.start end @@ -19,14 +19,14 @@ module Bundler get_constant(name) rescue LoadError Bundler.ui.error "Couldn't load console #{name}" - get_constant('irb') + get_constant("irb") end def get_constant(name) const_name = { - 'pry' => :Pry, - 'ripl' => :Ripl, - 'irb' => :IRB, + "pry" => :Pry, + "ripl" => :Ripl, + "irb" => :IRB, }[name] Object.const_get(const_name) rescue NameError diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index aee7960c4d..d7c3267206 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -1,4 +1,4 @@ -require 'bundler/current_ruby' +require "bundler/current_ruby" module Bundler class CLI::Exec diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 4890e2f707..7918397055 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -1,4 +1,4 @@ -require 'pathname' +require "pathname" module Bundler class CLI::Gem @@ -18,11 +18,11 @@ module Bundler def run Bundler.ui.confirm "Creating gem '#{name}'..." - underscored_name = name.tr('-', '_') - namespaced_path = name.tr('-', '/') - constant_name = name.gsub(/-[_-]*(?![_-]|$)/){ '::' }.gsub(/([_-]+|(::)|^)(.|$)/){ $2.to_s + $3.upcase } - constant_array = constant_name.split('::') - test_task = options[:test] == 'minitest' ? 'test' : 'spec' + underscored_name = name.tr("-", "_") + namespaced_path = name.tr("-", "/") + constant_name = name.gsub(/-[_-]*(?![_-]|$)/){ "::" }.gsub(/([_-]+|(::)|^)(.|$)/){ $2.to_s + $3.upcase } + constant_array = constant_name.split("::") + test_task = options[:test] == "minitest" ? "test" : "spec" git_user_name = `git config user.name`.chomp git_user_email = `git config user.email`.chomp @@ -66,13 +66,13 @@ module Bundler templates.merge!(".travis.yml.tt" => ".travis.yml") case test_framework - when 'rspec' + when "rspec" templates.merge!( "rspec.tt" => ".rspec", "spec/spec_helper.rb.tt" => "spec/spec_helper.rb", "spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb" ) - when 'minitest' + when "minitest" templates.merge!( "test/test_helper.rb.tt" => "test/test_helper.rb", "test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb" @@ -150,7 +150,7 @@ module Bundler end def validate_ext_name - return unless gem_name.index('-') + return unless gem_name.index("-") Bundler.ui.error "You have specified a gem name which does not conform to the \n" \ "naming guidelines for C extensions. For more information, \n" \ @@ -183,7 +183,7 @@ module Bundler def bundler_dependency_version v = Gem::Version.new(Bundler::VERSION) req = v.segments[0..1] - req << 'a' if v.prerelease? + req << "a" if v.prerelease? req.join(".") end diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index 31299bb21e..1d201a90f5 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -19,13 +19,13 @@ module Bundler end spec = Gem::Specification.load(gemspec) puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" - File.open('Gemfile', 'wb') do |file| + File.open("Gemfile", "wb") do |file| file << "# Generated from #{gemspec}\n" file << spec.to_gemfile end else puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" - FileUtils.cp(File.expand_path('../../templates/Gemfile', __FILE__), 'Gemfile') + FileUtils.cp(File.expand_path("../../templates/Gemfile", __FILE__), "Gemfile") end end end diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 128f9d6f2a..be4ee3d171 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -39,7 +39,7 @@ module Bundler options[:with] = with options[:without] = without - ENV['RB_USER_INSTALL'] = '1' if Bundler::FREEBSD + ENV["RB_USER_INSTALL"] = "1" if Bundler::FREEBSD # Just disable color in deployment mode Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment] @@ -53,7 +53,7 @@ module Bundler if (options["trust-policy"]) unless (Bundler.rubygems.security_policies.keys.include?(options["trust-policy"])) Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \ - "The known policies are: #{Bundler.rubygems.security_policies.keys.join(', ')}." + "The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}." exit 1 end Bundler.settings["trust-policy"] = options["trust-policy"] @@ -63,7 +63,7 @@ module Bundler if options[:deployment] || options[:frozen] unless Bundler.default_lockfile.exist? - flag = options[:deployment] ? '--deployment' : '--frozen' + flag = options[:deployment] ? "--deployment" : "--frozen" raise ProductionError, "The #{flag} flag requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \ "sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \ "before deploying." @@ -73,7 +73,7 @@ module Bundler options[:local] = true end - Bundler.settings[:frozen] = '1' + Bundler.settings[:frozen] = "1" end # When install is called with --no-deployment, disable deployment mode @@ -96,7 +96,7 @@ module Bundler Bundler.settings.without = options[:without] Bundler.settings.with = options[:with] Bundler::Fetcher.disable_endpoint = options["full-index"] - Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil + Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? "1" : nil # rubygems plugins sometimes hook into the gem install process Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins) @@ -112,7 +112,7 @@ module Bundler if Bundler.settings[:path] absolute_path = File.expand_path(Bundler.settings[:path]) - relative_path = absolute_path.sub(File.expand_path('.'), '.') + relative_path = absolute_path.sub(File.expand_path("."), ".") Bundler.ui.confirm "Bundled gems are installed into #{relative_path}." else Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed." @@ -172,12 +172,12 @@ module Bundler def dependencies_count_for(definition) count = definition.dependencies.count - "#{count} Gemfile #{count == 1 ? 'dependency' : 'dependencies'}" + "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}" end def gems_installed_for(definition) count = definition.specs.count - "#{count} #{count == 1 ? 'gem' : 'gems'} now installed" + "#{count} #{count == 1 ? "gem" : "gems"} now installed" end def print_post_install_message(name, msg) diff --git a/lib/bundler/cli/open.rb b/lib/bundler/cli/open.rb index 474eec433b..b6bfda4d25 100644 --- a/lib/bundler/cli/open.rb +++ b/lib/bundler/cli/open.rb @@ -1,5 +1,5 @@ -require 'bundler/cli/common' -require 'shellwords' +require "bundler/cli/common" +require "shellwords" module Bundler class CLI::Open @@ -10,12 +10,12 @@ module Bundler end def run - editor = [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? } + editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find{|e| !e.nil? && !e.empty? } return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path Dir.chdir(path) do command = Shellwords.split(editor) + [path] - system(*command) || Bundler.ui.info("Could not run '#{command.join(' ')}'") + system(*command) || Bundler.ui.info("Could not run '#{command.join(" ")}'") end end end diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index 94dd032a9d..9b82079664 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -1,4 +1,4 @@ -require 'bundler/cli/common' +require "bundler/cli/common" module Bundler class CLI::Outdated diff --git a/lib/bundler/cli/package.rb b/lib/bundler/cli/package.rb index f99678c9ec..de53cb6d8d 100644 --- a/lib/bundler/cli/package.rb +++ b/lib/bundler/cli/package.rb @@ -23,7 +23,7 @@ module Bundler private def install - require 'bundler/cli/install' + require "bundler/cli/install" options = self.options.dup if Bundler.settings[:cache_all_platforms] options["local"] = false diff --git a/lib/bundler/cli/show.rb b/lib/bundler/cli/show.rb index 161e931c72..824b3936d5 100644 --- a/lib/bundler/cli/show.rb +++ b/lib/bundler/cli/show.rb @@ -1,4 +1,4 @@ -require 'bundler/cli/common' +require "bundler/cli/common" module Bundler class CLI::Show @@ -40,10 +40,10 @@ module Bundler desc = " * #{s.name} (#{s.version}#{s.git_version})" if @verbose latest = latest_specs.find { |l| l.name == s.name } - Bundler.ui.info <<-END.gsub(/^ +/, '') + Bundler.ui.info <<-END.gsub(/^ +/, "") #{desc} - \tSummary: #{s.summary || 'No description available.'} - \tHomepage: #{s.homepage || 'No website available.'} + \tSummary: #{s.summary || "No description available."} + \tHomepage: #{s.homepage || "No website available."} \tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"} END else diff --git a/lib/bundler/cli/viz.rb b/lib/bundler/cli/viz.rb index 06f3deb245..3e1b29a513 100644 --- a/lib/bundler/cli/viz.rb +++ b/lib/bundler/cli/viz.rb @@ -6,7 +6,7 @@ module Bundler end def run - require 'graphviz' + require "graphviz" output_file = File.expand_path(options[:file]) graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format], options[:without]) graph.viz diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 532f587f28..8aef625290 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -128,7 +128,7 @@ module Bundler end def mswin64? - Bundler::WINDOWS && Gem::Platform.local.os == "mswin64" && Gem::Platform.local.cpu == 'x64' + Bundler::WINDOWS && Gem::Platform.local.os == "mswin64" && Gem::Platform.local.cpu == "x64" end def mswin64_19? @@ -148,7 +148,7 @@ module Bundler end def mingw? - Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != 'x64' + Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != "x64" end def mingw_18? @@ -172,7 +172,7 @@ module Bundler end def x64_mingw? - Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == 'x64' + Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == "x64" end def x64_mingw_20? diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 9c84d350d2..d5b7bad79c 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -140,7 +140,7 @@ module Bundler unless specs["bundler"].any? local = Bundler.settings[:frozen] ? rubygems_index : index - bundler = local.search(Gem::Dependency.new('bundler', VERSION)).last + bundler = local.search(Gem::Dependency.new("bundler", VERSION)).last specs["bundler"] = bundler if bundler end @@ -265,7 +265,7 @@ module Bundler return end - File.open(file, 'wb'){|f| f.puts(contents) } + File.open(file, "wb"){|f| f.puts(contents) } rescue Errno::EACCES raise PermissionError.new(file) end @@ -294,7 +294,7 @@ module Bundler # are ordered consistently sort_by(&:full_name). each do |spec| - next if spec.name == 'bundler' + next if spec.name == "bundler" out << spec.to_lock end out << "\n" @@ -370,8 +370,8 @@ module Bundler both_sources.each do |name, (dep, lock_source)| if (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep)) - gemfile_source_name = (dep && dep.source) || 'no specified source' - lockfile_source_name = lock_source || 'no specified source' + gemfile_source_name = (dep && dep.source) || "no specified source" + lockfile_source_name = lock_source || "no specified source" changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`" end end diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb index d02bbeeaaf..1956863c2d 100644 --- a/lib/bundler/dependency.rb +++ b/lib/bundler/dependency.rb @@ -1,6 +1,6 @@ -require 'rubygems/dependency' -require 'bundler/shared_helpers' -require 'bundler/rubygems_ext' +require "rubygems/dependency" +require "bundler/shared_helpers" +require "bundler/rubygems_ext" module Bundler class Dependency < Gem::Dependency @@ -57,8 +57,8 @@ module Bundler @env = options["env"] @should_include = options.fetch("should_include", true) - if options.key?('require') - @autorequire = Array(options['require'] || []) + if options.key?("require") + @autorequire = Array(options["require"] || []) end end @@ -98,7 +98,7 @@ module Bundler def to_lock out = super - out << '!' if source + out << "!" if source out << "\n" end diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb index 072843d7a5..163f61eabb 100644 --- a/lib/bundler/deployment.rb +++ b/lib/bundler/deployment.rb @@ -40,7 +40,7 @@ module Bundler send task_method, :install, opts do bundle_cmd = context.fetch(:bundle_cmd, "bundle") bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet") - bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle')) + bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), "bundle")) bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile") bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact bundle_with = [*context.fetch(:bundle_with, [])].compact @@ -54,7 +54,7 @@ module Bundler args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty? args << "--with #{bundle_with.join(" ")}" unless bundle_with.empty? - run "cd #{app_path} && #{bundle_cmd} install #{args.join(' ')}" + run "cd #{app_path} && #{bundle_cmd} install #{args.join(" ")}" end end end diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 037bea44b1..750c549d94 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -1,5 +1,5 @@ -require 'bundler/dependency' -require 'bundler/ruby_dsl' +require "bundler/dependency" +require "bundler/ruby_dsl" module Bundler class Dsl @@ -38,9 +38,9 @@ module Bundler end def gemspec(opts = nil) - path = opts && opts[:path] || '.' + path = opts && opts[:path] || "." glob = opts && opts[:glob] - name = opts && opts[:name] || '{,*}' + name = opts && opts[:name] || "{,*}" development_group = opts && opts[:development_group] || :development expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname) @@ -104,7 +104,7 @@ module Bundler else raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \ "You specified that #{dep.name} (#{dep.requirement}) should come from " \ - "#{current.source || 'an unspecified source'} and #{dep.source}\n" + "#{current.source || "an unspecified source"} and #{dep.source}\n" end end end @@ -219,7 +219,7 @@ module Bundler git_source(:gist){ |repo_name| "https://gist.github.com/#{repo_name}.git" } git_source(:bitbucket) do |repo_name| - user_name, repo_name = repo_name.split '/' + user_name, repo_name = repo_name.split "/" repo_name ||= user_name "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git" end @@ -321,7 +321,7 @@ 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 = "You passed #{invalid_keys.map{|k| ":"+k }.join(", ")} " message << if invalid_keys.size > 1 "as options for #{command}, but they are invalid." else @@ -434,17 +434,17 @@ module Bundler trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) } || trace_line return m unless trace_line - line_numer = trace_line.split(':')[1].to_i - 1 + line_numer = trace_line.split(":")[1].to_i - 1 return m unless line_numer lines = contents.lines.to_a - indent = ' # ' - indicator = indent.gsub('#', '>') + indent = " # " + indicator = indent.gsub("#", ">") first_line = (line_numer.zero?) last_line = (line_numer == (lines.count - 1)) m << "\n" - m << "#{indent}from #{trace_line.gsub(/:in.*$/, '')}\n" + m << "#{indent}from #{trace_line.gsub(/:in.*$/, "")}\n" m << "#{indent}-------------------------------------------\n" m << "#{indent}#{ lines[line_numer - 1] }" unless first_line m << "#{indicator}#{ lines[line_numer] }" @@ -460,7 +460,7 @@ module Bundler description = self.description if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/ trace_line = Regexp.last_match[1] - description = description.sub(/#{Regexp.quote trace_line}:\s*/, '').sub("\n", ' - ') + description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ") end [trace_line, description] end diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb index f52764310b..ea82088f39 100644 --- a/lib/bundler/env.rb +++ b/lib/bundler/env.rb @@ -1,5 +1,5 @@ -require 'bundler/rubygems_integration' -require 'bundler/source/git/git_proxy' +require "bundler/rubygems_integration" +require "bundler/source/git/git_proxy" module Bundler class Env @@ -14,13 +14,13 @@ module Bundler out << " Bundler #{Bundler::VERSION}\n" out << " Rubygems #{Gem::VERSION}\n" out << " Ruby #{ruby_version}" - out << " GEM_HOME #{ENV['GEM_HOME']}\n" unless ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty? - out << " GEM_PATH #{ENV['GEM_PATH']}\n" unless ENV['GEM_PATH'] == ENV['GEM_HOME'] - out << " RVM #{ENV['rvm_version']}\n" if ENV['rvm_version'] + out << " GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty? + out << " GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"] + out << " RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"] out << " Git #{git_version}\n" %w(rubygems-bundler open_gem).each do |name| specs = Bundler.rubygems.find_name(name) - out << " #{name} (#{specs.map(&:version).join(',')})\n" unless specs.empty? + out << " #{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty? end out << "\nBundler settings\n\n" unless Bundler.settings.all.empty? @@ -54,7 +54,7 @@ module Bundler def ruby_version str = "#{RUBY_VERSION}" - if RUBY_VERSION < '1.9' + if RUBY_VERSION < "1.9" str << " (#{RUBY_RELEASE_DATE}" str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL str << ") [#{RUBY_PLATFORM}]\n" diff --git a/lib/bundler/environment.rb b/lib/bundler/environment.rb index 837c4db009..0e4ed37814 100644 --- a/lib/bundler/environment.rb +++ b/lib/bundler/environment.rb @@ -6,7 +6,7 @@ module Bundler @root = root @definition = definition - env_file = Bundler.app_config_path.join('environment.rb') + env_file = Bundler.app_config_path.join("environment.rb") env_file.rmtree if env_file.exist? end diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index d2f7551ee1..7592d1739b 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -1,14 +1,14 @@ -require 'bundler/vendored_persistent' -require 'cgi' -require 'securerandom' +require "bundler/vendored_persistent" +require "cgi" +require "securerandom" module Bundler # Handles all the fetching with the rubygems server class Fetcher - autoload :Downloader, 'bundler/fetcher/downloader' - autoload :Dependency, 'bundler/fetcher/dependency' - autoload :Index, 'bundler/fetcher/index' + autoload :Downloader, "bundler/fetcher/downloader" + autoload :Dependency, "bundler/fetcher/dependency" + autoload :Index, "bundler/fetcher/index" # This error is raised when it looks like the network is down class NetworkDownError < HTTPError; end @@ -75,11 +75,11 @@ module Bundler # fetch a gem specification def fetch_spec(spec) - spec = spec - [nil, 'ruby', ''] - spec_file_name = "#{spec.join '-'}.gemspec" + spec = spec - [nil, "ruby", ""] + spec_file_name = "#{spec.join "-"}.gemspec" uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") - if uri.scheme == 'file' + if uri.scheme == "file" Bundler.load_marshal Gem.inflate(Gem.read_binary(uri.path)) elsif cached_spec_path = gemspec_cached_path(spec_file_name) Bundler.load_gemspec(cached_spec_path) @@ -106,7 +106,7 @@ module Bundler @use_api = false if fetchers.none?(&:api_fetcher?) specs[remote_uri].each do |name, version, platform, dependencies| - next if name == 'bundler' + next if name == "bundler" spec = nil if dependencies spec = EndpointSpecification.new(name, version, platform, dependencies) @@ -202,7 +202,7 @@ module Bundler Bundler.settings[:ssl_client_cert] raise SSLError if needs_ssl && !defined?(OpenSSL::SSL) - con = Net::HTTP::Persistent.new 'bundler', :ENV + con = Net::HTTP::Persistent.new "bundler", :ENV if remote_uri.scheme == "https" con.verify_mode = (Bundler.settings[:ssl_verify_mode] || diff --git a/lib/bundler/fetcher/base.rb b/lib/bundler/fetcher/base.rb index 729be04fb5..f0818e15cd 100644 --- a/lib/bundler/fetcher/base.rb +++ b/lib/bundler/fetcher/base.rb @@ -7,7 +7,7 @@ module Bundler attr_reader :display_uri def initialize(downloader, remote_uri, fetch_uri, display_uri) - raise 'Abstract class' if self.class == Base + raise "Abstract class" if self.class == Base @downloader = downloader @remote_uri = remote_uri @fetch_uri = fetch_uri diff --git a/lib/bundler/fetcher/dependency.rb b/lib/bundler/fetcher/dependency.rb index e495c7fd30..2f5d41daea 100644 --- a/lib/bundler/fetcher/dependency.rb +++ b/lib/bundler/fetcher/dependency.rb @@ -1,4 +1,4 @@ -require 'bundler/fetcher/base' +require "bundler/fetcher/base" module Bundler class Fetcher @@ -43,7 +43,7 @@ module Bundler end def dependency_specs(gem_names) - Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(',')}" + Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(",")}" gem_list = [] deps_list = [] diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index f9bd279d0d..7f4cff2f09 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -1,4 +1,4 @@ -require 'bundler/fetcher/base' +require "bundler/fetcher/base" module Bundler class Fetcher diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index 8838ac8467..0a90ca506e 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -43,11 +43,11 @@ module Bundler end def self.request_issue_report_for(e) - Bundler.ui.info <<-EOS.gsub(/^ {6}/, '') + Bundler.ui.info <<-EOS.gsub(/^ {6}/, "") --- ERROR REPORT TEMPLATE ------------------------------------------------------- - What did you do? - I ran the command `#{$PROGRAM_NAME} #{ARGV.join(' ')}` + I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}` - What did you expect to happen? @@ -70,7 +70,7 @@ module Bundler Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue." - Bundler.ui.warn <<-EOS.gsub(/^ {6}/, '') + Bundler.ui.warn <<-EOS.gsub(/^ {6}/, "") First, try this link to see if there are any existing issue reports for this error: #{issues_url(e)} @@ -81,7 +81,7 @@ module Bundler end def self.issues_url(exception) - 'https://github.com/bundler/bundler/search?q=' \ + "https://github.com/bundler/bundler/search?q=" \ "#{CGI.escape(exception.message.lines.first.chomp)}&type=Issues" end diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb index 2d8684b750..58d4b20928 100644 --- a/lib/bundler/gem_helper.rb +++ b/lib/bundler/gem_helper.rb @@ -1,5 +1,5 @@ -require 'bundler/vendored_thor' unless defined?(Thor) -require 'bundler' +require "bundler/vendored_thor" unless defined?(Thor) +require "bundler" module Bundler class GemHelper @@ -35,35 +35,35 @@ module Bundler built_gem_path = nil desc "Build #{name}-#{version}.gem into the pkg directory." - task 'build' do + task "build" do built_gem_path = build_gem end desc "Build and install #{name}-#{version}.gem into system gems." - task 'install' => 'build' do + task "install" => "build" do install_gem(built_gem_path) end desc "Build and install #{name}-#{version}.gem into system gems without network access." - task 'install:local' => 'build' do + task "install:local" => "build" do install_gem(built_gem_path, :local) end desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems\n" \ "To prevent publishing in Rubygems use `gem_push=no rake release`" - task 'release', [:remote] => ['build', 'release:guard_clean', - 'release:source_control_push', 'release:rubygem_push'] do + task "release", [:remote] => ["build", "release:guard_clean", + "release:source_control_push", "release:rubygem_push"] do end - task 'release:guard_clean' do + task "release:guard_clean" do guard_clean end - task 'release:source_control_push', [:remote] do |t, args| + task "release:source_control_push", [:remote] do |t, args| tag_version { git_push(args[:remote]) } unless already_tagged? end - task 'release:rubygem_push' do + task "release:rubygem_push" do rubygem_push(built_gem_path) if gem_push? end @@ -74,16 +74,16 @@ module Bundler file_name = nil sh("gem build -V '#{spec_path}'") { |out, code| file_name = File.basename(built_gem_path) - FileUtils.mkdir_p(File.join(base, 'pkg')) - FileUtils.mv(built_gem_path, 'pkg') + FileUtils.mkdir_p(File.join(base, "pkg")) + FileUtils.mv(built_gem_path, "pkg") Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}." } - File.join(base, 'pkg', file_name) + File.join(base, "pkg", file_name) end def install_gem(built_gem_path = nil, local = false) built_gem_path ||= build_gem - out, _ = sh_with_code("gem install '#{built_gem_path}'#{' --local' if local}") + out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}") raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/] Bundler.ui.confirm "#{name} (#{version}) installed." end @@ -103,20 +103,20 @@ module Bundler Dir[File.join(base, "#{name}-*.gem")].sort_by{|f| File.mtime(f)}.last end - def git_push(remote = '') + def git_push(remote = "") perform_git_push remote perform_git_push "#{remote} --tags" Bundler.ui.confirm "Pushed git commits and tags." end - def perform_git_push(options = '') + def perform_git_push(options = "") cmd = "git push #{options}" out, code = sh_with_code(cmd) raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0 end def already_tagged? - if sh('git tag').split(/\n/).include?(version_tag) + if sh("git tag").split(/\n/).include?(version_tag) Bundler.ui.confirm "Tag #{version_tag} has already been created." true end @@ -163,7 +163,7 @@ module Bundler def sh_with_code(cmd, &block) cmd << " 2>&1" - outbuf = '' + outbuf = "" Bundler.ui.debug(cmd) SharedHelpers.chdir(base) { outbuf = `#{cmd}` @@ -175,7 +175,7 @@ module Bundler end def gem_push? - ! %w{n no nil false off 0}.include?(ENV['gem_push'].to_s.downcase) + ! %w{n no nil false off 0}.include?(ENV["gem_push"].to_s.downcase) end end end diff --git a/lib/bundler/gem_helpers.rb b/lib/bundler/gem_helpers.rb index 2af87c94d9..fc1a341574 100644 --- a/lib/bundler/gem_helpers.rb +++ b/lib/bundler/gem_helpers.rb @@ -3,13 +3,13 @@ module Bundler GENERIC_CACHE = {} GENERICS = [ - [Gem::Platform.new('java'), Gem::Platform.new('java')], - [Gem::Platform.new('mswin32'), Gem::Platform.new('mswin32')], - [Gem::Platform.new('mswin64'), Gem::Platform.new('mswin64')], - [Gem::Platform.new('universal-mingw32'), Gem::Platform.new('universal-mingw32')], - [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')] + [Gem::Platform.new("java"), Gem::Platform.new("java")], + [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")], + [Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")], + [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")], + [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")] ] def generic(p) diff --git a/lib/bundler/gem_installer.rb b/lib/bundler/gem_installer.rb index 7d84939853..8124e4bcfc 100644 --- a/lib/bundler/gem_installer.rb +++ b/lib/bundler/gem_installer.rb @@ -1,4 +1,4 @@ -require 'rubygems/installer' +require "rubygems/installer" module Bundler class GemInstaller < Gem::Installer diff --git a/lib/bundler/gem_tasks.rb b/lib/bundler/gem_tasks.rb index bc7590886f..4c8f28c9d6 100644 --- a/lib/bundler/gem_tasks.rb +++ b/lib/bundler/gem_tasks.rb @@ -1,2 +1,2 @@ -require 'bundler/gem_helper' +require "bundler/gem_helper" Bundler::GemHelper.install_tasks diff --git a/lib/bundler/graph.rb b/lib/bundler/graph.rb index 5138a1378e..a89cd1c70f 100644 --- a/lib/bundler/graph.rb +++ b/lib/bundler/graph.rb @@ -1,4 +1,4 @@ -require 'set' +require "set" module Bundler class Graph GRAPH_NAME = :Gemfile @@ -126,7 +126,7 @@ module Bundler def g @g ||= ::GraphViz.digraph(@graph_name, {:concentrate => true, :normalize => true, :nodesep => 0.55}) do |g| g.edge[:weight] = 2 - g.edge[:fontname] = g.node[:fontname] = 'Arial, Helvetica, SansSerif' + g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif" g.edge[:fontsize] = 12 end end @@ -135,8 +135,8 @@ module Bundler @groups.each do |group| g.add_nodes( group, - {:style => 'filled', - :fillcolor => '#B9B9D5', + {:style => "filled", + :fillcolor => "#B9B9D5", :shape => "box3d", :fontsize => 16}.merge(@node_options[group]) ) @@ -145,7 +145,7 @@ module Bundler @relations.each do |parent, children| children.each do |child| if @groups.include?(parent) - g.add_nodes(child, {:style => 'filled', :fillcolor => '#B9B9D5'}.merge(@node_options[child])) + g.add_nodes(child, {:style => "filled", :fillcolor => "#B9B9D5"}.merge(@node_options[child])) g.add_edges(parent, child, {:constraint => false}.merge(@edge_options["#{parent}_#{child}"])) else g.add_nodes(child, @node_options[child]) diff --git a/lib/bundler/index.rb b/lib/bundler/index.rb index 5789fd8d4f..5091d0a18d 100644 --- a/lib/bundler/index.rb +++ b/lib/bundler/index.rb @@ -68,7 +68,7 @@ module Bundler end end - results.sort_by {|s| [s.version, s.platform.to_s == 'ruby' ? "\0" : s.platform.to_s] } + results.sort_by {|s| [s.version, s.platform.to_s == "ruby" ? "\0" : s.platform.to_s] } end def local_search(query, base = nil) @@ -177,7 +177,7 @@ module Bundler spec ? [spec] : [] end - if RUBY_VERSION < '1.9' + if RUBY_VERSION < "1.9" def same_version?(a, b) regex = /^(.*?)(?:\.0)*$/ a.to_s[regex, 1] == b.to_s[regex, 1] diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index 5bac0c8e6d..04096c3f11 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -40,7 +40,7 @@ module Bundler # return an array of the deps that we added return @new_deps ensure - Bundler.settings[:frozen] = '1' if frozen + Bundler.settings[:frozen] = "1" if frozen end private diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 2f77603293..9df19b02ad 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -28,12 +28,12 @@ # puts Pod::VERSION # => "0.34.4" # def gemfile(install = false, &gemfile) - require 'bundler' + require "bundler" old_root = Bundler.method(:root) def Bundler.root Bundler::SharedHelpers.pwd.expand_path end - ENV['BUNDLE_GEMFILE'] ||= 'Gemfile' + ENV["BUNDLE_GEMFILE"] ||= "Gemfile" builder = Bundler::Dsl.new builder.instance_eval(&gemfile) diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 38869c09f1..432cdd0107 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -1,6 +1,6 @@ -require 'erb' -require 'rubygems/dependency_installer' -require 'bundler/worker' +require "erb" +require "rubygems/dependency_installer" +require "bundler/worker" module Bundler class Installer < Environment @@ -125,7 +125,7 @@ module Bundler if options.any? Bundler.ui.warn "#{spec.name} has no executables, but you may want " + "one from a gem it depends on." - options.each{|name,bins| Bundler.ui.warn " #{name} has: #{bins.join(', ')}" } + options.each{|name,bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" } else Bundler.ui.warn "There are no executables for the gem #{spec.name}." end @@ -134,7 +134,7 @@ module Bundler # double-assignment to avoid warnings about variables that will be used by ERB bin_path = bin_path = Bundler.bin_path - template = template = File.read(File.expand_path('../templates/Executable', __FILE__)) + template = template = File.read(File.expand_path("../templates/Executable", __FILE__)) relative_gemfile_path = relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path) ruby_command = ruby_command = Thor::Util.ruby_command @@ -148,8 +148,8 @@ module Bundler next end - File.open(binstub_path, 'w', 0777 & ~File.umask) do |f| - f.puts ERB.new(template, nil, '-').result(binding) + File.open(binstub_path, "w", 0777 & ~File.umask) do |f| + f.puts ERB.new(template, nil, "-").result(binding) end end @@ -158,10 +158,10 @@ module Bundler when 1 Bundler.ui.warn "Skipped #{exists[0]} since it already exists." when 2 - Bundler.ui.warn "Skipped #{exists.join(' and ')} since they already exist." + Bundler.ui.warn "Skipped #{exists.join(" and ")} since they already exist." else - items = exists[0...-1].empty? ? nil : exists[0...-1].join(', ') - skipped = [items, exists[-1]].compact.join(' and ') + items = exists[0...-1].empty? ? nil : exists[0...-1].join(", ") + skipped = [items, exists[-1]].compact.join(" and ") Bundler.ui.warn "Skipped #{skipped} since they already exist." end Bundler.ui.warn "If you want to overwrite skipped stubs, use --force." @@ -178,7 +178,7 @@ module Bundler force = options["force"] jobs = [Bundler.settings[:jobs].to_i-1, 1].max if jobs > 1 && can_install_in_parallel? - require 'bundler/installer/parallel_installer' + require "bundler/installer/parallel_installer" install_in_parallel jobs, options[:standalone], force else install_sequentially options[:standalone], force @@ -199,15 +199,15 @@ module Bundler def generate_standalone_bundler_executable_stubs(spec) # double-assignment to avoid warnings about variables that will be used by ERB bin_path = Bundler.bin_path - template = File.read(File.expand_path('../templates/Executable.standalone', __FILE__)) + template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__)) ruby_command = ruby_command = Thor::Util.ruby_command spec.executables.each do |executable| next if executable == "bundle" standalone_path = standalone_path = Pathname(Bundler.settings[:path]).expand_path.relative_path_from(bin_path) executable_path = executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path) - File.open "#{bin_path}/#{executable}", 'w', 0755 do |f| - f.puts ERB.new(template, nil, '-').result(binding) + File.open "#{bin_path}/#{executable}", "w", 0755 do |f| + f.puts ERB.new(template, nil, "-").result(binding) end end end @@ -232,7 +232,7 @@ module Bundler spec.require_paths.each do |path| full_path = File.join(spec.full_gem_path, path) gem_path = Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)) - paths << gem_path.to_s.sub("#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG['ruby_version']}", '#{ruby_engine}/#{ruby_version}') + paths << gem_path.to_s.sub("#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG["ruby_version"]}", "#{ruby_engine}/#{ruby_version}") end end diff --git a/lib/bundler/installer/parallel_installer.rb b/lib/bundler/installer/parallel_installer.rb index c0d858aad2..c152a7eaa4 100644 --- a/lib/bundler/installer/parallel_installer.rb +++ b/lib/bundler/installer/parallel_installer.rb @@ -1,4 +1,4 @@ -require 'bundler/worker' +require "bundler/worker" class ParallelInstaller class SpecInstallation diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index c5d860c2ab..ee6b159b3e 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -142,7 +142,7 @@ module Bundler dep = Bundler::Dependency.new(name, version) - if pinned && dep.name != 'bundler' + if pinned && dep.name != "bundler" spec = @specs.find {|k, v| v.name == dep.name } dep.source = spec.last.source if spec @@ -172,7 +172,7 @@ module Bundler @specs[@current_spec.identifier] ||= @current_spec elsif line =~ NAME_VERSION_6 name, version = $1, $2 - version = version.split(',').map(&:strip) if version + version = version.split(",").map(&:strip) if version dep = Gem::Dependency.new(name, version) @current_spec.dependencies << dep end diff --git a/lib/bundler/match_platform.rb b/lib/bundler/match_platform.rb index e6a33ecbad..1dda3cadc1 100644 --- a/lib/bundler/match_platform.rb +++ b/lib/bundler/match_platform.rb @@ -1,4 +1,4 @@ -require 'bundler/gem_helpers' +require "bundler/gem_helpers" module Bundler module MatchPlatform diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb index 7ce3bb94af..46398057b9 100644 --- a/lib/bundler/psyched_yaml.rb +++ b/lib/bundler/psyched_yaml.rb @@ -1,19 +1,19 @@ # Psych could be a gem, so try to ask for it begin - gem 'psych' + gem "psych" rescue LoadError end if defined?(gem) # Psych could just be in the stdlib # but it's too late if Syck is already loaded begin - require 'psych' unless defined?(Syck) + require "psych" unless defined?(Syck) rescue LoadError # Apparently Psych wasn't available. Oh well. end # At least load the YAML stdlib, whatever that may be -require 'yaml' unless defined?(YAML.dump) +require "yaml" unless defined?(YAML.dump) module Bundler # On encountering invalid YAML, diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 78711b23f1..68eff38725 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -1,4 +1,4 @@ -require 'set' +require "set" # This is the latest iteration of the gem dependency resolving algorithm. As of now, # it can resolve (as a success or failure) any set of gem dependencies we throw at it @@ -8,19 +8,19 @@ require 'set' module Bundler class Resolver - require 'bundler/vendored_molinillo' + require "bundler/vendored_molinillo" class Molinillo::VersionConflict def clean_req(req) if req.to_s.include?(">= 0") - req.to_s.gsub(/ \(.*?\)$/, '') + req.to_s.gsub(/ \(.*?\)$/, "") else - req.to_s.gsub(/\, (runtime|development)\)$/, ')') + req.to_s.gsub(/\, (runtime|development)\)$/, ")") end end def message - conflicts.values.flatten.reduce('') do |o, conflict| + conflicts.values.flatten.reduce("") do |o, conflict| o << %(Bundler could not find compatible versions for gem "#{conflict.requirement.name}":\n) if conflict.locked_requirement o << %( In snapshot (#{Bundler.default_lockfile.basename}):\n) @@ -29,10 +29,10 @@ module Bundler end o << %( In Gemfile:\n) o << conflict.requirement_trees.map do |tree| - t = '' + t = "" depth = 2 tree.each do |req| - t << ' ' * depth << %(#{clean_req req}) + t << " " * depth << %(#{clean_req req}) t << %( depends on) unless tree[-1] == req t << %(\n) depth += 1 @@ -40,7 +40,7 @@ module Bundler t end.join("\n") - if conflict.requirement.name == 'bundler' + if conflict.requirement.name == "bundler" o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION})) other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new Bundler::VERSION) end @@ -202,7 +202,7 @@ module Bundler names = e.dependencies.sort_by(&:name).map { |d| "gem '#{d.name}'"} raise CyclicDependencyError, "Your bundle requires gems that depend" \ " on each other, creating an infinite loop. Please remove" \ - " #{names.count > 1 ? 'either ' : '' }#{names.join(' or ')}" \ + " #{names.count > 1 ? "either " : "" }#{names.join(" or ")}" \ " and try again." end @@ -216,24 +216,24 @@ module Bundler if debug? debug_info = yield debug_info = debug_info.inspect unless debug_info.is_a?(String) - STDERR.puts debug_info.split("\n").map { |s| ' ' * depth + s } + STDERR.puts debug_info.split("\n").map { |s| " " * depth + s } end end def debug? - ENV['DEBUG_RESOLVER'] || ENV['DEBUG_RESOLVER_TREE'] + ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"] end def before_resolution - Bundler.ui.info 'Resolving dependencies...', false + Bundler.ui.info "Resolving dependencies...", false end def after_resolution - Bundler.ui.info '' + Bundler.ui.info "" end def indicate_progress - Bundler.ui.info '.', false + Bundler.ui.info ".", false end private @@ -277,11 +277,11 @@ module Bundler end def name_for_explicit_dependency_source - Bundler.default_gemfile.basename.to_s rescue 'Gemfile' + Bundler.default_gemfile.basename.to_s rescue "Gemfile" end def name_for_locking_dependency_source - Bundler.default_lockfile.basename.to_s rescue 'Gemfile.lock' + Bundler.default_lockfile.basename.to_s rescue "Gemfile.lock" end def requirement_satisfied_by?(requirement, activated, spec) @@ -306,7 +306,7 @@ module Bundler if base = @base[dependency.name] and !base.empty? dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1 else - base_dep = Dependency.new dependency.name, '>= 0.a' + base_dep = Dependency.new dependency.name, ">= 0.a" all = search_for(DepProxy.new base_dep, dependency.__platform).size.to_f if all.zero? 0 @@ -321,7 +321,7 @@ module Bundler def verify_gemfile_dependencies_are_found!(requirements) requirements.each do |requirement| - next if requirement.name == 'bundler' + next if requirement.name == "bundler" if search_for(requirement).empty? if base = @base[requirement.name] and !base.empty? version = base.first.version @@ -334,7 +334,7 @@ module Bundler versions = @source_requirements[name][name].map(&:version) message = "Could not find gem '#{requirement}' in #{requirement.source}.\n" if versions.any? - message << "Source contains '#{name}' at: #{versions.join(', ')}" + message << "Source contains '#{name}' at: #{versions.join(", ")}" else message << "Source does not contain any versions of '#{requirement}'" end diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index f423f4a6f6..cf3d36d925 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -1,13 +1,13 @@ -require 'pathname' +require "pathname" if defined?(Gem::QuickLoader) # Gem Prelude makes me a sad panda :'( Gem::QuickLoader.load_full_rubygems_library end -require 'rubygems' -require 'rubygems/specification' -require 'bundler/match_platform' +require "rubygems" +require "rubygems/specification" +require "bundler/match_platform" module Gem @loaded_stacks = Hash.new { |h,k| h[k] = [] } @@ -88,11 +88,11 @@ module Gem private def dependencies_to_gemfile(dependencies, group = nil) - gemfile = '' + gemfile = "" if dependencies.any? gemfile << "group :#{group} do\n" if group dependencies.each do |dependency| - gemfile << ' ' if group + gemfile << " " if group gemfile << %|gem "#{dependency.name}"| req = dependency.requirements_list.first gemfile << %|, "#{req}"| if req @@ -111,7 +111,7 @@ module Gem def encode_with(coder) to_yaml_properties.each do |ivar| - coder[ivar.to_s.sub(/^@/, '')] = instance_variable_get(ivar) + coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar) end end @@ -123,7 +123,7 @@ module Gem out = " #{name}" unless requirement == Gem::Requirement.default reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }.sort.reverse - out << " (#{reqs.join(', ')})" + out << " (#{reqs.join(", ")})" end out end @@ -146,11 +146,11 @@ module Gem end class Platform - JAVA = Gem::Platform.new('java') unless defined?(JAVA) - MSWIN = Gem::Platform.new('mswin32') unless defined?(MSWIN) - MSWIN64 = Gem::Platform.new('mswin64') unless defined?(MSWIN64) - MINGW = Gem::Platform.new('x86-mingw32') unless defined?(MINGW) - X64_MINGW = Gem::Platform.new('x64-mingw32') unless defined?(X64_MINGW) + JAVA = Gem::Platform.new("java") unless defined?(JAVA) + MSWIN = Gem::Platform.new("mswin32") unless defined?(MSWIN) + MSWIN64 = Gem::Platform.new("mswin64") unless defined?(MSWIN64) + MINGW = Gem::Platform.new("x86-mingw32") unless defined?(MINGW) + X64_MINGW = Gem::Platform.new("x64-mingw32") unless defined?(X64_MINGW) undef_method :hash if method_defined? :hash def hash diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 6cd1570cad..272276a31a 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -1,6 +1,6 @@ -require 'monitor' -require 'rubygems' -require 'rubygems/config_file' +require "monitor" +require "rubygems" +require "rubygems/config_file" module Bundler class RubygemsIntegration @@ -116,7 +116,7 @@ module Bundler def spec_cache_dirs @spec_cache_dirs ||= begin - dirs = gem_path.map {|dir| File.join(dir, 'specifications')} + dirs = gem_path.map {|dir| File.join(dir, "specifications")} dirs << Gem.spec_cache_dir if Gem.respond_to?(:spec_cache_dir) # Not in Rubygems 2.0.3 or earlier dirs.uniq.select {|dir| File.directory? dir} end @@ -202,12 +202,12 @@ module Bundler end def gem_from_path(path, policy = nil) - require 'rubygems/format' + require "rubygems/format" Gem::Format.from_file_by_path(path, policy) end def spec_from_gem(path, policy = nil) - require 'rubygems/security' + require "rubygems/security" gem_from_path(path, security_policies[policy]).spec rescue Gem::Package::FormatError raise GemspecError, "Could not read gem at #{path}. It may be corrupted." @@ -216,7 +216,7 @@ module Bundler e.message =~ /unknown trust policy|unsigned gem/i || e.message =~ /couldn't verify (meta)?data signature/i raise SecurityError, - "The gem #{File.basename(path, '.gem')} can't be installed because " \ + "The gem #{File.basename(path, ".gem")} can't be installed because " \ "the security policy didn't allow it, with the message: #{e.message}" else raise e @@ -224,7 +224,7 @@ module Bundler end def build(spec, skip_validation = false) - require 'rubygems/builder' + require "rubygems/builder" Gem::Builder.new(spec).build end @@ -244,7 +244,7 @@ module Bundler def security_policies @security_policies ||= begin - require 'rubygems/security' + require "rubygems/security" Gem::Security::Policies rescue LoadError, NameError {} @@ -269,7 +269,7 @@ module Bundler executables = specs.map(&:executables).flatten ::Kernel.send(:define_method, :gem) do |dep, *reqs| - if executables.include? File.basename(caller.first.split(':').first) + if executables.include? File.basename(caller.first.split(":").first) return end reqs.pop if reqs.last.is_a?(Hash) @@ -334,8 +334,8 @@ module Bundler redefine_method(gem_class, :bin_path) do |name, *args| exec_name = args.first - if exec_name == 'bundle' - return ENV['BUNDLE_BIN_PATH'] + if exec_name == "bundle" + return ENV["BUNDLE_BIN_PATH"] end spec = nil @@ -392,7 +392,7 @@ module Bundler # This backport fixes the marshaling of @segments. def backport_yaml_initialize redefine_method(Gem::Version, :yaml_initialize) do |tag, map| - @version = map['version'] + @version = map["version"] @segments = nil @hash = nil end @@ -532,7 +532,7 @@ module Bundler # Rubygems 1.8.20 and adds the skip_validation parameter, so that's # when we start passing it through. def build(spec, skip_validation = false) - require 'rubygems/builder' + require "rubygems/builder" Gem::Builder.new(spec).build(skip_validation) end end @@ -581,7 +581,7 @@ module Bundler end def download_gem(spec, uri, path) - require 'resolv' + require "resolv" uri = Bundler.settings.mirror_for(uri) proxy, dns = configuration[:http_proxy], Resolv::DNS.new fetcher = Gem::RemoteFetcher.new(proxy, dns) @@ -589,14 +589,14 @@ module Bundler end def gem_from_path(path, policy = nil) - require 'rubygems/package' + require "rubygems/package" p = Gem::Package.new(path) p.security_policy = policy if policy return p end def build(spec, skip_validation = false) - require 'rubygems/package' + require "rubygems/package" Gem::Package.build(spec, skip_validation) end @@ -613,14 +613,14 @@ module Bundler end def all_specs - require 'bundler/remote_specification' + require "bundler/remote_specification" Gem::Specification.stubs.map do |stub| StubSpecification.from_stub(stub) end end def backport_ext_builder_monitor - require 'rubygems/ext' + require "rubygems/ext" Gem::Ext::Builder.class_eval do if !const_defined?(:CHDIR_MONITOR) @@ -652,15 +652,15 @@ module Bundler @rubygems = RubygemsIntegration::MoreFuture.new elsif RubygemsIntegration.provides?(">= 1.99.99") @rubygems = RubygemsIntegration::Future.new - elsif RubygemsIntegration.provides?('>= 1.8.20') + elsif RubygemsIntegration.provides?(">= 1.8.20") @rubygems = RubygemsIntegration::MoreModern.new - elsif RubygemsIntegration.provides?('>= 1.8.5') + elsif RubygemsIntegration.provides?(">= 1.8.5") @rubygems = RubygemsIntegration::Modern.new - elsif RubygemsIntegration.provides?('>= 1.8.0') + elsif RubygemsIntegration.provides?(">= 1.8.0") @rubygems = RubygemsIntegration::AlmostModern.new - elsif RubygemsIntegration.provides?('>= 1.7.0') + elsif RubygemsIntegration.provides?(">= 1.7.0") @rubygems = RubygemsIntegration::Transitional.new - elsif RubygemsIntegration.provides?('>= 1.4.0') + elsif RubygemsIntegration.provides?(">= 1.4.0") @rubygems = RubygemsIntegration::Legacy.new else # Rubygems 1.3.6 and 1.3.7 @rubygems = RubygemsIntegration::Ancient.new diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 8736bba656..ee260fbc83 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -79,9 +79,9 @@ module Bundler REQUIRE_ERRORS.find { |r| r =~ e.message } raise if dep.autorequire || $1 != required_file - if dep.autorequire.nil? && dep.name.include?('-') + if dep.autorequire.nil? && dep.name.include?("-") begin - namespaced_file = dep.name.gsub('-', '/') + namespaced_file = dep.name.gsub("-", "/") Kernel.require namespaced_file rescue LoadError => e REQUIRE_ERRORS.find { |r| r =~ e.message } @@ -108,7 +108,7 @@ module Bundler Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}" specs.each do |spec| - next if spec.name == 'bundler' + next if spec.name == "bundler" spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true) spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache) end @@ -168,8 +168,8 @@ module Bundler output = stale_gem_dirs.collect do |gem_dir| full_name = Pathname.new(gem_dir).basename.to_s - parts = full_name.split('-') - name = parts[0..-2].join('-') + parts = full_name.split("-") + name = parts[0..-2].join("-") version = parts.last output = "#{name} (#{version})" @@ -184,8 +184,8 @@ module Bundler end + stale_git_dirs.collect do |gem_dir| full_name = Pathname.new(gem_dir).basename.to_s - parts = full_name.split('-') - name = parts[0..-2].join('-') + parts = full_name.split("-") + name = parts[0..-2].join("-") revision = parts[-1] output = "#{name} (#{revision})" @@ -270,17 +270,17 @@ module Bundler def setup_manpath # Store original MANPATH for restoration later in with_clean_env() - ENV['BUNDLE_ORIG_MANPATH'] = ENV['MANPATH'] + ENV["BUNDLE_ORIG_MANPATH"] = ENV["MANPATH"] # Add man/ subdirectories from activated bundles to MANPATH for man(1) manuals = $LOAD_PATH.map do |path| - man_subdir = path.sub(/lib$/, 'man') - man_subdir unless Dir[man_subdir + '/man?/'].empty? + man_subdir = path.sub(/lib$/, "man") + man_subdir unless Dir[man_subdir + "/man?/"].empty? end.compact unless manuals.empty? - ENV['MANPATH'] = manuals.concat( - ENV['MANPATH'].to_s.split(File::PATH_SEPARATOR) + ENV["MANPATH"] = manuals.concat( + ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR) ).uniq.join(File::PATH_SEPARATOR) end end diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 1c2ef6e635..a4f2a9cf84 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -1,4 +1,4 @@ -require 'uri' +require "uri" module Bundler class Settings @@ -47,7 +47,7 @@ module Bundler keys = @global_config.keys | @local_config.keys | env_keys keys.map do |key| - key.sub(/^BUNDLE_/, '').gsub(/__/, ".").downcase + key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase end end @@ -147,7 +147,7 @@ module Bundler end def ignore_config? - ENV['BUNDLE_IGNORE_CONFIG'] + ENV["BUNDLE_IGNORE_CONFIG"] end def app_cache_path @@ -185,7 +185,7 @@ module Bundler end def to_bool(value) - !(value.nil? || value == '' || value =~ /^(false|f|no|n|0)$/i || value == false) + !(value.nil? || value == "" || value =~ /^(false|f|no|n|0)$/i || value == false) end def is_num(value) @@ -207,7 +207,7 @@ module Bundler hash[key] = value hash.delete(key) if value.nil? FileUtils.mkdir_p(file.dirname) - require 'bundler/psyched_yaml' + require "bundler/psyched_yaml" File.open(file, "w") { |f| f.puts YAML.dump(hash) } end diff --git a/lib/bundler/setup.rb b/lib/bundler/setup.rb index 897a1dee85..db13967bb1 100644 --- a/lib/bundler/setup.rb +++ b/lib/bundler/setup.rb @@ -1,9 +1,9 @@ -require 'bundler/shared_helpers' +require "bundler/shared_helpers" if Bundler::SharedHelpers.in_bundle? - require 'bundler' + require "bundler" - if STDOUT.tty? || ENV['BUNDLER_FORCE_TTY'] + if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"] begin Bundler.setup rescue Bundler::BundlerError => e diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 9532438c52..3368912343 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -1,9 +1,9 @@ -require 'pathname' -require 'rubygems' +require "pathname" +require "rubygems" -require 'bundler/constants' -require 'bundler/rubygems_integration' -require 'bundler/current_ruby' +require "bundler/constants" +require "bundler/rubygems_integration" +require "bundler/current_ruby" module Gem class Dependency @@ -29,7 +29,7 @@ module Bundler gemfile = default_gemfile case gemfile.basename.to_s - when 'gems.rb' then Pathname.new(gemfile.sub(/.rb$/, '.locked')) + when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked")) else Pathname.new("#{gemfile}.lock") end end @@ -83,22 +83,22 @@ module Bundler rubyopt = [ENV["RUBYOPT"]].compact if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/ rubyopt.unshift %|-rbundler/setup| - ENV["RUBYOPT"] = rubyopt.join(' ') + ENV["RUBYOPT"] = rubyopt.join(" ") end # Set RUBYLIB rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) - rubylib.unshift File.expand_path('../..', __FILE__) + rubylib.unshift File.expand_path("../..", __FILE__) ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR) end private def find_gemfile - given = ENV['BUNDLE_GEMFILE'] + given = ENV["BUNDLE_GEMFILE"] return given if given && !given.empty? - find_file('Gemfile', 'gems.rb') + find_file("Gemfile", "gems.rb") end def find_file(*names) @@ -118,9 +118,9 @@ module Bundler current = File.expand_path(SharedHelpers.pwd) until !File.directory?(current) || current == previous - if ENV['BUNDLE_SPEC_RUN'] + if ENV["BUNDLE_SPEC_RUN"] # avoid stepping above the tmp directory when testing - return nil if File.file?(File.join(current, 'bundler.gemspec')) + return nil if File.file?(File.join(current, "bundler.gemspec")) end names.each do |name| diff --git a/lib/bundler/similarity_detector.rb b/lib/bundler/similarity_detector.rb index 66f1044c84..32c3d7f774 100644 --- a/lib/bundler/similarity_detector.rb +++ b/lib/bundler/similarity_detector.rb @@ -20,7 +20,7 @@ module Bundler if words.length==1 words[0] elsif words.length>1 - [words[0..-2].join(', '), words[-1]].join(' or ') + [words[0..-2].join(", "), words[-1]].join(" or ") end end diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index d715b78f93..73aab9b899 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -1,8 +1,8 @@ module Bundler class Source - autoload :Rubygems, 'bundler/source/rubygems' - autoload :Path, 'bundler/source/path' - autoload :Git, 'bundler/source/git' + autoload :Rubygems, "bundler/source/rubygems" + autoload :Path, "bundler/source/path" + autoload :Git, "bundler/source/git" attr_accessor :dependency_names diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 5bc2086bf7..992a908cec 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -1,11 +1,11 @@ -require 'fileutils' -require 'uri' -require 'digest/sha1' +require "fileutils" +require "uri" +require "digest/sha1" module Bundler class Source class Git < Path - autoload :GitProxy, 'bundler/source/git/git_proxy' + autoload :GitProxy, "bundler/source/git/git_proxy" attr_reader :uri, :ref, :branch, :options, :submodules @@ -19,9 +19,9 @@ module Bundler # Stringify options that could be set as symbols %w(ref branch tag revision).each{|k| options[k] = options[k].to_s if options[k] } - @uri = options["uri"] || '' + @uri = options["uri"] || "" @branch = options["branch"] - @ref = options["ref"] || options["branch"] || options["tag"] || 'master' + @ref = options["ref"] || options["branch"] || options["tag"] || "master" @submodules = options["submodules"] @name = options["name"] @version = options["version"] @@ -73,7 +73,7 @@ module Bundler end def name - File.basename(@uri, '.git') + File.basename(@uri, ".git") end # This is the path which is going to contain a specific @@ -228,7 +228,7 @@ module Bundler # The gemspecs we cache should already be evaluated. spec = Bundler.load_gemspec(spec_path) next unless spec - File.open(spec_path, 'wb') {|file| file.write(spec.to_ruby) } + File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) } end end @@ -251,7 +251,7 @@ module Bundler end def base_name - File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)?(//\w*/)?(\w*/)*},''),".git") + File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)?(//\w*/)?(\w*/)*},""),".git") end def shortref_for_display(ref) @@ -266,7 +266,7 @@ module Bundler if uri =~ %r{^\w+://(\w+@)?} # Downcase the domain component of the URI # and strip off a trailing slash, if one is present - input = URI.parse(uri).normalize.to_s.sub(%r{/$},'') + input = URI.parse(uri).normalize.to_s.sub(%r{/$},"") else # If there is no URI scheme, assume it is an ssh/git URI input = uri diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index a7aa989978..21e16ba60f 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -1,7 +1,7 @@ module Bundler class Source class Path < Source - autoload :Installer, 'bundler/source/path/installer' + autoload :Installer, "bundler/source/path/installer" attr_reader :path, :options attr_writer :name diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 29efd68f54..ec52c918b1 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -1,6 +1,6 @@ -require 'uri' -require 'rubygems/user_interaction' -require 'rubygems/spec_fetcher' +require "uri" +require "rubygems/user_interaction" +require "rubygems/spec_fetcher" module Bundler class Source @@ -68,7 +68,7 @@ module Bundler end def to_s - remote_names = self.remotes.map(&:to_s).join(', ') + remote_names = self.remotes.map(&:to_s).join(", ") "rubygems repository #{remote_names}" end alias_method :name, :to_s @@ -149,7 +149,7 @@ module Bundler if name == "extensions" && Dir.glob(src).any? src = File.join(src, "*/*") ext_src = Dir.glob(src).first - ext_src.gsub!(src[0..-6], '') + ext_src.gsub!(src[0..-6], "") dst = File.dirname(File.join(dst, ext_src)) end Bundler.mkdir_p dst @@ -275,8 +275,8 @@ module Bundler idx = Index.new have_bundler = false Bundler.rubygems.all_specs.reverse.each do |spec| - next if spec.name == 'bundler' && spec.version.to_s != VERSION - have_bundler = true if spec.name == 'bundler' + next if spec.name == "bundler" && spec.version.to_s != VERSION + have_bundler = true if spec.name == "bundler" spec.source = self idx << spec end @@ -287,7 +287,7 @@ module Bundler # so, let's create a fake gemspec for it (it's a path) # gemspec bundler = Gem::Specification.new do |s| - s.name = 'bundler' + s.name = "bundler" s.version = VERSION s.platform = Gem::Platform::RUBY s.source = self diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 42962df259..9e9c88bb5d 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -1,5 +1,5 @@ -require 'tsort' -require 'forwardable' +require "tsort" +require "forwardable" module Bundler class SpecSet @@ -15,7 +15,7 @@ module Bundler def for(dependencies, skip = [], check = false, match_current_platform = false) handled, deps, specs = {}, dependencies.dup, [] - skip << 'bundler' + skip << "bundler" until deps.empty? dep = deps.shift @@ -44,7 +44,7 @@ module Bundler end end - if spec = lookup['bundler'].first + if spec = lookup["bundler"].first specs << spec end @@ -108,7 +108,7 @@ module Bundler private def sorted - rake = @specs.find { |s| s.name == 'rake' } + rake = @specs.find { |s| s.name == "rake" } begin @sorted ||= ([rake] + tsort).compact.uniq rescue TSort::Cyclic => error @@ -131,7 +131,7 @@ module Bundler @lookup ||= begin lookup = Hash.new { |h,k| h[k] = [] } specs = @specs.sort_by do |s| - s.platform.to_s == 'ruby' ? "\0" : s.platform.to_s + s.platform.to_s == "ruby" ? "\0" : s.platform.to_s end specs.reverse_each do |s| lookup[s.name] << s diff --git a/lib/bundler/ssl_certs/certificate_manager.rb b/lib/bundler/ssl_certs/certificate_manager.rb index 0148736b7a..558bd9ef50 100644 --- a/lib/bundler/ssl_certs/certificate_manager.rb +++ b/lib/bundler/ssl_certs/certificate_manager.rb @@ -1,6 +1,6 @@ -require 'fileutils' -require 'net/https' -require 'openssl' +require "fileutils" +require "net/https" +require "openssl" module Bundler module SSLCerts @@ -13,7 +13,7 @@ module Bundler def initialize(rubygems_path = nil) if rubygems_path - rubygems_cert_path = File.join(rubygems_path, 'lib/rubygems/ssl_certs') + rubygems_cert_path = File.join(rubygems_path, "lib/rubygems/ssl_certs") @rubygems_certs = certificates_in(rubygems_cert_path) end @@ -41,7 +41,7 @@ module Bundler http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.cert_store = store - http.head('/') + http.head("/") end private diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb index a15a1adf85..ca5cbe6d9d 100644 --- a/lib/bundler/stub_specification.rb +++ b/lib/bundler/stub_specification.rb @@ -1,4 +1,4 @@ -require 'bundler/remote_specification' +require "bundler/remote_specification" module Bundler class StubSpecification < RemoteSpecification diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable index 5c60c28337..cc9e06cfec 100755 --- a/lib/bundler/templates/Executable +++ b/lib/bundler/templates/Executable @@ -6,11 +6,11 @@ # this file is here to facilitate running it. # -require 'pathname' -ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../<%= relative_gemfile_path %>", +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>", Pathname.new(__FILE__).realpath) -require 'rubygems' -require 'bundler/setup' +require "rubygems" +require "bundler/setup" -load Gem.bin_path('<%= spec.name %>', '<%= executable %>') +load Gem.bin_path("<%= spec.name %>", "<%= executable %>") diff --git a/lib/bundler/ui.rb b/lib/bundler/ui.rb index af325afba8..7400f80ab1 100644 --- a/lib/bundler/ui.rb +++ b/lib/bundler/ui.rb @@ -1,7 +1,7 @@ module Bundler module UI - autoload :RGProxy, 'bundler/ui/rg_proxy' - autoload :Shell, 'bundler/ui/shell' - autoload :Silent, 'bundler/ui/silent' + autoload :RGProxy, "bundler/ui/rg_proxy" + autoload :Shell, "bundler/ui/shell" + autoload :Silent, "bundler/ui/silent" end end diff --git a/lib/bundler/ui/rg_proxy.rb b/lib/bundler/ui/rg_proxy.rb index 6f514be87f..1c9c2deaba 100644 --- a/lib/bundler/ui/rg_proxy.rb +++ b/lib/bundler/ui/rg_proxy.rb @@ -1,5 +1,5 @@ -require 'bundler/ui' -require 'rubygems/user_interaction' +require "bundler/ui" +require "rubygems/user_interaction" module Bundler module UI diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb index 9a5fd1d903..92af57756c 100644 --- a/lib/bundler/ui/shell.rb +++ b/lib/bundler/ui/shell.rb @@ -1,4 +1,4 @@ -require 'bundler/vendored_thor' +require "bundler/vendored_thor" module Bundler module UI @@ -12,7 +12,7 @@ module Bundler Thor::Base.shell = Thor::Shell::Basic end @shell = Thor::Base.shell.new - @level = ENV['DEBUG'] ? "debug" : "info" + @level = ENV["DEBUG"] ? "debug" : "info" @warning_history = [] end @@ -95,7 +95,7 @@ module Bundler def strip_leading_spaces(text) spaces = text[/\A\s+/, 0] - spaces ? text.gsub(/#{spaces}/, '') : text + spaces ? text.gsub(/#{spaces}/, "") : text end def word_wrap(text, line_width = @shell.terminal_width) diff --git a/lib/bundler/vendored_molinillo.rb b/lib/bundler/vendored_molinillo.rb index 4081f3fa92..795d63a3d3 100644 --- a/lib/bundler/vendored_molinillo.rb +++ b/lib/bundler/vendored_molinillo.rb @@ -1,2 +1,2 @@ module Bundler; end -require 'bundler/vendor/molinillo/lib/molinillo' +require "bundler/vendor/molinillo/lib/molinillo" diff --git a/lib/bundler/vendored_persistent.rb b/lib/bundler/vendored_persistent.rb index 8ed4ce8306..ef404f35d5 100644 --- a/lib/bundler/vendored_persistent.rb +++ b/lib/bundler/vendored_persistent.rb @@ -1,11 +1,11 @@ # We forcibly require OpenSSL, because net/http/persistent will only autoload # it. On some Rubies, autoload fails but explicit require succeeds. begin - require 'openssl' + require "openssl" rescue LoadError # some Ruby builds don't have OpenSSL end -vendor = File.expand_path('../vendor', __FILE__) +vendor = File.expand_path("../vendor", __FILE__) $:.unshift(vendor) unless $:.include?(vendor) -require 'net/http/persistent' +require "net/http/persistent" diff --git a/lib/bundler/vendored_thor.rb b/lib/bundler/vendored_thor.rb index 1931b5f278..114483db02 100644 --- a/lib/bundler/vendored_thor.rb +++ b/lib/bundler/vendored_thor.rb @@ -1,3 +1,3 @@ module Bundler; end -require 'bundler/vendor/thor/lib/thor' -require 'bundler/vendor/thor/lib/thor/actions' +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 aaf714555f..5e20ae6dac 100644 --- a/lib/bundler/vlad.rb +++ b/lib/bundler/vlad.rb @@ -2,7 +2,7 @@ # # Just add "require 'bundler/vlad'" in your Vlad deploy.rb, and # include the vlad:bundle:install task in your vlad:deploy task. -require 'bundler/deployment' +require "bundler/deployment" include Rake::DSL if defined? Rake::DSL diff --git a/lib/bundler/worker.rb b/lib/bundler/worker.rb index 531e597915..8102328d97 100644 --- a/lib/bundler/worker.rb +++ b/lib/bundler/worker.rb @@ -1,4 +1,4 @@ -require 'thread' +require "thread" module Bundler class Worker |