Skip to content

Commit d634d24

Browse files
committed
Consistently use double-quotes
1 parent d6e3037 commit d634d24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2092
-2089
lines changed

.rubocop.yml

+3
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,6 @@ PercentLiteralDelimiters:
8888
'%w': '[]'
8989
'%W': '[]'
9090
'%x': ()
91+
92+
StringLiterals:
93+
EnforcedStyle: double_quotes

Gemfile

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22

3-
gem 'rake', '>= 0.9'
4-
gem 'rdoc', '>= 3.9'
3+
gem "rake", ">= 0.9"
4+
gem "rdoc", ">= 3.9"
55

66
group :development do
7-
gem 'guard-rspec'
8-
gem 'pry'
7+
gem "guard-rspec"
8+
gem "pry"
99
platforms :ruby_19, :ruby_20 do
10-
gem 'pry-debugger'
11-
gem 'pry-stack_explorer'
10+
gem "pry-debugger"
11+
gem "pry-stack_explorer"
1212
end
1313
end
1414

1515
group :test do
16-
gem 'childlabor'
17-
gem 'coveralls', '>= 0.5.7', :require => false
16+
gem "childlabor"
17+
gem "coveralls", ">= 0.5.7", :require => false
1818
# mime-types is required indirectly by coveralls
1919
# needs to be < 2.0 to work with Ruby 1.8.7
20-
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
21-
gem 'fakeweb', '>= 1.3'
22-
gem 'rspec', '>= 2.14'
23-
gem 'rspec-mocks', '>= 2.12.2'
24-
gem 'rubocop', '>= 0.19', :platforms => [:ruby_19, :ruby_20, :ruby_21]
25-
gem 'simplecov', :require => false
20+
gem "mime-types", "~> 1.25", :platforms => [:jruby, :ruby_18]
21+
gem "fakeweb", ">= 1.3"
22+
gem "rspec", ">= 2.14"
23+
gem "rspec-mocks", ">= 2.12.2"
24+
gem "rubocop", ">= 0.19", :platforms => [:ruby_19, :ruby_20, :ruby_21]
25+
gem "simplecov", :require => false
2626
end
2727

2828
gemspec

Thorfile

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
1+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
22

3-
require 'bundler'
4-
require 'thor/rake_compat'
3+
require "bundler"
4+
require "thor/rake_compat"
55

66
class Default < Thor
77
include Thor::RakeCompat
88
Bundler::GemHelper.install_tasks
99

10-
desc 'build', "Build thor-#{Thor::VERSION}.gem into the pkg directory"
10+
desc "build", "Build thor-#{Thor::VERSION}.gem into the pkg directory"
1111
def build
12-
Rake::Task['build'].execute
12+
Rake::Task["build"].execute
1313
end
1414

15-
desc 'install', "Build and install thor-#{Thor::VERSION}.gem into system gems"
15+
desc "install", "Build and install thor-#{Thor::VERSION}.gem into system gems"
1616
def install
17-
Rake::Task['install'].execute
17+
Rake::Task["install"].execute
1818
end
1919

20-
desc 'release', "Create tag v#{Thor::VERSION} and build and push thor-#{Thor::VERSION}.gem to Rubygems"
20+
desc "release", "Create tag v#{Thor::VERSION} and build and push thor-#{Thor::VERSION}.gem to Rubygems"
2121
def release
22-
Rake::Task['release'].execute
22+
Rake::Task["release"].execute
2323
end
2424

25-
desc 'spec', 'Run RSpec code examples'
25+
desc "spec", "Run RSpec code examples"
2626
def spec
27-
exec 'rspec spec'
27+
exec "rspec spec"
2828
end
2929
end

bin/thor

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env ruby
22
# -*- mode: ruby -*-
33

4-
require 'thor/runner'
4+
require "thor/runner"
55
$thor_runner = true
66
Thor::Runner.start

lib/thor.rb

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
require 'set'
2-
require 'thor/base'
1+
require "set"
2+
require "thor/base"
33

44
class Thor # rubocop:disable ClassLength
55
class << self
@@ -10,7 +10,7 @@ class << self
1010
# options<Hash>
1111
#
1212
def package_name(name, options = {})
13-
@package_name = name.nil? || name == '' ? nil : name
13+
@package_name = name.nil? || name == "" ? nil : name
1414
end
1515

1616
# Sets the default command when thor is executed without an explicit command to be called.
@@ -20,9 +20,9 @@ def package_name(name, options = {})
2020
#
2121
def default_command(meth = nil)
2222
if meth
23-
@default_command = meth == :none ? 'help' : meth.to_s
23+
@default_command = meth == :none ? "help" : meth.to_s
2424
else
25-
@default_command ||= from_superclass(:default_command, 'help')
25+
@default_command ||= from_superclass(:default_command, "help")
2626
end
2727
end
2828
alias_method :default_task, :default_command
@@ -167,12 +167,12 @@ def command_help(shell, command_name)
167167
command = all_commands[meth]
168168
handle_no_command_error(meth) unless command
169169

