Module: Applocale
- Defined in:
- lib/applocale/Core/setting.rb,
lib/applocale.rb,
lib/applocale/version.rb,
lib/applocale/Core/init.rb,
lib/applocale/Util/lang.rb,
lib/applocale/Command/init.rb,
lib/applocale/Util/platform.rb,
lib/applocale/Util/file_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/error_util.rb,
lib/applocale/Util/regex_util.rb,
lib/applocale/Util/config_util.rb,
lib/applocale/Util/compare_util.rb,
lib/applocale/Util/convert_util.rb,
lib/applocale/Core/ParseCSV/parse_csv.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx.rb,
lib/applocale/Core/convert_to_localefile.rb,
lib/applocale/Core/GoogleHepler/google_helper.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx_module.rb,
lib/applocale/Core/ParseXLSX/parse_xlsx_module.rb,
lib/applocale/Core/ParseModel/parse_model_module.rb,
lib/applocale/Core/ParserStringFile/parse_xml_file.rb,
lib/applocale/Core/ParserStringFile/parse_strings_file.rb,
lib/applocale/Core/CompareStringFile/compare_string_file.rb,
lib/applocale/Core/CompareStringFile/compare_string_files.rb,
lib/applocale/Core/ParserStringFile/parse_localized_resource.rb
Overview
module Applocale
class Setting
class <<self
attr_accessor :link, :platform, :keystr, :langlist, :xlsxpath
end
def self.printlog
puts ' In Setting'
puts " link = #{self.link}"
puts " platform = #{self.platform}"
puts " keystr = #{self.keystr}"
puts " langlist = #{self.langlist}"
puts " xlsxpath = #{self.xlsxpath}"
end
end
end
Defined Under Namespace
Modules: Config, ErrorUtil, Locale, ParseModelModule, ParseXLSXModule, Platform
Classes: Command, CompareStringFile, CompareStringFiles, ContentUtil, ConvertFile, ConvertToStrFile, FilePathUtil, GoogleHelper, Injeust, ParseCSV, ParseLocalizedResource, ParseStringsFile, ParseXLSX, ParseXMLFile, ValidKey
Constant Summary
collapse
- VERSION =
"0.4.4"
Class Method Summary
collapse
-
.compare(file1, file2) ⇒ Object
-
.compare_local(file1, file2, projpath = Dir.pwd, result_file) ⇒ Object
-
.create_config_file(platformStr = nil, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
-
.findkey(key, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
-
.start_local_update(asetting = nil, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename.to_s) ⇒ Object
-
.start_reverse(is_skip, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
-
.start_update(projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
Class Method Details
.compare(file1, file2) ⇒ Object
.compare_local(file1, file2, projpath = Dir.pwd, result_file) ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
# File 'lib/applocale/Core/init.rb', line 135
def self.compare_local(file1, file2, projpath = Dir.pwd, result_file)
puts 'Reminder: run `update` for both files before `compare`'.yellow
proj_path = projpath
proj_path = Dir.pwd if projpath.nil?
proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path)
obj1 = Applocale::Config::ConfigUtil.new(proj_apath, file1)
obj2 = Applocale::Config::ConfigUtil.new(proj_apath, file2)
setting1 = obj1.load_configfile_to_setting(false)
setting2 = obj2.load_configfile_to_setting(false)
platform1 = setting1.platform
platform2 = setting2.platform
if platform1 != platform2
ErrorUtil::FileMustSamePlatform.new.raise
end
if result_file.nil?
ErrorUtil::MissingComparisonResultFilePath.new.raise
end
if File.extname(result_file).strip.downcase[1..-1].downcase != 'csv'
ErrorUtil::NotSupportComparisonResultFileExtension.new.raise
end
result_file_path = File.join(proj_apath, FilePathUtil.default_mainfolder, result_file)
Applocale::CompareStringFiles.new(platform1, file1, file2, setting1, setting2, result_file_path)
end
|
.create_config_file(platformStr = nil, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
.findkey(key, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
.start_local_update(asetting = nil, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename.to_s) ⇒ Object
.start_reverse(is_skip, projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
.start_update(projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/applocale/Core/init.rb', line 42
def self.start_update(projpath = Dir.pwd, configFile = FilePathUtil.default_config_filename)
configfile_name = configFile
configfile_name = FilePathUtil.default_config_filename if configfile_name.nil?
proj_path = projpath
proj_path = Dir.pwd if projpath.nil?
proj_apath = Applocale::FilePathUtil.get_proj_absoluat_path(proj_path)
obj = Applocale::Config::ConfigUtil.new(proj_apath, configfile_name)
setting = obj.load_configfile_to_setting
if setting.link.to_s.length <= 0
ErrorUtil::ConfigFileInValid.new('[link] is missing in config file ').raise
end
if Applocale::GoogleHelper.is_googlelink(setting.link)
if setting.google_credentials_path.to_s.length <= 0
setting.google_credentials_path = File.expand_path(FilePathUtil.default_google_credentials_filename, File.dirname(setting.configfile_pathstr))
end
googleobj = Applocale::GoogleHelper.new(setting.link, setting.google_credentials_path, setting.xlsxpath)
googleobj.download(setting.sheet_obj_list, export_format: setting.export_format, export_to: setting.export_to)
else
download = open(setting.link)
IO.copy_stream(download, setting.xlsxpath)
end
Applocale.start_local_update(setting, proj_path, configfile_name)
end
|