zendesk_apps_tools 1.20.0 → 1.21.0

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: 7f59a2d6a2b6db4e5c6b32bd5a2e88ac2f258d57
4
- data.tar.gz: 81d6ac4cbb8393781e046b7f20fc97f43d51a338
3
+ metadata.gz: c9928163ca30c93bfc116df97416ff63cd79db3a
4
+ data.tar.gz: 41fad016c37ea6d7f7200d895e909821251281d6
5
5
  SHA512:
6
- metadata.gz: 74f1ff6f06fc42f4ecf02a89b0a2497aa7b6ac637eee1164f0513b1ed3c0549972a0ae5c3d5014dbe94321d857a141c99af062f2a0f7763e2a33ddbd7ecbf3d5
7
- data.tar.gz: 202b2e65c2102498834ca34b7c15f02d14460b5dfebce76c1441d189c01c70980de6168734f5ff3391b3574cbcfc8104616ae5bd2128d43f2dbde18f8fbfab47
6
+ metadata.gz: 8dff809ab9b247991919f9d770350ef614b20bd19fb48ef3bcf7d4531548943f71c408ad90669f102b7fc541791817c298233db7ddf277067fcd317666319782
7
+ data.tar.gz: 0d8267dbd7748d1863d840b9c7f476781255eb21d9fd01e7e0a58d72b914bc1cea56fb4396df141b910af2892a8ad299afee1547e54abb38c939accb4bb3f991
@@ -6,14 +6,9 @@ module ZendeskAppsTools
6
6
  def prepare_api_auth
7
7
  @subdomain ||= get_cache('subdomain') || get_value_from_stdin('Enter your Zendesk subdomain or full Zendesk URL:')
8
8
  @username ||= get_cache('username') || get_value_from_stdin('Enter your username:')
9
+ @password ||= get_cache('password') || get_password_from_stdin('Enter your password:')
9
10
 
10
- unless @password
11
- print 'Enter your password: '
12
- @password ||= STDIN.noecho(&:gets).chomp
13
- puts
14
-
15
- set_cache 'subdomain' => @subdomain, 'username' => @username
16
- end
11
+ set_cache 'subdomain' => @subdomain, 'username' => @username
17
12
  end
18
13
 
19
14
  def get_full_url
@@ -101,9 +101,10 @@ module ZendeskAppsTools
101
101
 
102
102
  settings_helper = ZendeskAppsTools::Settings.new
103
103
 
104
- settings = settings_helper.get_settings_yaml options[:config], manifest[:parameters]
104
+ settings = settings_helper.get_settings_from_file options[:config], manifest[:parameters]
105
+
105
106
  unless settings
106
- settings = settings_helper.get_settings_from self, manifest[:parameters]
107
+ settings = settings_helper.get_settings_from_user_input self, manifest[:parameters]
107
108
  end
108
109
 
109
110
  require 'zendesk_apps_tools/server'
@@ -29,5 +29,12 @@ module ZendeskAppsTools
29
29
 
30
30
  return input
31
31
  end
32
+
33
+ def get_password_from_stdin(prompt, opts = {})
34
+ print "#{prompt} "
35
+ password = STDIN.noecho(&:gets).chomp
36
+ puts
37
+ password
38
+ end
32
39
  end
33
40
  end
@@ -18,7 +18,7 @@ module ZendeskAppsTools
18
18
 
19
19
  # resolve symlink to source path
20
20
  if File.symlink? file.absolute_path
21
- path = File.readlink(file.absolute_path)
21
+ path = File.expand_path(File.readlink(file.absolute_path), File.dirname(file.absolute_path))
22
22
  end
23
23
  zipfile.add(file.relative_path, app_dir.join(path).to_s)
24
24
  end
@@ -4,7 +4,7 @@ require 'yaml'
4
4
  module ZendeskAppsTools
5
5
  class Settings
6
6
 
7
- def get_settings_from(user_input, parameters)
7
+ def get_settings_from_user_input(user_input, parameters)
8
8
  return {} if parameters.nil?
9
9
 
10
10
  parameters.inject({}) do |settings, param|
@@ -26,16 +26,22 @@ module ZendeskAppsTools
26
26
  end
27
27
  end
28
28
 
29
- def get_settings_yaml(filepath, parameters)
29
+ def get_settings_from_file(filepath, parameters)
30
30
  return {} if parameters.nil?
31
31
  return nil unless File.exists? filepath
32
32
 
33
33
  begin
34
34
  settings_file = File.read(filepath)
35
- settings_yml = YAML::load(settings_file)
36
- settings_yml.each do |index, setting|
35
+
36
+ if filepath =~ /\.json$/ || settings_file =~ /\A\s*{/
37
+ settings_data = JSON.load(settings_file)
38
+ else
39
+ settings_data = YAML::load(settings_file)
40
+ end
41
+
42
+ settings_data.each do |index, setting|
37
43
  if (setting.is_a?(Hash) || setting.is_a?(Array))
38
- settings_yml[index] = JSON.dump(setting)
44
+ settings_data[index] = JSON.dump(setting)
39
45
  end
40
46
  end
41
47
  rescue => err
@@ -43,14 +49,14 @@ module ZendeskAppsTools
43
49
  end
44
50
 
45
51
  parameters.inject({}) do |settings, param|
46
- input = settings_yml[param[:name]]
52
+ input = settings_data[param[:name]]
47
53
 
48
54
  if !input && param[:default]
49
55
  input = param[:default]
50
56
  end
51
57
 
52
58
  if !input && param[:required]
53
- puts "'#{param[:name]}' is required but not specified in the yaml file.\n"
59
+ puts "'#{param[:name]}' is required but not specified in the config file.\n"
54
60
  return nil
55
61
  end
56
62
 
@@ -74,4 +80,3 @@ module ZendeskAppsTools
74
80
 
75
81
  end
76
82
  end
77
-
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.20.0
4
+ version: 1.21.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-08-26 00:00:00.000000000 Z
14
+ date: 2014-10-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -75,14 +75,14 @@ dependencies:
75
75
  requirements:
76
76
  - - "~>"
77
77
  - !ruby/object:Gem::Version
78
- version: 1.15.0
78
+ version: 1.16.1
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: 1.15.0
85
+ version: 1.16.1
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: cucumber
88
88
  requirement: !ruby/object:Gem::Requirement