Class: Commandline
- Inherits:
-
Thor
- Object
- Thor
- Commandline
- Includes:
- Thor::Actions
- Defined in:
- lib/babelish_rnc/commandline.rb
Constant Summary collapse
- CSVCLASSES =
[ {:name => "CSV2Strings", :ext => ".strings"}, {:name => "CSV2Android", :ext => ".xml"}, {:name => "CSV2JSON", :ext => ".json"}, {:name => "CSV2Php", :ext => ".php"}, ]
- BASECLASSES =
[ {:name => "Strings2CSV", :ext => ".strings"}, {:name => "Android2CSV", :ext => ".xml"}, {:name => "JSON2CSV", :ext => ".json"}, {:name => "Php2CSV", :ext => ".php"}, ]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
176 177 178 |
# File 'lib/babelish_rnc/commandline.rb', line 176 def self.exit_on_failure? true end |
Instance Method Details
#csv_download ⇒ Object
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/babelish_rnc/commandline.rb', line 71 def csv_download all = [:sheet] ? false : [:all] filename = ['gd_filename'] raise ArgumentError.new("csv_download command : missing file to download") unless filename if all download(filename) else download(filename, ['output_filename'], ['sheet']) end end |
#init ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/babelish_rnc/commandline.rb', line 96 def init if File.exist?(".babelish") say "Config file '.babelish' already exists." else say "Creating new config file '.babelish'." config_file = File.("../../../.babelish.sample", __FILE__) if File.exist?(config_file) system "cp #{config_file} .babelish" else say "Template '#{config_file}' not found." end end end |
#open(file = "translations.csv") ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/babelish_rnc/commandline.rb', line 83 def open(file = "translations.csv") filename = file || ["filename"] if File.exist?(filename) say "Opening local file '#{filename}'" system "open \"#{filename}\"" else say "Opening Google Drive file '#{filename}'" gd = BabelishRnc::GoogleDoc.new gd.open filename.to_s end end |
#version ⇒ Object
112 113 114 115 |
# File 'lib/babelish_rnc/commandline.rb', line 112 def version require "babelish_rnc/version" say "babelish_rnc #{BabelishRnc::VERSION}" end |