kensa 2.1.0 → 2.2.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: daf02ac33a6d3d6d7df00e355c55cbaed75e09aa
4
- data.tar.gz: e5ea9344eb03ccb5384d3b024c9a3cf69a3ca503
3
+ metadata.gz: 5f100c19fcb05b5c0dd0a94287ac64d745050905
4
+ data.tar.gz: ac3f713db8e27febba8a41b276de592fa63e469d
5
5
  SHA512:
6
- metadata.gz: 3250cb8526d605b2b15cad6fc10e67acd161c1432f68e0f234bbfc5c9ab1232c48a809898696ee1471aff328b5b1d7efbff46cdc8e726bcbd5e23b9c669591d3
7
- data.tar.gz: db98d6775bd5ed405d879d5d1501961bc4db28e839de7585606052d3422737943a7ddd99c5aa8f83e770ec6481c95505baef70e5f5fd0877bbbe93801c73e76a
6
+ metadata.gz: c222175a5ce64e55ea5afad73536e716bb38eb66224dd4d84810adcae537dcbb5af2f2b2aea11ee0c7100a3ceeec4c286810962e465149a1bb8673acaede5e1f
7
+ data.tar.gz: d9cd6cffdd76e56bf78b9d7c1ad8b21abca12729fa59c0deedd4985d29ec9355f8fe8736002d6357d314c6a1216d60ee5a079de494c19d70953acbb9f8a59e16
@@ -1,11 +1,16 @@
1
- branches:
2
- only:
3
- - master
1
+ language: ruby
2
+
4
3
  rvm:
5
- - 1.9.2
6
4
  - 1.9.3
7
5
  - 2.0.0
8
6
  - 2.1.0
7
+
8
+ sudo: false
9
+
10
+ branches:
11
+ only:
12
+ - master
13
+
9
14
  notifications:
10
15
  email:
11
16
  - addons@heroku.com
@@ -1,21 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kensa (2.1.0)
4
+ kensa (2.2.0)
5
5
  launchy (~> 2.2.0)
6
6
  mechanize (~> 2.6.0)
7
+ netrc (~> 0.10.3)
7
8
  rest-client (~> 1.4, < 1.7.0)
8
9
  term-ansicolor (~> 1.3)
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- addressable (2.3.5)
14
+ addressable (2.3.8)
14
15
  artifice (0.6)
15
16
  rack-test
16
17
  coderay (1.0.8)
17
18
  contest (0.1.3)
18
- domain_name (0.5.16)
19
+ domain_name (0.5.23)
19
20
  unf (>= 0.0.5, < 1.0.0)
20
21
  fakefs (0.4.2)
21
22
  launchy (2.2.0)
@@ -30,11 +31,12 @@ GEM
30
31
  webrobots (>= 0.0.9, < 0.2)
31
32
  method_source (0.8.1)
32
33
  mime-types (1.25.1)
33
- mini_portile (0.5.2)
34
+ mini_portile (0.6.2)
34
35
  net-http-digest_auth (1.4)
35
36
  net-http-persistent (2.9.4)
36
- nokogiri (1.6.1)
37
- mini_portile (~> 0.5.0)
37
+ netrc (0.10.3)
38
+ nokogiri (1.6.5)
39
+ mini_portile (~> 0.6.0)
38
40
  ntlm-http (0.1.1)
39
41
  pry (0.9.11.4)
40
42
  coderay (~> 1.0.5)
@@ -46,8 +48,10 @@ GEM
46
48
  rack-test (0.6.2)
47
49
  rack (>= 1.0)
48
50
  rake (10.0.4)
49
- rest-client (1.6.7)
50
- mime-types (>= 1.16)
51
+ rdoc (4.2.0)
52
+ rest-client (1.6.8)
53
+ mime-types (~> 1.16)
54
+ rdoc (>= 2.4.2)
51
55
  rr (1.0.4)
52
56
  sinatra (1.4.2)
53
57
  rack (~> 1.5, >= 1.5.2)
@@ -58,8 +62,8 @@ GEM
58
62
  tins (~> 1.0)
59
63
  tilt (1.3.6)
60
64
  timecop (0.6.1)
61
- tins (1.0.0)
62
- unf (0.1.3)
65
+ tins (1.3.5)
66
+ unf (0.1.4)
63
67
  unf_ext
64
68
  unf_ext (0.0.6)
65
69
  webrobots (0.1.1)
data/bin/kensa CHANGED
@@ -68,7 +68,7 @@ COMMANDS
68
68
 
69
69
  TEST TYPES
70
70
 
