deployto 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -82,7 +82,7 @@ class DeployTool::Command
82
82
  target.push(opts)
83
83
  rescue => e
84
84
  puts e
85
- puts "\nPlease contact %s support: %s" % [EfficientCloud.cloud_name, EfficientCloud.support_email]
85
+ puts "\nPlease contact %s support: %s" % [DeployTool::Target::EfficientCloud.cloud_name, DeployTool::Target::EfficientCloud.support_email]
86
86
  exit 2
87
87
  end
88
88
  DeployTool::Config[args[0]] = target.to_h
@@ -1,6 +1,6 @@
1
1
  require 'highline'
2
2
  class DeployTool::Target::EfficientCloud < DeployTool::Target
3
- SUPPORTED_API_VERSION = 3
3
+ SUPPORTED_API_VERSION = 4
4
4
 
5
5
  def self.cloud_name
6
6
  @cloud_name || 'Efficient Cloud'
@@ -1,4 +1,3 @@
1
- require 'rexml/document'
2
1
  require 'addressable/uri'
3
2
  require 'net/http'
4
3
  require 'net/http/post/multipart'
@@ -35,7 +34,8 @@ class DeployTool::Target::EfficientCloud
35
34
  end
36
35
 
37
36
  def call(method, method_name, data = {})
38
- url = Addressable::URI.parse("http://#{@server}/api/cli/v1/apps/#{@app_name}/#{method_name}")
37
+ method_name = '/' + method_name unless method_name.nil?
38
+ url = Addressable::URI.parse("http://#{@server}/api/cli/v1/apps/#{@app_name}#{method_name}.json")
39
39
  client = OAuth2::Client.new(CLIENT_ID, CLIENT_SECRET, :site => "http://#{server}/", :token_url => '/oauth2/token', :raise_errors => false) do |builder|
40
40
  builder.use Faraday::Request::Multipart
41
41
  builder.use Faraday::Request::UrlEncoded
@@ -118,12 +118,14 @@ class DeployTool::Target::EfficientCloud
118
118
  @refresh_token = token.refresh_token
119
119
  @auth_method = :refresh_token
120
120
 
121
- response = token.request(method, url.path, method==:post ? {:body => data} : {:params => data})
121
+ opts = method==:get ? {:params => data} : {:body => data}
122
+ opts.merge!({:headers => {'Accept' => 'application/json'}})
123
+ response = token.request(method, url.path, opts)
122
124
  if response.status != 200
123
125
  details = MultiJson.decode(response.body) rescue nil
124
126
  raise "#{response.status} #{details}"
125
127
  end
126
- response
128
+ MultiJson.decode(response.body)
127
129
  end
128
130
 
129
131
  def to_h
@@ -131,12 +133,12 @@ class DeployTool::Target::EfficientCloud
131
133
  end
132
134
 
133
135
  def info
134
- response = call :get, 'info'
136
+ response = call :get, nil
135
137
  return nil if not response
136
- doc = REXML::Document.new response.body
137
138
  data = {}
138
- doc.elements["app"].each_element do |el|
139
- data[el.name.gsub('-','_').to_sym] = el.text
139
+ response["app"].each do |k,v|
140
+ next unless v === String
141
+ data[k.to_sym] = v
140
142
  end
141
143
  data
142
144
  end
@@ -171,16 +173,13 @@ class DeployTool::Target::EfficientCloud
171
173
 
172
174
  puts "-----> Uploading %s code tarball..." % human_filesize(tempfile.path)
173
175
  initial_response = call :post, 'upload', {:code => Faraday::UploadIO.new(tempfile, "application/zip")}
174
- doc = REXML::Document.new initial_response.body
175
- doc.elements["code/code-token"].text
176
+ initial_response["code_token"]
176
177
  end
177
178
 
178
179
  def deploy(code_token)
179
180
  initial_response = call :post, 'deploy', {:code_token => code_token}
180
181
  return nil if not initial_response
181
- doc = REXML::Document.new initial_response.body
182
- deploy_token = doc.elements["deploy/token"].text
183
- deploy_token
182
+ initial_response["token"]
184
183
  end
185
184
 
186
185
  def save_timing_data(data)
@@ -198,19 +197,18 @@ class DeployTool::Target::EfficientCloud
198
197
  while true
199
198
  sleep 1
200
199
  resp = call :get, 'deploy_status', {:deploy_token => deploy_token}
201
- doc = REXML::Document.new resp.body
202
200
 
203
- if doc.elements["deploy/message"].nil?
201
+ if resp["message"].nil?
204
202
  puts resp
205
203
  puts "...possibly done."
206
204
  break
207
205
  end
208
- if doc.elements["deploy/message"].text == 'finished'
206
+ if resp["message"] == 'finished'
209
207
  puts "\n-----> FINISHED after %d seconds!" % (Time.now-start)
210
208
  break
211
209
  end
212
210
 
213
- status = doc.elements["deploy/message"].text.gsub('["', '').gsub('"]', '')
211
+ status = resp["message"].gsub('["', '').gsub('"]', '')
214
212
  if previous_status != status
