zci 0.0.3 → 0.0.4
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 +1 -1
- data/bin/zci +1 -0
- data/lib/zci.rb +0 -2
- data/lib/zci/commands/02_import.rb +2 -1
- data/lib/zci/commands/04_export.rb +4 -4
- data/lib/zci/version.rb +1 -1
- 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: e3d3f61d260ae0403bc963126c7942912b879b13
|
4
|
+
data.tar.gz: d671b91e875893a877da1b90ba3e200204e31e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f9bb7d49e4a72098348e17248e7ef134730cd45ef06b84460efd2dcecca01a0b078ea483d827082c7b2d0a58276d815fd53e05fa0eba3c3efdb9524b8a6b6be
|
7
|
+
data.tar.gz: b2e39f1530a923c3543765f3724c76c57f67943c6a241f48ec3befd8e704c22ac76e5c376e9335faa423e85d1eee734b20bf17a4a8d0fb67dc3ce2e5d39d8fb7
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -117,6 +117,6 @@ Tested with the following Ruby versions:
|
|
117
117
|
|
118
118
|
Author: Anton Maminov (anton.maminov@gmail.com)
|
119
119
|
|
120
|
-
Copyright: 2015 [crowdin.com](http://crowdin.com/)
|
120
|
+
Copyright: 2015-2016 [crowdin.com](http://crowdin.com/)
|
121
121
|
|
122
122
|
This project is licensed under the MIT license, a copy of which can be found in the LICENSE file.
|
data/bin/zci
CHANGED
data/lib/zci.rb
CHANGED
@@ -21,7 +21,7 @@ command :'import:sources' do |c|
|
|
21
21
|
|
22
22
|
# Check if Category exists in Zendesk
|
23
23
|
source_category = @zendesk.hc_categories.find(id: source_category_id)
|
24
|
-
raise('No such category')
|
24
|
+
raise('No such category') if source_category.nil? || source_category.id != source_category_id
|
25
25
|
|
26
26
|
# Get category's sections in Zendesk
|
27
27
|
puts "[Zendesk] Get sections for Category with id #{source_category_id}"
|
@@ -55,6 +55,7 @@ command :'import:sources' do |c|
|
|
55
55
|
remote_project_tree = get_remote_files_hierarchy(crowdin_project_info['files'])
|
56
56
|
|
57
57
|
resources_category_dir = File.join(resources_dir, source_category_id.to_s)
|
58
|
+
|
58
59
|
unless File.exists?(resources_category_dir)
|
59
60
|
FileUtils.mkdir(resources_category_dir)
|
60
61
|
end
|
@@ -13,7 +13,7 @@ command :'export:translations' do |c|
|
|
13
13
|
|
14
14
|
@cli_config['categories'].each do |category|
|
15
15
|
@zendesk.locales.select { |locale| !locale.default? }.each do |locale|
|
16
|
-
if lang = category['translations'].detect { |tr| tr['zendesk_locale']
|
16
|
+
if lang = category['translations'].detect { |tr| tr['zendesk_locale'].casecmp(locale.locale) == 0 }
|
17
17
|
section_xml_files = Dir["#{resources_dir}/#{lang['crowdin_language_code']}/#{category['zendesk_category']}/section_*.xml"]
|
18
18
|
article_xml_files = Dir["#{resources_dir}/#{lang['crowdin_language_code']}/#{category['zendesk_category']}/article_*.xml"]
|
19
19
|
|
@@ -39,8 +39,8 @@ command :'export:translations' do |c|
|
|
39
39
|
sections = @zendesk.sections
|
40
40
|
all_sections.each do |section_hash|
|
41
41
|
if section = sections.find(id: section_hash[:id])
|
42
|
-
if section_tr = section.translations.detect { |tr| tr.locale
|
43
|
-
section_tr.update(
|
42
|
+
if section_tr = section.translations.detect { |tr| tr.locale.casecmp(locale.locale) == 0 }
|
43
|
+
section_tr.update(title: section_hash[:name], body: section_hash[:description])
|
44
44
|
if section_tr.changed?
|
45
45
|
section_tr.save
|
46
46
|
puts "[Zendesk] Update `#{lang['crowdin_language_code']}` language translation for Section\##{section.id}."
|
@@ -58,7 +58,7 @@ command :'export:translations' do |c|
|
|
58
58
|
all_articles.each do |article_hash|
|
59
59
|
if section = sections.find(id: article_hash[:section_id])
|
60
60
|
if article = section.articles.find(id: article_hash[:id])
|
61
|
-
if article_tr = article.translations.detect { |tr| tr.locale
|
61
|
+
if article_tr = article.translations.detect { |tr| tr.locale.casecmp(locale.locale) == 0 }
|
62
62
|
article_tr.update(title: article_hash[:title], body: article_hash[:body])
|
63
63
|
if article_tr.changed?
|
64
64
|
article_tr.save
|
data/lib/zci/version.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.4
|
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: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.5.1
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Zendesk and Crowdin integration Command Line Interface (CLI)
|