crowdin-cli 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/crowdin-cli +8 -10
- data/lib/crowdin-cli/version.rb +1 -1
- metadata +1 -1
data/bin/crowdin-cli
CHANGED
@@ -83,7 +83,7 @@ end
|
|
83
83
|
# @params [Array] paths set of strings representing directory paths
|
84
84
|
#
|
85
85
|
def find_common_directory_path(paths)
|
86
|
-
return paths.first if paths.length <= 1
|
86
|
+
return paths.first.split('/').slice(0...-1).join('/') if paths.length <= 1
|
87
87
|
arr = paths.sort
|
88
88
|
first = arr.first.split('/')
|
89
89
|
last = arr.last.split('/')
|
@@ -156,8 +156,10 @@ command :upload do |c|
|
|
156
156
|
|
157
157
|
local_files = []
|
158
158
|
dest_files = []
|
159
|
+
|
159
160
|
@config['files'].each do |file|
|
160
161
|
if File.exist?("#{@base_path}#{file['source']}")
|
162
|
+
dest_files << file['source']
|
161
163
|
local_files << { dest: file['source'], source: "#{@base_path}#{file['source']}", export_pattern: file['translation'] }
|
162
164
|
else
|
163
165
|
Dir.glob("#{@base_path}#{file['source']}").each do |source|
|
@@ -175,16 +177,11 @@ command :upload do |c|
|
|
175
177
|
end
|
176
178
|
end
|
177
179
|
|
178
|
-
local_project_tree = get_local_files_hierarchy(local_files.collect{ |h| h[:dest] })
|
179
|
-
|
180
180
|
common_dir = find_common_directory_path(dest_files)
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
local_project_tree[:dirs].delete_if{ |dir| dir == ''}
|
186
|
-
local_project_tree[:files].each{ |file| file.sub!(common_dir, '')}
|
187
|
-
end
|
181
|
+
|
182
|
+
local_project_tree = get_local_files_hierarchy(local_files.collect{ |h| h[:dest].sub(common_dir, '') })
|
183
|
+
|
184
|
+
local_files.each{ |file| file[:dest].sub!(common_dir, '') }
|
188
185
|
|
189
186
|
# Create directory tree
|
190
187
|
#
|
@@ -259,6 +256,7 @@ command :upload do |c|
|
|
259
256
|
@config['files'].each do |file|
|
260
257
|
if File.exists?("#{@base_path}#{file['source']}")
|
261
258
|
dest = file['source'].sub("#{@base_path}", '')
|
259
|
+
dest_files << dest
|
262
260
|
|
263
261
|
translation_languages.each do |lang|
|
264
262
|
source = export_pattern_to_path(dest, file['translation'], lang)
|
data/lib/crowdin-cli/version.rb
CHANGED