kensa 1.0.2 → 1.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/kensa.gemspec +6 -6
- data/lib/heroku/kensa.rb +1 -1
- data/lib/heroku/kensa/check.rb +7 -4
- data/lib/heroku/kensa/client.rb +3 -1
- data/lib/heroku/kensa/manifest.rb +1 -2
- data/test/all_check_test.rb +0 -1
- data/test/manifest_check_test.rb +4 -5
- data/test/manifest_test.rb +12 -0
- data/test/plan_change_check_test.rb +0 -1
- data/test/provision_check_test.rb +0 -1
- data/test/resources/server.rb +1 -1
- metadata +11 -15
data/Rakefile
CHANGED
@@ -25,7 +25,7 @@ begin
|
|
25
25
|
gemspec.add_development_dependency(%q<contest>, [">= 0"])
|
26
26
|
gemspec.add_development_dependency(%q<timecop>, [">= 0.3.5"])
|
27
27
|
gemspec.add_development_dependency(%q<sinatra>, [">= 0.9"])
|
28
|
-
gemspec.add_dependency(%q<rest-client>, ["
|
28
|
+
gemspec.add_dependency(%q<rest-client>, ["~> 1.4.0"])
|
29
29
|
gemspec.add_dependency(%q<yajl-ruby>, ["~> 0.6"])
|
30
30
|
gemspec.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
31
31
|
gemspec.add_dependency(%q<launchy>, [">= 0.3.2"])
|
data/kensa.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kensa}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.1.0.pre"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Blake Mizerany", "Pedro Belo", "Adam Wiggins"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-20}
|
13
13
|
s.default_executable = %q{kensa}
|
14
14
|
s.description = %q{Kensa is a command-line tool to help add-on providers integrating their services with Heroku. It manages manifest files, and provides a TDD-like approach for programmers to test and develop their APIs.}
|
15
15
|
s.email = %q{pedro@heroku.com}
|
@@ -72,7 +72,7 @@ Gem::Specification.new do |s|
|
|
72
72
|
s.add_development_dependency(%q<contest>, [">= 0"])
|
73
73
|
s.add_development_dependency(%q<timecop>, [">= 0.3.5"])
|
74
74
|
s.add_development_dependency(%q<sinatra>, [">= 0.9"])
|
75
|
-
s.add_runtime_dependency(%q<rest-client>, ["
|
75
|
+
s.add_runtime_dependency(%q<rest-client>, ["~> 1.4.0"])
|
76
76
|
s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.6"])
|
77
77
|
s.add_runtime_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
78
78
|
s.add_runtime_dependency(%q<launchy>, [">= 0.3.2"])
|
@@ -82,7 +82,7 @@ Gem::Specification.new do |s|
|
|
82
82
|
s.add_dependency(%q<contest>, [">= 0"])
|
83
83
|
s.add_dependency(%q<timecop>, [">= 0.3.5"])
|
84
84
|
s.add_dependency(%q<sinatra>, [">= 0.9"])
|
85
|
-
s.add_dependency(%q<rest-client>, ["
|
85
|
+
s.add_dependency(%q<rest-client>, ["~> 1.4.0"])
|
86
86
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.6"])
|
87
87
|
s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
88
88
|
s.add_dependency(%q<launchy>, [">= 0.3.2"])
|
@@ -93,7 +93,7 @@ Gem::Specification.new do |s|
|
|
93
93
|
s.add_dependency(%q<contest>, [">= 0"])
|
94
94
|
s.add_dependency(%q<timecop>, [">= 0.3.5"])
|
95
95
|
s.add_dependency(%q<sinatra>, [">= 0.9"])
|
96
|
-
s.add_dependency(%q<rest-client>, ["
|
96
|
+
s.add_dependency(%q<rest-client>, ["~> 1.4.0"])
|
97
97
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.6"])
|
98
98
|
s.add_dependency(%q<term-ansicolor>, ["~> 1.0"])
|
99
99
|
s.add_dependency(%q<launchy>, [">= 0.3.2"])
|
data/lib/heroku/kensa.rb
CHANGED
data/lib/heroku/kensa/check.rb
CHANGED
@@ -99,9 +99,6 @@ module Heroku
|
|
99
99
|
check "is a hash" do
|
100
100
|
data["api"].is_a?(Hash)
|
101
101
|
end
|
102
|
-
check "contains username" do
|
103
|
-
data["api"].has_key?("username") && data["api"]["username"] != ""
|
104
|
-
end
|
105
102
|
check "contains password" do
|
106
103
|
data["api"].has_key?("password") && data["api"]["password"] != ""
|
107
104
|
end
|
@@ -139,6 +136,12 @@ module Heroku
|
|
139
136
|
end
|
140
137
|
end
|
141
138
|
end
|
139
|
+
check "deprecated fields" do
|
140
|
+
if data["api"].has_key?("username")
|
141
|
+
error "username is deprecated: Please authenticate using the add-on id."
|
142
|
+
end
|
143
|
+
true
|
144
|
+
end
|
142
145
|
end
|
143
146
|
|
144
147
|
end
|
@@ -206,7 +209,7 @@ module Heroku
|
|
206
209
|
end
|
207
210
|
|
208
211
|
def credentials
|
209
|
-
|
212
|
+
[ data['id'], data['api']['password'] ]
|
210
213
|
end
|
211
214
|
end
|
212
215
|
|
data/lib/heroku/kensa/client.rb
CHANGED
@@ -25,7 +25,7 @@ module Heroku
|
|
25
25
|
|
26
26
|
def init
|
27
27
|
Manifest.new(filename, @options).write
|
28
|
-
Screen.new.message "Initialized new addon manifest in #{filename}"
|
28
|
+
Screen.new.message "Initialized new addon manifest in #{filename}\n"
|
29
29
|
end
|
30
30
|
|
31
31
|
def test
|
@@ -76,6 +76,8 @@ module Heroku
|
|
76
76
|
resource['provider/addons'].post(resolve_manifest, headers)
|
77
77
|
puts "-----> Manifest for \"#{data['id']}\" was pushed successfully"
|
78
78
|
puts " Continue at https://provider.heroku.com/addons/#{data['id']}"
|
79
|
+
rescue RestClient::UnprocessableEntity => e
|
80
|
+
abort("FAILED: #{e.http_body}")
|
79
81
|
rescue RestClient::Unauthorized
|
80
82
|
abort("Authentication failure")
|
81
83
|
rescue RestClient::Forbidden
|
@@ -12,8 +12,7 @@ module Heroku
|
|
12
12
|
"id": "myaddon",
|
13
13
|
"api": {
|
14
14
|
"config_vars": [ "MYADDON_URL" ],
|
15
|
-
"
|
16
|
-
"password": "b1EWrHYXE1R5J71D",#{ sso_key }
|
15
|
+
"password": "#{generate_password(16)}",#{ sso_key }
|
17
16
|
"production": "https://yourapp.com/",
|
18
17
|
"test": "http://localhost:4567/"
|
19
18
|
}
|
data/test/all_check_test.rb
CHANGED
data/test/manifest_check_test.rb
CHANGED
@@ -26,11 +26,6 @@ class ManifestCheckTest < Test::Unit::TestCase
|
|
26
26
|
assert_invalid
|
27
27
|
end
|
28
28
|
|
29
|
-
test "api has a username" do
|
30
|
-
@data["api"].delete("username")
|
31
|
-
assert_invalid
|
32
|
-
end
|
33
|
-
|
34
29
|
test "api has a password" do
|
35
30
|
@data["api"].delete("password")
|
36
31
|
assert_invalid
|
@@ -77,4 +72,8 @@ class ManifestCheckTest < Test::Unit::TestCase
|
|
77
72
|
assert_valid
|
78
73
|
end
|
79
74
|
|
75
|
+
test "username is deprecated" do
|
76
|
+
@data["api"]["username"] = "heroku"
|
77
|
+
assert_invalid
|
78
|
+
end
|
80
79
|
end
|
data/test/manifest_test.rb
CHANGED
@@ -9,6 +9,18 @@ class ManifestTest < Test::Unit::TestCase
|
|
9
9
|
test 'have sso salt' do
|
10
10
|
assert_not_nil @manifest.skeleton['api']['sso_salt']
|
11
11
|
end
|
12
|
+
|
13
|
+
test 'generates a new sso salt every time' do
|
14
|
+
assert @manifest.skeleton['api']['ssl_salt'] != Manifest.new.skeleton['api']['sso_salt']
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'has an api password' do
|
18
|
+
assert_not_nil @manifest.skeleton['api']['password']
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'generates a new password every time' do
|
22
|
+
assert @manifest.skeleton['api']['password'] != Manifest.new.skeleton['api']['password']
|
23
|
+
end
|
12
24
|
end
|
13
25
|
|
14
26
|
context 'manifest without sso' do
|
data/test/resources/server.rb
CHANGED
@@ -14,7 +14,7 @@ helpers do
|
|
14
14
|
|
15
15
|
def auth_heroku?
|
16
16
|
@auth ||= Rack::Auth::Basic::Request.new(request.env)
|
17
|
-
@auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == ['
|
17
|
+
@auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == ['myaddon', 'secret']
|
18
18
|
end
|
19
19
|
|
20
20
|
def unauthorized!(status=403)
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kensa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
4
|
+
prerelease: true
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
9
|
+
- pre
|
10
|
+
version: 1.1.0.pre
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Blake Mizerany
|
@@ -16,7 +17,7 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2011-01-
|
20
|
+
date: 2011-01-20 00:00:00 -08:00
|
20
21
|
default_executable: kensa
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
@@ -75,20 +76,13 @@ dependencies:
|
|
75
76
|
prerelease: false
|
76
77
|
requirement: &id005 !ruby/object:Gem::Requirement
|
77
78
|
requirements:
|
78
|
-
- -
|
79
|
+
- - ~>
|
79
80
|
- !ruby/object:Gem::Version
|
80
81
|
segments:
|
81
82
|
- 1
|
82
83
|
- 4
|
83
84
|
- 0
|
84
85
|
version: 1.4.0
|
85
|
-
- - <
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 1
|
89
|
-
- 7
|
90
|
-
- 0
|
91
|
-
version: 1.7.0
|
92
86
|
type: :runtime
|
93
87
|
version_requirements: *id005
|
94
88
|
- !ruby/object:Gem::Dependency
|
@@ -196,11 +190,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
196
190
|
version: "0"
|
197
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
192
|
requirements:
|
199
|
-
- - "
|
193
|
+
- - ">"
|
200
194
|
- !ruby/object:Gem::Version
|
201
195
|
segments:
|
202
|
-
-
|
203
|
-
|
196
|
+
- 1
|
197
|
+
- 3
|
198
|
+
- 1
|
199
|
+
version: 1.3.1
|
204
200
|
requirements: []
|
205
201
|
|
206
202
|
rubyforge_project:
|