crowdin-cli 0.5.0.pre → 0.5.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/crowdin-cli +42 -42
- data/lib/crowdin-cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: befb18bf581377776d503a2aec95c65efe68f281
|
4
|
+
data.tar.gz: 8b04486d86ab986221eb693f016a1763f99877d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88473e4a33402a1e87f94ecf9e766737e5070da9a12647793ca9eb44fea68652ec1b3833f442e6efe2c8bb8f660cc77f3e67da019af3161de8f3103d07fbe7d2
|
7
|
+
data.tar.gz: 35ff4bf6f393eb6c19fc638e3568dfdbb29ca9782a7349a01f94cd8b0f91aa98c194bbd855e4ac531c1982d5bf8881b77c8d6189e958a92000f768d6113676b9
|
data/bin/crowdin-cli
CHANGED
@@ -371,16 +371,14 @@ command :upload do |c|
|
|
371
371
|
c.flag [:b, :branch]
|
372
372
|
|
373
373
|
c.action do |global_options, options, args|
|
374
|
-
|
375
|
-
|
376
|
-
source_language = project_info['details']['source_language']['code']
|
374
|
+
source_language = @project_info['details']['source_language']['code']
|
377
375
|
|
378
376
|
# Crowdin supported languages list
|
379
377
|
supported_languages = @crowdin.supported_languages
|
380
378
|
source_language = supported_languages.find { |lang| lang['crowdin_code'] == source_language }
|
381
379
|
|
382
380
|
if @branch_name
|
383
|
-
branch = project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
381
|
+
branch = @project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
384
382
|
|
385
383
|
if branch
|
386
384
|
branch_files = [] << branch
|
@@ -400,7 +398,7 @@ command :upload do |c|
|
|
400
398
|
remote_project_tree[:files].map! { |p| p.split('/')[2..-1].unshift('').join('/') }
|
401
399
|
else
|
402
400
|
# INFO it also includes all branches
|
403
|
-
remote_project_tree = get_remote_files_hierarchy(project_info['files'])
|
401
|
+
remote_project_tree = get_remote_files_hierarchy(@project_info['files'])
|
404
402
|
end
|
405
403
|
|
406
404
|
local_files = []
|
@@ -571,10 +569,8 @@ command :upload do |c|
|
|
571
569
|
|
572
570
|
language = options[:language]
|
573
571
|
|
574
|
-
project_info = @crowdin.project_info
|
575
|
-
|
576
572
|
if @branch_name
|
577
|
-
branch = project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
573
|
+
branch = @project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
578
574
|
|
579
575
|
if branch
|
580
576
|
params[:branch] = @branch_name
|
@@ -589,10 +585,10 @@ command :upload do |c|
|
|
589
585
|
remote_project_tree[:dirs].map! { |p| p.split('/')[2..-1].unshift('').join('/') }
|
590
586
|
remote_project_tree[:files].map! { |p| p.split('/')[2..-1].unshift('').join('/') }
|
591
587
|
else
|
592
|
-
remote_project_tree = get_remote_files_hierarchy(project_info['files'])
|
588
|
+
remote_project_tree = get_remote_files_hierarchy(@project_info['files'])
|
593
589
|
end
|
594
590
|
|
595
|
-
project_languages = project_info['languages'].collect { |h| h['code'] }
|
591
|
+
project_languages = @project_info['languages'].collect { |h| h['code'] }
|
596
592
|
|
597
593
|
if language == 'all'
|
598
594
|
# do nothing
|
@@ -606,7 +602,7 @@ command :upload do |c|
|
|
606
602
|
|
607
603
|
supported_languages = @crowdin.supported_languages
|
608
604
|
|
609
|
-
source_language = project_info['details']['source_language']['code']
|
605
|
+
source_language = @project_info['details']['source_language']['code']
|
610
606
|
source_language = supported_languages.find { |lang| lang['crowdin_code'] == source_language }
|
611
607
|
|
612
608
|
translation_languages = supported_languages.select { |lang| project_languages.include?(lang['crowdin_code']) }
|
@@ -735,13 +731,21 @@ command :download do |c|
|
|
735
731
|
c.switch ['ignore-match'], negatable: false
|
736
732
|
|
737
733
|
c.action do |global_options, options, args|
|
734
|
+
if @branch_name
|
735
|
+
branch = @project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
736
|
+
|
737
|
+
unless branch
|
738
|
+
exit_now! <<-EOS.strip_heredoc
|
739
|
+
path `#{@branch_name}' did not match any branch known to Crowdin
|
740
|
+
EOS
|
741
|
+
end
|
742
|
+
end
|
743
|
+
|
738
744
|
language = options[:language]
|
739
745
|
|
740
746
|
supported_languages = @crowdin.supported_languages
|
741
747
|
|
742
|
-
|
743
|
-
|
744
|
-
project_languages = project_info['languages'].collect{ |h| h['code'] }
|
748
|
+
project_languages = @project_info['languages'].collect { |h| h['code'] }
|
745
749
|
|
746
750
|
if language == 'all'
|
747
751
|
if @jipt_language
|
@@ -774,7 +778,7 @@ command :download do |c|
|
|
774
778
|
end
|
775
779
|
end
|
776
780
|
|
777
|
-
source_language = project_info['details']['source_language']['code']
|
781
|
+
source_language = @project_info['details']['source_language']['code']
|
778
782
|
source_language = supported_languages.find { |lang| lang['crowdin_code'] == source_language }
|
779
783
|
|
780
784
|
translation_languages = supported_languages.select { |lang| project_languages.include?(lang['crowdin_code']) }
|
@@ -858,23 +862,29 @@ long_desc I18n.t('app.commands.list.long_desc')
|
|
858
862
|
command :list do |ls_cmd|
|
859
863
|
|
860
864
|
ls_cmd.desc I18n.t('app.commands.list.commands.project.desc')
|
861
|
-
ls_cmd.command :project do |
|
862
|
-
|
863
|
-
|
865
|
+
ls_cmd.command :project do |prj_cmd|
|
866
|
+
prj_cmd.desc I18n.t('app.commands.list.switches.tree.desc')
|
867
|
+
prj_cmd.switch ['tree'], negatable: false
|
864
868
|
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
proj_cmd.action do |global_options, options, args|
|
870
|
-
project_info = @crowdin.project_info
|
869
|
+
prj_cmd.desc I18n.t('app.flags.branch.desc')
|
870
|
+
prj_cmd.arg_name 'branch_name'
|
871
|
+
prj_cmd.flag [:b, :branch]
|
871
872
|
|
873
|
+
prj_cmd.action do |global_options, options, args|
|
872
874
|
if @branch_name
|
873
|
-
branch = project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
874
|
-
|
875
|
+
branch = @project_info['files'].find { |h| h['node_type'] == 'branch' && h['name'] == @branch_name }
|
876
|
+
|
877
|
+
unless branch
|
878
|
+
exit_now! <<-EOS.strip_heredoc
|
879
|
+
path `#{@branch_name}' did not match any branch known to Crowdin
|
880
|
+
EOS
|
881
|
+
end
|
882
|
+
|
883
|
+
branch_files = [] << branch
|
884
|
+
|
875
885
|
remote_project_tree = get_remote_files_hierarchy(branch_files)
|
876
886
|
else
|
877
|
-
remote_project_tree = get_remote_files_hierarchy(project_info['files'])
|
887
|
+
remote_project_tree = get_remote_files_hierarchy(@project_info['files'])
|
878
888
|
end
|
879
889
|
|
880
890
|
if options[:tree]
|
@@ -891,10 +901,6 @@ command :list do |ls_cmd|
|
|
891
901
|
src_cmd.desc I18n.t('app.commands.list.switches.tree.desc')
|
892
902
|
src_cmd.switch ['tree'], negatable: false
|
893
903
|
|
894
|
-
src_cmd.desc I18n.t('app.flags.branch.desc')
|
895
|
-
src_cmd.arg_name 'branch_name'
|
896
|
-
src_cmd.flag [:b, :branch]
|
897
|
-
|
898
904
|
src_cmd.action do |global_options, options, args|
|
899
905
|
local_files = []
|
900
906
|
dest_files = []
|
@@ -965,14 +971,8 @@ command :list do |ls_cmd|
|
|
965
971
|
trans_cmd.desc I18n.t('app.commands.list.switches.tree.desc')
|
966
972
|
trans_cmd.switch ['tree'], negatable: false
|
967
973
|
|
968
|
-
trans_cmd.desc I18n.t('app.flags.branch.desc')
|
969
|
-
trans_cmd.arg_name 'branch_name'
|
970
|
-
trans_cmd.flag [:b, :branch]
|
971
|
-
|
972
974
|
trans_cmd.action do |global_options, options, args|
|
973
|
-
|
974
|
-
|
975
|
-
project_languages = project_info['languages'].collect{ |h| h['code'] }
|
975
|
+
project_languages = @project_info['languages'].collect { |h| h['code'] }
|
976
976
|
|
977
977
|
supported_languages = @crowdin.supported_languages
|
978
978
|
translation_languages = supported_languages.select { |lang| project_languages.include?(lang['crowdin_code']) }
|
@@ -1029,7 +1029,7 @@ command :list do |ls_cmd|
|
|
1029
1029
|
#ls_cmd.default_command :project
|
1030
1030
|
end # list
|
1031
1031
|
|
1032
|
-
pre do |globals
|
1032
|
+
pre do |globals, command, options, args|
|
1033
1033
|
# Pre logic here
|
1034
1034
|
# Return true to proceed; false to abourt and not call the
|
1035
1035
|
# chosen command
|
@@ -1169,11 +1169,11 @@ pre do |globals ,command, options, args|
|
|
1169
1169
|
end
|
1170
1170
|
|
1171
1171
|
@branch_name = options[:branch] || nil
|
1172
|
-
@base_path = @branch_name ? File.join(@base_path, @branch_name) : @base_path
|
1172
|
+
# @base_path = @branch_name ? File.join(@base_path, @branch_name) : @base_path
|
1173
1173
|
|
1174
1174
|
unless Dir.exists?(@base_path)
|
1175
1175
|
exit_now! <<-EOS.strip_heredoc
|
1176
|
-
No such directory `#{@base_path}`. Please make sure that the `base_path`
|
1176
|
+
No such directory `#{@base_path}`. Please make sure that the `base_path` is properly set.
|
1177
1177
|
EOS
|
1178
1178
|
end
|
1179
1179
|
|
@@ -1202,7 +1202,7 @@ pre do |globals ,command, options, args|
|
|
1202
1202
|
@crowdin = Crowdin::API.new(api_key: @config['api_key'], project_id: @config['project_identifier'], base_url: base_url)
|
1203
1203
|
|
1204
1204
|
begin
|
1205
|
-
@crowdin.project_info
|
1205
|
+
@project_info = @crowdin.project_info
|
1206
1206
|
rescue Crowdin::API::Errors::Error => err
|
1207
1207
|
raise err
|
1208
1208
|
rescue
|
data/lib/crowdin-cli/version.rb
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.0.
|
4
|
+
version: 0.5.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|