heroku-api 0.3.16 → 0.3.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,22 @@
1
- 0.3.16 01/06/2013
1
+ 0.3.17 01/20/2014
2
+ =================
3
+
4
+ return custom dyno sizes
5
+ support PX dynos
6
+ remove tier from mocks
7
+ improved error messaging
8
+
9
+ 0.3.16 01/06/2014
2
10
  =================
3
11
 
4
- add process types
5
12
  use multi_json instead of okjson
6
- fix for escaping collaborator emails in requests
7
- loosen excon dependency
13
+ escape email addresses for delete collaborator
14
+ bump/loosen excon dependency
8
15
 
9
16
  0.3.15 11/03/2013
10
17
  =================
11
18
 
12
- add get_dyno_types for retrieving process types
19
+ add get__dyno_types for retrieving process types
13
20
 
14
21
  0.3.14 07/03/2013
15
22
  =================
@@ -7,6 +7,7 @@ module Heroku
7
7
  attr_reader :response
8
8
 
9
9
  def initialize(message, response)
10
+ message = message << "\nbody: #{response.body.inspect}"
10
11
  super message
11
12
  @response = response
12
13
  end
@@ -78,7 +78,6 @@ module Heroku
78
78
  'owner_email' => 'email@example.com',
79
79
  'slug_size' => nil,
80
80
  'stack' => stack,
81
- 'tier' => "legacy",
82
81
  'requested_stack' => nil,
83
82
  'git_url' => "git@heroku.com:#{app}.git",
84
83
  'repo_migrate_status' => 'complete',
@@ -22,7 +22,8 @@ module Heroku
22
22
  unless attached = request_params[:query].has_key?('attach') && request_params[:query]['attach'].to_s == 'true'
23
23
  type = 'Ps'
24
24
  end
25
- command = request_params[:query].has_key?('command') && request_params[:query]['command']
25
+ command = request_params[:query].has_key?('command') && request_params[:query]['command']
26
+ size = request_params[:query]['size']
26
27
  rendezvous_url = if attached
27
28
  "s1.runtime.heroku.com:5000/#{SecureRandom.hex(32)}"
28
29
  end
@@ -35,6 +36,7 @@ module Heroku
35
36
  'pretty_state' => 'completed for 0s',
36
37
  'process' => "run.#{max_run_id + 1}",
37
38
  'rendezvous_url' => rendezvous_url,
39
+ 'size' => size,
38
40
  'slug' => 'NONE',
39
41
  'state' => 'created',
40
42
  'transitioned_at' => timestamp,
@@ -200,7 +202,7 @@ module Heroku
200
202
  with_mock_app(mock_data, app) do
201
203
  new_resize_vars = request_params[:body]
202
204
  process = mock_data[:ps][app].first["process"].split('.')[0]
203
- size = new_resize_vars[process]["size"][/(\d+)/]
205
+ size = new_resize_vars[process]["size"][/[(\d+)P]/]
204
206
  mock_data[:ps][app].first.merge!({'size' => size})
205
207
  {
206
208
  :body => MultiJson.dump(get_mock_processes(mock_data, app)),
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  class API
3
- VERSION = "0.3.16"
3
+ VERSION = "0.3.17"
4
4
  end
5
5
  end
@@ -44,6 +44,7 @@ class TestProcesses < Minitest::Test
44
44
  # pretty_state
45
45
  assert_equal('run.1', ps['process'])
46
46
  assert_nil(ps['rendevous_url'])
47
+ assert_nil(ps['size'])
47
48
  assert_equal('NONE', ps['slug'])
48
49
  # depending on timing it will be one of these two states
49
50
  assert_includes(['created', 'starting'], ps['state'])
@@ -76,6 +77,66 @@ class TestProcesses < Minitest::Test
76
77
  end
77
78
  end
78
79
 
80
+ def test_post_ps_with_size
81
+ with_app do |app_data|
82
+ command = 'bash'
83
+ response = heroku.post_ps(app_data['name'], command, 'size' => '2')
84
+ ps = response.body
85
+
86
+ assert_equal(200, response.status)
87
+ assert_equal('complete', ps['action'])
88
+ assert_equal('2', ps['size'])
89
+ assert_equal(command, ps['command'])
90
+ # elapsed
91
+ # pretty_state
92
+ assert_equal('run.1', ps['process'])
93
+ assert_nil(ps['rendezvous_url'])
94
+ assert_equal('NONE', ps['slug'])
95
+ # depending on timing it will be one of these two states
96
+ assert_includes(['created', 'starting'], ps['state'])
97
+ end
98
+ end
99
+
100
+ def test_post_ps_with_size_numeric
101
+ with_app do |app_data|
102
+ command = 'bash'
103
+ response = heroku.post_ps(app_data['name'], command, 'size' => 4)
104
+ ps = response.body
105
+
106
+ assert_equal(200, response.status)
107
+ assert_equal('complete', ps['action'])
108
+ assert_equal(4, ps['size'])
109
+ assert_equal(command, ps['command'])
110
+ # elapsed
111
+ # pretty_state
112
+ assert_equal('run.1', ps['process'])
113
+ assert_nil(ps['rendezvous_url'])
114
+ assert_equal('NONE', ps['slug'])
115
+ # depending on timing it will be one of these two states
116
+ assert_includes(['created', 'starting'], ps['state'])
117
+ end
118
+ end
119
+
120
+ def test_post_ps_with_size_string
121
+ with_app do |app_data|
122
+ command = 'bash'
123
+ response = heroku.post_ps(app_data['name'], command, 'size' => 'P')
124
+ ps = response.body
125
+
126
+ assert_equal(200, response.status)
127
+ assert_equal('complete', ps['action'])
128
+ assert_equal('P', ps['size'])
129
+ assert_equal(command, ps['command'])
130
+ # elapsed
131
+ # pretty_state
132
+ assert_equal('run.1', ps['process'])
133
+ assert_nil(ps['rendezvous_url'])
134
+ assert_equal('NONE', ps['slug'])
135
+ # depending on timing it will be one of these two states
136
+ assert_includes(['created', 'starting'], ps['state'])
137
+ end
138
+ end
139
+
79
140
  def test_post_ps_app_not_found
80
141
  assert_raises(Heroku::API::Errors::NotFound) do
81
142
  heroku.post_ps(random_name, 'pwd')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16
4
+ version: 0.3.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-06 00:00:00.000000000 Z
13
+ date: 2014-01-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: excon