maid 0.10.0 → 0.11.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.commitlintrc.json +7 -0
  3. data/.github/FUNDING.yml +14 -0
  4. data/.github/workflows/{coverage.yml → coverage-upload.yml} +10 -8
  5. data/.github/workflows/lint.yml +41 -1
  6. data/.github/workflows/merge-gatekeeper.yml +20 -0
  7. data/.github/workflows/release.yml +31 -34
  8. data/.github/workflows/stale.yml +28 -0
  9. data/.github/workflows/test.yml +11 -8
  10. data/.gitignore +1 -1
  11. data/.releaserc.json +34 -0
  12. data/.rubocop.yml +3 -1
  13. data/.rubocop_todo.yml +105 -107
  14. data/.ruby-version +1 -1
  15. data/AUTHORS.md +1 -0
  16. data/CHANGELOG.md +23 -0
  17. data/CONTRIBUTING.md +15 -0
  18. data/Dockerfile +13 -0
  19. data/Gemfile.lock +230 -0
  20. data/Guardfile +2 -0
  21. data/README.md +82 -49
  22. data/Rakefile +9 -0
  23. data/fixtures/files/test_rules.rb +3 -0
  24. data/lib/maid/logger/logger.rb +63 -0
  25. data/lib/maid/maid.rb +6 -22
  26. data/lib/maid/repeat.rb +2 -2
  27. data/lib/maid/rule.rb +2 -2
  28. data/lib/maid/rule_container.rb +2 -2
  29. data/lib/maid/tools.rb +3 -3
  30. data/lib/maid/trash_migration.rb +2 -0
  31. data/lib/maid/version.rb +1 -1
  32. data/lib/maid/watch.rb +2 -2
  33. data/lib/maid.rb +3 -2
  34. data/maid.gemspec +18 -15
  35. data/script/docker-test +7 -0
  36. data/script/update-version.rb +14 -0
  37. data/spec/fakefs_helper.rb +13 -0
  38. data/spec/lib/maid/logger/logger_spec.rb +64 -0
  39. data/spec/lib/maid/maid_spec.rb +113 -103
  40. data/spec/lib/maid/rake/single_rule_spec.rb +1 -1
  41. data/spec/lib/maid/tools_spec.rb +383 -224
  42. data/spec/lib/maid/trash_migration_spec.rb +7 -5
  43. data/spec/spec_helper.rb +9 -1
  44. metadata +124 -49
  45. data/.release-please-manifest.json +0 -3
  46. data/Vagrantfile +0 -14
  47. data/script/vagrant-provision +0 -43
  48. data/script/vagrant-test +0 -7
  49. data/script/vagrant-test-all +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 386fffc38404ce847ae5650376f84be904056ad5d6acd86cea9311cedade94c1
4
- data.tar.gz: 49c5f4a3b21d583d2edd09d73d862c495c2e8d5eb36c510401bc5ff216316c57
3
+ metadata.gz: b0e37d0f17194d3ab84ab03c7520c4a7d610da6a94d0b0da9eda781da477a9e4
4
+ data.tar.gz: 40b6bace47a3acc2946cc30dac5139fb389a564a223eaecfb079a615020110a5
5
5
  SHA512:
6
- metadata.gz: 334f18ddb7a90a62a6b3c6136930c1724e08358ab7fb0dcca7011570b1b93bffa24958a07756c52f303f617aeea8cc02142d4d6163b75cfeaad3b71c32aeb34e
7
- data.tar.gz: 397ca948024144b6beaa7f7139df13a66ff84b2240a3ffd8a716d67286334f5e3da6520e25e6d5df2ba8a3e5f8f417ec64fd29e42f4a955ef5fb24471b3a7dc3
6
+ metadata.gz: 2f4a77cfca1a267cb193f005a55f1d366b87b545d2385db9c845fade9ecfd8b57c276f4823018958ea1dd4de3ffd8d3ee5d28afea04a5e6d833e31d1e1933b49
7
+ data.tar.gz: b0e2db3844fd69f0cd94316eb8eede4243c8bc7499568bf5add17f7b7ed31f0cc723d0f448d75ce85a6f54ae1724acd79eebb5f41dc23342dee31b522e87c858
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": ["@commitlint/config-conventional"],
3
+ "rules": {
4
+ "body-max-line-length": [0, "always", 100],
5
+ "subject-case": [2, "always", "sentence-case"]
6
+ }
7
+ }
@@ -0,0 +1,14 @@
1
+ # # These are supported funding model platforms
2
+ #
3
+ # github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ # patreon: # Replace with a single Patreon username
5
+ # open_collective: # Replace with a single Open Collective username
6
+ # ko_fi: # Replace with a single Ko-fi username
7
+ # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ # liberapay: # Replace with a single Liberapay username
10
+ # issuehunt: # Replace with a single IssueHunt username
11
+ # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ # polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: "benjaminoakes"
14
+ # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,29 +1,31 @@
1
- name: Code coverage
1
+ permissions:
2
+ contents: read
3
+ name: Upload coverage to Code Climate
2
4
 
3
5
  on:
4
6
  push:
5
- branches:
6
- master
7
- pull_request:
8
7
  branches:
9
8
  - master
10
9
 
11
10
  jobs:
12
- code-climate:
11
+ upload-coverage:
13
12
  runs-on: ubuntu-latest
14
13
  steps:
15
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
+
16
16
  - name: Set up Ruby
17
17
  uses: ruby/setup-ruby@v1
18
18
  with:
19
19
  bundler-cache: true
20
+
20
21
  - name: Install dependencies
21
22
  run: bundle install
22
- - name: Publish code coverage
23
+
24
+ - name: Upload coverage to Code Climate
23
25
  uses: paambaati/codeclimate-action@v3.2.0
24
26
  with:
25
27
  coverageCommand: bundle exec rake
26
28
  env:
27
29
  CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_KEY }}
28
30
  COVERAGE: true
29
-
31
+ ISOLATED: true
@@ -1,3 +1,5 @@
1
+ permissions:
2
+ contents: read
1
3
  name: Lint
2
4
 
3
5
  on:
@@ -9,10 +11,26 @@ on:
9
11
  - master
10
12
 
11
13
  jobs:
14
+ commitlint:
15
+ runs-on: ubuntu-latest
16
+ if: github.event_name == 'push'
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v3
23
+ with:
24
+ node-version: "lts/*"
25
+ - name: Install commitlint
26
+ run: npm install -g @commitlint/config-conventional @commitlint/cli
27
+ - name: Validate current commit (push)
28
+ run: echo "${{ github.event.head_commit.message }}" | commitlint
29
+
12
30
  rubocop:
13
31
  runs-on: ubuntu-latest
14
32
  steps:
15
- - uses: actions/checkout@v3
33
+ - uses: actions/checkout@v4
16
34
  - name: Set up Ruby
17
35
  uses: ruby/setup-ruby@v1
18
36
  with:
@@ -22,3 +40,25 @@ jobs:
22
40
  run: bundle install
23
41
  - name: Run lint
24
42
  run: bundle exec rubocop