170-
shell.say 'Usage:'
170+
shell.say "Usage:"
171171
shell.say " #{banner(command)}"
172172
shell.say
173173
class_options_help(shell, nil => command.options.map { |_, o| o })
174174
if command.long_description
175-
shell.say 'Description:'
175+
shell.say "Description:"
176176
shell.print_wrapped(command.long_description, :indent => 2)
177177
else
178178
shell.say command.description
@@ -195,7 +195,7 @@ def help(shell, subcommand = false)
195195
if defined?(@package_name) && @package_name
196196
shell.say "#{@package_name} commands:"
197197
else
198-
shell.say 'Commands:'
198+
shell.say "Commands:"
199199
end
200200

201201
shell.print_table(list, :indent => 2, :truncate => true)
@@ -209,7 +209,7 @@ def printable_commands(all = true, subcommand = false)
209209
next if command.hidden?
210210
item = []
211211
item << banner(command, false, subcommand)
212-
item << (command.description ? "# #{command.description.gsub(/\s+/m, ' ')}" : '')
212+
item << (command.description ? "# #{command.description.gsub(/\s+/m, ' ')}" : "")
213213
item
214214
end.compact
215215
end
@@ -231,7 +231,7 @@ def subcommand(subcommand, subcommand_class)
231231

232232
define_method(subcommand) do |*args|
233233
args, opts = Thor::Arguments.split(args)
234-
args.unshift('help') if opts.include? '--help' or opts.include? '-h'
234+
args.unshift("help") if opts.include? "--help" or opts.include? "-h"
235235
invoke subcommand_class, args, opts, :invoked_via_subcommand => true, :class_options => options
236236
end
237237
end
@@ -386,11 +386,11 @@ def create_command(meth) #:nodoc:
386386
commands[meth] = base_class.new(meth, @desc, @long_desc, @usage, method_options)
387387
@usage, @desc, @long_desc, @method_options, @hide = nil
388388
true
389-
elsif all_commands[meth] || meth == 'method_missing'
389+
elsif all_commands[meth] || meth == "method_missing"
390390
true
391391
else
392392
puts "[WARNING] Attempted to create command #{meth.inspect} without usage or description. " <<
393-
'Call desc if you want this method to be available as command or declare it inside a ' <<
393+
"Call desc if you want this method to be available as command or declare it inside a " <<
394394
"no_commands{} block. Invoked from #{caller[1].inspect}."
395395
false
396396
end
@@ -421,7 +421,7 @@ def retrieve_command_name(args) #:nodoc:
421421
# +normalize_command_name+ also converts names like +animal-prison+
422422
# into +animal_prison+.
423423
def normalize_command_name(meth) #:nodoc:
424-
return default_command.to_s.gsub('-', '_') unless meth
424+
return default_command.to_s.gsub("-", "_") unless meth
425425

426426
possibilities = find_command_possibilities(meth)
427427
if possibilities.size > 1
@@ -434,7 +434,7 @@ def normalize_command_name(meth) #:nodoc:
434434
meth = possibilities.first
435435
end
436436

437-
meth.to_s.gsub('-', '_') # treat foo-bar as foo_bar
437+
meth.to_s.gsub("-", "_") # treat foo-bar as foo_bar
438438
end
439439
alias_method :normalize_task_name, :normalize_command_name
440440

@@ -457,7 +457,7 @@ def find_command_possibilities(meth)
457457
alias_method :find_task_possibilities, :find_command_possibilities
458458

459459
def subcommand_help(cmd)
460-
desc 'help [COMMAND]', 'Describe subcommands or one specific subcommand'
460+
desc "help [COMMAND]", "Describe subcommands or one specific subcommand"
461461
class_eval "
462462
def help(command = nil, subcommand = true); super; end
463463
"
@@ -469,7 +469,7 @@ def help(command = nil, subcommand = true); super; end
469469

470470
map HELP_MAPPINGS => :help
471471

472-
desc 'help [COMMAND]', 'Describe available commands or one specific command'
472+
desc "help [COMMAND]", "Describe available commands or one specific command"
473473
def help(command = nil, subcommand = false)
474474
if command
475475
if self.class.subcommands.include? command

lib/thor/actions.rb

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
require 'fileutils'
2-
require 'uri'
3-
require 'thor/core_ext/io_binary_read'
4-
require 'thor/actions/create_file'
5-
require 'thor/actions/create_link'
6-
require 'thor/actions/directory'
7-
require 'thor/actions/empty_directory'
8-
require 'thor/actions/file_manipulation'
9-
require 'thor/actions/inject_into_file'
1+
require "fileutils"
2+
require "uri"
3+
require "thor/core_ext/io_binary_read"
4+
require "thor/actions/create_file"
5+
require "thor/actions/create_link"
6+
require "thor/actions/directory"
7+
require "thor/actions/empty_directory"
8+
require "thor/actions/file_manipulation"
9+
require "thor/actions/inject_into_file"
1010

