bin/crowdin-cli in crowdin-cli-0.4.2 vs bin/crowdin-cli in crowdin-cli-0.4.3

- old
+ new

@@ -238,11 +238,11 @@ # Extract compressed files +files_list+ in a ZIP archive +zipfile_name+ to +dest_path+ # # +files_list+ is a Hash of key-value pairs. Where key is a possible archive filename based on current project configuration # and value is the expanded filename # -def unzip_file_with_translations(zipfile_name, dest_path, files_list) +def unzip_file_with_translations(zipfile_name, dest_path, files_list, ignore_match) # overwrite files if they already exist inside of the extracted path Zip.on_exists_proc = true # files that exists in archive and doesn't match current project configuration unmatched_files = [] @@ -252,22 +252,21 @@ # `f' - relative path in archive file = files_list[f.name] if file fpath = File.join(dest_path, file) FileUtils.mkdir_p(File.dirname(fpath)) - puts "Download: `#{file}'" + puts "Extracting: `#{file}'" zipfile.extract(f, fpath) else unmatched_files << f end end end - unless unmatched_files.empty? - puts "Warning: Downloaded translations do not match current project configuration. Some of the resulted files will be omitted." + unless unmatched_files.empty? or ignore_match + puts "Warning: Downloaded translations do not match current project configuration. The following files will be omitted:" unmatched_files.each { |file| puts " - `#{file}'" } - puts "Crowdin has internal caching mechanisms that prevents us from overload. Please try to download translations later." end end # Build a Hash tree from Array of +filenames* # @@ -651,11 +650,15 @@ c.desc I18n.t('app.commands.download.flags.language.desc') c.long_desc I18n.t('app.commands.download.flags.language.long_desc') c.arg_name 'language_code' c.flag [:l, :language], default_value: 'all' - c.action do |global_options ,options, args| + c.desc I18n.t('app.commands.download.switches.ignore_match.desc') + c.switch ['ignore-match'], negatable: false + + + c.action do |global_options, options, args| language = options[:language] supported_languages = @crowdin.supported_languages project_info = @crowdin.project_info @@ -754,10 +757,10 @@ tempfile = Tempfile.new(language) zipfile_name = tempfile.path begin @crowdin.download_translation(language, output: zipfile_name) - unzip_file_with_translations(zipfile_name, @base_path, downloadable_files_hash) + unzip_file_with_translations(zipfile_name, @base_path, downloadable_files_hash, options['ignore-match']) ensure tempfile.close tempfile.unlink # delete the tempfile end