escobar 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 072e5a1bc94a5f953adb447a45e7703f4bfe0467
4
- data.tar.gz: b8a9972fe4f9dce4fe5417840b015779c4c88275
3
+ metadata.gz: 01ad21160912979d47383fb8fb83da53afcae7ff
4
+ data.tar.gz: 290aaa0bf2c42725dc8367592a0674995f130348
5
5
  SHA512:
6
- metadata.gz: 5e6ee165a7329ca2afb2993375ace8b53be9366cca8448bc49ede681ab15a33e4be7ec6c329fef0f50c90a44c75c282c3490cc32fbbe7094dab0dac6839ceb29
7
- data.tar.gz: 7fb5e12910a483946bc8f209ba7dba6623852aae5922c006f5d59b9679be983f67722d52d9f97ba690bbf3e214460acc8b75f68db53b7d9186f94c70e5daa037
6
+ metadata.gz: 94f334a512cea6d0a66edbb92736c76f2f731aba2506fc3d537c12c7efaf34823a795f4b3cdb1e4627a2032eae00480a56e8b3163fa1f654b15748f06c7f9003
7
+ data.tar.gz: f4cb80571cb30c5f9be60e4cfa6e62e8a79cd0b010e83e76c3d14cc320eeaed3296020e0f931bf3dab23acc79edd67eab8d6996ee3a379d6bf8aaf7064639a98
@@ -21,67 +21,17 @@ module Escobar
21
21
 
22
22
  def pipelines
23
23
  @pipelines ||= heroku.get("/pipelines").map do |pipe|
24
- Escobar::Heroku::Pipeline.new(heroku, pipe["id"], pipe["name"])
24
+ Escobar::Heroku::Pipeline.new(self, pipe["id"], pipe["name"])
25
25
  end
26
26
  end
27
27
 
28
- def dashboard_url(name)
29
- "https://dashboard.heroku.com/apps/#{name}"
30
- end
31
-
32
28
  def reap_deployment(heroku_app_id, heroku_build_id)
33
29
  info = heroku.get("/apps/#{heroku_app_id}/builds/#{heroku_build_id}")
34
30
  case info["status"]
35
31
  when "succeeded", "failed"
36
32
  info
37
33
  else
38
- false
39
- end
40
- end
41
-
42
- # rubocop:disable Metrics/AbcSize
43
- # rubocop:disable Metrics/LineLength
44
- # rubocop:disable Metrics/MethodLength
45
- def create_deployment(name, repo, ref, environment, force)
46
- deployment = Escobar::GitHub::Deployment.new(github.client)
47
- deployment.ref = ref
48
- deployment.repo = repo
49
- deployment.force = force
50
- deployment.environment = environment
51
-
52
- archive_link = deployment.archive_link
53
-
54
- pipeline = self[name]
55
- if pipeline
56
- payload = pipeline.to_hash
57
- payload[:name] = name
58
- payload[:provider] = "slash-heroku"
59
-
60
- github_deployment = deployment.create(payload)
61
-
62
- body = {
63
- source_blob: {
64
- url: archive_link,
65
- version: github_deployment.sha[0..7],
66
- version_description: "#{deployment.repo}:#{github_deployment.sha}"
67
- }
68
- }
69
-
70
- app = pipeline.environments[environment].last
71
-
72
- build = heroku.post("/apps/#{app.name}/builds", body)
73
- if build["id"]
74
- status_payload = {
75
- target_url: "#{dashboard_url(app.name)}/activity/builds/#{build['id']}",
76
- description: "Deploying from slash-heroku"
77
- }
78
-
79
- deployment.create_status(github_deployment.url, "pending", status_payload)
80
- {
81
- app_id: app.name, build_id: build["id"],
82
- deployment_url: github_deployment.url
83
- }
84
- end
34
+ nil
85
35
  end
86
36
  end
87
37
  end
@@ -13,7 +13,11 @@ module Escobar
13
13
  end
14
14
 
15
15
  def info
16
- @info ||= client.get("/apps/#{id}")
16
+ @info ||= client.heroku.get("/apps/#{id}")
17
+ end
18
+
19
+ def dashboard_url
20
+ "https://dashboard.heroku.com/apps/#{name}"
17
21
  end
18
22
  end
19
23
  end
@@ -49,8 +49,48 @@ module Escobar
49
49
  end
50
50
 
51
51
  def couplings!
52
- client.get("/pipelines/#{id}/pipeline-couplings").map do |coupling|
53
- Escobar::Heroku::Coupling.new(client, coupling)
52
+ client.heroku.get("/pipelines/#{id}/pipeline-couplings").map do |pc|
53
+ Escobar::Heroku::Coupling.new(client, pc)
54
+ end
55
+ end
56
+
57
+ # rubocop:disable Metrics/AbcSize
58
+ # rubocop:disable Metrics/LineLength
59
+ # rubocop:disable Metrics/MethodLength
60
+ def create_deployment(ref, environment, force)
61
+ deployment = Escobar::GitHub::Deployment.new(client.github.client)
62
+ deployment.ref = ref
63
+ deployment.repo = github_repository
64
+ deployment.force = force
65
+ deployment.environment = environment
66
+
67
+ archive_link = deployment.archive_link
68
+
69
+ payload = self.to_hash
70
+ payload[:name] = name
71
+ payload[:provider] = "slash-heroku"
72
+
73
+ github_deployment = deployment.create(payload)
74
+ body = {
75
+ source_blob: {
76
+ url: archive_link,
77
+ version: github_deployment.sha[0..7],
78
+ version_description: "#{deployment.repo}:#{github_deployment.sha}"
79
+ }
80
+ }
81
+ app = environments[environment].last
82
+ build = client.heroku.post("/apps/#{app.name}/builds", body)
83
+ if build["id"]
84
+ status_payload = {
85
+ target_url: "#{app.app.dashboard_url}/activity/builds/#{build['id']}",
86
+ description: "Deploying from slash-heroku"
87
+ }
88
+
89
+ deployment.create_status(github_deployment.url, "pending", status_payload)
90
+ {
91
+ app_id: app.name, build_id: build["id"],
92
+ deployment_url: github_deployment.url
93
+ }
54
94
  end
55
95
  end
56
96
 
@@ -58,7 +98,7 @@ module Escobar
58
98
  response = kolkrabbi.get do |request|
59
99
  request.url path
60
100
  request.headers["Content-Type"] = "application/json"
61
- request.headers["Authorization"] = "Bearer #{client.token}"
101
+ request.headers["Authorization"] = "Bearer #{client.heroku.token}"
62
102
  end
63
103
 
64
104
  JSON.parse(response.body)
@@ -1,3 +1,3 @@
1
1
  module Escobar
2
- VERSION = "0.1.7".freeze
2
+ VERSION = "0.1.9".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escobar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Donohoe