zendesk_apps_tools 1.21.0 → 1.21.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 +4 -4
- data/features/step_definitions/app_steps.rb +3 -3
- data/lib/zendesk_apps_tools/command.rb +13 -13
- data/lib/zendesk_apps_tools/common.rb +3 -3
- data/lib/zendesk_apps_tools/deploy.rb +1 -1
- data/lib/zendesk_apps_tools/directory.rb +1 -1
- data/lib/zendesk_apps_tools/settings.rb +2 -2
- data/lib/zendesk_apps_tools/translate.rb +5 -5
- 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: 31889800a9bc18cfd1543f5b05279bcef4c6d684
|
4
|
+
data.tar.gz: 32336ce53277c686109a718d016837b3af016f4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e690d1a3f280ebec4ab9b2405640596ce13a70e29569d2f38fcc4b212fa5d9b61b1dab8dd60724338a6f53448ee5425ef9a40bc1c394c5e385b31546748fc17
|
7
|
+
data.tar.gz: 1e3334a995f7e081b288a6ac28ae9410dd5c51128b66a4d6f32cceadbe28b61501a404847448592828b58b74314961b8f23317922e17936318c921426e531789
|
@@ -60,7 +60,7 @@ Then /^the app file "(.*?)" is created with:$/ do |file, content|
|
|
60
60
|
end
|
61
61
|
|
62
62
|
Then /^the app file "(.*?)" is created$/ do |filename|
|
63
|
-
File.exists?(filename).should
|
63
|
+
File.exists?(filename).should be_truthy
|
64
64
|
end
|
65
65
|
|
66
66
|
Then /^the fixture "(.*?)" is used for "(.*?)"$/ do |fixture, app_file|
|
@@ -93,11 +93,11 @@ Then /^the command output should contain "(.*?)"$/ do |output|
|
|
93
93
|
end
|
94
94
|
|
95
95
|
Then /^"(.*?)" should be a symlink$/ do |path|
|
96
|
-
File.symlink?(path).should
|
96
|
+
File.symlink?(path).should be_truthy
|
97
97
|
end
|
98
98
|
|
99
99
|
Then /^the zip file in "(.*?)" should not contain any symlinks$/ do |path|
|
100
100
|
Zip::ZipFile.foreach Dir[path+'/app-*.zip'][0] do |p|
|
101
|
-
p.symlink?.should
|
101
|
+
p.symlink?.should be_falsy
|
102
102
|
end
|
103
103
|
end
|
@@ -16,7 +16,7 @@ module ZendeskAppsTools
|
|
16
16
|
|
17
17
|
SHARED_OPTIONS = {
|
18
18
|
['path', '-p'] => './',
|
19
|
-
:
|
19
|
+
clean: false
|
20
20
|
}
|
21
21
|
|
22
22
|
include Thor::Actions
|
@@ -25,15 +25,15 @@ module ZendeskAppsTools
|
|
25
25
|
|
26
26
|
source_root File.expand_path(File.join(File.dirname(__FILE__), "../.."))
|
27
27
|
|
28
|
-
desc 'translate SUBCOMMAND', 'Manage translation files', :
|
28
|
+
desc 'translate SUBCOMMAND', 'Manage translation files', hide: true
|
29
29
|
subcommand 'translate', Translate
|
30
30
|
|
31
31
|
desc "new", "Generate a new app"
|
32
32
|
def new
|
33
|
-
@author_name = get_value_from_stdin("Enter this app author's name:\n", :
|
34
|
-
@author_email = get_value_from_stdin("Enter this app author's email:\n", :
|
35
|
-
@author_url = get_value_from_stdin("Enter this app author's url:\n", :
|
36
|
-
@app_name = get_value_from_stdin("Enter a name for this new app:\n", :
|
33
|
+
@author_name = get_value_from_stdin("Enter this app author's name:\n", error_msg: "Invalid name, try again:")
|
34
|
+
@author_email = get_value_from_stdin("Enter this app author's email:\n", valid_regex: /^.+@.+\..+$/, error_msg: "Invalid email, try again:")
|
35
|
+
@author_url = get_value_from_stdin("Enter this app author's url:\n", valid_regex: /^https?:\/\/.+$/, error_msg: "Invalid url, try again:", allow_empty: true)
|
36
|
+
@app_name = get_value_from_stdin("Enter a name for this new app:\n", error_msg: "Invalid app name, try again:")
|
37
37
|
|
38
38
|
get_new_app_directory
|
39
39
|
|
@@ -78,7 +78,7 @@ module ZendeskAppsTools
|
|
78
78
|
end
|
79
79
|
|
80
80
|
desc "clean", "Remove app packages in temp folder"
|
81
|
-
method_option :path, :
|
81
|
+
method_option :path, default: './', required: false, aliases: "-p"
|
82
82
|
def clean
|
83
83
|
setup_path(options[:path])
|
84
84
|
|
@@ -92,9 +92,9 @@ module ZendeskAppsTools
|
|
92
92
|
DEFAULT_SERVER_PORT = 4567
|
93
93
|
|
94
94
|
desc "server", "Run a http server to serve the local app"
|
95
|
-
method_option :path, :
|
96
|
-
method_option :config, :
|
97
|
-
method_option :port, :
|
95
|
+
method_option :path, default: DEFAULT_SERVER_PATH, required: false, aliases: "-p"
|
96
|
+
method_option :config, default: DEFAULT_CONFIG_PATH, required: false, aliases: "-c"
|
97
|
+
method_option :port, default: DEFAULT_SERVER_PORT, required: false
|
98
98
|
def server
|
99
99
|
setup_path(options[:path])
|
100
100
|
manifest = app_package.manifest_json
|
@@ -118,7 +118,7 @@ module ZendeskAppsTools
|
|
118
118
|
|
119
119
|
desc "create", "Create app on your account"
|
120
120
|
method_options SHARED_OPTIONS
|
121
|
-
method_option :zipfile, :
|
121
|
+
method_option :zipfile, default: nil, required: false, type: :string
|
122
122
|
def create
|
123
123
|
clear_cache
|
124
124
|
@command = 'Create'
|
@@ -127,12 +127,12 @@ module ZendeskAppsTools
|
|
127
127
|
app_name = JSON.parse(File.read(File.join options[:path], 'manifest.json'))['name']
|
128
128
|
end
|
129
129
|
app_name ||= get_value_from_stdin('Enter app name:')
|
130
|
-
deploy_app(:post, '/api/v2/apps.json', { :
|
130
|
+
deploy_app(:post, '/api/v2/apps.json', { name: app_name })
|
131
131
|
end
|
132
132
|
|
133
133
|
desc "update", "Update app on the server"
|
134
134
|
method_options SHARED_OPTIONS
|
135
|
-
method_option :zipfile, :
|
135
|
+
method_option :zipfile, default: nil, required: false, type: :string
|
136
136
|
def update
|
137
137
|
clear_cache
|
138
138
|
@command = 'Update'
|
@@ -13,9 +13,9 @@ module ZendeskAppsTools
|
|
13
13
|
|
14
14
|
def get_value_from_stdin(prompt, opts = {})
|
15
15
|
options = {
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
16
|
+
valid_regex: opts[:allow_empty] ? /^.*$/ : /\S+/,
|
17
|
+
error_msg: 'Invalid, try again:',
|
18
|
+
allow_empty: false
|
19
19
|
}.merge(opts)
|
20
20
|
|
21
21
|
while input = ask(prompt)
|
@@ -29,7 +29,7 @@ module ZendeskAppsTools
|
|
29
29
|
package_path = Dir[File.join path, '/tmp/*.zip'].sort.last
|
30
30
|
end
|
31
31
|
|
32
|
-
payload = { :
|
32
|
+
payload = { uploaded_data: Faraday::UploadIO.new(package_path, 'application/zip') }
|
33
33
|
|
34
34
|
response = connection.post('/api/v2/apps/uploads.json', payload)
|
35
35
|
JSON.parse(response.body)['id']
|
@@ -13,7 +13,7 @@ module ZendeskAppsTools
|
|
13
13
|
|
14
14
|
def get_new_app_directory
|
15
15
|
prompt = "Enter a directory name to save the new app (will create the dir if it does not exist, default to current dir):\n"
|
16
|
-
opts = { :
|
16
|
+
opts = { valid_regex: /^(\w|\/|\\)*$/, allow_empty: true }
|
17
17
|
while @app_dir = get_value_from_stdin(prompt, opts) do
|
18
18
|
@app_dir = './' and break if @app_dir.empty?
|
19
19
|
if !File.exists?(@app_dir)
|
@@ -9,12 +9,12 @@ module ZendeskAppsTools
|
|
9
9
|
|
10
10
|
parameters.inject({}) do |settings, param|
|
11
11
|
if param[:default]
|
12
|
-
input = user_input.get_value_from_stdin("Enter a value for parameter '#{param[:name]}' or press 'Return' to use the default value '#{param[:default]}':\n", :
|
12
|
+
input = user_input.get_value_from_stdin("Enter a value for parameter '#{param[:name]}' or press 'Return' to use the default value '#{param[:default]}':\n", allow_empty: true)
|
13
13
|
input = param[:default] if input.empty?
|
14
14
|
elsif param[:required]
|
15
15
|
input = user_input.get_value_from_stdin("Enter a value for required parameter '#{param[:name]}':\n")
|
16
16
|
else
|
17
|
-
input = user_input.get_value_from_stdin("Enter a value for optional parameter '#{param[:name]}' or press 'Return' to skip:\n", :
|
17
|
+
input = user_input.get_value_from_stdin("Enter a value for optional parameter '#{param[:name]}' or press 'Return' to skip:\n", allow_empty: true)
|
18
18
|
end
|
19
19
|
|
20
20
|
if param[:type] == 'checkbox'
|
@@ -15,14 +15,14 @@ module ZendeskAppsTools
|
|
15
15
|
LOCALE_ENDPOINT = "https://support.zendesk.com/api/v2/locales/agent.json"
|
16
16
|
|
17
17
|
desc 'to_yml', 'Create Zendesk translation file from en.json'
|
18
|
-
method_option :path, :
|
18
|
+
method_option :path, default: './', required: false
|
19
19
|
def to_yml
|
20
20
|
setup_path(options[:path]) if options[:path]
|
21
21
|
manifest = JSON.parse(File.open("#{destination_root}/manifest.json").read)
|
22
22
|
app_name = manifest['name']
|
23
23
|
|
24
24
|
unless app_name
|
25
|
-
app_name = get_value_from_stdin('What is the name of this app?', :
|
25
|
+
app_name = get_value_from_stdin('What is the name of this app?', error_msg: "Invalid name, try again:")
|
26
26
|
end
|
27
27
|
|
28
28
|
en_json = JSON.parse(File.open("#{destination_root}/translations/en.json").read)
|
@@ -35,7 +35,7 @@ module ZendeskAppsTools
|
|
35
35
|
end
|
36
36
|
|
37
37
|
desc 'to_json', 'Convert Zendesk translation yml to I18n formatted json'
|
38
|
-
method_option :path, :
|
38
|
+
method_option :path, default: './', required: false
|
39
39
|
def to_json
|
40
40
|
setup_path(options[:path]) if options[:path]
|
41
41
|
en_yml = YAML.load_file("#{destination_root}/translations/en.yml")
|
@@ -49,10 +49,10 @@ module ZendeskAppsTools
|
|
49
49
|
end
|
50
50
|
|
51
51
|
desc 'update', 'Update translation files from Zendesk'
|
52
|
-
method_option :path, :
|
52
|
+
method_option :path, default: './', required: false
|
53
53
|
def update(request_builder = Faraday.new)
|
54
54
|
setup_path(options[:path]) if options[:path]
|
55
|
-
app_package = get_value_from_stdin("What is the package name for this app? (without app_)", :
|
55
|
+
app_package = get_value_from_stdin("What is the package name for this app? (without app_)", valid_regex: /^[a-z_]+$/, error_msg: "Invalid package name, try again:")
|
56
56
|
|
57
57
|
key_prefix = "txt.apps.#{app_package}."
|
58
58
|
|
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: 1.21.
|
4
|
+
version: 1.21.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: 2014-
|
14
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: thor
|