kensa 1.0.0.beta2 → 1.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/bin/kensa +1 -4
- data/kensa.gemspec +2 -2
- data/lib/heroku/kensa.rb +6 -0
- data/lib/heroku/kensa/check.rb +1 -22
- data/lib/heroku/kensa/client.rb +8 -2
- data/lib/heroku/kensa/manifest.rb +0 -4
- data/test/manifest_check_test.rb +1 -39
- metadata +3 -3
data/Rakefile
CHANGED
@@ -10,7 +10,9 @@ end
|
|
10
10
|
task :default => :test
|
11
11
|
|
12
12
|
begin
|
13
|
+
$: << File.join(File.dirname(__FILE__), 'lib')
|
13
14
|
require 'jeweler'
|
15
|
+
require 'heroku/kensa'
|
14
16
|
Jeweler::Tasks.new do |gemspec|
|
15
17
|
gemspec.name = "kensa"
|
16
18
|
gemspec.summary = ""
|
@@ -29,7 +31,7 @@ begin
|
|
29
31
|
gemspec.add_dependency(%q<launchy>, [">= 0.3.2"])
|
30
32
|
gemspec.add_dependency(%q<mechanize>, ["~> 1.0.0"])
|
31
33
|
|
32
|
-
gemspec.version =
|
34
|
+
gemspec.version = Heroku::Kensa::VERSION
|
33
35
|
end
|
34
36
|
rescue LoadError
|
35
37
|
puts "Jeweler not available. Install it with: gem install jeweler"
|
data/bin/kensa
CHANGED
@@ -16,9 +16,9 @@ ARGV.options do |o|
|
|
16
16
|
o.on("-f file", "--file") {|filename| options[:filename] = filename }
|
17
17
|
o.on("--async") { options[:async] = true }
|
18
18
|
o.on("--production") { options[:env] = "production" }
|
19
|
-
o.on("--plan PLANID") { |plan| options[:plan] = plan }
|
20
19
|
o.on("--without-sso") { options[:sso] = false }
|
21
20
|
o.on("-h", "--help") { command = "help" }
|
21
|
+
o.on("-v", "--version") { options[:command] = "version" }
|
22
22
|
o.parse!
|
23
23
|
end
|
24
24
|
|
@@ -47,9 +47,6 @@ OPTIONS
|
|
47
47
|
--async
|
48
48
|
Check provision call with async response.
|
49
49
|
|
50
|
-
--plan plan-id
|
51
|
-
Use the identified plan when doing provision calls
|
52
|
-
|
53
50
|
--without-sso
|
54
51
|
Skip single sign-on authentication when doing provision calls
|
55
52
|
|
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.0.
|
8
|
+
s.version = "1.0.0.beta3"
|
9
9
|
|
10
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{2010-
|
12
|
+
s.date = %q{2010-08-11}
|
13
13
|
s.default_executable = %q{kensa}
|
14
14
|
s.description = %q{}
|
15
15
|
s.email = %q{pedro@heroku.com}
|
data/lib/heroku/kensa.rb
CHANGED
data/lib/heroku/kensa/check.rb
CHANGED
@@ -138,27 +138,6 @@ module Heroku
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
141
|
-
|
142
|
-
test "plans"
|
143
|
-
check "key must exist" do
|
144
|
-
data.has_key?("plans")
|
145
|
-
end
|
146
|
-
check "is an array" do
|
147
|
-
data["plans"].is_a?(Array)
|
148
|
-
end
|
149
|
-
check "contains at least one plan" do
|
150
|
-
!data["plans"].empty?
|
151
|
-
end
|
152
|
-
check "all plans are a hash" do
|
153
|
-
data["plans"].all? {|plan| plan.is_a?(Hash) }
|
154
|
-
end
|
155
|
-
check "all plans must have an id" do
|
156
|
-
data["plans"].all? {|plan| plan.has_key?("id") }
|
157
|
-
end
|
158
|
-
check "all plans have an unique id" do
|
159
|
-
ids = data["plans"].map {|plan| plan["id"] }
|
160
|
-
ids.size == ids.uniq.size
|
161
|
-
end
|
162
141
|
end
|
163
142
|
|
164
143
|
end
|
@@ -246,7 +225,7 @@ module Heroku
|
|
246
225
|
|
247
226
|
payload = {
|
248
227
|
:heroku_id => APPID,
|
249
|
-
:plan =>
|
228
|
+
:plan => 'test',
|
250
229
|
:callback_url => callback
|
251
230
|
}
|
252
231
|
|
data/lib/heroku/kensa/client.rb
CHANGED
@@ -18,7 +18,7 @@ module Heroku
|
|
18
18
|
class CommandInvalid < Exception; end
|
19
19
|
|
20
20
|
def run!
|
21
|
-
command = @args.shift
|
21
|
+
command = @args.shift || @options[:command]
|
22
22
|
raise CommandInvalid unless command && respond_to?(command)
|
23
23
|
send(command)
|
24
24
|
end
|
@@ -66,15 +66,21 @@ module Heroku
|
|
66
66
|
require_heroku
|
67
67
|
client = Heroku::Command.run "auth:client", ['--ignore-keys']
|
68
68
|
host = ENV['ADDONS_HOST'] || 'https://addons.heroku.com'
|
69
|
+
data = Yajl::Parser.parse(resolve_manifest)
|
69
70
|
resource = RestClient::Resource.new(host, client.user, client.password)
|
70
71
|
resource['provider/addons'].post(resolve_manifest)
|
71
|
-
puts "Manifest pushed
|
72
|
+
puts "-----> Manifest for \"#{data['id']}\" was pushed successfully"
|
73
|
+
puts " Continue at https://provider.heroku.com/addons/#{data['id']}"
|
72
74
|
rescue RestClient::Unauthorized
|
73
75
|
abort("Authentication failure")
|
74
76
|
rescue RestClient::Forbidden
|
75
77
|
abort("Not authorized to push this manifest. Please make sure you have permissions to push it")
|
76
78
|
end
|
77
79
|
|
80
|
+
def version
|
81
|
+
puts "Kensa #{VERSION}"
|
82
|
+
end
|
83
|
+
|
78
84
|
private
|
79
85
|
|
80
86
|
def resolve_manifest
|
data/test/manifest_check_test.rb
CHANGED
@@ -5,15 +5,7 @@ class ManifestCheckTest < Test::Unit::TestCase
|
|
5
5
|
|
6
6
|
def check ; ManifestCheck ; end
|
7
7
|
|
8
|
-
setup
|
9
|
-
@data = Manifest.new.skeleton
|
10
|
-
@data["plans"] << {
|
11
|
-
"id" => "advanced",
|
12
|
-
"name" => "Advanced",
|
13
|
-
"price" => "100",
|
14
|
-
"price_unit" => "month"
|
15
|
-
}
|
16
|
-
end
|
8
|
+
setup { @data = Manifest.new.skeleton }
|
17
9
|
|
18
10
|
test "is valid if no errors" do
|
19
11
|
assert_valid
|
@@ -79,34 +71,4 @@ class ManifestCheckTest < Test::Unit::TestCase
|
|
79
71
|
assert_invalid
|
80
72
|
end
|
81
73
|
|
82
|
-
test "plans key must exist" do
|
83
|
-
@data.delete("plans")
|
84
|
-
assert_invalid
|
85
|
-
end
|
86
|
-
|
87
|
-
test "plans key must be an Array" do
|
88
|
-
@data["plans"] = ""
|
89
|
-
assert_invalid
|
90
|
-
end
|
91
|
-
|
92
|
-
test "has at least one plan" do
|
93
|
-
@data["plans"] = []
|
94
|
-
assert_invalid
|
95
|
-
end
|
96
|
-
|
97
|
-
test "all plans are a hash" do
|
98
|
-
@data["plans"][0] = ""
|
99
|
-
assert_invalid
|
100
|
-
end
|
101
|
-
|
102
|
-
test "all plans have an id" do
|
103
|
-
@data["plans"].first.delete("id")
|
104
|
-
assert_invalid
|
105
|
-
end
|
106
|
-
|
107
|
-
test "all plans have an unique id" do
|
108
|
-
@data["plans"].first["id"] = @data["plans"].last["id"]
|
109
|
-
assert_invalid
|
110
|
-
end
|
111
|
-
|
112
74
|
end
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 1
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.0.
|
9
|
+
- beta3
|
10
|
+
version: 1.0.0.beta3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Blake Mizerany
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-
|
20
|
+
date: 2010-08-11 00:00:00 -07:00
|
21
21
|
default_executable: kensa
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|