zendesk_apps_tools 2.0.0 → 2.0.1

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: 2aa8d1a04c58a6751dd96d0687835f37544ad2ee
4
- data.tar.gz: e794bc24aa0504a80a204d1343bef70709fcc6dc
3
+ metadata.gz: dd8fa7aee06e73ef92024f7f6a9faa862385cae1
4
+ data.tar.gz: ad97829c73dcf87c66b883181ddea93a1644570d
5
5
  SHA512:
6
- metadata.gz: 9349fb4006085842c5df59f3c773f3ac3a0f4bfdd112d07c1fb36f9351a772ca37ed48a2a52ddaf171f5ab1c9d9c540ca008c4d1acb87cd6627d2b1cd2b85b6a
7
- data.tar.gz: 72cf6af1f015140e146d39823d04f85aa831cf9f6c43e072bb1d1f2fed3ecb2815652784983831d6e003a2b3e69fa12f4d6009c1c9de03206749d746f40d3c04
6
+ metadata.gz: 3f08f861c9459796999f1c64d7ab05b10bba4018368c7197220161c570b3a27d02f23e60aebd7cbf5220527cf1580af53c8504288a88c723bf94f6a8f92e1e8c
7
+ data.tar.gz: 813614e2cabbd9be1222f2fc84f8abe3199191d050bc588127998daba2fa906e098953c04721e6b194cf543ba9791bf16a66a0e0d516d6be3ae1ac8f952aa4a9
@@ -0,0 +1,12 @@
1
+ Feature: upload an app to the apps marketplace
2
+ Background: create a new zendesk app
3
+
4
+ Scenario: package a zendesk app by running 'zat create --no-install' command
5
+ Given an app is created in directory "tmp/aruba"
6
+ Given a .zat file in "tmp/aruba"
7
+ When I run the command "zat create --path tmp/aruba --no-install" to create the app
8
+ And the command output should contain "validate OK"
9
+ And the command output should contain "package created"
10
+ And the command output should contain "Status working"
11
+ And the command output should contain "Create OK"
12
+ And the zip file should exist in directory "tmp/aruba/tmp"
@@ -31,6 +31,12 @@ Given /^a(n|(?: v1)) app is created in directory "(.*?)"$/ do |version, app_dir|
31
31
  )
32
32
  end
33
33
 
34
+ Given /^a \.zat file in "(.*?)"/ do |app_dir|
35
+ f = File.new(File.join(app_dir, '.zat'), 'w')
36
+ f.write(JSON.dump(username: 'test@user.com', password: 'hunter2', subdomain: 'app-account'))
37
+ f.close
38
+ end
39
+
34
40
  When /^I run "(.*?)" command with the following details:$/ do |cmd, table|
35
41
  IO.popen(cmd, 'w+') do |pipe|
36
42
  # [ ['parameter name', 'value'] ]
@@ -49,8 +55,9 @@ When /^I create a symlink from "(.*?)" to "(.*?)"$/ do |src, dest|
49
55
  FileUtils.ln_s(src, dest)
50
56
  end
51
57
 
52
- When /^I run the command "(.*?)" to (validate|package|clean) the app$/ do |cmd, _action|
53
- IO.popen(cmd, 'w+') do |pipe|
58
+ When /^I run the command "(.*?)" to (validate|package|clean|create) the app$/ do |cmd, _action|
59
+ env_hash = prepare_env_hash_for(cmd)
60
+ IO.popen(env_hash, cmd, 'w+') do |pipe|
54
61
  pipe.puts "\n"
55
62
  pipe.close_write
56
63
  @output = pipe.readlines
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ def prepare_env_hash_for(cmd)
3
+ if cmd.start_with? 'zat create'
4
+ path = File.expand_path('../../support/webmock', __FILE__)
5
+ { 'RUBYOPT' => "#{ENV['RUBYOPT']} -r #{path}" }
6
+ else
7
+ {}
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # we only want this file to monkey-patch zat when we shell out to it, but cucumber automatically requires it as well.
4
+ unless defined?(Cucumber)
5
+
6
+ require 'webmock'
7
+
8
+ WebMock::API.stub_request(:post, 'https://app-account.zendesk.com/api/v2/apps/uploads.json').to_return(body: JSON.dump(id: '123'))
9
+ WebMock::API.stub_request(:post, 'https://app-account.zendesk.com/api/v2/apps.json').with(body: JSON.dump(name: 'John Test App', upload_id: '123')).to_return(body: JSON.dump(job_id: '987'))
10
+ WebMock::API.stub_request(:get, 'https://app-account.zendesk.com/api/v2/apps/job_statuses/987').to_return(body: JSON.dump(status: 'working')).then.to_return(body: JSON.dump(status: 'completed', app_id: '55'))
11
+
12
+ WebMock.enable!
13
+ WebMock.disable_net_connect!
14
+ end
@@ -92,7 +92,7 @@ module ZendeskAppsTools
92
92
  desc 'package', 'Package your app'
93
93
  shared_options(except: [:unattended])
94
94
  def package
95
- return false unless invoke(:validate, [])
95
+ return false unless validate
96
96
 
97
97
  setup_path(options[:path])
98
98
 
@@ -152,6 +152,7 @@ module ZendeskAppsTools
152
152
  method_option :install, default: true, type: :boolean, desc: 'Also create an installation with some settings immediately after uploading.'
153
153
  def create
154
154
  cache.clear
155
+ setup_path(options[:path])
155
156
  @command = 'Create'
156
157
 
157
158
  unless options[:zipfile]
@@ -170,6 +171,7 @@ module ZendeskAppsTools
170
171
  method_option :zipfile, default: nil, required: false, type: :string
171
172
  def update
172
173
  cache.clear
174
+ setup_path(options[:path])
173
175
  @command = 'Update'
174
176
 
175
177
  app_id = cache.fetch('app_id') || find_app_id
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ZendeskAppsTools
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
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.0.0
4
+ version: 2.0.1
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-03-14 00:00:00.000000000 Z
14
+ date: 2017-03-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -209,11 +209,14 @@ files:
209
209
  - app_template_iframe/translations/en.json
210
210
  - bin/zat
211
211
  - features/clean.feature
212
+ - features/create.feature
212
213
  - features/fixtures/quote_character_translation.json
213
214
  - features/new.feature
214
215
  - features/package.feature
215
216
  - features/step_definitions/app_steps.rb
216
217
  - features/support/env.rb
218
+ - features/support/helpers.rb
219
+ - features/support/webmock.rb
217
220
  - features/validate.feature
218
221
  - lib/zendesk_apps_tools.rb
219
222
  - lib/zendesk_apps_tools/api_connection.rb
@@ -259,9 +262,12 @@ specification_version: 4
259
262
  summary: Tools to help you develop Zendesk Apps.
260
263
  test_files:
261
264
  - features/clean.feature
265
+ - features/create.feature
262
266
  - features/fixtures/quote_character_translation.json
263
267
  - features/new.feature
264
268
  - features/package.feature
265
269
  - features/step_definitions/app_steps.rb
266
270
  - features/support/env.rb
271
+ - features/support/helpers.rb
272
+ - features/support/webmock.rb
267
273
  - features/validate.feature