zendesk_apps_support 1.13.3 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58ceec0aaae39626d6beea11fec546292b8bc189
4
- data.tar.gz: ab381ae71f046c859a30f4d69ab4a7461dfbdb9b
3
+ metadata.gz: 679199783462b55a07e745d2426f36f2e7aac214
4
+ data.tar.gz: 1430e6af569e94e4cb825ccd06ad73b628866b50
5
5
  SHA512:
6
- metadata.gz: c17c0fc787ef6e3031f6b5328b1604ce5e1fd564ad175add7289e099560bde444516d3283bb87e58be3fe67cbb3795873d3de2998b565b5facc17e931e98ecf1
7
- data.tar.gz: 493cd4ff0ed9a17cfd625d905e77fff4a86baa98772fc70f0baaabc9a5930d539f1ecd2911d69b3648f26937038af94aeb8a274533653b146e2017330772a289
6
+ metadata.gz: ad83e9e61ceff49f753f4d4977fd7a4d827306a5da652940c4a437b1215bfadc3b11a47848a53d5c3bf8b4a6ea47a22731147d091cc31ef0fdf474b2b584cd81
7
+ data.tar.gz: 44ea8771a24edf318259e22b4c5af7313ef134cbfb52a1220ebe1e852db5ec8b1c2c0ee5d118fa1b48148896f55343e91c0e3a4ea601d66509ee25a134672fff
@@ -10,6 +10,11 @@ en:
10
10
  one: 'JSHint error in %{file}: %{errors}'
11
11
  other: 'JSHint errors in %{file}: %{errors}'
12
12
  missing_location_and_requirements: Missing app location or requirements
13
+ no_location_required: Having location defined while requirements only
14
+ is true
15
+ no_framework_version_required: Having framework version defined while
16
+ requirements only is true
17
+ no_app_js_required: Having app.js present while requirements only is true
13
18
  manifest_not_json: manifest is not proper JSON. %{errors}
14
19
  missing_manifest: Could not find manifest.json
15
20
  missing_requirements: Could not find requirements.json
@@ -20,6 +20,18 @@ parts:
20
20
  key: "txt.apps.admin.error.app_build.missing_location_and_requirements"
21
21
  title: "App builder job: missing location and requirements error"
22
22
  value: "Missing app location or requirements"
23
+ - translation:
24
+ key: "txt.apps.admin.error.app_build.no_location_required"
25
+ title: "App builder job: ban location while requirements only"
26
+ value: "Having location defined while requirements only is true"
27
+ - translation:
28
+ key: "txt.apps.admin.error.app_build.no_framework_version_required"
29
+ title: "App builder job: ban framework version while requirements only"
30
+ value: "Having framework version defined while requirements only is true"
31
+ - translation:
32
+ key: "txt.apps.admin.error.app_build.no_app_js_required"
33
+ title: "App builder job: ban app.js while requirements only"
34
+ value: "Having app.js present while requirements only is true"
23
35
  - translation:
24
36
  key: "txt.apps.admin.error.app_build.manifest_not_json"
25
37
  title: "App builder job: manifest is invalid JSON error"
@@ -11,10 +11,12 @@ module ZendeskAppsSupport
11
11
  SRC_TEMPLATE = Erubis::Eruby.new( File.read(File.expand_path('../assets/src.js.erb', __FILE__)) )
12
12
 
13
13
  attr_reader :root, :warnings
14
+ attr_accessor :requirements_only
14
15
 
15
16
  def initialize(dir)
16
17
  @root = Pathname.new(File.expand_path(dir))
17
18
  @warnings = []
19
+ @requirements_only = false
18
20
  end
19
21
 
20
22
  def validate
@@ -26,8 +28,9 @@ module ZendeskAppsSupport
26
28
  errors << Validations::Package.call(self)
27
29
  errors << Validations::Translations.call(self)
28
30
 
29
- if has_js?
30
- errors << Validations::Source.call(self)
31
+ errors << Validations::Source.call(self)
32
+
33
+ unless @requirements_only
31
34
  errors << Validations::Templates.call(self)
32
35
  errors << Validations::Stylesheets.call(self)
33
36
  end
@@ -117,10 +120,6 @@ module ZendeskAppsSupport
117
120
  file_exists?("requirements.json")
118
121
  end
119
122
 
120
- def is_requirements_only?
121
- has_requirements? && !has_location?
122
- end
123
-
124
123
  private
125
124
 
126
125
  def compiled_templates(app_id, asset_url_prefix)
@@ -16,6 +16,7 @@ module ZendeskAppsSupport
16
16
  return [ValidationError.new(:missing_manifest)] unless manifest
17
17
 
18
18
  manifest = MultiJson.load(manifest.read)
19
+
19
20
  [].tap do |errors|
20
21
  errors << missing_keys_error(manifest)
21
22
  errors << default_locale_error(manifest, package)
@@ -25,13 +26,19 @@ module ZendeskAppsSupport
25
26
  errors << invalid_type_error(manifest)
26
27
  errors << name_as_parameter_name_error(manifest)
27
28
 
28
- if package.has_js?
29
+ if manifest['requirementsOnly']
30
+ package.requirements_only = true
31
+
32
+ errors << ban_location(manifest)
33
+ errors << ban_framework_version(manifest)
34
+ else
29
35
  errors << missing_location_error(package)
30
36
  errors << invalid_location_error(manifest)
31
37
  errors << duplicate_location_error(manifest)
32
38
  errors << missing_framework_version(manifest)
33
39
  errors << invalid_version_error(manifest, package)
34
40
  end
41
+
35
42
  errors.compact!
36
43
  end
37
44
  rescue MultiJson::DecodeError => e
@@ -40,6 +47,14 @@ module ZendeskAppsSupport
40
47
 
41
48
  private
42
49
 
50
+ def ban_location(manifest)
51
+ ValidationError.new(:no_location_required) unless manifest['location'].nil?
52
+ end
53
+
54
+ def ban_framework_version(manifest)
55
+ ValidationError.new(:no_framework_version_required) unless manifest['frameworkVersion'].nil?
56
+ end
57
+
43
58
  def oauth_error(manifest)
44
59
  return unless manifest['oauth']
45
60
 
@@ -159,8 +174,6 @@ module ZendeskAppsSupport
159
174
  end
160
175
  end
161
176
 
162
- private
163
-
164
177
  def missing_keys_validation_error(missing_keys)
165
178
  ValidationError.new('manifest_keys.missing', :missing_keys => missing_keys.join(', '), :count => missing_keys.length)
166
179
  end
@@ -21,6 +21,7 @@ module ZendeskAppsSupport
21
21
  def call(package)
22
22
  source = package.files.find { |f| f.relative_path == 'app.js' }
23
23
 
24
+ return [ ValidationError.new(:no_app_js_required) ] if package.requirements_only && source
24
25
  return [ ValidationError.new(:missing_source) ] unless source
25
26
 
26
27
  jshint_errors = linter.lint(source.read)
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: 1.13.3
4
+ version: 1.14.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: 2014-02-17 00:00:00.000000000 Z
14
+ date: 2014-02-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -190,8 +190,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: 1.3.6
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.2.2
193
+ rubygems_version: 2.2.0
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Support to help you develop Zendesk Apps.
197
197
  test_files: []
198
+ has_rdoc: