zci 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bac2e0338648d66c14665b57a42a1bed7a0f14e
4
- data.tar.gz: 111f98adbc1eaead681810163e70b898da33d626
3
+ metadata.gz: e3d3f61d260ae0403bc963126c7942912b879b13
4
+ data.tar.gz: d671b91e875893a877da1b90ba3e200204e31e4e
5
5
  SHA512:
6
- metadata.gz: ed09e352493f2368c1d441e92b689a6dce98e7d1bd7c5a3e4ff141fe286aa69ccf27f633b9b740d52146124825ebd565987263f84735bbcc0c70ac1998309a6d
7
- data.tar.gz: 2c60c5647e53a75a8402233f6da718386c3179669d0ec2a372245de8c31ecc53d1ea1b4b67654b97d31213de03a23c624ff612ef0bd1d40b2c5333a0f6e50069
6
+ metadata.gz: 1f9bb7d49e4a72098348e17248e7ef134730cd45ef06b84460efd2dcecca01a0b078ea483d827082c7b2d0a58276d815fd53e05fa0eba3c3efdb9524b8a6b6be
7
+ data.tar.gz: b2e39f1530a923c3543765f3724c76c57f67943c6a241f48ec3befd8e704c22ac76e5c376e9335faa423e85d1eee734b20bf17a4a8d0fb67dc3ce2e5d39d8fb7
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 Anton Maminov
3
+ Copyright (c) 2015-2016 Anton Maminov
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
3
  require 'zci'
4
+ # require 'byebug'
4
5
 
5
6
  include GLI::App
6
7
  include ZCI
data/lib/zci.rb CHANGED
@@ -7,8 +7,6 @@ require 'crowdin-api'
7
7
  require 'nokogiri'
8
8
  require 'zip'
9
9
 
10
- # require 'byebug'
11
-
12
10
  # Add requires for other files you add to your project here, so
13
11
  # you just need to require this one file in your bin file
14
12
  require 'zci/helpers.rb'
@@ -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') unless source_category.id == source_category_id
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'] == locale.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 == locale.locale }
43
- section_tr.update(name: section_hash[:name], description: section_hash[:description])
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 == locale.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
@@ -1,3 +1,3 @@
1
1
  module ZCI
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  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.0.3
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: 2015-11-17 00:00:00.000000000 Z
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.4.8
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)