zendesk_apps_tools 1.29.0 → 1.30.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6071142dc8a358f7fd8f51064eb763ce6aaef8c2
|
4
|
+
data.tar.gz: c22c2dd78ab4515e61b23ebeca4c318fdab33aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 120cfaf7867651a8c813bb4dd40645e4f5ca536cfaa6afba57c8db0c64384a45c221d84eaf1a38b5f85e7ebf62ce3755ad8346eb9cec168200bff951a3fe9ff7
|
7
|
+
data.tar.gz: d294f305422e01b12c1c92f07d9155e1777697b8df337413a0119efee4d8eb3b552cdb3a58e4be2b60e8f049eef3ff47c44b23f10896ed16a7de4a1a92b88c24
|
@@ -8,19 +8,18 @@ module ZendeskAppsTools
|
|
8
8
|
response = connection.send(connection_method) do |req|
|
9
9
|
req.url url
|
10
10
|
req.headers[:content_type] = 'application/json'
|
11
|
-
|
12
11
|
req.body = JSON.generate body
|
13
12
|
end
|
14
13
|
|
15
14
|
check_status response
|
16
15
|
|
17
|
-
rescue Faraday::Error::ClientError => e
|
16
|
+
rescue Faraday::Error::ClientError, JSON::ParserError => e
|
18
17
|
say_error_and_exit e.message
|
19
18
|
end
|
20
19
|
|
21
20
|
def upload(path)
|
22
21
|
connection = get_connection :multipart
|
23
|
-
zipfile_path
|
22
|
+
zipfile_path = options[:zipfile]
|
24
23
|
|
25
24
|
if zipfile_path
|
26
25
|
package_path = zipfile_path
|
@@ -34,9 +33,7 @@ module ZendeskAppsTools
|
|
34
33
|
response = connection.post('/api/v2/apps/uploads.json', payload)
|
35
34
|
JSON.parse(response.body)['id']
|
36
35
|
|
37
|
-
rescue Faraday::Error::ClientError => e
|
38
|
-
say_error_and_exit e.message
|
39
|
-
rescue JSON::ParserError => e
|
36
|
+
rescue Faraday::Error::ClientError, JSON::ParserError => e
|
40
37
|
say_error_and_exit e.message
|
41
38
|
end
|
42
39
|
|
@@ -11,14 +11,18 @@ module ZendeskAppsTools
|
|
11
11
|
def zip(archive_path)
|
12
12
|
Zip::ZipFile.open(archive_path, 'w') do |zipfile|
|
13
13
|
app_package.files.each do |file|
|
14
|
-
|
14
|
+
relative_path = file.relative_path
|
15
|
+
path = relative_path
|
15
16
|
say_status 'package', "adding #{path}"
|
16
17
|
|
17
18
|
# resolve symlink to source path
|
18
19
|
if File.symlink? file.absolute_path
|
19
20
|
path = File.expand_path(File.readlink(file.absolute_path), File.dirname(file.absolute_path))
|
20
21
|
end
|
21
|
-
|
22
|
+
if file.to_s == 'app.scss'
|
23
|
+
relative_path = relative_path.sub 'app.scss', 'app.css'
|
24
|
+
end
|
25
|
+
zipfile.add(relative_path, app_dir.join(path).to_s)
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
@@ -49,22 +49,22 @@ module ZendeskAppsTools
|
|
49
49
|
|
50
50
|
desc 'update', 'Update translation files from Zendesk'
|
51
51
|
method_option :path, default: './', required: false
|
52
|
-
def update(
|
52
|
+
def update()
|
53
53
|
setup_path(options[:path]) if options[:path]
|
54
54
|
app_package = get_value_from_stdin('What is the package name for this app? (without app_)', valid_regex: /^[a-z_]+$/, error_msg: 'Invalid package name, try again:')
|
55
55
|
|
56
56
|
key_prefix = "txt.apps.#{app_package}."
|
57
57
|
|
58
58
|
say('Fetching translations...')
|
59
|
-
locale_response =
|
59
|
+
locale_response = Faraday.get(LOCALE_ENDPOINT)
|
60
60
|
|
61
61
|
if locale_response.status == 200
|
62
62
|
locales = JSON.parse(locale_response.body)['locales']
|
63
63
|
|
64
|
+
locales = locales.map { |locale| fetch_locale_async locale, app_package}.map(&:value)
|
65
|
+
|
64
66
|
locales.each do |locale|
|
65
|
-
|
66
|
-
locale_response = api_request(locale_url, request_builder).body
|
67
|
-
translations = JSON.parse(locale_response)['locale']['translations']
|
67
|
+
translations = locale['translations']
|
68
68
|
|
69
69
|
locale_name = ZendeskAppsTools::LocaleIdentifier.new(locale['locale']).locale_id
|
70
70
|
write_json("#{destination_root}/translations/#{locale_name}.json", nest_translations_hash(translations, key_prefix))
|
@@ -95,6 +95,14 @@ module ZendeskAppsTools
|
|
95
95
|
end
|
96
96
|
|
97
97
|
no_commands do
|
98
|
+
def fetch_locale_async(locale, app_package)
|
99
|
+
Thread.new do
|
100
|
+
say("Fetching #{locale['locale']}")
|
101
|
+
json = Faraday.get("#{locale['url']}?include=translations&packages=app_#{app_package}").body
|
102
|
+
JSON.parse(json)['locale']
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
98
106
|
def setup_path(path)
|
99
107
|
@destination_stack << relative_to_original_destination_root(path) unless @destination_stack.last == path
|
100
108
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Rosen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-04-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: thor
|
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
version: 1.3.6
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.6.3
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Tools to help you develop Zendesk Apps.
|
@@ -238,4 +238,3 @@ test_files:
|
|
238
238
|
- features/step_definitions/app_steps.rb
|
239
239
|
- features/support/env.rb
|
240
240
|
- features/validate.feature
|
241
|
-
has_rdoc:
|