crowdin-cli 0.0.11 → 0.0.12
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 +20 -10
- data/lib/crowdin-cli/version.rb +1 -1
- metadata +2 -2
data/bin/crowdin-cli
CHANGED
@@ -143,10 +143,14 @@ command :upload do |c|
|
|
143
143
|
|
144
144
|
c.desc 'Upload source files'
|
145
145
|
c.command :sources do |c|
|
146
|
+
|
147
|
+
c.desc 'defines whether to add sources if there is the same file previously added'
|
148
|
+
c.switch [:ignore_duplicates]
|
149
|
+
|
146
150
|
c.action do |global_options, options, args|
|
147
151
|
project_info = @crowdin.project_info
|
148
152
|
|
149
|
-
source_language = project_info['source_language']['code']
|
153
|
+
source_language = project_info['details']['source_language']['code']
|
150
154
|
|
151
155
|
# Crowdin supported languages list
|
152
156
|
supported_languages = @crowdin.supported_languages
|
@@ -177,6 +181,8 @@ command :upload do |c|
|
|
177
181
|
end
|
178
182
|
end
|
179
183
|
|
184
|
+
exit_now!("Nothing to upload") if local_files.empty?
|
185
|
+
|
180
186
|
common_dir = find_common_directory_path(dest_files)
|
181
187
|
|
182
188
|
local_project_tree = get_local_files_hierarchy(local_files.collect{ |h| h[:dest].sub(common_dir, '') })
|
@@ -191,14 +197,16 @@ command :upload do |c|
|
|
191
197
|
@crowdin.add_directory(dir)
|
192
198
|
end
|
193
199
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
200
|
+
unless options[:ignore_duplicates]
|
201
|
+
# Update existing files in Crowdin project
|
202
|
+
#
|
203
|
+
# array containing elements common to the two arrays
|
204
|
+
update_files = local_project_tree[:files] & remote_project_tree[:files]
|
205
|
+
files_for_upload = local_files.select{ |file| update_files.include?(file[:dest]) }
|
206
|
+
files_for_upload.each do |file|
|
207
|
+
puts "Update file `#{file[:dest]}`"
|
208
|
+
@crowdin.update_file([] << file)
|
209
|
+
end
|
202
210
|
end
|
203
211
|
|
204
212
|
# Add new files to Crowdin project
|
@@ -247,7 +255,7 @@ command :upload do |c|
|
|
247
255
|
supported_languages = @crowdin.supported_languages
|
248
256
|
translation_languages = supported_languages.select{ |lang| project_languages.include?(lang['crowdin_code']) }
|
249
257
|
|
250
|
-
source_language = project_info['source_language']['code']
|
258
|
+
source_language = project_info['details']['source_language']['code']
|
251
259
|
source_language = supported_languages.find{ |lang| lang['crowdin_code'] == source_language }
|
252
260
|
|
253
261
|
translated_files = Hash.new{ |hash, key| hash[key] = Array.new }
|
@@ -281,6 +289,8 @@ command :upload do |c|
|
|
281
289
|
end # if
|
282
290
|
end # @config['files']
|
283
291
|
|
292
|
+
exit_now!("Nothing to upload") if dest_files.empty?
|
293
|
+
|
284
294
|
params = {}
|
285
295
|
params[:import_duplicates] = options[:import_dublicates] ? 1 : 0
|
286
296
|
params[:import_eq_suggestions] = options[:import_eq_suggestions] ? 1 : 0
|
data/lib/crowdin-cli/version.rb
CHANGED
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.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|