zendesk_apps_support 3.4.5 → 3.5.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 +4 -4
- data/README.md +1 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/translations/zendesk_apps_support.yml +4 -0
- data/lib/zendesk_apps_support/manifest.rb +9 -1
- data/lib/zendesk_apps_support/package.rb +2 -1
- data/lib/zendesk_apps_support/validations/translations.rb +9 -0
- 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: 4989892ae59b6757887256e7546490877f807907
|
4
|
+
data.tar.gz: 5d5f77a49ffded79659ac94fb949a402791c6e98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21c8ffd2a39ac6d0a7ccf666035ce06997616aa9e88af988ce19f79e1dd021886865dce5fce22d9eac9037e0a2c9ebba904c8b7fe1eab520c409a3a7cf7d7284
|
7
|
+
data.tar.gz: dde683e6071c2b52f408c138076bc4685b7edb1e7a9ae57c2ecffef152bbba3cd76e31c3a94c9309bc85970c1f4c00da5ec6bc13b5d477d938bb44cb6274ad3e
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Zendesk Apps Support
|
2
2
|
|
3
3
|
## Description
|
4
|
-
Classes to manage and validate
|
4
|
+
Classes to manage and validate Zendesk Apps. This is a gem used in [Zendesk Apps Tools](https://github.com/zendesk/zendesk_apps_tools/).
|
5
5
|
|
6
6
|
## Owners
|
7
7
|
This repo is owned and maintained by the Zendesk Apps team. You can reach us on vegemite@zendesk.com. We are located in Melbourne!
|
data/config/locales/en.yml
CHANGED
@@ -92,6 +92,7 @@ en:
|
|
92
92
|
invalid_format: "%{field} is invalid for translation."
|
93
93
|
not_json: "%{file} is not valid JSON. %{errors}"
|
94
94
|
not_json_object: "%{file} is not a JSON object."
|
95
|
+
missing_required_key: 'Missing required key from %{file}: %{missing_key}'
|
95
96
|
stylesheet_error: 'Sass error: %{sass_error}'
|
96
97
|
invalid_type_parameter:
|
97
98
|
one: "%{invalid_types} is an invalid parameter type."
|
@@ -234,6 +234,10 @@ parts:
|
|
234
234
|
key: "txt.apps.admin.error.app_build.translation.not_json_object"
|
235
235
|
title: "App builder job: translation file is not a JSON object"
|
236
236
|
value: "%{file} is not a JSON object."
|
237
|
+
- translation:
|
238
|
+
key: "txt.apps.admin.error.app_build.translation.missing_required_key"
|
239
|
+
title: "App builder job: required key missing from translation file"
|
240
|
+
value: "Missing required key from %{file}: %{missing_key}"
|
237
241
|
- translation:
|
238
242
|
key: "txt.apps.admin.error.app_build.stylesheet_error"
|
239
243
|
title: "App builder job: invalid stylesheet syntax"
|
@@ -47,8 +47,10 @@ module ZendeskAppsSupport
|
|
47
47
|
|
48
48
|
def products
|
49
49
|
@products ||=
|
50
|
-
if requirements_only?
|
50
|
+
if requirements_only?
|
51
51
|
[ Product::SUPPORT ]
|
52
|
+
elsif marketing_only?
|
53
|
+
products_ignore_locations || [ Product::SUPPORT ]
|
52
54
|
else
|
53
55
|
products_from_locations
|
54
56
|
end
|
@@ -138,6 +140,12 @@ module ZendeskAppsSupport
|
|
138
140
|
.map { |code| Product.find_by(code: code) }
|
139
141
|
end
|
140
142
|
|
143
|
+
def products_ignore_locations
|
144
|
+
locations.keys.map do |product_name|
|
145
|
+
Product.find_by(name: product_name)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
141
149
|
def set_locations_and_hosts
|
142
150
|
@locations =
|
143
151
|
case original_locations
|
@@ -243,7 +243,7 @@ module ZendeskAppsSupport
|
|
243
243
|
def runtime_translations(translations)
|
244
244
|
result = translations.dup
|
245
245
|
result.delete('name')
|
246
|
-
result.delete('
|
246
|
+
result.delete('short_description')
|
247
247
|
result.delete('long_description')
|
248
248
|
result.delete('installation_instructions')
|
249
249
|
result
|
@@ -251,6 +251,7 @@ module ZendeskAppsSupport
|
|
251
251
|
|
252
252
|
def process_translations(locale_path)
|
253
253
|
translations = File.exist?(locale_path) ? JSON.parse(File.read(locale_path)) : {}
|
254
|
+
translations['app'].delete('name') if translations.key?('app')
|
254
255
|
translations['app'].delete('package') if translations.key?('app')
|
255
256
|
remove_zendesk_keys(translations)
|
256
257
|
end
|
@@ -17,6 +17,7 @@ module ZendeskAppsSupport
|
|
17
17
|
path_match = TRANSLATIONS_PATH.match(file.relative_path)
|
18
18
|
if path_match
|
19
19
|
errors << locale_error(file, path_match[1]) << json_error(file)
|
20
|
+
errors << required_keys(file) if errors.compact.empty?
|
20
21
|
end
|
21
22
|
end.compact
|
22
23
|
end
|
@@ -47,6 +48,14 @@ module ZendeskAppsSupport
|
|
47
48
|
ValidationError.new('translation.not_json', file: file.relative_path, errors: e)
|
48
49
|
end
|
49
50
|
|
51
|
+
def required_keys(file)
|
52
|
+
return if file.relative_path != 'translations/en.json' || JSON.parse(file.read)['app']['name']
|
53
|
+
|
54
|
+
ValidationError.new('translation.missing_required_key',
|
55
|
+
file: file.relative_path,
|
56
|
+
missing_key: 'app.name')
|
57
|
+
end
|
58
|
+
|
50
59
|
def validate_translation_format(json)
|
51
60
|
json.keys.each do |key|
|
52
61
|
raise TranslationFormatError, "'#{key}': '#{json[key]}'" unless json[key].is_a? Hash
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.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: 2017-
|
14
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|