Skip to content

Commit 81cd25a

Browse files
Mike GunderloyMike Gunderloy
authored andcommitted
Inserting newline requires double-quoted string
1 parent a43c08f commit 81cd25a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/annotate/annotate_models.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class << self
2020
# Fabrication https://github.com/paulelliott/fabrication.git
2121
FABRICATORS_TEST_DIR = File.join("test", "fabricators")
2222
FABRICATORS_SPEC_DIR = File.join("spec", "fabricators")
23-
23+
2424

2525
def model_dir
2626
@model_dir || "app/models"
@@ -146,7 +146,7 @@ def annotate_one_file(file_name, info_block, options={})
146146
if new_content == old_content
147147
old_content.sub!(encoding, '')
148148
new_content = options[:position] == 'after' ?
149-
(encoding_header + (old_content =~ /\n$/ ? old_content : old_content + '\n') + info_block) :
149+
(encoding_header + (old_content =~ /\n$/ ? old_content : old_content + "\n") + info_block) :
150150
(encoding_header + info_block + old_content)
151151
end
152152

@@ -181,12 +181,12 @@ def annotate(klass, file, header, options={})
181181
if annotate_one_file(model_file_name, info, options_with_position(options, :position_in_class))
182182
annotated = true
183183
end
184-
184+
185185
unless options[:exclude_tests]
186186
[
187187
File.join(UNIT_TEST_DIR, "#{model_name}_test.rb"), # test
188188
File.join(SPEC_MODEL_DIR, "#{model_name}_spec.rb"), # spec
189-
].each do |file|
189+
].each do |file|
190190
# todo: add an option "position_in_test" -- or maybe just ask if anyone ever wants different positions for model vs. test vs. fixture
191191
if annotate_one_file(file, info, options_with_position(options, :position_in_fixture))
192192
annotated = true
@@ -203,7 +203,7 @@ def annotate(klass, file, header, options={})
203203
File.join(FACTORIES_SPEC_DIR, "#{model_name.pluralize}.rb"), # FactoryGirl Factories
204204
File.join(FABRICATORS_TEST_DIR, "#{model_name}_fabricator.rb"), # Fabrication Fabricators
205205
File.join(FABRICATORS_SPEC_DIR, "#{model_name}_fabricator.rb"), # Fabrication Fabricators
206-
].each do |file|
206+
].each do |file|
207207
if annotate_one_file(file, info, options_with_position(options, :position_in_fixture))
208208
annotated = true
209209
end
@@ -218,10 +218,10 @@ def annotate(klass, file, header, options={})
218218
end
219219
end
220220
end
221-
221+
222222
annotated
223223
end
224-
224+
225225
# position = :position_in_fixture or :position_in_class
226226
def options_with_position(options, position_in)
227227
options.merge(:position=>(options[position_in] || options[:position]))
@@ -309,7 +309,7 @@ def do_annotations(options={})
309309
puts "Unable to annotate #{file}: #{e.inspect}"
310310
puts ""
311311
# todo: check if all backtrace lines are in "gems" -- if so, it's an annotate bug, so print the whole stack trace.
312-
# puts e.backtrace.join("\n\t")
312+
# puts e.backtrace.join("\n\t")
313313
end
314314
end
315315
if annotated.empty?
@@ -338,12 +338,12 @@ def remove_annotations(options={})
338338
fixture_file_name = File.join(dir,klass.table_name + ".yml")
339339
remove_annotation_of_file(fixture_file_name) if File.exist?(fixture_file_name)
340340
end
341-
341+
342342
[ File.join(UNIT_TEST_DIR, "#{klass.name.underscore}_test.rb"),
343343
File.join(SPEC_MODEL_DIR,"#{klass.name.underscore}_spec.rb")].each do |file|
344344
remove_annotation_of_file(file) if File.exist?(file)
345345
end
346-
346+
347347
end
348348
rescue Exception => e
349349
puts "Unable to annotate #{file}: #{e.message}"

0 commit comments

Comments
 (0)