bin/crowdin-cli in crowdin-cli-0.3.2 vs bin/crowdin-cli in crowdin-cli-0.3.3
- old
+ new
@@ -205,17 +205,23 @@
# Return a string representing that part of the directory tree that is common to all the files
#
# @params [Array] paths set of strings representing directory paths
#
def find_common_directory_path(paths)
- return paths.first.split('/').slice(0...-1).join('/') if paths.length <= 1
- arr = paths.sort
- first = arr.first.split('/')
- last = arr.last.split('/')
- i = 0
- i += 1 while first[i] == last[i] && i <= first.length
- first.slice(0, i).join('/')
+ case paths.length
+ when 0
+ return '/'
+ when 1
+ return paths.first.split('/').slice(0...-1).join('/')
+ else
+ arr = paths.sort
+ first = arr.first.split('/')
+ last = arr.last.split('/')
+ i = 0
+ i += 1 while first[i] == last[i] && i <= first.length
+ first.slice(0, i).join('/')
+ end
end
# 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 posible archive filename based on current project configuration
@@ -589,10 +595,10 @@
puts "\rUploading translation file `#{file[:source].sub(@base_path, '')}' - Skipped"
when 'uploaded'
puts "\rUploading translation file `#{file[:source].sub(@base_path, '')}' - OK"
end
else
- puts "Warning: Local file `#{file[:source]}' does not exists"
+ puts "Warning: Local file `#{file[:source]}' does not exist"
end
else
# if source file does not exist, don't upload translations
puts "Warning: Skip `#{file[:source].sub(@base_path, '')}'"
end