heroku-api 0.3.11 → 0.3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -1
- data/changelog.txt +6 -0
- data/heroku-api.gemspec +1 -1
- data/lib/heroku/api.rb +7 -3
- data/lib/heroku/api/mock/processes.rb +16 -0
- data/lib/heroku/api/processes.rb +12 -0
- data/lib/heroku/api/version.rb +1 -1
- data/test/test_addons.rb +1 -1
- data/test/test_apps.rb +1 -1
- data/test/test_attachments.rb +1 -1
- data/test/test_collaborators.rb +1 -1
- data/test/test_config_vars.rb +1 -1
- data/test/test_domains.rb +1 -1
- data/test/test_error_conditions.rb +1 -1
- data/test/test_features.rb +1 -1
- data/test/test_keys.rb +1 -1
- data/test/test_login.rb +1 -1
- data/test/test_logs.rb +1 -1
- data/test/test_processes.rb +11 -1
- data/test/test_releases.rb +1 -1
- data/test/test_ssl_endpoints.rb +1 -1
- data/test/test_stacks.rb +1 -1
- data/test/test_user.rb +1 -1
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fb78b67088d699c2a0477c2ee68bf160d3a930db
|
4
|
+
data.tar.gz: 267dd8a9b5c5454c050a2859c5d1945e7ed062e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 336c3c6c37d289beba85c8ee126dc1892cdc0f86992e326777a74a135c15929b0f9b6b0bc34999099d6e86964a0291f429015237d84d196e890b16a6f3e8d179
|
7
|
+
data.tar.gz: c68842cd687f2df68df04c07c8e286c37d6aeaad0fc764f9aafa42da7692d5d6e5e860779f0ef5c78866b8037749816104d8ace810204e0ed6fa61d7eeb53565
|
data/README.md
CHANGED
@@ -88,7 +88,8 @@ For additional details about any of the commands, see the [API docs](http://api-
|
|
88
88
|
heroku.put_dynos(APP, DYNOS) # set number of dynos for bamboo app APP to DYNOS
|
89
89
|
heroku.put_workers(APP, WORKERS) # set number of workers for bamboo app APP to WORKERS
|
90
90
|
heroku.post_ps_scale(APP, 'worker', WORKERS) # set number of workers for cedar app APP to WORKERS
|
91
|
-
|
91
|
+
heroku.put_formation(APP, 'web' => '2X') # set dyno size to '2X' for all 'web' processes for APP app
|
92
|
+
|
92
93
|
### Releases
|
93
94
|
|
94
95
|
heroku.get_releases(APP) # list of releases for the APP app
|
data/changelog.txt
CHANGED
data/heroku-api.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_runtime_dependency 'excon', '~>0.
|
19
|
+
s.add_runtime_dependency 'excon', '~>0.23.0'
|
20
20
|
|
21
21
|
s.add_development_dependency 'minitest'
|
22
22
|
s.add_development_dependency 'rake'
|
data/lib/heroku/api.rb
CHANGED
@@ -93,15 +93,14 @@ module Heroku
|
|
93
93
|
else Heroku::API::Errors::ErrorWithResponse
|
94
94
|
end
|
95
95
|
|
96
|
+
decompress_response!(error.response)
|
96
97
|
reerror = klass.new(error.message, error.response)
|
97
98
|
reerror.set_backtrace(error.backtrace)
|
98
99
|
raise(reerror)
|
99
100
|
end
|
100
101
|
|
101
102
|
if response.body && !response.body.empty?
|
102
|
-
|
103
|
-
response.body = Zlib::GzipReader.new(StringIO.new(response.body)).read
|
104
|
-
end
|
103
|
+
decompress_response!(response)
|
105
104
|
begin
|
106
105
|
response.body = Heroku::API::OkJson.decode(response.body)
|
107
106
|
rescue
|
@@ -117,6 +116,11 @@ module Heroku
|
|
117
116
|
|
118
117
|
private
|
119
118
|
|
119
|
+
def decompress_response!(response)
|
120
|
+
return unless response.headers['Content-Encoding'] == 'gzip'
|
121
|
+
response.body = Zlib::GzipReader.new(StringIO.new(response.body)).read
|
122
|
+
end
|
123
|
+
|
120
124
|
def app_params(params)
|
121
125
|
app_params = {}
|
122
126
|
params.each do |key, value|
|
@@ -193,6 +193,22 @@ module Heroku
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
+
# stub PUT /apps/:app/formation
|
197
|
+
Excon.stub(:expects => 200, :method => :put, :path => %r{^/apps/([^/]+)/formation}) do |params|
|
198
|
+
request_params, mock_data = parse_stub_params(params)
|
199
|
+
app, _ = request_params[:captures][:path]
|
200
|
+
with_mock_app(mock_data, app) do
|
201
|
+
new_resize_vars = request_params[:body]
|
202
|
+
process = mock_data[:ps][app].first["process"].split('.')[0]
|
203
|
+
size = new_resize_vars[process]["size"][/(\d+)/]
|
204
|
+
mock_data[:ps][app].first.merge!({'size' => size})
|
205
|
+
{
|
206
|
+
:body => Heroku::API::OkJson.encode(get_mock_processes(mock_data, app)),
|
207
|
+
:status => 200
|
208
|
+
}
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
196
212
|
end
|
197
213
|
end
|
198
214
|
end
|
data/lib/heroku/api/processes.rb
CHANGED
@@ -73,5 +73,17 @@ module Heroku
|
|
73
73
|
:query => {'workers' => workers}
|
74
74
|
)
|
75
75
|
end
|
76
|
+
|
77
|
+
# PUT /apps/:app/formation
|
78
|
+
def put_formation(app, options)
|
79
|
+
options.each { |process, size| options[process] = {'size' => size} }
|
80
|
+
request(
|
81
|
+
:body => Heroku::API::OkJson.encode(options),
|
82
|
+
:expects => 200,
|
83
|
+
:method => :put,
|
84
|
+
:path => "/apps/#{app}/formation"
|
85
|
+
)
|
86
|
+
end
|
87
|
+
|
76
88
|
end
|
77
89
|
end
|
data/lib/heroku/api/version.rb
CHANGED
data/test/test_addons.rb
CHANGED
data/test/test_apps.rb
CHANGED
data/test/test_attachments.rb
CHANGED
data/test/test_collaborators.rb
CHANGED
data/test/test_config_vars.rb
CHANGED
data/test/test_domains.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
2
|
|
3
|
-
class TestErrorConditions <
|
3
|
+
class TestErrorConditions < Minitest::Test
|
4
4
|
|
5
5
|
def test_request_without_app_returns_a_sensible_error
|
6
6
|
assert_raises(Heroku::API::Errors::NilApp) do
|
data/test/test_features.rb
CHANGED
data/test/test_keys.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
2
|
|
3
|
-
class TestKeys <
|
3
|
+
class TestKeys < Minitest::Test
|
4
4
|
KEY_DATA = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCz29znMi/UJX/nvkRSO5FFugKhU9DkkI53E0vXUnP8zeLFxMgyUqmXryPVjWtGzz2LRWqjm14SbqHAmM44pGHVfBIp6wCKBWSUYGv/FxOulwYgtWzz4moxWLZrFyWWgJAnehcVUifHNgzKwT2ovWm2ns52681Z8yFK3K8/uLStDjLIaPePEOaxaTvgIxZNsfyEoXoHcyTPwdR1GtQuDTuDYqYmjmPCoKybYnXrTQ1QFuQxDneBkswQYSl0H2aLf3uBK4F01hr+azXQuSe39eSV4I/TqzmNJlanpILT9Jz3/J1i4r6brpF3AxLnFnb9ufIbzQAIa/VZIulfrZkcBsUl david@carbon.local"
|
5
5
|
|
6
6
|
def test_delete_key_key_not_found
|
data/test/test_login.rb
CHANGED
data/test/test_logs.rb
CHANGED
data/test/test_processes.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
2
|
|
3
|
-
class TestProcesses <
|
3
|
+
class TestProcesses < Minitest::Test
|
4
4
|
|
5
5
|
def test_get_ps
|
6
6
|
with_app do |app_data|
|
@@ -242,4 +242,14 @@ class TestProcesses < MiniTest::Unit::TestCase
|
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
245
|
+
def test_put_formation
|
246
|
+
with_app do |app_data|
|
247
|
+
response = heroku.put_formation(app_data['name'], {"web" => "2X"})
|
248
|
+
ps = response.body.first
|
249
|
+
|
250
|
+
assert_equal(200, response.status)
|
251
|
+
assert_equal('2', ps['size'])
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
245
255
|
end
|
data/test/test_releases.rb
CHANGED
data/test/test_ssl_endpoints.rb
CHANGED
data/test/test_stacks.rb
CHANGED
data/test/test_user.rb
CHANGED
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.12
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- geemus (Wesley Beary)
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: excon
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
19
|
+
version: 0.23.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
26
|
+
version: 0.23.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: minitest
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: Ruby Client for the Heroku API
|
@@ -132,27 +125,26 @@ files:
|
|
132
125
|
- test/test_user.rb
|
133
126
|
homepage: http://github.com/heroku/heroku.rb
|
134
127
|
licenses: []
|
128
|
+
metadata: {}
|
135
129
|
post_install_message:
|
136
130
|
rdoc_options: []
|
137
131
|
require_paths:
|
138
132
|
- lib
|
139
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
134
|
requirements:
|
142
|
-
- -
|
135
|
+
- - '>='
|
143
136
|
- !ruby/object:Gem::Version
|
144
137
|
version: '0'
|
145
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
139
|
requirements:
|
148
|
-
- -
|
140
|
+
- - '>='
|
149
141
|
- !ruby/object:Gem::Version
|
150
142
|
version: '0'
|
151
143
|
requirements: []
|
152
144
|
rubyforge_project:
|
153
|
-
rubygems_version:
|
145
|
+
rubygems_version: 2.0.3
|
154
146
|
signing_key:
|
155
|
-
specification_version:
|
147
|
+
specification_version: 4
|
156
148
|
summary: Ruby Client for the Heroku API
|
157
149
|
test_files:
|
158
150
|
- test/data/site.crt
|