71
- provision [optional params]
71
+ provision [optional params]
72
72
  Simulate a provision call from Heroku.
73
73
  [optional params]
74
74
  accepts extra command options and passes them on to the provision request
@@ -87,6 +87,6 @@ TEST TYPES
87
87
  Confirm that the manifest is valid. Automatically runs before all tests.
88
88
 
89
89
  all
90
- runs provision, planchange, and deprovision tests.
90
+ runs provision, planchange, and deprovision tests.
91
91
  defaults to using 'foo' for planchange plan.
92
92
 
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
 
27
27
  s.add_runtime_dependency(%q<launchy>, "~> 2.2.0")
28
28
  s.add_runtime_dependency(%q<mechanize>, "~> 2.6.0")
29
+ s.add_runtime_dependency(%q<netrc>, "~> 0.10.3")
29
30
  s.add_runtime_dependency(%q<rest-client>, ["< 1.7.0", "~> 1.4"])
30
31
  s.add_runtime_dependency(%q<term-ansicolor>, "~> 1.3")
31
32
 
@@ -127,7 +127,7 @@ module Heroku
127
127
  end
128
128
  end
129
129
 
130
- if data["api"].has_key?("config_vars")
130
+ if data["api"].has_key?("config_vars")
131
131
  check "contains config_vars array" do
132
132
  data["api"]["config_vars"].is_a?(Array)
133
133
  end
@@ -189,7 +189,7 @@ module Heroku
189
189
  end
190
190
 
191
191
  check "all keys in the manifest are present" do
192
- difference = data['api']['config_vars'] - response['config'].keys
192
+ difference = data['api']['config_vars'] - response['config'].keys
193
193
  unless difference.empty?
194
194
  verb = (difference.size == 1) ? "is" : "are"
195
195
  print "\n\t", yellow( "#{difference.join(', ')} #{verb} missing from the manifest")
