kensa 1.1.0.pre → 1.1.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/kensa +5 -1
- data/kensa.gemspec +1 -1
- data/lib/heroku/kensa.rb +1 -1
- data/lib/heroku/kensa/client.rb +25 -2
- metadata +2 -2
data/bin/kensa
CHANGED
@@ -26,7 +26,9 @@ end
|
|
26
26
|
include Heroku::Kensa
|
27
27
|
|
28
28
|
begin
|
29
|
-
|
29
|
+
args = ARGV.dup
|
30
|
+
ARGV.clear
|
31
|
+
Client.new(args, options).run!
|
30
32
|
rescue Client::CommandInvalid
|
31
33
|
abort File.read(__FILE__).split('__END__').last
|
32
34
|
end
|
@@ -66,6 +68,8 @@ COMMANDS
|
|
66
68
|
|
67
69
|
push Send the manifest to Heroku
|
68
70
|
|
71
|
+
pull <id> Fetch the latest manifest from Heroku
|
72
|
+
|
69
73
|
TEST TYPES
|
70
74
|
|
71
75
|
provision
|
data/kensa.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{kensa}
|
8
|
-
s.version = "1.1.0.
|
8
|
+
s.version = "1.1.0.pre2"
|
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"]
|
data/lib/heroku/kensa.rb
CHANGED
data/lib/heroku/kensa/client.rb
CHANGED
@@ -71,7 +71,6 @@ module Heroku
|
|
71
71
|
user, password = ask_for_credentials
|
72
72
|
host = ENV['ADDONS_HOST'] || 'https://addons.heroku.com'
|
73
73
|
data = Yajl::Parser.parse(resolve_manifest)
|
74
|
-
headers = { "X-Kensa-Version" => "1", "User-Agent" => "kensa/#{VERSION}" }
|
75
74
|
resource = RestClient::Resource.new(host, user, password)
|
76
75
|
resource['provider/addons'].post(resolve_manifest, headers)
|
77
76
|
puts "-----> Manifest for \"#{data['id']}\" was pushed successfully"
|
@@ -84,20 +83,44 @@ module Heroku
|
|
84
83
|
abort("Not authorized to push this manifest. Please make sure you have permissions to push it")
|
85
84
|
end
|
86
85
|
|
86
|
+
def pull
|
87
|
+
addon = @args.first || abort('usage: kensa pull <add-on name>')
|
88
|
+
|
89
|
+
if manifest_exists?
|
90
|
+
print "Manifest already exists. Replace it? (y/n) "
|
91
|
+
abort unless gets.strip.downcase == 'y'
|
92
|
+
puts
|
93
|
+
end
|
94
|
+
|
95
|
+
user, password = ask_for_credentials
|
96
|
+
host = ENV['ADDONS_HOST'] || 'https://addons.heroku.com'
|
97
|
+
resource = RestClient::Resource.new(host, user, password)
|
98
|
+
manifest = resource["provider/addons/#{addon}"].get(headers)
|
99
|
+
File.open(filename, 'w') { |f| f.puts manifest }
|
100
|
+
puts "-----> Manifest for \"#{addon}\" received successfully"
|
101
|
+
end
|
102
|
+
|
87
103
|
def version
|
88
104
|
puts "Kensa #{VERSION}"
|
89
105
|
end
|
90
106
|
|
91
107
|
private
|
108
|
+
def headers
|
109
|
+
{ :accept => :json, "X-Kensa-Version" => "1", "User-Agent" => "kensa/#{VERSION}" }
|
110
|
+
end
|
92
111
|
|
93
112
|
def resolve_manifest
|
94
|
-
if
|
113
|
+
if manifest_exists?
|
95
114
|
File.read(filename)
|
96
115
|
else
|
97
116
|
abort("fatal: #{filename} not found")
|
98
117
|
end
|
99
118
|
end
|
100
119
|
|
120
|
+
def manifest_exists?
|
121
|
+
File.exists?(filename)
|
122
|
+
end
|
123
|
+
|
101
124
|
def run_check(klass, args={})
|
102
125
|
screen = Screen.new
|
103
126
|
data = Yajl::Parser.parse(resolve_manifest)
|