maid 0.9.0.alpha.2 → 0.10.0.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.act-env +1 -0
- data/.act-secrets.example +2 -0
- data/.github/workflows/release.yml +59 -0
- data/.github/workflows/test.yml +2 -2
- data/.gitignore +1 -0
- data/.release-please-manifest.json +3 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +24 -0
- data/Gemfile +1 -1
- data/lib/maid/rules.sample.rb +1 -1
- data/lib/maid/version.rb +2 -2
- data/maid.gemspec +14 -3
- data/spec/lib/maid/app_spec.rb +16 -16
- data/spec/lib/maid/maid_spec.rb +16 -16
- data/spec/lib/maid/platform_spec.rb +1 -1
- data/spec/lib/maid/rake/single_rule_spec.rb +7 -1
- data/spec/lib/maid/tools_spec.rb +9 -9
- data/spec/lib/maid/trash_migration_spec.rb +5 -5
- data/spec/lib/maid/user_agent_spec.rb +5 -4
- data/spec/spec_helper.rb +1 -0
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86f0caf9efcf85d866543e58ce5e4dd924106e2170cb5024239fed0e666393fc
|
4
|
+
data.tar.gz: 4ab003ac12ae07cc4764646f7d5f9dc609eb516c4c4fcfba2e9a3ff08d7aa5ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22573a7e9a42c321d46ecf8fbd7ddafe0a2684685fa0d49b494d679d21abce21b790e06d04ce9ff1db4ac9193d9b80d71f527646f94402431c7e6a0e5d035f9
|
7
|
+
data.tar.gz: 0fe26f4a3b537ba0ac815d61ca42ef832fe770ef6298c736cb7ae6385ec38624c34cb4e01c118aeeef56ba8f131bd883fc1605cfe04178e907ba271f7c3a448d
|
data/.act-env
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Mirrors GitHub Actions' environment vars
|
@@ -0,0 +1,59 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
|
8
|
+
permissions:
|
9
|
+
contents: write
|
10
|
+
pull-requests: write
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
release-please:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: Prepare release
|
18
|
+
id: release
|
19
|
+
uses: google-github-actions/release-please-action@v3
|
20
|
+
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.1
|
43
|
+
- name: Set up Ruby
|
44
|
+
uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
# ruby-version derived from .ruby-version file
|
47
|
+
bundler-cache: true
|
48
|
+
- name: Install dependencies
|
49
|
+
run: bundle install
|
50
|
+
- name: Run tests
|
51
|
+
run: bundle exec rake
|
52
|
+
- name: Publish gem
|
53
|
+
run: |
|
54
|
+
mkdir -p $HOME/.gem
|
55
|
+
touch $HOME/.gem/credentials
|
56
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
57
|
+
env:
|
58
|
+
GEM_HOST_API_KEY: secrets.RUBYGEMS_AUTH_TOKEN
|
59
|
+
if: ${{ steps.release.outputs.release_created }}
|
data/.github/workflows/test.yml
CHANGED
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1
|
1
|
+
3.2.1
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.10.0-alpha.1](https://github.com/maid/maid/compare/v0.9.0...v0.10.0-alpha.1) (2023-03-28)
|
4
|
+
|
5
|
+
|
6
|
+
### ⚠ BREAKING CHANGES
|
7
|
+
|
8
|
+
* Drop support for ruby < 2.7
|
9
|
+
|
10
|
+
### Features
|
11
|
+
|
12
|
+
* Add ruby 3+ support ([008ee83](https://github.com/maid/maid/commit/008ee83f1655a81e3523431ed35bc2dd20c10c6e))
|
13
|
+
* Pass scheduler options to Rufus for repeating tasks ([06a01d3](https://github.com/maid/maid/commit/06a01d3e847537bf8f3f51e6550969bf6123d9a1))
|
14
|
+
|
15
|
+
|
16
|
+
### Bug Fixes
|
17
|
+
|
18
|
+
* Unsafe regex for hostname in example rules ([#229](https://github.com/maid/maid/issues/229)) ([ffc793a](https://github.com/maid/maid/commit/ffc793a9c1e0f1ce433d75710cbd96626fd3835a))
|
19
|
+
* Use HTTPS for rubygems.org ([#219](https://github.com/maid/maid/issues/219)) ([ad0f81c](https://github.com/maid/maid/commit/ad0f81c6ffaed1fff2b91ce71f9b568b3f11b022))
|
20
|
+
|
21
|
+
|
22
|
+
### Code Refactoring
|
23
|
+
|
24
|
+
* Drop support for ruby < 2.7 ([33838aa](https://github.com/maid/maid/commit/33838aaaeed481158613ce620aeb3a7dc5989ced))
|
data/Gemfile
CHANGED
data/lib/maid/rules.sample.rb
CHANGED
@@ -66,7 +66,7 @@ Maid.rules do
|
|
66
66
|
# NOTE: Currently, only Mac OS X supports `downloaded_from`.
|
67
67
|
rule 'Old files downloaded while developing/testing' do
|
68
68
|
dir('~/Downloads/*').each do |path|
|
69
|
-
if downloaded_from(path).any? { |u| u.match('http://localhost') || u.match('http://staging
|
69
|
+
if downloaded_from(path).any? { |u| u.match('http://localhost') || u.match('http://staging\.yourcompany\.com') } &&
|
70
70
|
1.week.since?(accessed_at(path))
|
71
71
|
trash(path)
|
72
72
|
end
|
data/lib/maid/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
module Maid
|
2
|
-
VERSION = '0.
|
3
|
-
SUMMARY = 'Be lazy. Let Maid clean up after you, based on rules you define. Think of it as "Hazel for hackers".'
|
2
|
+
VERSION = '0.10.0-alpha.1'.freeze
|
3
|
+
SUMMARY = 'Be lazy. Let Maid clean up after you, based on rules you define. Think of it as "Hazel for hackers".'.freeze
|
4
4
|
end
|
data/maid.gemspec
CHANGED
@@ -6,12 +6,20 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = 'maid'
|
7
7
|
s.version = Maid::VERSION
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ['Benjamin Oakes']
|
10
|
-
s.email =
|
9
|
+
s.authors = ['Benjamin Oakes', 'Coaxial']
|
10
|
+
s.email = ['hello@benjaminoakes.com', 'c+rubygems@64b.it']
|
11
11
|
s.license = 'GPLv2'
|
12
|
-
s.homepage = 'http://github.com/
|
12
|
+
s.homepage = 'http://github.com/maid/maid'
|
13
13
|
s.summary = Maid::SUMMARY
|
14
14
|
s.description = s.summary
|
15
|
+
s.files = Dir['lib/**/*.rb'] + Dir['bin/maid']
|
16
|
+
s.metadata = {
|
17
|
+
"bug_tracker_uri" => "https://github.com/maid/maid/issues",
|
18
|
+
"changelog_uri" => "https://github.com/maid/maid/blob/master/CHANGELOG.md",
|
19
|
+
"documentation_uri" => "https://github.com/maid/maid/blob/master/README.md",
|
20
|
+
"source_code_uri" => "https://github.com/maid/maid",
|
21
|
+
"wiki_uri" => "https://github.com/maid/maid/wiki"
|
22
|
+
}
|
15
23
|
|
16
24
|
s.rubyforge_project = 'maid'
|
17
25
|
|
@@ -58,4 +66,7 @@ Gem::Specification.new do |s|
|
|
58
66
|
s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\0")
|
59
67
|
s.executables = `git ls-files -z -- bin/*`.split("\0").map{ |f| File.basename(f) }
|
60
68
|
s.require_paths = %w(lib)
|
69
|
+
|
70
|
+
s.post_install_message = "🙏 Thank you for installing Maid, we hope it's " \
|
71
|
+
"useful to you! Visit #{s.homepage} to report issues or contribute code."
|
61
72
|
end
|
data/spec/lib/maid/app_spec.rb
CHANGED
@@ -24,22 +24,22 @@ module Maid
|
|
24
24
|
|
25
25
|
before do
|
26
26
|
@app = App.new
|
27
|
-
@app.
|
28
|
-
@app.
|
27
|
+
allow(@app).to receive(:maid_options)
|
28
|
+
allow(@app).to receive(:say)
|
29
29
|
|
30
|
-
TrashMigration.
|
30
|
+
allow(TrashMigration).to receive(:needed?).and_return(false)
|
31
31
|
|
32
32
|
# NOTE: It's pretty important that this is stubbed, unless you want your rules to be run over and over when you test!
|
33
33
|
@maid = double('Maid')
|
34
|
-
@maid.
|
35
|
-
@maid.
|
36
|
-
@maid.
|
37
|
-
Maid.
|
34
|
+
allow(@maid).to receive(:clean)
|
35
|
+
allow(@maid).to receive(:log_device)
|
36
|
+
allow(@maid).to receive(:load_rules)
|
37
|
+
allow(Maid).to receive(:new).and_return(@maid)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'makes a new Maid with the options' do
|
41
41
|
opts = { :foo => 'bar' }
|
42
|
-
@app.
|
42
|
+
allow(@app).to receive(:maid_options).and_return(opts)
|
43
43
|
expect(Maid).to receive(:new).with(opts).and_return(@maid)
|
44
44
|
@app.clean
|
45
45
|
end
|
@@ -100,7 +100,7 @@ module Maid
|
|
100
100
|
|
101
101
|
it 'prints out the gem version' do
|
102
102
|
ua = 'Maid/0.0.1'
|
103
|
-
UserAgent.
|
103
|
+
allow(UserAgent).to receive(:value).and_return(ua)
|
104
104
|
expect(@app).to receive(:say).with(ua)
|
105
105
|
@app.version
|
106
106
|
end
|
@@ -129,10 +129,10 @@ module Maid
|
|
129
129
|
describe App, '#logs' do
|
130
130
|
before do
|
131
131
|
@maid = double('Maid')
|
132
|
-
@maid.
|
133
|
-
@maid.
|
134
|
-
@maid.
|
135
|
-
Maid.
|
132
|
+
allow(@maid).to receive(:clean)
|
133
|
+
allow(@maid).to receive(:log_device).and_return('/var/log/maid.log')
|
134
|
+
allow(@maid).to receive(:load_rules)
|
135
|
+
allow(Maid).to receive(:new).and_return(@maid)
|
136
136
|
end
|
137
137
|
|
138
138
|
describe 'prints out the log' do
|
@@ -142,7 +142,7 @@ module Maid
|
|
142
142
|
@log_file.write(@log)
|
143
143
|
@log_file.close
|
144
144
|
|
145
|
-
@maid.
|
145
|
+
allow(@maid).to receive(:log_device).and_return(@log_file.path)
|
146
146
|
end
|
147
147
|
|
148
148
|
after do
|
@@ -154,14 +154,14 @@ module Maid
|
|
154
154
|
end
|
155
155
|
|
156
156
|
it 'prints an error when log does not exist' do
|
157
|
-
@maid.
|
157
|
+
allow(@maid).to receive(:log_device).and_return('/maid/file-does-not-exist')
|
158
158
|
message = "Log file #{@maid.log_device} does not exist.\n"
|
159
159
|
|
160
160
|
expect(capture_stderr { App.start(['logs']) }).to eq(message)
|
161
161
|
end
|
162
162
|
|
163
163
|
it 'does not tail when log does not exist' do
|
164
|
-
@maid.
|
164
|
+
allow(@maid).to receive(:log_device).and_return('/maid/file-does-not-exist')
|
165
165
|
message = "Log file #{@maid.log_device} does not exist.\n"
|
166
166
|
|
167
167
|
expect(capture_stderr { App.start(['logs', '--tail']) }).to eq(message)
|
data/spec/lib/maid/maid_spec.rb
CHANGED
@@ -4,8 +4,8 @@ module Maid
|
|
4
4
|
describe Maid do
|
5
5
|
before do
|
6
6
|
@logger = double('Logger').as_null_object
|
7
|
-
Logger.
|
8
|
-
FileUtils.
|
7
|
+
allow(Logger).to receive(:new).and_return(@logger)
|
8
|
+
allow(FileUtils).to receive(:mkdir_p)
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '.new' do
|
@@ -36,22 +36,22 @@ module Maid
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'takes a logger object during intialization' do
|
39
|
-
Logger.
|
39
|
+
allow(Logger).to receive(:new).and_call_original
|
40
40
|
maid = Maid.new(:logger => @logger)
|
41
41
|
expect(maid.logger).to eq(@logger)
|
42
42
|
end
|
43
43
|
|
44
44
|
describe 'platform-specific behavior' do
|
45
45
|
before do
|
46
|
-
Platform.
|
47
|
-
Platform.
|
46
|
+
allow(Platform).to receive(:linux?)
|
47
|
+
allow(Platform).to receive(:osx?)
|
48
48
|
@home = File.expand_path('~')
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when running on Linux' do
|
52
52
|
before do
|
53
|
-
Platform.
|
54
|
-
XDG.
|
53
|
+
allow(Platform).to receive(:linux?).and_return(true)
|
54
|
+
allow(XDG).to receive(:[]).with('DATA_HOME').and_return("#{ @home }/.local/share")
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'set the trash to the correct default path' do
|
@@ -64,7 +64,7 @@ module Maid
|
|
64
64
|
|
65
65
|
context 'when running on OS X' do
|
66
66
|
before do
|
67
|
-
Platform.
|
67
|
+
allow(Platform).to receive(:osx?).and_return(true)
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'sets the trash to the correct default path' do
|
@@ -77,7 +77,7 @@ module Maid
|
|
77
77
|
|
78
78
|
context 'when running on an unsupported platform' do
|
79
79
|
it 'does not implement trashing files' do
|
80
|
-
expect
|
80
|
+
expect { Maid.new }.to raise_error(NotImplementedError)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
@@ -127,7 +127,7 @@ module Maid
|
|
127
127
|
describe '#clean' do
|
128
128
|
before do
|
129
129
|
@maid = Maid.new
|
130
|
-
@logger.
|
130
|
+
allow(@logger).to receive(:info)
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'logs start and finish' do
|
@@ -144,7 +144,7 @@ module Maid
|
|
144
144
|
|
145
145
|
describe '#load_rules' do
|
146
146
|
before do
|
147
|
-
Kernel.
|
147
|
+
allow(Kernel).to receive(:load)
|
148
148
|
@maid = Maid.new
|
149
149
|
end
|
150
150
|
|
@@ -154,7 +154,7 @@ module Maid
|
|
154
154
|
end
|
155
155
|
|
156
156
|
it 'gives an error on STDERR if there is a LoadError' do
|
157
|
-
Kernel.
|
157
|
+
allow(Kernel).to receive(:load).and_raise(LoadError)
|
158
158
|
expect(STDERR).to receive(:puts)
|
159
159
|
@maid.load_rules
|
160
160
|
end
|
@@ -179,8 +179,8 @@ module Maid
|
|
179
179
|
|
180
180
|
describe '#watch' do
|
181
181
|
before do
|
182
|
-
Listen.
|
183
|
-
Listen.
|
182
|
+
allow(Listen).to receive(:to)
|
183
|
+
allow(Listen).to receive(:start)
|
184
184
|
@maid = Maid.new
|
185
185
|
end
|
186
186
|
|
@@ -270,11 +270,11 @@ module Maid
|
|
270
270
|
end
|
271
271
|
|
272
272
|
it 'reports `not-a-real-command` as not being a supported command' do
|
273
|
-
expect
|
273
|
+
expect { @maid.cmd('not-a-real-command arg1 arg2') }.to raise_error(NotImplementedError)
|
274
274
|
end
|
275
275
|
|
276
276
|
it 'should report `echo` as a real command' do
|
277
|
-
expect
|
277
|
+
expect { @maid.cmd('echo .') }.not_to raise_error
|
278
278
|
end
|
279
279
|
end
|
280
280
|
end
|
@@ -2,11 +2,17 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Maid
|
4
4
|
module Rake
|
5
|
-
describe SingleRule do
|
5
|
+
describe SingleRule, fakefs: true do
|
6
6
|
subject(:single_rule) { described_class.new name, task }
|
7
7
|
let(:name) { double(:rule_description) }
|
8
8
|
let(:task) { Proc.new {} }
|
9
9
|
|
10
|
+
before do
|
11
|
+
logfile = File.join('~', '.maid', 'maid.log')
|
12
|
+
FileUtils.mkdir_p(File.expand_path(File.dirname(logfile)))
|
13
|
+
FileUtils.touch(File.expand_path(logfile))
|
14
|
+
end
|
15
|
+
|
10
16
|
describe '#initialize' do
|
11
17
|
it 'has a name' do
|
12
18
|
expect(single_rule.name). to eq(name)
|
data/spec/lib/maid/tools_spec.rb
CHANGED
@@ -18,10 +18,10 @@ module Maid
|
|
18
18
|
@maid = Maid.new(:logger => @logger)
|
19
19
|
|
20
20
|
# Prevent warnings from showing when testing deprecated methods:
|
21
|
-
@maid.
|
21
|
+
allow(@maid).to receive(:__deprecated_run_action__)
|
22
22
|
|
23
23
|
# For safety, stub `cmd` to prevent running commands:
|
24
|
-
@maid.
|
24
|
+
allow(@maid).to receive(:cmd)
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#move' do
|
@@ -156,14 +156,14 @@ module Maid
|
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'removes files greater then the remove option size' do
|
159
|
-
@maid.
|
159
|
+
allow(@maid).to receive(:disk_usage).and_return(1025)
|
160
160
|
@maid.trash(@src_file, :remove_over => 1.mb)
|
161
161
|
expect(File.exist?(@src_file)).not_to be(true)
|
162
162
|
expect(File.exist?(@trash_file)).not_to be(true)
|
163
163
|
end
|
164
164
|
|
165
165
|
it 'trashes files less then the remove option size' do
|
166
|
-
@maid.
|
166
|
+
allow(@maid).to receive(:disk_usage).and_return(1023)
|
167
167
|
@maid.trash(@src_file, :remove_over => 1.mb)
|
168
168
|
expect(File.exist?(@trash_file)).to be(true)
|
169
169
|
end
|
@@ -225,7 +225,7 @@ module Maid
|
|
225
225
|
it 'lists multiple files in alphabetical order' do
|
226
226
|
# It doesn't occur with `FakeFS` as far as I can tell, but Ubuntu (and possibly OS X) can give the results out
|
227
227
|
# of lexical order. That makes using the `dry-run` output difficult to use.
|
228
|
-
Dir.
|
228
|
+
allow(Dir).to receive(:glob).and_return(%w(/home/foo/b.zip /home/foo/a.zip /home/foo/c.zip))
|
229
229
|
expect(@maid.dir('~/Downloads/*.zip')).to eq(%w(/home/foo/a.zip /home/foo/b.zip /home/foo/c.zip))
|
230
230
|
end
|
231
231
|
|
@@ -278,7 +278,7 @@ module Maid
|
|
278
278
|
it 'lists multiple files in alphabetical order' do
|
279
279
|
# It doesn't occur with `FakeFS` as far as I can tell, but Ubuntu (and possibly OS X) can give the results out
|
280
280
|
# of lexical order. That makes using the `dry-run` output difficult to use.
|
281
|
-
Dir.
|
281
|
+
allow(Dir).to receive(:glob).and_return(%w(/home/foo/b.zip /home/foo/a.zip /home/foo/c.zip))
|
282
282
|
expect(@maid.dir('~/Downloads/*.zip')).to eq(%w(/home/foo/a.zip /home/foo/b.zip /home/foo/c.zip))
|
283
283
|
end
|
284
284
|
|
@@ -373,7 +373,7 @@ module Maid
|
|
373
373
|
|
374
374
|
describe '#downloaded_from' do
|
375
375
|
before do
|
376
|
-
Platform.
|
376
|
+
allow(Platform).to receive(:osx?).and_return(true)
|
377
377
|
end
|
378
378
|
|
379
379
|
it 'determines the download site' do
|
@@ -410,7 +410,7 @@ module Maid
|
|
410
410
|
describe '#zipfile_contents' do
|
411
411
|
it 'inspects the contents of a .zip file' do
|
412
412
|
entries = [double(:name => 'foo.exe'), double(:name => 'README.txt'), double(:name => 'subdir/anything.txt')]
|
413
|
-
Zip::File.
|
413
|
+
allow(Zip::File).to receive(:open).and_yield(entries)
|
414
414
|
|
415
415
|
expect(@maid.zipfile_contents('foo.zip')).to eq(['README.txt', 'foo.exe', 'subdir/anything.txt'])
|
416
416
|
end
|
@@ -425,7 +425,7 @@ module Maid
|
|
425
425
|
context 'when the file does not exist' do
|
426
426
|
it 'raises an error' do
|
427
427
|
expect(@maid).to receive(:cmd).and_return('du: cannot access `foo.zip\': No such file or directory')
|
428
|
-
expect
|
428
|
+
expect { @maid.disk_usage('foo.zip') }.to raise_error(RuntimeError)
|
429
429
|
end
|
430
430
|
end
|
431
431
|
end
|
@@ -6,7 +6,7 @@ module Maid
|
|
6
6
|
describe TrashMigration, :fakefs => true do
|
7
7
|
context 'when running on Linux' do
|
8
8
|
before do
|
9
|
-
Platform.
|
9
|
+
allow(Platform).to receive(:linux?).and_return(true)
|
10
10
|
end
|
11
11
|
|
12
12
|
context 'and the incorrect trash path does not exist' do
|
@@ -26,7 +26,7 @@ module Maid
|
|
26
26
|
|
27
27
|
context 'and the kill switch is activated' do
|
28
28
|
before do
|
29
|
-
ENV.
|
29
|
+
allow(ENV).to receive(:[]).with('MAID_NO_MIGRATE_TRASH').and_return('any-value')
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'is not needed' do
|
@@ -38,7 +38,7 @@ module Maid
|
|
38
38
|
|
39
39
|
context 'when running on OS X' do
|
40
40
|
before do
|
41
|
-
Platform.
|
41
|
+
allow(Platform).to receive(:linux?).and_return(false)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'is not needed' do
|
@@ -48,7 +48,7 @@ module Maid
|
|
48
48
|
|
49
49
|
describe 'performing' do
|
50
50
|
before do
|
51
|
-
Logger.
|
51
|
+
allow(Logger).to receive(:new).and_return(double('Logger').as_null_object)
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'in Linux' do
|
@@ -57,7 +57,7 @@ module Maid
|
|
57
57
|
File::FNM_DOTMATCH) }
|
58
58
|
|
59
59
|
before do
|
60
|
-
subject.
|
60
|
+
allow(subject).to receive(:correct_trash).and_return(File.expand_path('~/.local/share/Trash/files/'))
|
61
61
|
|
62
62
|
FileUtils.mkdir_p(subject.incorrect_trash)
|
63
63
|
FileUtils.touch(File.join(subject.incorrect_trash, filename))
|
@@ -2,18 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Maid
|
4
4
|
describe UserAgent do
|
5
|
+
before do
|
6
|
+
allow(::Maid).to receive(:const_get).with(:VERSION).and_return('0.0.1')
|
7
|
+
stub_const('RUBY_DESCRIPTION', 'ruby 1.8.8p0 (1970-01-01 revision 1) [pdp7-unix]')
|
8
|
+
end
|
9
|
+
|
5
10
|
describe 'the user agent string' do
|
6
11
|
it 'is formatted with the Maid version, platform version, and Ruby version' do
|
7
|
-
stub_const('RUBY_DESCRIPTION', 'ruby 1.8.8p0 (1970-01-01 revision 1) [pdp7-unix]')
|
8
|
-
::Maid.stub(:const_get).with(:VERSION) { '0.0.1' }
|
9
|
-
|
10
12
|
expect(UserAgent.value).to eq('Maid/0.0.1 (ruby 1.8.8p0 (1970-01-01 revision 1) [pdp7-unix])')
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
describe 'the short user agent string' do
|
15
17
|
it 'is formatted with the Maid version' do
|
16
|
-
::Maid.stub(:const_get).with(:VERSION) { '0.0.1' }
|
17
18
|
expect(UserAgent.short).to eq('Maid/0.0.1')
|
18
19
|
end
|
19
20
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0.pre.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Oakes
|
8
|
+
- Coaxial
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
12
|
+
date: 2023-03-28 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: escape
|
@@ -340,18 +341,24 @@ description: Be lazy. Let Maid clean up after you, based on rules you define. Th
|
|
340
341
|
of it as "Hazel for hackers".
|
341
342
|
email:
|
342
343
|
- hello@benjaminoakes.com
|
344
|
+
- c+rubygems@64b.it
|
343
345
|
executables:
|
344
346
|
- maid
|
345
347
|
extensions: []
|
346
348
|
extra_rdoc_files: []
|
347
349
|
files:
|
350
|
+
- ".act-env"
|
351
|
+
- ".act-secrets.example"
|
352
|
+
- ".github/workflows/release.yml"
|
348
353
|
- ".github/workflows/test.yml"
|
349
354
|
- ".gitignore"
|
355
|
+
- ".release-please-manifest.json"
|
350
356
|
- ".rspec"
|
351
357
|
- ".ruby-gemset"
|
352
358
|
- ".ruby-version"
|
353
359
|
- ".yardopts"
|
354
360
|
- AUTHORS.md
|
361
|
+
- CHANGELOG.md
|
355
362
|
- CONTRIBUTING.md
|
356
363
|
- ChangeLog
|
357
364
|
- Gemfile
|
@@ -407,11 +414,17 @@ files:
|
|
407
414
|
- spec/lib/maid/user_agent_spec.rb
|
408
415
|
- spec/lib/maid_spec.rb
|
409
416
|
- spec/spec_helper.rb
|
410
|
-
homepage: http://github.com/
|
417
|
+
homepage: http://github.com/maid/maid
|
411
418
|
licenses:
|
412
419
|
- GPLv2
|
413
|
-
metadata:
|
414
|
-
|
420
|
+
metadata:
|
421
|
+
bug_tracker_uri: https://github.com/maid/maid/issues
|
422
|
+
changelog_uri: https://github.com/maid/maid/blob/master/CHANGELOG.md
|
423
|
+
documentation_uri: https://github.com/maid/maid/blob/master/README.md
|
424
|
+
source_code_uri: https://github.com/maid/maid
|
425
|
+
wiki_uri: https://github.com/maid/maid/wiki
|
426
|
+
post_install_message: "\U0001F64F Thank you for installing Maid, we hope it's useful
|
427
|
+
to you! Visit http://github.com/maid/maid to report issues or contribute code."
|
415
428
|
rdoc_options: []
|
416
429
|
require_paths:
|
417
430
|
- lib
|