Skip to content

Commit 82c9545

Browse files
committed
Fix end alignment
1 parent 9620ba7 commit 82c9545

File tree

12 files changed

+92
-78
lines changed

12 files changed

+92
-78
lines changed

.rubocop.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@ AccessModifierIndentation:
6464

6565
EmptyLinesAroundAccessModifier:
6666
Enabled: true
67+
68+
# Align ends correctly
69+
EndAlignment:
70+
AlignWith: variable
71+
72+
# Indentation of when/else
73+
CaseIndentation:
74+
IndentWhenRelativeTo: end
75+
IndentOneStep: false

Gemfile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@ gem 'rake', '>= 0.9'
44
gem 'rdoc', '>= 3.9'
55

66
group :development do
7+
gem 'guard-rspec'
78
gem 'pry'
8-
gem 'pry-debugger', :platforms => :mri_19
9+
gem 'pry-rescue'
10+
platforms :ruby_19, :ruby_20 do
11+
gem 'pry-debugger'
12+
gem 'pry-stack_explorer'
13+
end
914
end
1015

1116
group :test do
1217
gem 'childlabor'
1318
gem 'coveralls', '>=0.5.7', :require => false
1419
# mime-types is required indirectly by coveralls
1520
# needs to be < 2.0 to work with Ruby 1.8.7
16-
gem 'mime-types', '~> 1.25', :platforms => :ruby_18
21+
gem 'mime-types', '~> 1.25', :platforms => [:jruby, :ruby_18]
1722
gem 'fakeweb', '>= 1.3'
1823
gem 'rspec', '>= 2.14'
1924
gem 'rspec-mocks', '>= 2.12.2'
20-
gem 'rubocop', '>= 0.15', :platforms => [:ruby_19, :ruby_20]
25+
gem 'rubocop', '>= 0.16', :platforms => [:ruby_19, :ruby_20, :ruby_21]
2126
gem 'simplecov', :require => false
2227
end
2328

lib/thor.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ def method_options(options = nil)
147147
#
148148
def method_option(name, options = {})
149149
scope = if options[:for]
150-
find_and_refresh_command(options[:for]).options
151-
else
152-
method_options
153-
end
150+
find_and_refresh_command(options[:for]).options
151+
else
152+
method_options
153+
end
154154

155155
build_option(name, options, scope)
156156
end

lib/thor/actions/create_file.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def identical?
5050
#
5151
def render
5252
@render ||= if data.is_a?(Proc)
53-
data.call
54-
else
55-
data
56-
end
53+
data.call
54+
else
55+
data
56+
end
5757
end
5858

5959
def invoke!

lib/thor/actions/file_manipulation.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ def get(source, *args, &block)
8282
render = open(source) { |input| input.binmode.read }
8383

8484
destination ||= if block_given?
85-
block.arity == 1 ? block.call(render) : block.call
86-
else
87-
File.basename(source)
88-
end
85+
block.arity == 1 ? block.call(render) : block.call
86+
else
87+
File.basename(source)
88+
end
8989

9090
create_file destination, render, config
9191
end

lib/thor/actions/inject_into_file.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def invoke!
5151
say_status :invoke
5252

5353
content = if @behavior == :after
54-
'\0' + replacement
55-
else
56-
replacement + '\0'
57-
end
54+
'\0' + replacement
55+
else
56+
replacement + '\0'
57+
end
5858

5959
replace!(/#{flag}/, content, config[:force])
6060
end
@@ -63,12 +63,12 @@ def revoke!
6363
say_status :revoke
6464

6565
regexp = if @behavior == :after
66-
content = '\1\2'
67-
/(#{flag})(.*)(#{Regexp.escape(replacement)})/m
68-
else
69-
content = '\2\3'
70-
/(#{Regexp.escape(replacement)})(.*)(#{flag})/m
71-
end
66+
content = '\1\2'
67+
/(#{flag})(.*)(#{Regexp.escape(replacement)})/m
68+
else
69+
content = '\2\3'
70+
/(#{Regexp.escape(replacement)})(.*)(#{flag})/m
71+
end
7272

7373
replace!(regexp, content, true)
7474
end
@@ -77,16 +77,16 @@ def revoke!
7777

7878
def say_status(behavior)
7979
status = if behavior == :invoke
80-
if flag == /\A/
81-
:prepend
82-
elsif flag == /\z/
83-
:append
84-
else
85-
:insert
86-
end
87-
else
88-
:subtract
89-
end
80+
if flag == /\A/
81+
:prepend
82+
elsif flag == /\z/
83+
:append
84+
else
85+
:insert
86+
end
87+
else
88+
:subtract
89+
end
9090

9191
super(status, config[:verbose])
9292
end

lib/thor/base.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,12 @@ def argument(name, options = {}) # rubocop:disable MethodLength
210210
no_commands { attr_accessor name }
211211

212212
required = if options.key?(:optional)
213-
!options[:optional]
214-
elsif options.key?(:required)
215-
options[:required]
216-
else
217-
options[:default].nil?
218-
end
213+
!options[:optional]
214+
elsif options.key?(:required)
215+
options[:required]
216+
else
217+
options[:default].nil?
218+
end
219219

220220
remove_argument name
221221

lib/thor/group.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ def class_options_help(shell, groups = {}) #:nodoc:
172172
def get_options_from_invocations(group_options, base_options) #:nodoc: # rubocop:disable MethodLength
173173
invocations.each do |name, from_option|
174174
value = if from_option
175-
option = class_options[name]
176-
option.type == :boolean ? name : option.default
177-
else
178-
name
179-
end
175+
option = class_options[name]
176+
option.type == :boolean ? name : option.default
177+
else
178+
name
179+
end
180180
next unless value
181181

182182
klass, _ = prepare_for_invocation(name, value)

lib/thor/parser/option.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ def human_name
7878

7979
def usage(padding = 0)
8080
sample = if banner && !banner.to_s.empty?
81-
"#{switch_name}=#{banner}"
82-
else
83-
switch_name
84-
end
81+
"#{switch_name}=#{banner}"
82+
else
83+
switch_name
84+
end
8585

8686
sample = "[#{sample}]" unless required?
8787

lib/thor/runner.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ def install(name) # rubocop:disable MethodLength
7676
end
7777

7878
location = if options[:relative] || name =~ %r{^https?://}
79-
name
80-
else
81-
File.expand_path(name)
82-
end
79+
name
80+
else
81+
File.expand_path(name)
82+
end
8383

8484
thor_yaml[as] = {
8585
:filename => Digest::MD5.hexdigest(name + as),

0 commit comments

Comments
 (0)