zendesk_apps_support 4.11.1 → 4.11.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9188517f4a57a804b4648f6d4efbe06ec79ed6510b2acc95366aea3419691cb
|
4
|
+
data.tar.gz: e7c7235e7ba466161d93d0ceb5e3f43c1a4c28ee30eeecbddcd698d948ea900b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5072150921ee6e3eb4f8d070079aedea3854a20a3ab7c55d6e7a2b6715422109e9b7fbf60f82fb2ae9aa6ad73e55f5adbfbdb62ee2ad09d24b095571311eb0ee
|
7
|
+
data.tar.gz: 046b5813b2fc8e18d8b3514834eadd4d886036fde06750013ffa1b9c2aa1bbdb58edc01dbce9bbdb803f614e555f8c77b2e185e960cb9a6f8221d450d72493a7
|
@@ -28,13 +28,13 @@ module ZendeskAppsSupport
|
|
28
28
|
@warnings = []
|
29
29
|
end
|
30
30
|
|
31
|
-
def validate(marketplace: true)
|
31
|
+
def validate(marketplace: true, skip_marketplace_translations: false)
|
32
32
|
errors = []
|
33
33
|
errors << Validations::Manifest.call(self)
|
34
34
|
if has_valid_manifest?(errors)
|
35
35
|
errors << Validations::Marketplace.call(self) if marketplace
|
36
36
|
errors << Validations::Source.call(self)
|
37
|
-
errors << Validations::Translations.call(self)
|
37
|
+
errors << Validations::Translations.call(self, skip_marketplace_translations: skip_marketplace_translations)
|
38
38
|
errors << Validations::Requirements.call(self)
|
39
39
|
|
40
40
|
unless manifest.requirements_only? || manifest.marketing_only? || manifest.iframe_only?
|
@@ -49,8 +49,8 @@ module ZendeskAppsSupport
|
|
49
49
|
errors.flatten.compact
|
50
50
|
end
|
51
51
|
|
52
|
-
def validate!(marketplace: true)
|
53
|
-
errors = validate(marketplace: marketplace)
|
52
|
+
def validate!(marketplace: true, skip_marketplace_translations: false)
|
53
|
+
errors = validate(marketplace: marketplace, skip_marketplace_translations: skip_marketplace_translations)
|
54
54
|
raise errors.first if errors.any?
|
55
55
|
true
|
56
56
|
end
|
@@ -13,13 +13,16 @@ module ZendeskAppsSupport
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class << self
|
16
|
-
def call(package)
|
16
|
+
def call(package, opts = {})
|
17
17
|
package.files.each_with_object([]) do |file, errors|
|
18
18
|
path_match = TRANSLATIONS_PATH.match(file.relative_path)
|
19
19
|
next unless path_match
|
20
20
|
errors << locale_error(file, path_match[1]) << json_error(file) << format_error(file)
|
21
21
|
next unless errors.compact.empty?
|
22
|
-
|
22
|
+
if file.relative_path == 'translations/en.json'
|
23
|
+
# rubocop:disable Metrics/LineLength
|
24
|
+
errors.push(*validate_marketplace_content(file, package, opts.fetch(:skip_marketplace_translations, false)))
|
25
|
+
end
|
23
26
|
end.compact
|
24
27
|
end
|
25
28
|
|
@@ -70,24 +73,30 @@ module ZendeskAppsSupport
|
|
70
73
|
ValidationError.new('translation.not_json', file: file.relative_path, errors: e)
|
71
74
|
end
|
72
75
|
|
73
|
-
def validate_marketplace_content(file, package)
|
76
|
+
def validate_marketplace_content(file, package, skip_marketplace_translations)
|
74
77
|
errors = []
|
75
78
|
json = JSON.parse(file.read)
|
76
79
|
product_names = Product::PRODUCTS_AVAILABLE.map(&:name)
|
77
80
|
present_product_keys = json['app'].is_a?(Hash) ? json['app'].keys & product_names : []
|
81
|
+
skip_marketplace_strings = package.manifest.private? || skip_marketplace_translations
|
78
82
|
|
79
83
|
if present_product_keys.empty?
|
80
|
-
errors << validate_top_level_required_keys(json,
|
84
|
+
errors << validate_top_level_required_keys(json, file.relative_path, skip_marketplace_strings)
|
81
85
|
else
|
82
86
|
errors << validate_products_match_manifest_products(present_product_keys, package, file.relative_path)
|
83
|
-
errors << validate_products_have_required_keys(
|
87
|
+
errors << validate_products_have_required_keys(
|
88
|
+
json,
|
89
|
+
present_product_keys,
|
90
|
+
file.relative_path,
|
91
|
+
skip_marketplace_strings
|
92
|
+
)
|
84
93
|
end
|
85
94
|
errors.compact
|
86
95
|
end
|
87
96
|
|
88
|
-
def validate_top_level_required_keys(json,
|
97
|
+
def validate_top_level_required_keys(json, file_path, skip_marketplace_strings)
|
89
98
|
keys = json['app'].is_a?(Hash) ? json['app'].keys : []
|
90
|
-
missing_keys = get_missing_keys(
|
99
|
+
missing_keys = get_missing_keys(keys, skip_marketplace_strings)
|
91
100
|
return if missing_keys.empty?
|
92
101
|
ValidationError.new(
|
93
102
|
'translation.missing_required_key',
|
@@ -96,9 +105,9 @@ module ZendeskAppsSupport
|
|
96
105
|
)
|
97
106
|
end
|
98
107
|
|
99
|
-
def validate_products_have_required_keys(json,
|
108
|
+
def validate_products_have_required_keys(json, products, file_path, skip_marketplace_strings)
|
100
109
|
products.each do |product|
|
101
|
-
missing_keys = get_missing_keys(
|
110
|
+
missing_keys = get_missing_keys(json['app'][product].keys, skip_marketplace_strings)
|
102
111
|
next if missing_keys.empty?
|
103
112
|
return ValidationError.new(
|
104
113
|
'translation.missing_required_key_for_product',
|
@@ -135,10 +144,9 @@ module ZendeskAppsSupport
|
|
135
144
|
end
|
136
145
|
end
|
137
146
|
|
138
|
-
def get_missing_keys(
|
147
|
+
def get_missing_keys(keys, skip_marketplace_strings)
|
139
148
|
public_app_keys = %w[name short_description installation_instructions long_description]
|
140
|
-
mandatory_keys =
|
141
|
-
|
149
|
+
mandatory_keys = skip_marketplace_strings ? ['name'] : public_app_keys
|
142
150
|
# since we support description as well as short_description for backwards compatibility,
|
143
151
|
# validate keys as if description == short_description
|
144
152
|
keys_to_validate = keys.map do |key|
|
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: 4.11.
|
4
|
+
version: 4.11.2
|
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: 2018-
|
14
|
+
date: 2018-06-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
version: 1.3.6
|
275
275
|
requirements: []
|
276
276
|
rubyforge_project:
|
277
|
-
rubygems_version: 2.7.
|
277
|
+
rubygems_version: 2.7.3
|
278
278
|
signing_key:
|
279
279
|
specification_version: 4
|
280
280
|
summary: Support to help you develop Zendesk Apps.
|