crowdin-cli 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +81 -8
- data/bin/crowdin-cli +49 -20
- data/lib/crowdin-cli/version.rb +1 -1
- data/locales/en.yml +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 670a39458358d6f3b7be7cb8e4d17d1218ae10c5
|
4
|
+
data.tar.gz: abc0a523a67c8a6d05a9bfb12613f8857a2bda9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13580b9db9a409a01ebc2dc18207f4e0f97a97184f67e9cb859b93de1efaf97ae5811c591434f75f24c0fca36437c4a94976c8840084426a1f0d378d7bff53af
|
7
|
+
data.tar.gz: 1e30247d743d9f1b08363866985938d7ddc4c2f56555d80c61da360e3479f4f04dbf2d0db6db4766f999c486b57a3fa9a3b417861d260009c49b94acc8b21df3
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -216,7 +216,7 @@ base_path: /path/to/your/project
|
|
216
216
|
preserve_hierarchy: true
|
217
217
|
```
|
218
218
|
|
219
|
-
###
|
219
|
+
### Uploading files to specified path with specified type
|
220
220
|
|
221
221
|
This add support for 2 optional parameters in the yaml file section: `dest` and `type`.
|
222
222
|
This is useful typically for some projects, where the uploaded name must be different so Crowdin can detect the type correctly.
|
@@ -301,9 +301,41 @@ files:
|
|
301
301
|
first_line_contains_header: true
|
302
302
|
scheme: "identifier,source_phrase,context,uk,ru,fr"
|
303
303
|
multilingual_spreadsheet: true
|
304
|
+
```
|
305
|
+
|
306
|
+
### Versions Management
|
304
307
|
|
308
|
+
In version `0.5.0` we added support for versions management feature in Crowdin. Read more in our [blog](http://blog.crowdin.com/post/130133108120/new-feature-versions-management).
|
309
|
+
|
310
|
+
This is how Crowdin CLI command looks like if you upload source texts from the branch:
|
311
|
+
```
|
312
|
+
crowdin-cli upload sources -b {branch_name}
|
305
313
|
```
|
306
314
|
|
315
|
+
Upload translations texts from the branch:
|
316
|
+
```
|
317
|
+
crowdin-cli upload translations -b {branch_name}
|
318
|
+
```
|
319
|
+
|
320
|
+
Download translations from the branch:
|
321
|
+
```
|
322
|
+
crowdin-cli download -b {branch_name}
|
323
|
+
```
|
324
|
+
|
325
|
+
### Using a common base path for multiple branches
|
326
|
+
|
327
|
+
By default CLI tool uses the base path without taking the branch into account when using the new versions management feature.
|
328
|
+
In case you need to specify a common base path that contains the branches in subfolders named after branch names you can add `base_path_contains_branch_subfolders: true` option in main section of the configuration file.
|
329
|
+
|
330
|
+
Configuration file example:
|
331
|
+
```
|
332
|
+
---
|
333
|
+
project_identifier: test
|
334
|
+
api_key: KeepTheAPIkeySecret
|
335
|
+
base_url: https://api.crowdin.com
|
336
|
+
base_path: /path/to/your/project
|
337
|
+
base_path_contains_branch_subfolders: true
|
338
|
+
```
|
307
339
|
|
308
340
|
## Configurations Examples
|
309
341
|
|
@@ -416,10 +448,10 @@ Installation/SystemRequirements:
|
|
416
448
|
- Java
|
417
449
|
- rvm
|
418
450
|
|
419
|
-
Install JRuby 9.0.0.0 and Warbler gem
|
451
|
+
Install JRuby `>=9.0.0.0` and Warbler gem `>=2.0.0`:
|
420
452
|
|
421
453
|
```
|
422
|
-
$ rvm install jruby
|
454
|
+
$ rvm install jruby
|
423
455
|
$ gem install warbler --pre
|
424
456
|
```
|
425
457
|
|
@@ -427,8 +459,8 @@ Create a new file called `Gemfile` in new project directory, an specify `crowdin
|
|
427
459
|
|
428
460
|
```ruby
|
429
461
|
source 'https://rubygems.org'
|
430
|
-
gem 'crowdin-api', '=0.
|
431
|
-
gem 'crowdin-cli', '=0.
|
462
|
+
gem 'crowdin-api', '=0.4.0'
|
463
|
+
gem 'crowdin-cli', '=0.5.1'
|
432
464
|
```
|
433
465
|
|
434
466
|
Create a new file called `bin/crowdin-cli`:
|
@@ -459,7 +491,7 @@ Install dependencies:
|
|
459
491
|
$ bundle
|
460
492
|
```
|
461
493
|
|
462
|
-
Compile/package with
|
494
|
+
Compile/package with Warbler:
|
463
495
|
|
464
496
|
```
|
465
497
|
$ warble jar
|
@@ -467,7 +499,7 @@ $ warble jar
|
|
467
499
|
|
468
500
|
and rename `warbler.jar` to whatever you want.
|
469
501
|
|
470
|
-
Run jar in any computer with Java:
|
502
|
+
Run jar in any computer with installed Java:
|
471
503
|
|
472
504
|
```
|
473
505
|
java -jar <myapp>.jar
|
@@ -485,6 +517,47 @@ java -jar <myapp>.jar
|
|
485
517
|
|
486
518
|
Author: Anton Maminov (anton.maminov@gmail.com)
|
487
519
|
|
488
|
-
Copyright: 2012-
|
520
|
+
Copyright: 2012-2016 [crowdin.com](http://crowdin.com/)
|
489
521
|
|
490
522
|
This project is licensed under the MIT license, a copy of which can be found in the LICENSE file.
|
523
|
+
|
524
|
+
```
|
525
|
+
|
526
|
+
`.-:://oooosyyyyyyyyyyyyyyyyyyyysoooo+///:::...
|
527
|
+
.-//oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyysoo//:-.`
|
528
|
+
.:+syyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyssssssssssssyyyyyyyyyyyyso+/:.`
|
529
|
+
`:oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyssoo+++///::::::::::::::::::-------::::////+ooooo+/:.
|
530
|
+
`:oyyyyyyyyyyyyyyyyyyyyyyyyyyyso++/::::::::::::--......```` ```
|
531
|
+
-+yyyyyyyyyyyyyyyyyyyyyyyyyso+/:::::::::--...``
|
532
|
+
.oyyyyyyyyyyyyyyyyyyyyyyyyo+::::::::--.`` ....-----------------....`
|
533
|
+
/yyyyyyyyyyyyyyyyyyyyyyyo/:::::::-..` ..-:/+oosssyyyyyyyyyyyyyyyyyyyyyssssssso++/:--`
|
534
|
+
`oyyyyyyyyyyyyyyyyyyyyyyo/::::::-.` .-/+ssyyyyyyyyyyyyyyyysssooo++////::----..........```
|
535
|
+
`syyyyyyyyyyyyyyyyyyyyys/:::::-.` .:+syyyyyyyyyyyyyyysoo+//:::---..```
|
536
|
+
oyyyyyyyyyyyyyyyyyyyyy+:::::-. ./syyyyyyyyyyyyyyso+/::::--.``
|
537
|
+
:yyyyyyyyyyyyyyyyyyyyy+::::-. -oyyyyyyyyyyyyyys+/::::-.`` `.--::/++++ssssssssso++++/::-.`
|
538
|
+
oyyyyyyyyyyyyyyyyyyyy+::::-` .oyyyyyyyyyyyyyyo/:::-.` .-/+ssyyyyyyyyssoo++///::----......``
|
539
|
+
.yyyyyyyyyyyyyyyyyyyys::::- :syyyyyyyyyyyyys/:::-` ./osyyyyyyyyso+/::-.````
|
540
|
+
:ossyyyyyyyyyyyyyyyyy/:::- -yyyyyyyyyyyyyy+:::-` -oyyyyyyyyso/::-.``
|
541
|
+
``.:/+oosssyyyyyyyo::::` `syyyyyyyyyyyyyo:::. `oyyyyyyyyy+::-.`
|
542
|
+
.:::::::///++oo::::- -yyyyyyyyyyyyys:::. `oyyyyyyyys/:-`
|
543
|
+
-::::::::::::::::::. /yyyyyyyyyyyyy+::- :yyyyyyyyy/:.
|
544
|
+
-:::::::::::::::::: .:::++ooosssss:::` /ssyyyyyyo:-
|
545
|
+
o+/:-::::::::::::::::::- :::::::::::::` ``.///////:.
|
546
|
+
yyyyyyssoo++////:::::::. ::::::::::::- `..::::::::.
|
547
|
+
yyyyyyyyyyyyyyyysso::::. -o+/++///////:::- :yyssssss/:.
|
548
|
+
yyyyyyyyyyyyyyyyyyy::::. .yyyyyyyyyyyys:::` `yyyyyyyyo:-
|
549
|
+
+yyyyyyyyyyyyyyyyyy/:::. syyyyyyyyyyyy/::. /yyyyyyyy/:.
|
550
|
+
-yyyyyyyyyyyyyyyyyy/:::: :yyyyyyyyyyyyo::: `oyyyyyyyy/:-`
|
551
|
+
`syyyyyyyyyyyyyyyyyo::::` oyyyyyyyyyyyy+::- /syyyyyyyo/:-.`` `````.
|
552
|
+
:yyyyyyyyyyyyyyyyyy/:::- `syyyyyyyyyyyy/::-` `/oyyyyyyyssoo+++//:-.`
|
553
|
+
+yyyyyyyyyyyyyyyyyo::::- `oyyyyyyyyyyyyo:::-` `-://oo+///--`
|
554
|
+
`syyyyyyyyyyyyyyyyy+::::- /yyyyyyyyyyyyyo/:::-..` ``..`
|
555
|
+
`syyyyyyyyyyyyyyyyy+::::-` `/syyyyyyyyyyyyso++//::::/:///:-.`
|
556
|
+
`+yyyyyyyyyyyyyyyyys/::::-` .:+yyyyyyyyyyyyyyyysso/:.`
|
557
|
+
-syyyyyyyyyyyyyyyyyo:::::-.` `.---////----..
|
558
|
+
`/syyyyyyyyyyyyyyyyyo+::::::-..``
|
559
|
+
-+yyyyyyyyyyyyyyyyyyso+/:::::::---......--::-..`
|
560
|
+
-/oyyyyyyyyyyyyyyyyyyyysssoooooooo++/-.`
|
561
|
+
`-:/oosyyyyyyyyyyyyyooo//::.`
|
562
|
+
|
563
|
+
```
|
data/bin/crowdin-cli
CHANGED
@@ -82,6 +82,7 @@ def export_pattern_to_path(path, export_pattern, lang, languages_mapping = nil)
|
|
82
82
|
'%android_code%' => android_locale_code(lang['locale']),
|
83
83
|
'%osx_code%' => osx_language_code(lang['crowdin_code']) + '.lproj',
|
84
84
|
'%osx_xliff%' => osx_language_code(lang['crowdin_code']) + '.xliff',
|
85
|
+
'%osx_locale%' => osx_language_code(lang['crowdin_code']),
|
85
86
|
}
|
86
87
|
|
87
88
|
placeholders = pattern.inject([]){ |memo, h| memo << h.first[/%(.*)%/, 1] }
|
@@ -209,7 +210,8 @@ def get_invalid_placeholders(export_pattern)
|
|
209
210
|
'%locale_with_underscore%',
|
210
211
|
'%android_code%',
|
211
212
|
'%osx_code%',
|
212
|
-
'%
|
213
|
+
'%osx_xliff%',
|
214
|
+
'%osx_locale%',
|
213
215
|
'%original_file_name%',
|
214
216
|
'%original_path%',
|
215
217
|
'%file_extension%',
|
@@ -254,8 +256,14 @@ def unzip_file_with_translations(zipfile_name, dest_path, files_list, ignore_mat
|
|
254
256
|
|
255
257
|
Zip::File.open(zipfile_name) do |zipfile|
|
256
258
|
zipfile.select { |zip_entry| zip_entry.file? }.each do |f|
|
259
|
+
filename = f.name
|
260
|
+
if @branch_name and @base_path_contains_branch_subfolders
|
261
|
+
# strip branch from filename
|
262
|
+
filename = f.name.sub(File.join(@branch_name, '/'), '')
|
263
|
+
end
|
264
|
+
|
257
265
|
# `f' - relative path in archive
|
258
|
-
file = files_list[
|
266
|
+
file = files_list[filename]
|
259
267
|
if file
|
260
268
|
fpath = File.join(dest_path, file)
|
261
269
|
FileUtils.mkdir_p(File.dirname(fpath))
|
@@ -452,7 +460,7 @@ command :upload do |c|
|
|
452
460
|
end
|
453
461
|
end # Find
|
454
462
|
|
455
|
-
end # if File.
|
463
|
+
end # if File.exist?
|
456
464
|
end # @config['files']
|
457
465
|
|
458
466
|
if dest_files.empty?
|
@@ -630,7 +638,7 @@ command :upload do |c|
|
|
630
638
|
file_translation_languages = translation_languages
|
631
639
|
end
|
632
640
|
|
633
|
-
if File.
|
641
|
+
if File.exist?(File.join(@base_path, file['source']))
|
634
642
|
dest = file['dest'] || file['source']
|
635
643
|
dest.sub!(/\A#{Regexp.escape(@base_path)}/, '')
|
636
644
|
dest_files << dest
|
@@ -732,6 +740,9 @@ command :download do |c|
|
|
732
740
|
c.desc I18n.t('app.commands.download.switches.ignore_match.desc')
|
733
741
|
c.switch ['ignore-match'], negatable: false
|
734
742
|
|
743
|
+
c.desc I18n.t('app.commands.download.switches.include_unchanged')
|
744
|
+
c.switch ['include-unchanged'], negatable: false
|
745
|
+
|
735
746
|
c.action do |global_options, options, args|
|
736
747
|
if @branch_name
|
737
748
|
branch = @project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
@@ -768,15 +779,17 @@ command :download do |c|
|
|
768
779
|
params = {}
|
769
780
|
params[:branch] = @branch_name if @branch_name
|
770
781
|
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
if export_translations['success']
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
782
|
+
unless options['include-unchanged']
|
783
|
+
# use export API method before to download the most recent translations
|
784
|
+
print 'Building ZIP archive with the latest translations '
|
785
|
+
export_translations = @crowdin.export_translations(params)
|
786
|
+
if export_translations['success']
|
787
|
+
if export_translations['success']['status'] == 'built'
|
788
|
+
puts "- OK"
|
789
|
+
elsif export_translations['success']['status'] == 'skipped'
|
790
|
+
puts "- Skipped"
|
791
|
+
puts "Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes."
|
792
|
+
end
|
780
793
|
end
|
781
794
|
end
|
782
795
|
|
@@ -803,7 +816,7 @@ command :download do |c|
|
|
803
816
|
file_translation_languages = translation_languages
|
804
817
|
end
|
805
818
|
|
806
|
-
if File.
|
819
|
+
if File.exist?(File.join(@base_path, file['source']))
|
807
820
|
dest = file['source'].sub(/\A#{Regexp.escape(@base_path)}/, '')
|
808
821
|
|
809
822
|
file_translation_languages.each do |lang|
|
@@ -952,7 +965,7 @@ command :list do |ls_cmd|
|
|
952
965
|
end
|
953
966
|
end # Find
|
954
967
|
|
955
|
-
end # if File.
|
968
|
+
end # if File.exist?
|
956
969
|
end # @config['files']
|
957
970
|
|
958
971
|
common_dir = @preserve_hierarchy ? '' : find_common_directory_path(dest_files)
|
@@ -985,7 +998,7 @@ command :list do |ls_cmd|
|
|
985
998
|
|
986
999
|
ignores = file['ignore'] || []
|
987
1000
|
|
988
|
-
if File.
|
1001
|
+
if File.exist?(File.join(@base_path, file['source']))
|
989
1002
|
dest = file['source'].sub(/\A#{Regexp.escape(@base_path)}/, '')
|
990
1003
|
|
991
1004
|
translation_languages.each do |lang|
|
@@ -1053,7 +1066,7 @@ pre do |globals, command, options, args|
|
|
1053
1066
|
'translatable_elements',
|
1054
1067
|
]
|
1055
1068
|
|
1056
|
-
unless File.
|
1069
|
+
unless File.exist?(globals[:config])
|
1057
1070
|
exit_now! <<-EOS.strip_heredoc
|
1058
1071
|
Can't find configuration file (default `crowdin.yaml').
|
1059
1072
|
Type `crowdin-cli help` to know how to specify custom configuration file
|
@@ -1095,7 +1108,7 @@ pre do |globals, command, options, args|
|
|
1095
1108
|
|
1096
1109
|
# user credentials in the user-specific config file have a higher priority than project-specific
|
1097
1110
|
#
|
1098
|
-
if File.
|
1111
|
+
if File.exist?(globals[:identity])
|
1099
1112
|
identity = YAML.load(ERB.new(File.read(globals[:identity])).result) || {}
|
1100
1113
|
['api_key', 'project_identifier', 'base_path'].each do |key|
|
1101
1114
|
@config[key] = identity[key] if identity[key]
|
@@ -1170,10 +1183,26 @@ pre do |globals, command, options, args|
|
|
1170
1183
|
EOS
|
1171
1184
|
end
|
1172
1185
|
|
1186
|
+
@base_path_contains_branch_subfolders = false
|
1187
|
+
if @config['base_path_contains_branch_subfolders']
|
1188
|
+
@base_path_contains_branch_subfolders = case @config['base_path_contains_branch_subfolders']
|
1189
|
+
when true
|
1190
|
+
true
|
1191
|
+
when false
|
1192
|
+
false
|
1193
|
+
else
|
1194
|
+
exit_now! <<-EOS.strip_heredoc
|
1195
|
+
Parameter `base_path_contains_branch_subfolders` allows values of true or false.
|
1196
|
+
EOS
|
1197
|
+
end
|
1198
|
+
end
|
1199
|
+
|
1173
1200
|
@branch_name = options[:branch] || nil
|
1174
|
-
|
1201
|
+
if @branch_name and @base_path_contains_branch_subfolders
|
1202
|
+
@base_path = File.join(@base_path, @branch_name)
|
1203
|
+
end
|
1175
1204
|
|
1176
|
-
unless Dir.
|
1205
|
+
unless Dir.exist?(@base_path)
|
1177
1206
|
exit_now! <<-EOS.strip_heredoc
|
1178
1207
|
No such directory `#{@base_path}`. Please make sure that the `base_path` is properly set.
|
1179
1208
|
EOS
|
data/lib/crowdin-cli/version.rb
CHANGED
data/locales/en.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdin-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.5.1
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Crowdin CLI.
|