patches 3.4.0 → 3.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yml +26 -0
- data/CHANGELOG.md +28 -1
- 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/tenant_runner.rb +5 -1
- data/lib/patches/version.rb +2 -2
- 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: 3ef48f4cd04fd29602ab012fab6414c16cece6fa3ecd687f9deac3ff9244bf7b
|
4
|
+
data.tar.gz: f89c55aa18e9f84e77e5a26872896df6b5b0819842e940976b262a5b20e55dda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5899f3e9202d2227efd661d38771eef7534ac48414903b1fbd66820631ccf8dd90dcb20b2bc9f8bfbca81375388fe531acacab6dc294c92a621804083fd0b93b
|
7
|
+
data.tar.gz: 59707c3bb9d64ad45971fa7ef2287c346aa72fe6bcb393ed027ddd47ca6202feff2034b5ec30c1a32e5d39041ba4fe2bb2d1ee6ca625aabc58d87978f7e9e7c6
|
@@ -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,7 +6,34 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
## [3.
|
9
|
+
## [3.6.2] - 2022-08-10
|
10
|
+
|
11
|
+
Fixes incorrect release - tag and published gem back in sync
|
12
|
+
|
13
|
+
## [3.6.1] - 2022-08-10
|
14
|
+
### Added
|
15
|
+
- Github actions to publish to Rubygems upon release
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- Fix `patches:pending` rake task
|
19
|
+
|
20
|
+
## [3.6.0] - 2022-05-27
|
21
|
+
|
22
|
+
3.6.1 changes were incorrectly published as 3.6.0 but tagged as 3.6.1
|
23
|
+
|
24
|
+
### Added
|
25
|
+
- Added `notification_prefix` and `notification_suffix` to configuration options
|
26
|
+
- Linked to docs/usage.md in README
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
- Refactored `Patches::Notifier`
|
30
|
+
- `Patches::Notifier.append_tenant_message` effectively replaced by `tenant_suffix`
|
31
|
+
|
32
|
+
## [3.5.0] - 2020-07-22
|
33
|
+
### Added
|
34
|
+
- Enable application version constraint support on `Patches::TenantWorker`
|
35
|
+
|
36
|
+
## [3.4.0] - 2020-07-22
|
10
37
|
### Added
|
11
38
|
- `Patches::TenantWorker` application version constraint forward compatibility
|
12
39
|
|
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)
|
@@ -11,7 +11,11 @@ class Patches::TenantRunner
|
|
11
11
|
Patches.logger.info("Patches tenant runner for: #{tenants.join(',')}")
|
12
12
|
tenants.each do |tenant|
|
13
13
|
if parallel?
|
14
|
-
Patches::TenantWorker.perform_async(
|
14
|
+
Patches::TenantWorker.perform_async(
|
15
|
+
tenant,
|
16
|
+
path,
|
17
|
+
application_version: Patches::Config.configuration.application_version
|
18
|
+
)
|
15
19
|
else
|
16
20
|
run(tenant, path)
|
17
21
|
end
|
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.2
|
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
|