Error if the user tries --encoding in Ruby 1.8.

This commit is contained in:
Sebastian Celis 2012-02-27 16:06:54 -06:00
parent 9aea9641b5
commit f8586c4379

View file

@ -57,6 +57,9 @@ module Twine
@options[:consume_generate_all] = true
end
opts.on('-e', '--encoding ENCODING', 'Twine defaults to encoding all output files in UTF-8. This flag will tell Twine to use an alternate encoding for these files. For example, you could use this to write Apple .strings files in UTF-16. This flag currently only works with Apple .strings files and is currently only supported in Ruby 1.9.3 or greater.') do |e|
if !"".respond_to?(:encode)
raise Twine::Error.new "The --encoding flag is only supported on Ruby 1.9.3 or greater."
end
@options[:output_encoding] = e
end
opts.on('-o', '--output-file OUTPUT_FILE', 'Write the new strings database to this file instead of replacing the original file. This flag is only useful when running the consume-string-file or consume-loc-drop commands.') do |o|