Use stderr strictly for errors and stdout for all other output (#236)
This commit is contained in:
parent
b52de34ce9
commit
8eccb7fa57
7 changed files with 12 additions and 12 deletions
|
@ -227,7 +227,7 @@ module Twine
|
|||
|
||||
mapped_command = DEPRECATED_COMMAND_MAPPINGS[command]
|
||||
if mapped_command
|
||||
Twine::stderr.puts "WARNING: Twine commands names have changed. `#{command}` is now `#{mapped_command}`. The old command is deprecated and will soon stop working. For more information please check the documentation at https://github.com/mobiata/twine"
|
||||
Twine::stdout.puts "WARNING: Twine commands names have changed. `#{command}` is now `#{mapped_command}`. The old command is deprecated and will soon stop working. For more information please check the documentation at https://github.com/mobiata/twine"
|
||||
command = mapped_command
|
||||
end
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ module Twine
|
|||
definition.translations[lang] = value
|
||||
end
|
||||
elsif @options[:consume_all]
|
||||
Twine::stderr.puts "Adding new definition '#{key}' to twine file."
|
||||
Twine::stdout.puts "Adding new definition '#{key}' to twine file."
|
||||
current_section = @twine_file.sections.find { |s| s.name == 'Uncategorized' }
|
||||
unless current_section
|
||||
current_section = TwineSection.new('Uncategorized')
|
||||
|
@ -54,7 +54,7 @@ module Twine
|
|||
@twine_file.definitions_by_key[key] = current_definition
|
||||
@twine_file.definitions_by_key[key].translations[lang] = value
|
||||
else
|
||||
Twine::stderr.puts "Warning: '#{key}' not found in twine file."
|
||||
Twine::stdout.puts "WARNING: '#{key}' not found in twine file."
|
||||
end
|
||||
if !@twine_file.language_codes.include?(lang)
|
||||
@twine_file.add_language_code(lang)
|
||||
|
|
|
@ -90,7 +90,7 @@ module Twine
|
|||
|
||||
output = formatter.format_file(lang)
|
||||
unless output
|
||||
Twine::stderr.puts "Skipping file at path #{file_path} since it would not contain any translations."
|
||||
Twine::stdout.puts "Skipping file at path #{file_path} since it would not contain any translations."
|
||||
next
|
||||
end
|
||||
|
||||
|
@ -112,7 +112,7 @@ module Twine
|
|||
file_path = File.join(output_path, file_name)
|
||||
output = formatter.format_file(lang)
|
||||
unless output
|
||||
Twine::stderr.puts "Skipping file at path #{file_path} since it would not contain any translations."
|
||||
Twine::stdout.puts "Skipping file at path #{file_path} since it would not contain any translations."
|
||||
next
|
||||
end
|
||||
|
||||
|
@ -148,7 +148,7 @@ module Twine
|
|||
|
||||
output = formatter.format_file(lang)
|
||||
unless output
|
||||
Twine::stderr.puts "Skipping file #{file_name} since it would not contain any translations."
|
||||
Twine::stdout.puts "Skipping file #{file_name} since it would not contain any translations."
|
||||
next
|
||||
end
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ module Twine
|
|||
|
||||
value = write_value(definition, dev_lang, f)
|
||||
if !value && !definition.reference_key
|
||||
puts "Warning: #{definition.key} does not exist in developer language '#{dev_lang}'"
|
||||
Twine::stdout.puts "WARNING: #{definition.key} does not exist in developer language '#{dev_lang}'"
|
||||
end
|
||||
|
||||
if definition.reference_key
|
||||
|
|
|
@ -278,7 +278,7 @@ class TestGenerateLocalizationArchiveCLI < CLITest
|
|||
|
||||
def test_deprecated_command_prints_warning
|
||||
parse "generate-loc-drop #{@twine_file_path} #{@output_path} --format apple"
|
||||
assert_match "WARNING: Twine commands names have changed.", Twine::stderr.string
|
||||
assert_match "WARNING: Twine commands names have changed.", Twine::stdout.string
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -401,7 +401,7 @@ class TestConsumeLocalizationArchiveCLI < CLITest
|
|||
|
||||
def test_deprecated_command_prints_warning
|
||||
parse "consume-loc-drop #{@twine_file_path} #{@input_path}"
|
||||
assert_match "WARNING: Twine commands names have changed.", Twine::stderr.string
|
||||
assert_match "WARNING: Twine commands names have changed.", Twine::stdout.string
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class TestGenerateAllLocalizationFiles < CommandTest
|
|||
Dir.mkdir File.join @output_dir, 'en.lproj'
|
||||
empty_twine_file = build_twine_file('en') {}
|
||||
new_runner(empty_twine_file).generate_all_localization_files
|
||||
assert_match "Skipping file at path", Twine::stderr.string
|
||||
assert_match "Skipping file at path", Twine::stdout.string
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -92,7 +92,7 @@ class TestGenerateAllLocalizationFiles < CommandTest
|
|||
empty_twine_file = build_twine_file('en') {}
|
||||
new_runner(empty_twine_file).generate_all_localization_files
|
||||
|
||||
assert_match "Skipping file at path", Twine::stderr.string
|
||||
assert_match "Skipping file at path", Twine::stdout.string
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ class TestGenerateLocalizationArchive < CommandTest
|
|||
def test_prints_empty_file_warnings
|
||||
empty_twine_file = build_twine_file('en') {}
|
||||
new_runner(empty_twine_file).generate_localization_archive
|
||||
assert_match "Skipping file", Twine::stderr.string
|
||||
assert_match "Skipping file", Twine::stdout.string
|
||||
end
|
||||
|
||||
class TestValidate < CommandTest
|
||||
|
|
Reference in a new issue