1111
class Thor
1212
module Actions
@@ -48,17 +48,17 @@ def source_paths_for_search
4848
# Add runtime options that help actions execution.
4949
#
5050
def add_runtime_options!
51-
class_option :force, :type => :boolean, :aliases => '-f', :group => :runtime,
52-
:desc => 'Overwrite files that already exist'
51+
class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime,
52+
:desc => "Overwrite files that already exist"
5353

54-
class_option :pretend, :type => :boolean, :aliases => '-p', :group => :runtime,
55-
:desc => 'Run but do not make any changes'
54+
class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime,
55+
:desc => "Run but do not make any changes"
5656

57-
class_option :quiet, :type => :boolean, :aliases => '-q', :group => :runtime,
58-
:desc => 'Suppress status output'
57+
class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime,
58+
:desc => "Suppress status output"
5959

60-
class_option :skip, :type => :boolean, :aliases => '-s', :group => :runtime,
61-
:desc => 'Skip files that already exist'
60+
class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime,
61+
:desc => "Skip files that already exist"
6262
end
6363
end
6464

@@ -73,10 +73,10 @@ def add_runtime_options!
7373
#
7474
def initialize(args = [], options = {}, config = {})
7575
self.behavior = case config[:behavior].to_s
76-
when 'force', 'skip'
76+
when "force", "skip"
7777
_cleanup_options_and_set(options, config[:behavior])
7878
:invoke
79-
when 'revoke'
79+
when "revoke"
8080
:revoke
8181
else
8282
:invoke
@@ -106,16 +106,16 @@ def destination_root
106106
#
107107
def destination_root=(root)
108108
@destination_stack ||= []
109-
@destination_stack[0] = File.expand_path(root || '')
109+
@destination_stack[0] = File.expand_path(root || "")
110110
end
111111

112112
# Returns the given path relative to the absolute root (ie, root where
113113
# the script started).
114114
#
115115
def relative_to_original_destination_root(path, remove_dot = true)
116116
path = path.dup
117-
if path.gsub!(@destination_stack[0], '.')
118-
remove_dot ? (path[2..-1] || '') : path
117+
if path.gsub!(@destination_stack[0], ".")
118+
remove_dot ? (path[2..-1] || "") : path
119119
else
120120
path
121121
end
@@ -147,7 +147,7 @@ def find_in_source_paths(file) # rubocop:disable MethodLength
147147
end
148148

149149
if source_paths.empty?
150-
message << 'Currently you have no source paths.'
150+
message << "Currently you have no source paths."
151151
else
152152
message << "Your current source paths are: \n#{source_paths.join("\n")}"
153153
end
@@ -164,7 +164,7 @@ def find_in_source_paths(file) # rubocop:disable MethodLength
164164
# dir<String>:: the directory to move to.
165165
# config<Hash>:: give :verbose => true to log and use padding.
166166
#
167-
def inside(dir = '', config = {}, &block)
167+
def inside(dir = "", config = {}, &block)
168168
verbose = config.fetch(:verbose, false)
169169
pretend = options[:pretend]
170170

@@ -215,7 +215,7 @@ def apply(path, config = {})
215215
shell.padding += 1 if verbose
216216

217217
if is_uri
218-
contents = open(path, 'Accept' => 'application/x-thor-template') { |io| io.read }
218+
contents = open(path, "Accept" => "application/x-thor-template") { |io| io.read }
219219
else
220220
contents = open(path) { |io| io.read }
221221
end
@@ -292,7 +292,7 @@ def thor(command, *args)
292292

293293
args.unshift(command)
294294
args.push Thor::Options.to_switches(config)
295-
command = args.join(' ').strip
295+
command = args.join(" ").strip
296296

297297
run command, :with => :thor, :verbose => verbose, :pretend => pretend, :capture => capture
298298
end
@@ -311,7 +311,7 @@ def _cleanup_options_and_set(options, key) #:nodoc:
311311
%w[--force -f --skip -s].each { |i| options.delete(i) }
312312
options << "--#{key}"
313313
when Hash
314-
[:force, :skip, 'force', 'skip'].each { |i| options.delete(i) }
314+
[:force, :skip, "force", "skip"].each { |i| options.delete(i) }
315315
options.merge!(key => true)
316316
end
317317
end

lib/thor/actions/create_file.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'thor/actions/empty_directory'
1+
require "thor/actions/empty_directory"
22

33
class Thor
44
module Actions
@@ -59,7 +59,7 @@ def render
5959
def invoke!
6060
invoke_with_conflict_check do
6161
FileUtils.mkdir_p(File.dirname(destination))
62-
File.open(destination, 'wb') { |f| f.write render }
62+
File.open(destination, "wb") { |f| f.write render }
6363
end
6464
given_destination
6565
end

lib/thor/actions/create_link.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'thor/actions/create_file'
1+
require "thor/actions/create_file"
22

33
class Thor
44
module Actions

0 commit comments

Comments
 (0)