crowdin-cli 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
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
- if common_dir
183
- local_files.each{ |file| file[:dest].sub!(common_dir, '') }
184
- local_project_tree[:dirs].each{ |dir| dir.sub!(common_dir, '')}
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)
@@ -1,5 +1,5 @@
1
1
  module Crowdin
2
2
  module CLI
3
- VERSION = '0.0.10'
3
+ VERSION = '0.0.11'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crowdin-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: