diff options
author | Samuel E. Giddins <segiddins@segiddins.me> | 2015-07-15 20:52:48 -0700 |
---|---|---|
committer | Samuel E. Giddins <segiddins@segiddins.me> | 2015-07-15 20:52:48 -0700 |
commit | a77ca278809d7f31fa51e4b821faed86324c8275 (patch) | |
tree | da1c6c68b24fdcab9acfc07b6a352a39af1c6f4e /lib/bundler/cli | |
parent | af694073229af89af205d24ff449f51f74316a37 (diff) | |
download | bundler-a77ca278809d7f31fa51e4b821faed86324c8275.tar.gz |
[RuboCop] Enable Style/StringLiterals
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r-- | lib/bundler/cli/check.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/common.rb | 8 | ||||
-rw-r--r-- | lib/bundler/cli/console.rb | 10 | ||||
-rw-r--r-- | lib/bundler/cli/exec.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 20 | ||||
-rw-r--r-- | lib/bundler/cli/init.rb | 4 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 16 | ||||
-rw-r--r-- | lib/bundler/cli/open.rb | 8 | ||||
-rw-r--r-- | lib/bundler/cli/outdated.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/package.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/show.rb | 8 | ||||
-rw-r--r-- | lib/bundler/cli/viz.rb | 2 |
12 files changed, 42 insertions, 42 deletions
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 |