envirobly 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/envirobly/api.rb +15 -8
- data/lib/envirobly/deployment.rb +13 -7
- data/lib/envirobly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cf07e75c65933a5f7c064588ac13a36ee5af3e698fc82f90affc0960bf7d170
|
4
|
+
data.tar.gz: 2f721b799aeb0b2725c92b75b9f1d63b461ad5cfd44d095481aea5c809bd1a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a37f7b8895957e017ddab73d991c1a34b7b50aeff1e491caf923164e3e6c5abe8ddc67900371fc8dc1c7a552c3e2c930e9cb2b92174953531c87fc495debf357
|
7
|
+
data.tar.gz: 43075318aa04c61690e71665823e19da68c2797e1d4534433235a4f3f46254343d454abaa9cd367b641184452df6546ad5f9f447a89e51943dc34084f08202a7
|
data/lib/envirobly/api.rb
CHANGED
@@ -38,22 +38,29 @@ class Envirobly::Api
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
def get_as_json(url, headers: {})
|
42
|
+
request(url, type: Net::HTTP::Get, headers:)
|
43
|
+
end
|
44
|
+
|
45
|
+
def post_as_json(url, params: {}, headers: {})
|
46
|
+
request(url, type: Net::HTTP::Post, headers:) do |request|
|
47
|
+
request.body = params.to_json
|
44
48
|
end
|
49
|
+
end
|
45
50
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
51
|
+
def put_as_json(url, params: {}, headers: {})
|
52
|
+
request(url, type: Net::HTTP::Put, headers:) do |request|
|
53
|
+
request.body = params.to_json
|
50
54
|
end
|
55
|
+
end
|
51
56
|
|
57
|
+
private
|
52
58
|
def api_v1_deployments_url
|
53
59
|
URI::HTTPS.build(host: HOST, path: "/api/v1/deployments")
|
54
60
|
end
|
55
61
|
|
56
|
-
def request(
|
62
|
+
def request(url, type:, headers: {})
|
63
|
+
uri = URI(url)
|
57
64
|
http = Net::HTTP.new uri.host, uri.port
|
58
65
|
http.use_ssl = true
|
59
66
|
http.open_timeout = 10
|
data/lib/envirobly/deployment.rb
CHANGED
@@ -28,7 +28,8 @@ class Envirobly::Deployment
|
|
28
28
|
config: config.to_h
|
29
29
|
}
|
30
30
|
|
31
|
-
puts
|
31
|
+
puts "Deployment config:"
|
32
|
+
puts params.to_yaml
|
32
33
|
|
33
34
|
unless environment =~ URL_MATCHER
|
34
35
|
if project_url = config.dig("remote", "origin")
|
@@ -39,18 +40,23 @@ class Envirobly::Deployment
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
api = Envirobly::Api.new
|
43
|
-
response = api.create_deployment params
|
44
|
-
|
43
|
+
@api = Envirobly::Api.new
|
44
|
+
response = @api.create_deployment params
|
45
|
+
deployment_url = response.object.fetch("url")
|
46
|
+
response = @api.get_deployment_with_delay_and_retry deployment_url
|
45
47
|
@credentials = Envirobly::Aws::Credentials.new response.object.fetch("credentials")
|
46
48
|
@bucket = response.object.fetch("bucket")
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
-
else
|
50
|
+
puts "Uploading build context, please wait..."
|
51
|
+
unless archive_commit_and_upload
|
51
52
|
$stderr.puts "Error exporting build context. Aborting."
|
52
53
|
exit 1
|
53
54
|
end
|
55
|
+
|
56
|
+
puts "Build context uploaded."
|
57
|
+
@api.put_as_json deployment_url
|
58
|
+
|
59
|
+
# TODO: Output URL to watch the deployment progress
|
54
60
|
end
|
55
61
|
|
56
62
|
private
|
data/lib/envirobly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: envirobly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Starsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|