zci 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/README.md +15 -14
- data/lib/zci/commands/02_import.rb +3 -3
- data/lib/zci/commands/04_export.rb +8 -4
- data/lib/zci/commands/05_info.rb +10 -7
- data/lib/zci/version.rb +1 -1
- data/zci.gemspec +11 -14
- metadata +13 -62
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d032d53cdb29d566c82c1fa1e9baa0b612c3a00c7f2d319ab54a5c441d2a4b68
|
4
|
+
data.tar.gz: 6a83c172726b3b6c21fc49349cc1d3dadac0d1e20a949afaf35b426ac6b89200
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7567a0660485cb0477c3b008b596b5937f2658e06430b32af14192ab7a602f4f5f1cdc5b168d842a1d740b2dda7dabbed0b9f4b8172673da98fd8a80edd70eb
|
7
|
+
data.tar.gz: a279ef3ede31bc3647e42ffc68c8e9db81e3355b1c2b532de5f3d180e6264c5fa020aecbfe59b647f83fbd229839d1e4d59ccc8bb567871e6aed5746240f8f80
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.1
|
data/README.md
CHANGED
@@ -6,39 +6,40 @@ Zendesk and Crowdin integration Command Line Interface (CLI)
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
```
|
9
|
+
```ruby
|
10
10
|
gem 'zci'
|
11
11
|
```
|
12
12
|
|
13
13
|
And then execute:
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
```console
|
16
|
+
bundle
|
16
17
|
```
|
17
18
|
|
18
19
|
Or install it manually as:
|
19
20
|
|
20
|
-
```
|
21
|
-
|
21
|
+
```console
|
22
|
+
gem install zci
|
22
23
|
```
|
23
24
|
|
24
25
|
## Use
|
25
26
|
|
26
27
|
The simplest way to get started is to create a scaffold project:
|
27
28
|
|
28
|
-
```
|
29
|
-
|
29
|
+
```console
|
30
|
+
zci init todo
|
30
31
|
```
|
31
32
|
|
32
33
|
A new ./todo directory is created with the sample config `zci.yml`. View the basic output of the scaffold with:
|
33
34
|
|
34
|
-
```
|
35
|
-
|
36
|
-
|
35
|
+
```console
|
36
|
+
cd todo
|
37
|
+
zci help
|
37
38
|
```
|
38
39
|
|
39
40
|
Which will output:
|
40
41
|
|
41
|
-
```
|
42
|
+
```console
|
42
43
|
NAME
|
43
44
|
zci - is a command line tool that allows you to manage and synchronize your Zendesk localization with Crowdin project
|
44
45
|
|
@@ -46,7 +47,7 @@ SYNOPSIS
|
|
46
47
|
zci [global options] command [command options] [arguments...]
|
47
48
|
|
48
49
|
VERSION
|
49
|
-
0.
|
50
|
+
0.5.0
|
50
51
|
|
51
52
|
GLOBAL OPTIONS
|
52
53
|
-c, --config=<s> - Project-specific configuration file (default: /home/crowdin/zci.yml)
|
@@ -67,7 +68,7 @@ COMMANDS
|
|
67
68
|
|
68
69
|
The scaffold project that was created in ./todo comes with a `zci.yml` shell.
|
69
70
|
|
70
|
-
```
|
71
|
+
```yaml
|
71
72
|
---
|
72
73
|
# Crowdin API credentials
|
73
74
|
crowdin_project_id: '<%your-crowdin-project-id%>'
|
@@ -118,6 +119,6 @@ Tested with the following Ruby versions:
|
|
118
119
|
|
119
120
|
Author: Anton Maminov (anton.maminov@gmail.com)
|
120
121
|
|
121
|
-
Copyright: 2015-
|
122
|
+
Copyright: 2015-2019 [crowdin.com](http://crowdin.com/)
|
122
123
|
|
123
124
|
This project is licensed under the MIT license, a copy of which can be found in the LICENSE file.
|
@@ -85,7 +85,7 @@ command :'import:sources' do |c|
|
|
85
85
|
{
|
86
86
|
source: File.join(resources_category_dir, file_name),
|
87
87
|
dest: File.join(source_category_id.to_s, file_name),
|
88
|
-
export_pattern: '/%
|
88
|
+
export_pattern: '/%locale%/%original_path%/%original_file_name%',
|
89
89
|
title: category_hash[:name]
|
90
90
|
}
|
91
91
|
]
|
@@ -110,7 +110,7 @@ command :'import:sources' do |c|
|
|
110
110
|
{
|
111
111
|
source: File.join(resources_category_dir, file_name),
|
112
112
|
dest: File.join(source_category_id.to_s, file_name),
|
113
|
-
export_pattern: '/%
|
113
|
+
export_pattern: '/%locale%/%original_path%/%original_file_name%',
|
114
114
|
title: section[:name]
|
115
115
|
}
|
116
116
|
]
|
@@ -136,7 +136,7 @@ command :'import:sources' do |c|
|
|
136
136
|
{
|
137
137
|
source: File.join(resources_category_dir, file_name),
|
138
138
|
dest: File.join(source_category_id.to_s, file_name),
|
139
|
-
export_pattern: '/%
|
139
|
+
export_pattern: '/%locale%/%original_path%/%original_file_name%',
|
140
140
|
title: article[:title]
|
141
141
|
}
|
142
142
|
]
|
@@ -17,6 +17,8 @@ command :'export:translations' do |c|
|
|
17
17
|
resources_dir = File.join(File.dirname(global_options[:config]), options[:resources_dir])
|
18
18
|
language = options[:language]
|
19
19
|
|
20
|
+
crowdin_supported_languages = @crowdin.supported_languages
|
21
|
+
|
20
22
|
if language == 'all'
|
21
23
|
zendesk_locales = @zendesk.locales
|
22
24
|
else
|
@@ -26,9 +28,11 @@ command :'export:translations' do |c|
|
|
26
28
|
@cli_config['categories'].each do |category_section|
|
27
29
|
zendesk_locales.select { |locale| !locale.default? }.each do |locale|
|
28
30
|
if lang = category_section['translations'].detect { |tr| tr['zendesk_locale'].casecmp(locale.locale) == 0 }
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
crowdin_locale = crowdin_supported_languages.detect { |l| l['crowdin_code'] == lang['crowdin_language_code'] }['locale']
|
32
|
+
|
33
|
+
category_xml_files = Dir["#{resources_dir}/#{crowdin_locale}/#{category_section['zendesk_category']}/category_*.xml"]
|
34
|
+
section_xml_files = Dir["#{resources_dir}/#{crowdin_locale}/#{category_section['zendesk_category']}/section_*.xml"]
|
35
|
+
article_xml_files = Dir["#{resources_dir}/#{crowdin_locale}/#{category_section['zendesk_category']}/article_*.xml"]
|
32
36
|
|
33
37
|
all_categories = []
|
34
38
|
all_sections = []
|
@@ -105,7 +109,7 @@ command :'export:translations' do |c|
|
|
105
109
|
puts "[Zendesk] Update `#{lang['crowdin_language_code']}` language translation for Article\##{article.id}."
|
106
110
|
end
|
107
111
|
else
|
108
|
-
article_tr = article.translations.build(locale: locale.locale, title: article_hash[:title], body: article_hash[:body])
|
112
|
+
article_tr = article.translations.build(locale: locale.locale, draft: true, title: article_hash[:title], body: article_hash[:body])
|
109
113
|
article_tr.save
|
110
114
|
puts "[Zendesk] Create `#{lang['crowdin_language_code']}` language translation for Article\##{article.id}."
|
111
115
|
end
|
data/lib/zci/commands/05_info.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
desc 'Zendesk and Crowdin info'
|
2
2
|
command :'project:info' do |c|
|
3
3
|
c.action do |global_options, options, args|
|
4
|
+
puts "ruby #{RUBY_VERSION}"
|
5
|
+
puts "zci #{ZCI::VERSION}"
|
6
|
+
puts "zendesk_help_center_api #{ZendeskAPI::HelpCenter::VERSION}"
|
7
|
+
puts
|
4
8
|
# Crowdin
|
5
9
|
begin
|
6
10
|
crowdin_info = @crowdin.project_info
|
7
|
-
puts "Crowdin:
|
11
|
+
puts "Crowdin: authentication successful."
|
8
12
|
puts "Crowdin: available locales:"
|
9
13
|
crowdin_info["languages"].each do |lang|
|
10
|
-
puts "#{lang['code']}"
|
14
|
+
puts " - #{lang['code']}"
|
11
15
|
end
|
12
16
|
rescue => e
|
13
17
|
puts "Crowdin: API key is incorect"
|
@@ -16,20 +20,19 @@ command :'project:info' do |c|
|
|
16
20
|
|
17
21
|
# Zendesk
|
18
22
|
if @zendesk.current_user.id
|
19
|
-
puts "Zendesk:
|
23
|
+
puts "Zendesk: authentication successful."
|
20
24
|
categories = @zendesk.hc_categories
|
21
25
|
|
22
|
-
puts "Zendesk: available categories"
|
26
|
+
puts "Zendesk: available categories:"
|
23
27
|
categories.each do |category|
|
24
|
-
puts "#{category.id}: #{category.name}"
|
28
|
+
puts " - #{category.id}: #{category.name}"
|
25
29
|
end
|
26
|
-
puts
|
27
30
|
|
28
31
|
locales = @zendesk.locales
|
29
32
|
|
30
33
|
puts "Zendesk: available locales:"
|
31
34
|
locales.each do |locale|
|
32
|
-
puts "#{locale.locale}"
|
35
|
+
puts " - #{locale.locale}"
|
33
36
|
end
|
34
37
|
else
|
35
38
|
puts "Zendesk: login and/or password is incorect"
|
data/lib/zci/version.rb
CHANGED
data/zci.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require File.join([File.dirname(__FILE__), 'lib', 'zci', 'version.rb'])
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
4
|
s.name = 'zci'
|
5
5
|
s.version = ZCI::VERSION
|
6
6
|
s.author = 'Anton Maminov'
|
@@ -11,17 +11,14 @@ spec = Gem::Specification.new do |s|
|
|
11
11
|
s.summary = 'Zendesk and Crowdin integration Command Line Interface (CLI)'
|
12
12
|
s.files = `git ls-files`.split("\n")
|
13
13
|
s.require_paths << 'lib'
|
14
|
-
# s.has_rdoc = true
|
15
|
-
# s.extra_rdoc_files = ['README.rdoc','zci.rdoc']
|
16
|
-
# s.rdoc_options << '--title' << 'zci' << '--main' << 'README.rdoc' << '-ri'
|
17
14
|
s.bindir = 'bin'
|
18
15
|
s.executables << 'zci'
|
19
|
-
s.add_runtime_dependency 'nokogiri', '~> 1.
|
20
|
-
s.add_runtime_dependency 'rubyzip', '~> 1.2'
|
21
|
-
s.add_runtime_dependency 'crowdin-api', '~> 0.5'
|
22
|
-
s.add_runtime_dependency 'zendesk_help_center_api', '~> 0.
|
23
|
-
s.add_runtime_dependency 'gli', '~> 2.
|
24
|
-
s.add_development_dependency 'rake', '~> 12.
|
25
|
-
s.add_development_dependency 'rdoc', '~>
|
26
|
-
s.add_development_dependency 'aruba', '~> 0.14'
|
16
|
+
s.add_runtime_dependency 'nokogiri', '~> 1.10'
|
17
|
+
s.add_runtime_dependency 'rubyzip', '~> 1.2'
|
18
|
+
s.add_runtime_dependency 'crowdin-api', '~> 0.5'
|
19
|
+
s.add_runtime_dependency 'zendesk_help_center_api', '~> 0.5'
|
20
|
+
s.add_runtime_dependency 'gli', '~> 2.18'
|
21
|
+
s.add_development_dependency 'rake', '~> 12.3'
|
22
|
+
s.add_development_dependency 'rdoc', '~> 6.1'
|
23
|
+
s.add_development_dependency 'aruba', '~> 0.14'
|
27
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Maminov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -16,20 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.7.0
|
19
|
+
version: '1.10'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1.
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.7.0
|
26
|
+
version: '1.10'
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: rubyzip
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -37,9 +31,6 @@ dependencies:
|
|
37
31
|
- - "~>"
|
38
32
|
- !ruby/object:Gem::Version
|
39
33
|
version: '1.2'
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 1.2.0
|
43
34
|
type: :runtime
|
44
35
|
prerelease: false
|
45
36
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -47,9 +38,6 @@ dependencies:
|
|
47
38
|
- - "~>"
|
48
39
|
- !ruby/object:Gem::Version
|
49
40
|
version: '1.2'
|
50
|
-
- - ">="
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: 1.2.0
|
53
41
|
- !ruby/object:Gem::Dependency
|
54
42
|
name: crowdin-api
|
55
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,9 +45,6 @@ dependencies:
|
|
57
45
|
- - "~>"
|
58
46
|
- !ruby/object:Gem::Version
|
59
47
|
version: '0.5'
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 0.5.0
|
63
48
|
type: :runtime
|
64
49
|
prerelease: false
|
65
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -67,89 +52,62 @@ dependencies:
|
|
67
52
|
- - "~>"
|
68
53
|
- !ruby/object:Gem::Version
|
69
54
|
version: '0.5'
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: 0.5.0
|
73
55
|
- !ruby/object:Gem::Dependency
|
74
56
|
name: zendesk_help_center_api
|
75
57
|
requirement: !ruby/object:Gem::Requirement
|
76
58
|
requirements:
|
77
59
|
- - "~>"
|
78
60
|
- !ruby/object:Gem::Version
|
79
|
-
version: '0.
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.2.0
|
61
|
+
version: '0.5'
|
83
62
|
type: :runtime
|
84
63
|
prerelease: false
|
85
64
|
version_requirements: !ruby/object:Gem::Requirement
|
86
65
|
requirements:
|
87
66
|
- - "~>"
|
88
67
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: 0.2.0
|
68
|
+
version: '0.5'
|
93
69
|
- !ruby/object:Gem::Dependency
|
94
70
|
name: gli
|
95
71
|
requirement: !ruby/object:Gem::Requirement
|
96
72
|
requirements:
|
97
73
|
- - "~>"
|
98
74
|
- !ruby/object:Gem::Version
|
99
|
-
version: '2.
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: 2.16.0
|
75
|
+
version: '2.18'
|
103
76
|
type: :runtime
|
104
77
|
prerelease: false
|
105
78
|
version_requirements: !ruby/object:Gem::Requirement
|
106
79
|
requirements:
|
107
80
|
- - "~>"
|
108
81
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: 2.16.0
|
82
|
+
version: '2.18'
|
113
83
|
- !ruby/object:Gem::Dependency
|
114
84
|
name: rake
|
115
85
|
requirement: !ruby/object:Gem::Requirement
|
116
86
|
requirements:
|
117
87
|
- - "~>"
|
118
88
|
- !ruby/object:Gem::Version
|
119
|
-
version: '12.
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 12.0.0
|
89
|
+
version: '12.3'
|
123
90
|
type: :development
|
124
91
|
prerelease: false
|
125
92
|
version_requirements: !ruby/object:Gem::Requirement
|
126
93
|
requirements:
|
127
94
|
- - "~>"
|
128
95
|
- !ruby/object:Gem::Version
|
129
|
-
version: '12.
|
130
|
-
- - ">="
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: 12.0.0
|
96
|
+
version: '12.3'
|
133
97
|
- !ruby/object:Gem::Dependency
|
134
98
|
name: rdoc
|
135
99
|
requirement: !ruby/object:Gem::Requirement
|
136
100
|
requirements:
|
137
101
|
- - "~>"
|
138
102
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
140
|
-
- - ">="
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
version: 5.1.0
|
103
|
+
version: '6.1'
|
143
104
|
type: :development
|
144
105
|
prerelease: false
|
145
106
|
version_requirements: !ruby/object:Gem::Requirement
|
146
107
|
requirements:
|
147
108
|
- - "~>"
|
148
109
|
- !ruby/object:Gem::Version
|
149
|
-
version: '
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: 5.1.0
|
110
|
+
version: '6.1'
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
112
|
name: aruba
|
155
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,9 +115,6 @@ dependencies:
|
|
157
115
|
- - "~>"
|
158
116
|
- !ruby/object:Gem::Version
|
159
117
|
version: '0.14'
|
160
|
-
- - ">="
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: 0.14.2
|
163
118
|
type: :development
|
164
119
|
prerelease: false
|
165
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -167,9 +122,6 @@ dependencies:
|
|
167
122
|
- - "~>"
|
168
123
|
- !ruby/object:Gem::Version
|
169
124
|
version: '0.14'
|
170
|
-
- - ">="
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: 0.14.2
|
173
125
|
description:
|
174
126
|
email: anton.maminov@gmail.com
|
175
127
|
executables:
|
@@ -223,8 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
175
|
- !ruby/object:Gem::Version
|
224
176
|
version: '0'
|
225
177
|
requirements: []
|
226
|
-
|
227
|
-
rubygems_version: 2.6.11
|
178
|
+
rubygems_version: 3.0.1
|
228
179
|
signing_key:
|
229
180
|
specification_version: 4
|
230
181
|
summary: Zendesk and Crowdin integration Command Line Interface (CLI)
|