discharger 0.2.0 → 0.2.2

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
  SHA256:
3
- metadata.gz: 1c6a8e46dbab57a51adf0c6cc3334b47fcf2671c804b335c8919ebd618f965db
4
- data.tar.gz: 7f5c5820619821993de7d54d673d0f6c67437b81d0b46fb3d7f2b8a301faa292
3
+ metadata.gz: e2e691da215aea4ada1334022977bd115d761094b05d308105c4ef5ca772f7ba
4
+ data.tar.gz: a9aa28255523f17c93a9c4c63a127e9421215716431d16ba3701173a2a2e9941
5
5
  SHA512:
6
- metadata.gz: bff63aaf0204b05a18a737cd30c29530dbaa083b8727c3ee60e274ad94f47b902c1810ca13bcfecf535718ca45b9281d8fd0e65a4af1de164e1b2c56b2b38666
7
- data.tar.gz: a5cde81b45b56eb3e204d58e53f2ce3aae68a5cdca11e44ff0c93bfc9425b065afade6e9fdbe3ef9d23c9a2ae9ec19a01e722b9733114d549836120965577638
6
+ metadata.gz: 5939a5d383a6ed2cd020d5c9e859769c5f6403fad7c3228da7c8e71ad82b2ad3709fc1c0d27e11ac897a407c557984f20b6688b87dd86b1ecba6101eeba0f867
7
+ data.tar.gz: 674780767621e9a78856ac0a914634ccbed7b8f07cf8c95b7b0bf5ce33590f2b07fad19d9b5dab7dcfe6ab684a9d4bfbf7858c2f4ea796c806d1b25fe71c5022
@@ -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
- raise "Your application Discharger.slack_token must be set in the environment"
5
+ warn "Your application Discharger.slack_token must be set."
6
6
  end
7
7
  end
8
8
  end
@@ -70,8 +70,8 @@ module Discharger
70
70
  #
71
71
  # @example
72
72
  # syscall(
73
- # ["echo", "Hello, World!"],
74
- # ["ls", "-l"]
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", "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}"]
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", "checkout", working_branch]
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", "checkout", "-b #{new_version_branch}"])
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", "push", "origin", new_version_branch, "--force"]) do
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", pr_url] if success
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", "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"]
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", "checkout", working_branch]
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 ["git", "fetch origin #{working_branch}"],
232
- ["git", "checkout", working_branch],
233
- ["git", "checkout", "-b #{finish_branch}"]
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", "push", "origin", finish_branch, "--force"] do
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", "checkout", working_branch],
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", pr_url]
310
+ syscall ["open #{pr_url}"]
310
311
  end
311
312
  end
312
313
  end
@@ -1,3 +1,3 @@
1
1
  module Discharger
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
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.0
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-15 00:00:00.000000000 Z
11
+ date: 2024-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open3