discharger 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/discharger/railtie.rb +1 -1
- data/lib/discharger/task.rb +29 -28
- data/lib/discharger/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: e2e691da215aea4ada1334022977bd115d761094b05d308105c4ef5ca772f7ba
|
4
|
+
data.tar.gz: a9aa28255523f17c93a9c4c63a127e9421215716431d16ba3701173a2a2e9941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5939a5d383a6ed2cd020d5c9e859769c5f6403fad7c3228da7c8e71ad82b2ad3709fc1c0d27e11ac897a407c557984f20b6688b87dd86b1ecba6101eeba0f867
|
7
|
+
data.tar.gz: 674780767621e9a78856ac0a914634ccbed7b8f07cf8c95b7b0bf5ce33590f2b07fad19d9b5dab7dcfe6ab684a9d4bfbf7858c2f4ea796c806d1b25fe71c5022
|
data/lib/discharger/railtie.rb
CHANGED
@@ -2,7 +2,7 @@ module Discharger
|
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
3
|
config.after_initialize do |app|
|
4
4
|
if Rails.env.development? && Discharger.slack_token.nil?
|
5
|
-
|
5
|
+
warn "Your application Discharger.slack_token must be set."
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/lib/discharger/task.rb
CHANGED
@@ -70,8 +70,8 @@ module Discharger
|
|
70
70
|
#
|
71
71
|
# @example
|
72
72
|
# syscall(
|
73
|
-
# ["echo
|
74
|
-
# ["ls
|
73
|
+
# ["echo Hello, World!"],
|
74
|
+
# ["ls -l"]
|
75
75
|
# )
|
76
76
|
def syscall(*steps, output: $stdout, error: $stderr)
|
77
77
|
success = false
|
@@ -137,18 +137,18 @@ module Discharger
|
|
137
137
|
exit if input.chomp.match?(/^x/i)
|
138
138
|
|
139
139
|
continue = syscall(
|
140
|
-
["git
|
141
|
-
["git
|
142
|
-
["git
|
143
|
-
["git
|
144
|
-
["git
|
145
|
-
["git
|
146
|
-
["git
|
147
|
-
["git
|
148
|
-
["git
|
140
|
+
["git checkout #{working_branch}"],
|
141
|
+
["git branch -D #{staging_branch} 2>/dev/null || true"],
|
142
|
+
["git branch -D #{production_branch} 2>/dev/null || true"],
|
143
|
+
["git fetch origin #{staging_branch}:#{staging_branch} #{production_branch}:#{production_branch}"],
|
144
|
+
["git checkout #{production_branch}"],
|
145
|
+
["git rebase #{staging_branch}"],
|
146
|
+
["git tag -a v#{current_version} -m 'Release #{current_version}'"],
|
147
|
+
["git push origin #{production_branch}:#{production_branch} v#{current_version}:v#{current_version}"],
|
148
|
+
["git push origin v#{current_version}"]
|
149
149
|
) do
|
150
150
|
tasker["#{name}:slack"].invoke("Released #{Qualify.name} #{current_version} to production.", release_message_channel, ":chipmunk:")
|
151
|
-
syscall ["git
|
151
|
+
syscall ["git checkout #{working_branch}"]
|
152
152
|
end
|
153
153
|
|
154
154
|
abort "Release failed." unless continue
|
@@ -163,13 +163,13 @@ module Discharger
|
|
163
163
|
tasker["reissue"].invoke
|
164
164
|
new_version = Object.const_get(version_constant)
|
165
165
|
new_version_branch = "bump/begin-#{new_version.tr(".", "-")}"
|
166
|
-
continue = syscall(["git
|
166
|
+
continue = syscall(["git checkout -b #{new_version_branch}"])
|
167
167
|
|
168
168
|
abort "Bump failed." unless continue
|
169
169
|
|
170
170
|
pr_url = "#{pull_request_url}/compare/#{working_branch}...#{new_version_branch}?expand=1&title=Begin%20#{current_version}"
|
171
171
|
|
172
|
-
syscall(["git
|
172
|
+
syscall(["git push origin #{new_version_branch} --force"]) do
|
173
173
|
sysecho <<~MSG
|
174
174
|
Branch #{new_version_branch} created.
|
175
175
|
|
@@ -179,7 +179,7 @@ module Discharger
|
|
179
179
|
Opening PR: #{pr_url}
|
180
180
|
MSG
|
181
181
|
end.then do |success|
|
182
|
-
syscall ["open
|
182
|
+
syscall ["open #{pr_url}"] if success
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
@@ -187,14 +187,14 @@ module Discharger
|
|
187
187
|
desc description
|
188
188
|
task build: :environment do
|
189
189
|
syscall(
|
190
|
-
["git
|
191
|
-
["git
|
192
|
-
["git
|
193
|
-
["git
|
194
|
-
["git
|
190
|
+
["git fetch origin #{working_branch}"],
|
191
|
+
["git checkout #{working_branch}"],
|
192
|
+
["git branch -D #{staging_branch} 2>/dev/null || true"],
|
193
|
+
["git checkout -b #{staging_branch}"],
|
194
|
+
["git push origin #{staging_branch} --force"]
|
195
195
|
) do
|
196
196
|
tasker["#{name}:slack"].invoke("Building #{app_name} #{commit_identifier.call} on #{staging_branch}.", release_message_channel)
|
197
|
-
syscall ["git
|
197
|
+
syscall ["git checkout #{working_branch}"]
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
@@ -228,10 +228,11 @@ module Discharger
|
|
228
228
|
current_version = Object.const_get(version_constant)
|
229
229
|
finish_branch = "bump/finish-#{current_version.tr(".", "-")}"
|
230
230
|
|
231
|
-
syscall
|
232
|
-
["git
|
233
|
-
["git
|
234
|
-
|
231
|
+
syscall(
|
232
|
+
["git fetch origin #{working_branch}"],
|
233
|
+
["git checkout #{working_branch}"],
|
234
|
+
["git checkout -b #{finish_branch}"]
|
235
|
+
)
|
235
236
|
sysecho <<~MSG
|
236
237
|
Branch #{finish_branch} created.
|
237
238
|
|
@@ -256,7 +257,7 @@ module Discharger
|
|
256
257
|
|
257
258
|
pr_url = "#{pull_request_url}/compare/#{finish_branch}?#{params.to_query}"
|
258
259
|
|
259
|
-
continue = syscall ["git
|
260
|
+
continue = syscall ["git push origin #{finish_branch} --force"] do
|
260
261
|
sysecho <<~MSG
|
261
262
|
Branch #{finish_branch} created.
|
262
263
|
Open a PR to #{working_branch} to finalize the release.
|
@@ -269,7 +270,7 @@ module Discharger
|
|
269
270
|
MSG
|
270
271
|
end
|
271
272
|
if continue
|
272
|
-
syscall ["git
|
273
|
+
syscall ["git checkout #{working_branch}"],
|
273
274
|
["open", pr_url]
|
274
275
|
end
|
275
276
|
end
|
@@ -306,7 +307,7 @@ module Discharger
|
|
306
307
|
|
307
308
|
Once the PR is **approved**, run 'rake release' to release the version.
|
308
309
|
MSG
|
309
|
-
syscall ["open
|
310
|
+
syscall ["open #{pr_url}"]
|
310
311
|
end
|
311
312
|
end
|
312
313
|
end
|
data/lib/discharger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discharger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Gay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open3
|