zendesk_apps_tools 2.9.8 → 2.10.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
- SHA1:
3
- metadata.gz: c16064d8a08df7a6ce6385ed69a1dbd53546ae5b
4
- data.tar.gz: f9aed6f5c49f6e8ec69337c66f68cf525703d0e7
2
+ SHA256:
3
+ metadata.gz: 3b836fad3af7977e63d41940bc67b89d06a25ee1c8e1e6d78f0538430275df61
4
+ data.tar.gz: 949c5789c5b2024e4b57635543aa700492ebc95d0b0be32f0717eb74e9c10f1b
5
5
  SHA512:
6
- metadata.gz: ff38f4e82a7f084de62d4d7af698f8c3d10c558f1ea424a2d94b8afa7a3a619cd195fcf41df53833f7daec716eae763298ed34feca7f24be189867f5a7bd8e6e
7
- data.tar.gz: 68dd0f7cb2c544f894f27549cb33d57d8684a50355bd3e57c17d30ebd841256229afcd98ffb8e802127b6f9826ed814ec9b9808bedcf6f849994e19a6557ac5f
6
+ metadata.gz: 60fbce20a23e0aa6030a3add5302afe099b89c7724ed0a27fff960e5940735123533e7ff00f6cba07df4f38330689edf888952ffbbc1a510bfc1676b5b2ee4d1
7
+ data.tar.gz: 6760e9b4f6438e2bf813b433cec4c52a77500e394be8b0064a2cc3c2ce96fa899624058cd3a529129db2c09397542db83b95c5edc3fa9143abdd18cd6cc0e850
@@ -33,6 +33,10 @@ module ZendeskAppsTools
33
33
  default: false,
34
34
  hide: true,
35
35
  desc: 'Create a version 1 app template (Deprecated)'
36
+ method_option :scaffold, type: :boolean,
37
+ default: false,
38
+ hide: true,
39
+ desc: 'Create a version 2 app template with latest scaffold'
36
40
  def new
37
41
  run_deprecation_checks('error', '1.0') if options[:v1]
38
42
 
@@ -50,18 +54,32 @@ module ZendeskAppsTools
50
54
  @app_name = get_value_from_stdin("Enter a name for this new app:\n",
51
55
  error_msg: invalid.call('app name'))
52
56
 
53
- @iframe_location = if options[:v1]
54
- '_legacy'
55
- else
56
- iframe_uri_text = 'Enter your iFrame URI or leave it blank to use'\
57
- " a default local template page:\n"
58
- get_value_from_stdin(iframe_uri_text, allow_empty: true, default: 'assets/iframe.html')
59
- end
57
+ @iframe_location =
58
+ if options[:scaffold]
59
+ 'assets/iframe.html'
60
+ elsif options[:v1]
61
+ '_legacy'
62
+ else
63
+ iframe_uri_text = 'Enter your iFrame URI or leave it blank to use'\
64
+ " a default local template page:\n"
65
+ get_value_from_stdin(iframe_uri_text, allow_empty: true, default: 'assets/iframe.html')
66
+ end
60
67
 
61
68
  prompt_new_app_dir
62
69
 
63
- directory_options = @iframe_location != 'assets/iframe.html' ? { exclude_pattern: /iframe.html/ } : {}
70
+ directory_options =
71
+ if options[:scaffold]
72
+ # excludes everything but manifest.json
73
+ { exclude_pattern: /^((?!manifest.json).)*$/ }
74
+ elsif @iframe_location != 'assets/iframe.html'
75
+ { exclude_pattern: /iframe.html/ }
76
+ else
77
+ {}
78
+ end
79
+
64
80
  directory('app_template_iframe', @app_dir, directory_options)
81
+
82
+ download_scaffold(@app_dir) if options[:scaffold]
65
83
  end
66
84
 
67
85
  desc 'validate', 'Validate your app'
@@ -122,7 +140,7 @@ module ZendeskAppsTools
122
140
  method_option :path, default: './', required: false, aliases: '-p'
123
141
  def clean
124
142
  require 'fileutils'
125
-
143
+
126
144
  setup_path(options[:path])
127
145
 
128
146
  return unless File.exist?(Pathname.new(File.join(app_dir, 'tmp')).to_s)
@@ -299,5 +317,35 @@ module ZendeskAppsTools
299
317
  say_status 'warning', 'Unable to check for new versions of zendesk_apps_tools gem', :yellow
300
318
  end
301
319
  end
320
+
321
+ def download_scaffold(app_dir)
322
+ tmp_download_name = 'scaffold-download-temp.zip'
323
+ manifest_pattern = /manifest.json$/
324
+ manifest_path = ''
325
+ scaffold_url = 'https://github.com/zendesk/app_scaffold/archive/master.zip'
326
+ begin
327
+ require 'open-uri'
328
+ require 'zip'
329
+ download = open(scaffold_url)
330
+ IO.copy_stream(download, tmp_download_name)
331
+ Zip::File.open(tmp_download_name) do |zip_file|
332
+ zip_file.each do |entry|
333
+ filename = entry.name.sub('app_scaffold-master/','')
334
+ if manifest_pattern.match?(filename)
335
+ manifest_path = filename[0..-14]
336
+ else
337
+ say_status 'info', "Extracting #{filename}"
338
+ entry.extract("#{app_dir}/#{filename}")
339
+ end
340
+ end
341
+ end
342
+ say_status 'info', 'Moving manifest.json'
343
+ FileUtils.mv("#{app_dir}/manifest.json", "#{app_dir}/#{manifest_path}")
344
+ say_status 'info', 'App created'
345
+ rescue StandardError => e
346
+ say_error "We encountered an error while creating your app: #{e.message}"
347
+ end
348
+ File.delete(tmp_download_name) if File.exist?(tmp_download_name)
349
+ end
302
350
  end
303
351
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ZendeskAppsTools
3
- VERSION = '2.9.8'
3
+ VERSION = '2.10.0'
4
4
  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: 2.9.8
4
+ version: 2.10.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: 2018-08-13 00:00:00.000000000 Z
14
+ date: 2018-09-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -321,18 +321,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
321
  version: 1.3.6
322
322
  requirements: []
323
323
  rubyforge_project:
324
- rubygems_version: 2.6.8
324
+ rubygems_version: 2.7.6
325
325
  signing_key:
326
326
  specification_version: 4
327
327
  summary: Tools to help you develop Zendesk Apps.
328
328
  test_files:
329
- - features/clean.feature
330
329
  - features/create.feature
331
- - features/fixtures/quote_character_translation.json
330
+ - features/validate.feature
332
331
  - features/new.feature
333
- - features/package.feature
334
- - features/step_definitions/app_steps.rb
335
- - features/support/env.rb
332
+ - features/clean.feature
336
333
  - features/support/helpers.rb
337
334
  - features/support/webmock.rb
338
- - features/validate.feature
335
+ - features/support/env.rb
336
+ - features/step_definitions/app_steps.rb
337
+ - features/fixtures/quote_character_translation.json
338
+ - features/package.feature