patches 3.5.0 → 3.6.0
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 +4 -4
- data/.github/workflows/publish.yml +26 -0
- data/CHANGELOG.md +9 -0
- data/README.md +2 -2
- data/docs/usage.md +9 -0
- data/lib/patches/config.rb +2 -0
- data/lib/patches/notifier.rb +18 -9
- data/lib/patches/version.rb +1 -1
- data/lib/tasks/patches.rake +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1f8701526a4dd4b0b2f9468a341fda316bde2dd0ba8b9bf0cea5e4236aa9ee5
|
4
|
+
data.tar.gz: 6b340c8ab529811f011ba4b984f208f2abb080dfe4b97bcbbd2e7fcccf78e92a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa96ce95251d9295cd6544c54d8b2670c1d9f8aab860a50874539662a58e571ae902e400169cf58cfbb0649a980cb29badbb9b0dd65c09c2ecea35bfdd26a823
|
7
|
+
data.tar.gz: 5e08319d65bbd8d940ef2fd79091c0d6780e35878c4881fdc491a119eeb6a4fbb640a675e3d38d386d3a69eddb192f916d617aeb2285ca565ce187f2b1a32709
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: '2.7'
|
20
|
+
|
21
|
+
- name: Publish to RubyGems
|
22
|
+
run: |
|
23
|
+
gem build *.gemspec
|
24
|
+
gem push *.gem
|
25
|
+
env:
|
26
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.6.0] - 2022-05-27
|
10
|
+
### Added
|
11
|
+
- Added `notification_prefix` and `notification_suffix` to configuration options
|
12
|
+
- Linked to docs/usage.md in README
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
- Refactored `Patches::Notifier`
|
16
|
+
- `Patches::Notifier.append_tenant_message` effectively replaced by `tenant_suffix`
|
17
|
+
|
9
18
|
## [3.5.0] - 2020-07-22
|
10
19
|
### Added
|
11
20
|
- Enable application version constraint support on `Patches::TenantWorker`
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ A simple gem for one off tasks
|
|
11
11
|
|
12
12
|
## Version 2.0
|
13
13
|
|
14
|
-
Please note the breaking change release around deployment. See docs/usage.md for the full change.
|
14
|
+
Please note the breaking change release around deployment. See [docs/usage.md](docs/usage.md) for the full change.
|
15
15
|
|
16
16
|
TL;DR You need to manually declare the patches task to run in your deploy.rb
|
17
17
|
|
@@ -32,7 +32,7 @@ Or install it yourself as:
|
|
32
32
|
|
33
33
|
## Usage
|
34
34
|
|
35
|
-
see
|
35
|
+
see [docs/usage.md](docs/usage.md)
|
36
36
|
|
37
37
|
## Development
|
38
38
|
|
data/docs/usage.md
CHANGED
@@ -39,6 +39,15 @@ Patches::Config.configure do |config|
|
|
39
39
|
end
|
40
40
|
```
|
41
41
|
|
42
|
+
Additionally, you can override the default prefix and suffix of the
|
43
|
+
notification message in the patches config:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# for example
|
47
|
+
config.notification_prefix = "#{Tenant.current.name}-#{Rails.env}" # => [READYTECH-STAGING]
|
48
|
+
config.notification_suffix = Tenant.current.name # => ... patches succeeded for Readytech
|
49
|
+
```
|
50
|
+
|
42
51
|
### Running patches in parallel for tenants
|
43
52
|
|
44
53
|
If you are using the Apartment gem, you can run the patches for each tenant in parallel.
|
data/lib/patches/config.rb
CHANGED
data/lib/patches/notifier.rb
CHANGED
@@ -11,23 +11,32 @@ class Patches::Notifier
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def success_message(patches)
|
14
|
-
message
|
15
|
-
append_tenant_message(message)
|
14
|
+
message(patches.count, "patches succeeded")
|
16
15
|
end
|
17
16
|
|
18
17
|
def failure_message(patch_path, error)
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
message("Error applying patch:", Pathname.new(patch_path).basename, "failed with error:", error)
|
19
|
+
end
|
20
|
+
|
21
|
+
def message(*args)
|
22
|
+
[notification_prefix, *args, notification_suffix].compact.join(" ")
|
23
|
+
end
|
24
|
+
|
25
|
+
def notification_prefix
|
26
|
+
prefix = config.notification_prefix.presence || environment_prefix
|
27
|
+
"[#{prefix}]" if prefix.present?
|
22
28
|
end
|
23
29
|
|
24
30
|
def environment_prefix
|
25
|
-
|
31
|
+
Rails.env.upcase if defined?(Rails)
|
32
|
+
end
|
33
|
+
|
34
|
+
def notification_suffix
|
35
|
+
config.notification_suffix.presence || tenant_suffix
|
26
36
|
end
|
27
37
|
|
28
|
-
def
|
29
|
-
|
30
|
-
message
|
38
|
+
def tenant_suffix
|
39
|
+
"for tenant: #{Apartment::Tenant.current}" if defined?(Apartment)
|
31
40
|
end
|
32
41
|
|
33
42
|
def send_slack_message(message, color)
|
data/lib/patches/version.rb
CHANGED
data/lib/tasks/patches.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patches
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JobReady
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -242,6 +242,7 @@ extensions: []
|
|
242
242
|
extra_rdoc_files: []
|
243
243
|
files:
|
244
244
|
- ".buildkite/pipeline.yml"
|
245
|
+
- ".github/workflows/publish.yml"
|
245
246
|
- ".gitignore"
|
246
247
|
- ".rspec"
|
247
248
|
- CHANGELOG.md
|
@@ -297,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
297
298
|
- !ruby/object:Gem::Version
|
298
299
|
version: '0'
|
299
300
|
requirements: []
|
300
|
-
rubygems_version: 3.
|
301
|
+
rubygems_version: 3.1.6
|
301
302
|
signing_key:
|
302
303
|
specification_version: 4
|
303
304
|
summary: A simple gem for one off tasks
|