@@ -280,7 +280,7 @@ module Heroku
280
280
  payload = {
281
281
  :heroku_id => heroku_id,
282
282
  :plan => data[:plan] || 'test',
283
- :callback_url => callback,
283
+ :callback_url => callback,
284
284
  :logplex_token => nil,
285
285
  :region => "amazon-web-services::us-east-1",
286
286
  :options => data[:options] || {}
@@ -456,7 +456,7 @@ module Heroku
456
456
 
457
457
  check "validates token" do
458
458
  @sso.token = 'invalid'
459
- page, respcode = mechanize_get
459
+ page, respcode = mechanize_get
460
460
  error("expected 403, got #{respcode}") unless respcode == 403
461
461
  true
462
462
  end
@@ -470,7 +470,7 @@ module Heroku
470
470
 
471
471
  page_logged_in = nil
472
472
  check "logs in" do
473
- page_logged_in, respcode = mechanize_get
473
+ page_logged_in, respcode = mechanize_get
474
474
  error("expected 200, got #{respcode}") unless respcode == 200
475
475
  true
476
476
  end
@@ -2,6 +2,7 @@ require 'restclient'
2
2
  require 'term/ansicolor'
3
3
  require 'launchy'
4
4
  require 'optparse'
5
+ require 'netrc'
5
6
 
6
7
  module Heroku
7
8
  module Kensa
@@ -25,7 +26,7 @@ module Heroku
25
26
  manifest = Manifest.new(@options)
26
27
  protect_current_manifest!
27
28
  manifest.write
28
- screen.message "Initialized new addon manifest in #{filename}\n"
29
+ screen.message "Initialized new addon manifest in #{filename}\n"
29
30
  if @options[:foreman]
30
31
  screen.message "Initialized new .env file for foreman\n"
31
32
  end
@@ -42,7 +43,7 @@ module Heroku
42
43
  @options[:foreman] = true
43
44
  init
44
45
  rescue Exception => e
45
- raise CommandInvalid.new("error cloning #{Git.clone_url(template)} into #{app_name}")
46
+ raise CommandInvalid.new("error cloning #{Git.clone_url(template)} into #{app_name}")
46
47
  end
47
48
  end
48
49
 
@@ -124,7 +125,7 @@ module Heroku
124
125
  puts
125
126
  end
126
127
  end
127
-
128
+
128
129
  def filename
129
130
  @options[:filename]
130
131
  end
@@ -185,6 +186,14 @@ module Heroku
185
186
  end
186
187
 
187
188
  def ask_for_credentials
189
+ netrc_creds = Netrc.read['api.heroku.com']
190
+ if netrc_creds
191
+ print "Found credentials for #{netrc_creds.login}, proceed? (y/N) "
192
+ if gets.chomp.downcase == "y"
193
+ return [ netrc_creds.login, netrc_creds.password]
194
+ end
195
+ end
196
+
188
197
  puts "Enter your Heroku Provider credentials."
189
198
 
190
199
  print "Email: "
@@ -273,7 +282,7 @@ module Heroku
273
282
  # OptionParser errors out on unnamed options so we have to pull out all the --flags and --flag=somethings
274
283
  KNOWN_ARGS = %w{file async production without-sso help plan version sso foreman template}
275
284
  def self.pre_parse(args)
276
- args.partition do |token|
285
+ args.partition do |token|
277
286
  token.match(/^--/) && !token.match(/^--(#{KNOWN_ARGS.join('|')})/)
278
287
  end.reverse
279
288
  end
@@ -287,7 +296,7 @@ module Heroku
287
296
  value = peek && !peek.match(/^--/) ? peek : 'true'
288
297
  end
289
298
  key = key.sub(/^--/,'')
290
- options[key] = value
299
+ options[key] = value
291
300
  end
292
301
  end
293
302
  end
@@ -317,11 +326,11 @@ module Heroku
317
326
  end
318
327
  end
319
328
  end
320
-
329
+
321
330
  def self.parse(args)
322
331
  if args[0] == 'test' && args[1] == 'provision'
323
332
  safe_args, extra_params = self.pre_parse(args)
324
- self.defaults.tap do |options|
333
+ self.defaults.tap do |options|
325
334
  options.merge! self.parse_command_line(safe_args)
326
335
  options.merge! :options => self.parse_provision(extra_params, args)
327
336
  end
@@ -329,7 +338,7 @@ module Heroku
329
338
  self.defaults.merge(self.parse_command_line(args))
330
339
  end
331
340
  end
332
- end
341
+ end
333
342
  end
334
343
  end
335
344
  end
@@ -27,7 +27,7 @@ module Heroku
27
27
  def clone_url(name)
28
28
  if name.include? "://" #its a full url not on github
29
29
  return name
30
- elsif !name.include? "/" #its one of ours
30
+ elsif !name.include? "/" #its one of ours
31
31
  name = heroku_prefix + name
32
32
  end
33
33
 
@@ -29,7 +29,7 @@ module Heroku
29
29
  args = [
30
30
  { :accept => "application/json" }
31
31
  ]
32
-
32
+
33
33
  if payload
34
34
  args.first[:content_type] = "application/json"
35
35
  args.unshift OkJson.encode(payload)
@@ -4,9 +4,9 @@ class Hash
4
4
  each do |key, value|
5
5
  case value
6
6
  when Hash
7
- value = value.stringify_keys
7
+ value = value.stringify_keys
8
8
  when Array
9
- value = value.map { |v| v.stringify_keys if v.is_a? Hash }
9
+ value = value.map { |v| v.stringify_keys if v.is_a? Hash }
10
10
  end
11
11
 
12
12
  new_hash[key.to_s] = value
@@ -20,5 +20,5 @@ module OkJson
20
20
 
21
21
  def encode(x)
22
22
  encode_without_stringify(x.stringify_keys)
23
- end
23
+ end
24
24
  end
@@ -21,7 +21,7 @@ class Heroku::Kensa::PostProxy < WEBrick::HTTPServer
21
21
  <form action="#{@sso.post_url}" method="POST">
22
22
  #{ @params.map do |key, value|
23
23
  %|<input type="hidden" name="#{key}" value="#{value}" />|
24
- end.join("\n")
24
+ end.join("\n")
25
25
  }
26
26
  </form>
27
27
  </body>
@@ -16,13 +16,13 @@ module Heroku
16
16
  @proxy_port = find_available_port
17
17
  else
18
18
  @url = data["api"][env].chomp('/')
19
- end
19
+ end
20
20
  @timestamp = Time.now.to_i
21
21
  @token = make_token(@timestamp)
22
22
  end
23
23
 
24
24
  def path
25
- if self.POST?
25
+ if self.POST?
26
26
  URI.parse(url).path
27
27
  else
28
28
  "/heroku/resources/#{id}"
@@ -53,7 +53,7 @@ module Heroku
53
53
  def timestamp=(other)
54
54
  @timestamp = other
55
55
  @token = make_token(@timestamp)
56
- end
56
+ end
57
57
 
58
58
  def make_token(t)
59
59
  Digest::SHA1.hexdigest([@id, @salt, t].join(':'))
@@ -61,7 +61,7 @@ module Heroku
61
61
 
62
62
  def querystring
63
63
  return '' unless @salt
64
- '?' + query_data
64
+ '?' + query_data
65
65
  end
66
66
 
67
67
  def query_data
@@ -69,7 +69,7 @@ module Heroku
69
69
  end
70
70
 
71
71
  def query_params
72
- { 'token' => @token,
72
+ { 'token' => @token,
73
73
  'timestamp' => @timestamp.to_s,
74
74
  'nav-data' => sample_nav_data,
75
75
  'email' => 'username@example.com',
@@ -124,7 +124,7 @@ module Heroku
124
124
 
125
125
  trap("INT") { server.stop }
126
126
  pid = fork do
127
- server.start
127
+ server.start
128
128
  end
129
129
  at_exit { server.stop; Process.waitpid pid }
130
130
  end
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  module Kensa
3
- VERSION = '2.1.0'
3
+ VERSION = '2.2.0'
4
4
  end
5
5
  end
@@ -35,7 +35,7 @@ helpers do
35
35
  raise "#{param} not included with request" unless params.keys.include? param
36
36
  end
37
37
  end
38
-
38
+
39
39
  def login(heroku_user=true)
40
40
  @header = heroku_user
41
41
  erb <<-ERB
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kensa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -13,180 +13,194 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2014-08-21 00:00:00.000000000 Z
16
+ date: 2015-04-09 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: launchy
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
- - - ~>
22
+ - - "~>"
23
23
  - !ruby/object:Gem::Version
24
24
  version: 2.2.0
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
- - - ~>
29
+ - - "~>"
30
30
  - !ruby/object:Gem::Version
31
31
  version: 2.2.0
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: mechanize
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - ~>
36
+ - - "~>"
37
37
  - !ruby/object:Gem::Version
38
38
  version: 2.6.0
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  requirements:
43
- - - ~>
43
+ - - "~>"
44
44
  - !ruby/object:Gem::Version
45
45
  version: 2.6.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: netrc
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: 0.10.3
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.10.3
46
60
  - !ruby/object:Gem::Dependency
47
61
  name: rest-client
48
62
  requirement: !ruby/object:Gem::Requirement
49
63
  requirements:
50
- - - <
64
+ - - "<"
51
65
  - !ruby/object:Gem::Version
52
66
  version: 1.7.0
53
- - - ~>
67
+ - - "~>"
54
68
  - !ruby/object:Gem::Version
55
69
  version: '1.4'
56
70
  type: :runtime
57
71
  prerelease: false
58
72
  version_requirements: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - <
74
+ - - "<"
61
75
  - !ruby/object:Gem::Version
62
76
  version: 1.7.0
63
- - - ~>
77
+ - - "~>"
64
78
  - !ruby/object:Gem::Version
65
79
  version: '1.4'
66
80
  - !ruby/object:Gem::Dependency
67
81
  name: term-ansicolor
68
82
  requirement: !ruby/object:Gem::Requirement
69
83
  requirements:
70
- - - ~>
84
+ - - "~>"
71
85
  - !ruby/object:Gem::Version
72
86
  version: '1.3'
73
87
  type: :runtime
74
88
  prerelease: false
75
89
  version_requirements: !ruby/object:Gem::Requirement
76
90
  requirements:
77
- - - ~>
91
+ - - "~>"
78
92
  - !ruby/object:Gem::Version
79
93
  version: '1.3'
80
94
  - !ruby/object:Gem::Dependency
81
95
  name: artifice
82
96
  requirement: !ruby/object:Gem::Requirement
83
97
  requirements:
84
- - - ~>
98
+ - - "~>"
85
99
  - !ruby/object:Gem::Version
86
100
  version: '0.6'
87
101
  type: :development
88
102
  prerelease: false
89
103
  version_requirements: !ruby/object:Gem::Requirement
90
104
  requirements:
91
- - - ~>
105
+ - - "~>"
92
106
  - !ruby/object:Gem::Version
93
107
  version: '0.6'
94
108
  - !ruby/object:Gem::Dependency
95
109
  name: contest
96
110
  requirement: !ruby/object:Gem::Requirement
97
111
  requirements:
98
- - - ~>
112
+ - - "~>"
99
113
  - !ruby/object:Gem::Version
100
114
  version: 0.1.3
101
115
  type: :development
102
116
  prerelease: false
103
117
  version_requirements: !ruby/object:Gem::Requirement
104
118
  requirements:
105
- - - ~>
119
+ - - "~>"
106
120
  - !ruby/object:Gem::Version
107
121
  version: 0.1.3
108
122
  - !ruby/object:Gem::Dependency
109
123
  name: fakefs
110
124
  requirement: !ruby/object:Gem::Requirement
111
125
  requirements:
112
- - - ~>
126
+ - - "~>"
113
127
  - !ruby/object:Gem::Version
114
128
  version: 0.4.2
115
129
  type: :development
116
130
  prerelease: false
117
131
  version_requirements: !ruby/object:Gem::Requirement
118
132
  requirements:
119
- - - ~>
133
+ - - "~>"
120
134
  - !ruby/object:Gem::Version
121
135
  version: 0.4.2
122
136
  - !ruby/object:Gem::Dependency
123
137
  name: rake
124
138
  requirement: !ruby/object:Gem::Requirement
125
139
  requirements:
126
- - - '>='
140
+ - - ">="
127
141
  - !ruby/object:Gem::Version
128
142
  version: '0'
129
143
  type: :development
130
144
  prerelease: false
131
145
  version_requirements: !ruby/object:Gem::Requirement
132
146
  requirements:
133
- - - '>='
147
+ - - ">="
134
148
  - !ruby/object:Gem::Version
135
149
  version: '0'
136
150
  - !ruby/object:Gem::Dependency
137
151
  name: rr
138
152
  requirement: !ruby/object:Gem::Requirement
139
153
  requirements:
140
- - - ~>
154
+ - - "~>"
141
155
  - !ruby/object:Gem::Version
142
156
  version: 1.0.4
143
157
  type: :development
144
158
  prerelease: false
145
159
  version_requirements: !ruby/object:Gem::Requirement
146
160
  requirements:
147
- - - ~>
161
+ - - "~>"
148
162
  - !ruby/object:Gem::Version
149
163
  version: 1.0.4
150
164
  - !ruby/object:Gem::Dependency
151
165
  name: sinatra
152
166
  requirement: !ruby/object:Gem::Requirement
153
167
  requirements:
154
- - - ~>
168
+ - - "~>"
155
169
  - !ruby/object:Gem::Version
156
170
  version: 1.4.2
157
171
  type: :development
158
172
  prerelease: false
159
173
  version_requirements: !ruby/object:Gem::Requirement
160
174
  requirements:
161
- - - ~>
175
+ - - "~>"
162
176
  - !ruby/object:Gem::Version
163
177
  version: 1.4.2
164
178
  - !ruby/object:Gem::Dependency
165
179
  name: timecop
166
180
  requirement: !ruby/object:Gem::Requirement
167
181
  requirements:
168
- - - ~>
182
+ - - "~>"
169
183
  - !ruby/object:Gem::Version
170
184
  version: 0.6.1
171
185
  type: :development
172
186
  prerelease: false
173
187
  version_requirements: !ruby/object:Gem::Requirement
174
188
  requirements:
175
- - - ~>
189
+ - - "~>"
176
190
  - !ruby/object:Gem::Version
177
191
  version: 0.6.1
178
192
  - !ruby/object:Gem::Dependency
179
193
  name: pry
180
194
  requirement: !ruby/object:Gem::Requirement
181
195
  requirements:
182
- - - '>='
196
+ - - ">="
183
197
  - !ruby/object:Gem::Version
184
198
  version: '0'
185
199
  type: :development
186
200
  prerelease: false
187
201
  version_requirements: !ruby/object:Gem::Requirement
188
202
  requirements:
189
- - - '>='
203
+ - - ">="
190
204
  - !ruby/object:Gem::Version
191
205
  version: '0'
192
206
  description: Kensa is a command-line tool to help add-on providers integrating their
@@ -198,8 +212,8 @@ executables:
198
212
  extensions: []
199
213
  extra_rdoc_files: []
200
214
  files:
201
- - .gitignore
202
- - .travis.yml
215
+ - ".gitignore"
216
+ - ".travis.yml"
203
217
  - Gemfile
204
218
  - Gemfile.lock
205
219
  - LICENSE
@@ -244,17 +258,17 @@ require_paths:
244
258
  - lib
245
259
  required_ruby_version: !ruby/object:Gem::Requirement
246
260
  requirements:
247
- - - '>='
261
+ - - ">="
248
262
  - !ruby/object:Gem::Version
249
263
  version: 1.9.0
250
264
  required_rubygems_version: !ruby/object:Gem::Requirement
251
265
  requirements:
252
- - - '>='
266
+ - - ">="
253
267
  - !ruby/object:Gem::Version
254
268
  version: '0'
255
269
  requirements: []
256
270
  rubyforge_project:
257
- rubygems_version: 2.0.14
271
+ rubygems_version: 2.4.5
258
272
  signing_key:
259
273
  specification_version: 4
260
274
  summary: Tool to help Heroku add-on providers integrating their services