215
213
  case status
216
214
  when "build"
@@ -225,7 +223,7 @@ class DeployTool::Target::EfficientCloud
225
223
  previous_status = status
226
224
  end
227
225
 
228
- logs = doc.elements["deploy/logs"].text rescue nil
226
+ logs = resp["logs"]
229
227
  if logs
230
228
  puts "" if status != "build" # Add newline after the dots
231
229
  puts logs
@@ -255,4 +253,3 @@ class DeployTool::Target::EfficientCloud
255
253
  end
256
254
  end
257
255
  end
258
-
@@ -1,3 +1,3 @@
1
1
  module DeployTool
2
- VERSION = "0.9.4"
2
+ VERSION = "0.9.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployto
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 9
9
- - 4
10
- version: 0.9.4
8
+ - 5
9
+ version: 0.9.5
11
10
  platform: ruby
12
11
  authors:
13
12
  - Efficient Cloud Ltd
@@ -15,17 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-09-28 00:00:00 Z
17
+ date: 2011-10-20 00:00:00 +02:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: inifile
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ">="
27
26
  - !ruby/object:Gem::Version
28
- hash: 13
29
27
  segments:
30
28
  - 0
31
29
  - 4
@@ -37,11 +35,9 @@ dependencies:
37
35
  name: addressable
38
36
  prerelease: false
39
37
  requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
38
  requirements:
42
39
  - - ">="
43
40
  - !ruby/object:Gem::Version
44
- hash: 3
45
41
  segments:
46
42
  - 0
47
43
  version: "0"
@@ -51,11 +47,9 @@ dependencies:
51
47
  name: multipart-post
52
48
  prerelease: false
53
49
  requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
50
  requirements:
56
51
  - - ">="
57
52
  - !ruby/object:Gem::Version
58
- hash: 3
59
53
  segments:
60
54
  - 0
61
55
  version: "0"
@@ -65,11 +59,9 @@ dependencies:
65
59
  name: highline
66
60
  prerelease: false
67
61
  requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
62
  requirements:
70
63
  - - ">="
71
64
  - !ruby/object:Gem::Version
72
- hash: 11
73
65
  segments:
74
66
  - 1
75
67
  - 6
@@ -81,11 +73,9 @@ dependencies:
81
73
  name: zip
82
74
  prerelease: false
83
75
  requirement: &id005 !ruby/object:Gem::Requirement
84
- none: false
85
76
  requirements:
86
77
  - - ">="
87
78
  - !ruby/object:Gem::Version
88
- hash: 3
89
79
  segments:
90
80
  - 0
91
81
  version: "0"
@@ -95,11 +85,9 @@ dependencies:
95
85
  name: json_pure
96
86
  prerelease: false
97
87
  requirement: &id006 !ruby/object:Gem::Requirement
98
- none: false
99
88
  requirements:
100
89
  - - ">="
101
90
  - !ruby/object:Gem::Version
102
- hash: 3
103
91
  segments:
104
92
  - 0
105
93
  version: "0"
@@ -109,17 +97,15 @@ dependencies:
109
97
  name: oauth2
110
98
  prerelease: false
111
99
  requirement: &id007 !ruby/object:Gem::Requirement
112
- none: false
113
100
  requirements:
114
101
  - - ">="
115
102
  - !ruby/object:Gem::Version
116
- hash: 3
117
103
  segments:
118
104
  - 0
119
105
  version: "0"
120
106
  type: :runtime
121
107
  version_requirements: *id007
122
- description: Deployment tool with support for multiple Platform-as-a-Service providers.
108
+ description: Deployment tool for web application platforms powered by EFC.
123
109
  email: hello@platformdirectory.com
124
110
  executables:
125
111
  - deploy
@@ -140,6 +126,7 @@ files:
140
126
  - spec/spec.opts
141
127
  - spec/spec_helper.rb
142
128
  - spec/target_spec.rb
129
+ has_rdoc: true
143
130
  homepage: http://platformdirectory.com/
144
131
  licenses: []
145
132
 
@@ -149,27 +136,23 @@ rdoc_options: []
149
136
  require_paths:
150
137
  - lib
151
138
  required_ruby_version: !ruby/object:Gem::Requirement
152
- none: false
153
139
  requirements:
154
140
  - - ">="
155
141
  - !ruby/object:Gem::Version
156
- hash: 3
157
142
  segments:
158
143
  - 0
159
144
  version: "0"
160
145
  required_rubygems_version: !ruby/object:Gem::Requirement
161
- none: false
162
146
  requirements:
163
147
  - - ">="
164
148
  - !ruby/object:Gem::Version
165
- hash: 3
166
149
  segments:
167
150
  - 0
168
151
  version: "0"
169
152
  requirements: []
170
153
 
171
154
  rubyforge_project:
172
- rubygems_version: 1.8.8
155
+ rubygems_version: 1.3.6
173
156
  signing_key:
174
157
  specification_version: 3
175
158
  summary: Multi-platform deployment tool.