43
+ shellcheck:
44
+ runs-on: ubuntu-latest
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - name: Install Shellcheck
48
+ run: sudo apt install shellcheck -y
49
+ - name: Run shellcheck
50
+ run: shellcheck -x script/*
51
+
52
+ pr-title-lint:
53
+ runs-on: ubuntu-latest
54
+ if: github.event_name == 'pull_request'
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+ - name: Setup Node.js
58
+ uses: actions/setup-node@v3
59
+ with:
60
+ node-version: "lts/*"
61
+ - name: Install commitlint
62
+ run: npm install -g @commitlint/config-conventional @commitlint/cli
63
+ - name: Validate PR title
64
+ run: echo "${{ github.event.pull_request.title }}" | commitlint
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Merge Gatekeeper
3
+
4
+ on:
5
+ pull_request:
6
+ branches:
7
+ - main
8
+ - master
9
+
10
+ jobs:
11
+ merge-gatekeeper:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ checks: read
15
+ statuses: read
16
+ steps:
17
+ - name: Run Merge Gatekeeper
18
+ uses: upsidr/merge-gatekeeper@v1
19
+ with:
20
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -10,53 +10,50 @@ permissions:
10
10
  pull-requests: write
11
11
 
12
12
  jobs:
13
- release-please:
13
+ release:
14
+ name: Release
14
15
  runs-on: ubuntu-latest
15
16
  steps:
16
- - uses: actions/checkout@v3
17
- - name: Prepare release
18
- id: release
19
- uses: google-github-actions/release-please-action@v3
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
20
19
  with:
21
- release-type: ruby
22
- package-name: maid
23
- # Major bump is minor instead pre-1.0.0
24
- bump-minor-pre-major: true
25
- # Minor bump is patch instead pre-1.0.0
26
- bump-patch-for-minor-pre-major: true
27
- # Don't parse commits before this one as they don't follow the
28
- # conventional commit format AND don't have `release-please`
29
- # COMMIT_MESSAGE_OVERRIDE data.
30
- # (https://www.conventionalcommits.org/en/v1.0.0/#summary)
31
- bootstrap-sha: 0a6ff8abc6db00aca181d6bfed9751e332900ac9
32
- # This is the last release before starting to use release-please
33
- last-release-sha: 0a6ff8abc6db00aca181d6bfed9751e332900ac9
34
- version-file: lib/maid/version.rb
35
- # Don't use GITHUB_TOKEN because this doesn't allow workflows to
36
- # trigger workflows; it leave the `release-please`-generated PR with
37
- # pending checks as they're never started.
38
- token: ${{ secrets.BOT_GH_TOKEN }}
39
- # Uncomment for pre-releases, see
40
- # https://github.com/maid/maid/wiki/Release-Process
41
- # prerelease: true
42
- # release-as: v0.10.0-alpha.3
43
- - name: Set up Ruby
20
+ fetch-depth: 0
21
+ persist-credentials: false
22
+
23
+ - name: Setup Node.js
24
+ uses: actions/setup-node@v3
25
+ with:
26
+ node-version: "lts/*"
27
+
28
+ - name: Setup Ruby
44
29
  uses: ruby/setup-ruby@v1
45
30
  with:
46
31
  # ruby-version derived from .ruby-version file
47
32
  bundler-cache: true
33
+
48
34
  - name: Install dependencies
49
- run: bundle install
35
+ run: |
36
+ npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/exec
37
+ bundle install
38
+
50
39
  - name: Run tests
51
40
  run: bundle exec rake
52
- - name: Publish gem
41
+ env:
42
+ ISOLATED: true
43
+
44
+ - name: Configure gem credentials
53
45
  run: |
46
+ echo "::add-mask::$GEM_HOST_API_KEY"
54
47
  mkdir -p $HOME/.gem
55
48
  touch $HOME/.gem/credentials
56
49
  chmod 0600 $HOME/.gem/credentials
57
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
58
- gem build *.gemspec
59
- gem push *.gem
50
+ printf -- "---\n:rubygems_api_key: %s\n" "$GEM_HOST_API_KEY" > $HOME/.gem/credentials
60
51
  env:
61
52
  GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
62
- if: ${{ steps.release.outputs.release_created }}
53
+
54
+ - name: Release
55
+ id: semantic_release
56
+ env:
57
+ GITHUB_TOKEN: ${{ secrets.BOT_GH_TOKEN }}
58
+ run: |
59
+ npx semantic-release
@@ -0,0 +1,28 @@
1
+ name: 'Close stale issues and PRs'
2
+ on:
3
+ schedule:
4
+ - cron: '30 1 * * *'
5
+
6
+ jobs:
7
+ stale:
8
+ permissions:
9
+ issues: write
10
+ pull-requests: write
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/stale@v8
14
+ with:
15
+ days-before-stale: 30
16
+ days-before-close: 7
17
+ stale-issue-message: >-
18
+ This issue has been open for 30 days without any activity. Remove
19
+ `no-issue-activity` label or comment to avoid automatic closure in
20
+ 7 days.
21
+ stale-pr-message: >-
22
+ This PR has been open for 30 days without any activity. Remove
23
+ `no-pr-activity` label or comment to avoid automatic closure in 7
24
+ days.
25
+ stale-issue-label: 'no-issue-activity'
26
+ any-of-labels: 'needs-info'
27
+ stale-pr-label: 'no-pr-activity'
28
+ exempt-pr-labels: 'awaiting-approval,work-in-progress'
@@ -1,3 +1,5 @@
1
+ permissions:
2
+ contents: read
1
3
  name: Test
2
4
 
3
5
  on:
@@ -13,18 +15,17 @@ jobs:
13
15
  strategy:
14
16
  matrix:
15
17
  os:
16
- - ubuntu-20.04
17
18
  - ubuntu-22.04
18
- - macos-11
19
- - macos-12
19
+ - ubuntu-24.04
20
+ - macos-14
21
+ - macos-15
20
22
  ruby-version:
21
- - 2.7
22
- - 3.0
23
- - 3.1
24
- - 3.2
23
+ - "3.2"
24
+ - "3.3"
25
+ - "3.4"
25
26
  runs-on: ${{ matrix.os }}
26
27
  steps:
27
- - uses: actions/checkout@v3
28
+ - uses: actions/checkout@v4
28
29
  - name: Set up Ruby
29
30
  uses: ruby/setup-ruby@v1
30
31
  with:
@@ -34,3 +35,5 @@ jobs:
34
35
  run: bundle install
35
36
  - name: Run tests
36
37
  run: bundle exec rake
38
+ env:
39
+ ISOLATED: true
data/.gitignore CHANGED
@@ -2,8 +2,8 @@
2
2
  .bundle
3
3
  .vagrant
4
4
  .yardoc/*
5
- Gemfile.lock
6
5
  tmp/*
7
6
  doc/*
8
7
  .act-secrets
9
8
  coverage/
9
+ guard_*_runner*
data/.releaserc.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "branches": [
3
+ "master"
4
+ ],
5
+ "plugins": [
6
+ "@semantic-release/commit-analyzer",
7
+ "@semantic-release/release-notes-generator",
8
+ [
9
+ "@semantic-release/changelog",
10
+ {
11
+ "changelogFile": "CHANGELOG.md"
12
+ }
13
+ ],
14
+ [
15
+ "@semantic-release/exec",
16
+ {
17
+ "prepareCmd": "ruby script/update-version.rb ${nextRelease.version}",
18
+ "publishCmd": "gem build *.gemspec && gem push *.gem"
19
+ }
20
+ ],
21
+ [
22
+ "@semantic-release/git",
23
+ {
24
+ "assets": [
25
+ "CHANGELOG.md",
26
+ "lib/maid/version.rb",
27
+ "Gemfile.lock"
28
+ ],
29
+ "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
30
+ }
31
+ ],
32
+ "@semantic-release/github"
33
+ ]
34
+ }
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ inherit_from: .rubocop_todo.yml
3
3
 
4
4
  require:
5
5
  - rubocop-rake
6
+ plugins:
6
7
  - rubocop-rspec
7
8
 
8
9
  AllCops:
@@ -10,8 +11,9 @@ AllCops:
10
11
  Exclude:
11
12
  - "bin/*"
12
13
  - "vendor/bundle/**/*" # when running on GH Actions
14
+ - ".vagrant/**/*"
13
15
  NewCops: enable
14
- TargetRubyVersion: 2.7
16
+ TargetRubyVersion: "3.2"
15
17
 
16
18
  Metrics/BlockLength:
17
19
  Exclude: