maid 0.4.0.alpha.2 → 0.4.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -1
- data/.travis.yml +2 -1
- data/ChangeLog +4 -1
- data/README.md +13 -16
- data/lib/maid/tools.rb +5 -3
- data/lib/maid/user_agent.rb +1 -2
- data/lib/maid/version.rb +1 -1
- data/maid.gemspec +10 -10
- data/script/vagrant-provision +2 -14
- data/script/vagrant-test-all +5 -27
- data/spec/dependency_spec.rb +9 -13
- data/spec/lib/maid/app_spec.rb +9 -9
- data/spec/lib/maid/maid_spec.rb +9 -9
- data/spec/lib/maid/tools_spec.rb +4 -5
- data/spec/lib/maid/trash_migration_spec.rb +1 -1
- data/spec/lib/maid/user_agent_spec.rb +2 -6
- data/spec/lib/maid_spec.rb +2 -2
- metadata +48 -51
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0p247
|
data/.travis.yml
CHANGED
data/ChangeLog
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
maid (0.4.0) unstable; urgency=low
|
2
2
|
|
3
3
|
* (Work in progress)
|
4
|
-
*
|
4
|
+
* Ended official support for Ruby 1.8.7 and 1.9.2 (Closes: #108)
|
5
|
+
* Update to rubyzip 1.0.0 (Closes: #109)
|
6
|
+
* Updated other dependencies (Closes: #111)
|
5
7
|
* Mu Ye: Require option to cause real cleaning to take place (Closes: #78)
|
6
8
|
* Graham Siener: Add UTF-8 support for zipfile_contents tool (Closes: #35)
|
7
9
|
* Justin Hileman: Add ability to list duplicate files (Closes: #15)
|
@@ -24,6 +26,7 @@ maid (0.3.0) stable; urgency=high
|
|
24
26
|
* Only allow "move" to move to existing directories. Renaming files
|
25
27
|
can be accomplished with the new "rename" tool. This fixes a bug in
|
26
28
|
overwrite warnings. (Closes: #87)
|
29
|
+
* NOTE: A previous alpha of v0.3.0 was released as v0.2.3.alpha.1.
|
27
30
|
|
28
31
|
-- Benjamin Oakes <hello@benjaminoakes.com> Wed, 03 Apr 2013 00:00:00 +0000
|
29
32
|
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
[![Build Status](https://secure.travis-ci.org/benjaminoakes/maid.png)](http://travis-ci.org/benjaminoakes/maid)
|
5
5
|
[![Dependency Status](https://gemnasium.com/benjaminoakes/maid.png)](https://gemnasium.com/benjaminoakes/maid)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/benjaminoakes/maid.png)](https://codeclimate.com/github/benjaminoakes/maid)
|
7
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/benjaminoakes/maid/trend.png)](https://bitdeli.com/free)
|
7
8
|
|
8
9
|
**Be lazy!** Let Maid clean up after you, based on rules you define.
|
9
10
|
|
@@ -75,26 +76,29 @@ This project wouldn't be where it is today without its users and contributors.
|
|
75
76
|
|
76
77
|
## Installation
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
79
|
+
Maid is a gem, so just `gem install maid` like normal. Please see below for details.
|
80
|
+
|
81
|
+
#### Requirements
|
82
|
+
|
83
|
+
Modern Ruby versions and Unix-like operating systems should work, but only OS X and Ubuntu are tested regularly.
|
81
84
|
|
82
|
-
|
85
|
+
Offically supported:
|
83
86
|
|
84
87
|
* **OS:** Mac OS X, Ubuntu
|
85
|
-
* **Ruby:** 1.
|
88
|
+
* **Ruby:** 1.9.3+ (2.0.0 preferred)
|
86
89
|
|
87
|
-
Some features require OS X. See the [documentation][] for more details.
|
88
|
-
may work, but are not officially supported. (Contributions are welcome, however.)
|
90
|
+
Some features require OS X. See the [documentation][] for more details.
|
89
91
|
|
90
92
|
### Manual Installation
|
91
93
|
|
92
94
|
First, you need Ruby:
|
93
95
|
|
94
|
-
* **Mac OS X:** Ruby
|
95
|
-
* **Ubuntu:** Ruby is not preinstalled. To install Ruby 1.9.3: `sudo apt-get install ruby1.9.1
|
96
|
+
* **Mac OS X:** Ruby 2.0.0 comes preinstalled in OS X 10.9.
|
97
|
+
* **Ubuntu:** Ruby is not preinstalled. To install Ruby 1.9.3: `sudo apt-get install ruby1.9.1` (sic)
|
96
98
|
([Interested in a package?](https://github.com/benjaminoakes/maid/issues/3))
|
97
99
|
|
100
|
+
Consider `rbenv` or `rvm` if only Ruby 1.8.7 is available (e.g. if you are using an older version of OS X).
|
101
|
+
|
98
102
|
Then, you can install via RubyGems. Open a terminal and run:
|
99
103
|
|
100
104
|
sudo gem install maid
|
@@ -109,13 +113,6 @@ If you decide you don't want Maid installed anymore, remove it:
|
|
109
113
|
|
110
114
|
**NOTE:** This does not remove any files under `~/.maid` or crontab entries. Please remove them at your convenience.
|
111
115
|
|
112
|
-
### Troubleshooting
|
113
|
-
|
114
|
-
* Having multiple Ruby versions installed can confuse things. If you're a Ruby developer, you may prefer to just
|
115
|
-
`gem install maid` with your preferred setup. Ruby 1.9.3 is recommended.
|
116
|
-
* Older packages of Ruby for Ubuntu may not automatically add the RubyGems `bin` directory to your `$PATH`. Double
|
117
|
-
check your settings.
|
118
|
-
|
119
116
|
## Tutorial
|
120
117
|
|
121
118
|
In a nutshell, Maid uses "rules" to define how files are handled. Once you have rules defined, you can either test what
|
data/lib/maid/tools.rb
CHANGED
@@ -4,7 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'time'
|
5
5
|
|
6
6
|
require 'mime/types'
|
7
|
-
require 'zip
|
7
|
+
require 'zip'
|
8
8
|
|
9
9
|
# These "tools" are methods available in the Maid DSL.
|
10
10
|
#
|
@@ -366,8 +366,10 @@ module Maid::Tools
|
|
366
366
|
#
|
367
367
|
# zipfile_contents('foo.zip') # => ['foo.exe', 'README.txt', 'subdir/anything.txt']
|
368
368
|
def zipfile_contents(path)
|
369
|
-
# It might be nice to use `glob` from `Zip::
|
370
|
-
Zip::
|
369
|
+
# It might be nice to use `glob` from `Zip::FileSystem`, but it seems buggy. (Subdirectories aren't included.)
|
370
|
+
Zip::File.open(path) do |zip_file|
|
371
|
+
zip_file.entries.map { |entry| entry.name }.sort
|
372
|
+
end
|
371
373
|
end
|
372
374
|
|
373
375
|
# Calculate disk usage of a given path in kilobytes.
|
data/lib/maid/user_agent.rb
CHANGED
@@ -10,11 +10,10 @@ module Maid::UserAgent
|
|
10
10
|
def value
|
11
11
|
ohai = Ohai::System.new
|
12
12
|
ohai.all_plugins
|
13
|
-
ohai_rb = ohai['languages']['ruby']
|
14
13
|
|
15
14
|
maid = "Maid/#{ ::Maid.const_get(:VERSION) }"
|
16
15
|
platform = "#{ ohai['platform'] }/#{ ohai['platform_version'] }"
|
17
|
-
ruby = "Ruby/#{
|
16
|
+
ruby = "Ruby/#{ RUBY_VERSION } #{ RUBY_PLATFORM }"
|
18
17
|
|
19
18
|
"#{ maid } (#{ platform }; #{ ruby })"
|
20
19
|
end
|
data/lib/maid/version.rb
CHANGED
data/maid.gemspec
CHANGED
@@ -15,15 +15,15 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.rubyforge_project = 'maid'
|
17
17
|
|
18
|
-
s.required_ruby_version = Gem::Requirement.new('>= 1.
|
18
|
+
s.required_ruby_version = Gem::Requirement.new('>= 1.9.3')
|
19
19
|
|
20
20
|
# Strategy: if possible, use ranges (so there are fewer chances of version conflicts)
|
21
|
-
s.add_dependency('escape', '>= 0.0.1', '< 0.1.0') # Used for better Ruby 1.8.7 support
|
21
|
+
s.add_dependency('escape', '>= 0.0.1', '< 0.1.0') # Used for better Ruby 1.8.7 support, could be replaced with `Shellwords`
|
22
22
|
s.add_dependency('thor', '>= 0.14.0', '< 0.19.0')
|
23
23
|
s.add_dependency('deprecated', '~> 3.0.0')
|
24
24
|
s.add_dependency('mime-types', '~> 1.21') # TODO: loosen version restrictions based on testing
|
25
|
-
s.add_dependency('ohai', '>= 6.14.0', '
|
26
|
-
s.add_dependency('rubyzip', '
|
25
|
+
s.add_dependency('ohai', '>= 6.14.0', '~> 6.18.0')
|
26
|
+
s.add_dependency('rubyzip', '~> 1.0.0')
|
27
27
|
s.add_dependency('xdg', '~> 2.2.3') # previous versions had bugs
|
28
28
|
# TODO: use one of these two gems instead of `mdfind`. **But** They have to work on Linux as well.
|
29
29
|
#
|
@@ -32,12 +32,12 @@ Gem::Specification.new do |s|
|
|
32
32
|
|
33
33
|
# Strategy: specific versions (since they're just for development)
|
34
34
|
s.add_development_dependency('fakefs', '~> 0.4.2')
|
35
|
-
s.add_development_dependency('guard', '~>
|
36
|
-
s.add_development_dependency('guard-rspec', '~>
|
37
|
-
s.add_development_dependency('rake', '~> 10.0
|
38
|
-
s.add_development_dependency('redcarpet', '~>
|
39
|
-
s.add_development_dependency('rspec', '~> 2.
|
40
|
-
s.add_development_dependency('timecop', '
|
35
|
+
s.add_development_dependency('guard', '~> 2.2.2')
|
36
|
+
s.add_development_dependency('guard-rspec', '~> 4.0.3')
|
37
|
+
s.add_development_dependency('rake', '~> 10.1.0')
|
38
|
+
s.add_development_dependency('redcarpet', '~> 3.0.0') # Soft dependency of `yard`
|
39
|
+
s.add_development_dependency('rspec', '~> 2.14.1')
|
40
|
+
s.add_development_dependency('timecop', '~> 0.6.3')
|
41
41
|
s.add_development_dependency('yard', '~> 0.8.4')
|
42
42
|
|
43
43
|
# In Vagrant, polling won't cross over the OS boundary if you develop in the host OS but run your tests in the
|
data/script/vagrant-provision
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Documentation: [Shell Provisioner](http://vagrantup.com/v1/docs/provisioners/shell.html)
|
5
5
|
set -o errexit
|
6
6
|
|
7
|
-
# Set to '1.
|
7
|
+
# Set to '1.9.3', 'jruby'
|
8
8
|
target_ruby_version="${1:-1.9.3}"
|
9
9
|
|
10
10
|
# Install the given package, no questions asked.
|
@@ -25,9 +25,9 @@ function install-pkg-if-ruby {
|
|
25
25
|
sudo apt-get update
|
26
26
|
|
27
27
|
# ## Dependencies
|
28
|
-
install-pkg-if-ruby '1.8.7' 'ruby1.8'
|
29
28
|
# Installs `ruby 1.9.3p0`
|
30
29
|
install-pkg-if-ruby '1.9.3' 'ruby1.9.1'
|
30
|
+
install-pkg-if-ruby 'jruby' 'jruby'
|
31
31
|
|
32
32
|
# ## Development dependencies
|
33
33
|
#
|
@@ -36,20 +36,8 @@ install-pkg 'git-core'
|
|
36
36
|
# For building `ffi` for `guard`'s soft dependency on `rb-inotify`
|
37
37
|
install-pkg 'make'
|
38
38
|
install-pkg 'libffi-dev'
|
39
|
-
install-pkg-if-ruby '1.8.7' 'ruby1.8-dev'
|
40
39
|
install-pkg-if-ruby '1.9.3' 'ruby1.9.1-dev'
|
41
40
|
|
42
|
-
# ## RubyGems
|
43
|
-
|
44
|
-
# RubyGems is included in Ruby 1.9, but we need it installed in Ruby 1.8.
|
45
|
-
install-pkg-if-ruby '1.8.7' 'rubygems'
|
46
|
-
|
47
|
-
# That RubyGems package is 1.3.5 (at least on Ubuntu 10.04), and we need to update it to at least 1.3.6 for Bundler.
|
48
|
-
if [ "$target_ruby_version" == '1.8.7' ]; then
|
49
|
-
sudo gem install rubygems-update
|
50
|
-
sudo /var/lib/gems/1.8/bin/update_rubygems
|
51
|
-
fi
|
52
|
-
|
53
41
|
sudo gem install bundler
|
54
42
|
cd /vagrant
|
55
43
|
bundle install
|
data/script/vagrant-test-all
CHANGED
@@ -11,23 +11,6 @@
|
|
11
11
|
#
|
12
12
|
# Base boxes for supported releases are listed below. The idea is to come close to the [official Canonical support timeline](http://en.wikipedia.org/wiki/Ubuntu_releases#Table_of_versions), when possible.
|
13
13
|
#
|
14
|
-
# ### Releases preferred with Ruby 1.8.7
|
15
|
-
#
|
16
|
-
# These older releases of Ubuntu don't provide a prebuilt package for Ruby 1.9.3.
|
17
|
-
#
|
18
|
-
# Supported until 2013-04:
|
19
|
-
#
|
20
|
-
# * `hardy32`: https://raw.github.com/ndj/vagrant-hardy-box-php-5.2/master/hardy-32-php-52-basebox.box
|
21
|
-
#
|
22
|
-
# Supported until 2015-04:
|
23
|
-
#
|
24
|
-
# * `lucid32`: http://files.vagrantup.com/lucid32.box
|
25
|
-
# * `lucid64`: http://files.vagrantup.com/lucid64.box
|
26
|
-
#
|
27
|
-
# Supported until 2013-04:
|
28
|
-
#
|
29
|
-
# * `oneiric64`: https://github.com/shaftoe/vagrant-ubuntu-oneiric64/raw/master/oneiric64.box
|
30
|
-
#
|
31
14
|
# ### Releases preferred with Ruby 1.9.3
|
32
15
|
#
|
33
16
|
# Supported until 2017-04:
|
@@ -35,22 +18,17 @@
|
|
35
18
|
# * `precise32`: http://files.vagrantup.com/precise32.box
|
36
19
|
# * `precise64`: http://files.vagrantup.com/precise64.box
|
37
20
|
#
|
38
|
-
# Supported until 2014-
|
21
|
+
# Supported until 2014-07:
|
39
22
|
#
|
40
|
-
# * `
|
23
|
+
# * `saucy32`
|
24
|
+
# * `saucy64`
|
41
25
|
#
|
42
26
|
# ## See Also
|
43
27
|
#
|
44
28
|
# * [Vagrant Boxes List](http://www.vagrantbox.es/)
|
45
29
|
# * [Contributing Guide](https://github.com/benjaminoakes/maid/wiki/Contributing)
|
46
30
|
|
47
|
-
MAID_TARGET_BOX='hardy32' MAID_TARGET_RUBY='1.8.7' script/vagrant-test
|
48
|
-
# TODO: Locate and add box for `hardy64`
|
49
|
-
MAID_TARGET_BOX='lucid32' MAID_TARGET_RUBY='1.8.7' script/vagrant-test
|
50
|
-
MAID_TARGET_BOX='lucid64' MAID_TARGET_RUBY='1.8.7' script/vagrant-test
|
51
|
-
# TODO: Locate and add box for `oneiric32`
|
52
|
-
MAID_TARGET_BOX='oneiric64' MAID_TARGET_RUBY='1.8.7' script/vagrant-test
|
53
31
|
MAID_TARGET_BOX='precise32' MAID_TARGET_RUBY='1.9.3' script/vagrant-test
|
54
32
|
MAID_TARGET_BOX='precise64' MAID_TARGET_RUBY='1.9.3' script/vagrant-test
|
55
|
-
# TODO: Locate and add box for `
|
56
|
-
|
33
|
+
# TODO: Locate and add box for `saucy32`
|
34
|
+
# TODO: Locate and add box for `saucy64`
|
data/spec/dependency_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'ohai'
|
|
4
4
|
require 'rbconfig'
|
5
5
|
require 'stringio'
|
6
6
|
require 'xdg'
|
7
|
-
require 'zip
|
7
|
+
require 'zip'
|
8
8
|
|
9
9
|
# > What is Dependency Testing?
|
10
10
|
# >
|
@@ -50,12 +50,6 @@ describe 'Dependency expectations' do
|
|
50
50
|
@ohai['platform'].should match(/[a-z]+/i)
|
51
51
|
@ohai['platform_version'].should match(/[0-9]+/)
|
52
52
|
end
|
53
|
-
|
54
|
-
it 'has Ruby information' do
|
55
|
-
ruby = @ohai['languages']['ruby']
|
56
|
-
ruby['version'].should match(/^[0-9\.]+$/i)
|
57
|
-
ruby['platform'].should match(/[a-z0-9]+/i)
|
58
|
-
end
|
59
53
|
end
|
60
54
|
|
61
55
|
describe RbConfig do
|
@@ -76,16 +70,18 @@ describe 'Dependency expectations' do
|
|
76
70
|
end
|
77
71
|
end
|
78
72
|
|
79
|
-
describe Zip::
|
80
|
-
it 'makes entries available with
|
81
|
-
Zip::
|
82
|
-
should == %w(README.txt foo.exe subdir/anything.txt)
|
73
|
+
describe Zip::File do
|
74
|
+
it 'makes entries available with #entries' do
|
75
|
+
Zip::File.open("#@file_fixtures_path/foo.zip") do |zip_file|
|
76
|
+
zip_file.entries.map { |entry| entry.name }.sort.should == %w(README.txt foo.exe subdir/anything.txt)
|
77
|
+
end
|
83
78
|
end
|
84
79
|
|
85
80
|
it 'supports UTF-8 filenames' do
|
86
81
|
# Filename is a Japanese character
|
87
|
-
Zip::
|
88
|
-
should == %w(anything.txt)
|
82
|
+
Zip::File.open("#@file_fixtures_path/\343\201\225.zip") do |zip_file|
|
83
|
+
zip_file.entries.map { |entry| entry.name }.should == %w(anything.txt)
|
84
|
+
end
|
89
85
|
end
|
90
86
|
end
|
91
87
|
end
|
data/spec/lib/maid/app_spec.rb
CHANGED
@@ -23,22 +23,22 @@ module Maid
|
|
23
23
|
|
24
24
|
before do
|
25
25
|
@app = App.new
|
26
|
-
@app.stub
|
27
|
-
@app.stub
|
26
|
+
@app.stub(:maid_options)
|
27
|
+
@app.stub(:say)
|
28
28
|
|
29
29
|
TrashMigration.stub(:needed?) { false }
|
30
30
|
|
31
31
|
# NOTE: It's pretty important that this is stubbed, unless you want your rules to be run over and over when you test!
|
32
|
-
@maid =
|
33
|
-
@maid.stub
|
34
|
-
@maid.stub
|
35
|
-
@maid.stub
|
36
|
-
Maid.stub
|
32
|
+
@maid = double('Maid')
|
33
|
+
@maid.stub(:clean)
|
34
|
+
@maid.stub(:log_device)
|
35
|
+
@maid.stub(:load_rules)
|
36
|
+
Maid.stub(:new) { @maid }
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should make a new Maid with the options' do
|
40
40
|
opts = { :foo => 'bar' }
|
41
|
-
@app.stub
|
41
|
+
@app.stub(:maid_options).and_return(opts)
|
42
42
|
Maid.should_receive(:new).with(opts).and_return(@maid)
|
43
43
|
@app.clean
|
44
44
|
end
|
@@ -93,7 +93,7 @@ module Maid
|
|
93
93
|
# FIXME: This is ugly. Maybe use `Maid.start(%w(version --long))` instead.
|
94
94
|
|
95
95
|
# We can't simply stub `long?` because `options` is a frozen object.
|
96
|
-
options =
|
96
|
+
options = double('options', :long? => true)
|
97
97
|
@app.options = options
|
98
98
|
end
|
99
99
|
|
data/spec/lib/maid/maid_spec.rb
CHANGED
@@ -4,7 +4,7 @@ module Maid
|
|
4
4
|
describe Maid do
|
5
5
|
before do
|
6
6
|
@logger = double('Logger').as_null_object
|
7
|
-
Logger.stub
|
7
|
+
Logger.stub(:new) { @logger }
|
8
8
|
FileUtils.stub(:mkdir_p)
|
9
9
|
end
|
10
10
|
|
@@ -36,7 +36,7 @@ module Maid
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'should take a logger object during intialization' do
|
39
|
-
Logger.unstub
|
39
|
+
Logger.unstub(:new)
|
40
40
|
maid = Maid.new(:logger => @logger)
|
41
41
|
maid.logger.should == @logger
|
42
42
|
end
|
@@ -127,7 +127,7 @@ module Maid
|
|
127
127
|
describe '#clean' do
|
128
128
|
before do
|
129
129
|
@maid = Maid.new
|
130
|
-
@logger.stub
|
130
|
+
@logger.stub(:info)
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'should log start and finish' do
|
@@ -144,7 +144,7 @@ module Maid
|
|
144
144
|
|
145
145
|
describe '#load_rules' do
|
146
146
|
before do
|
147
|
-
Kernel.stub
|
147
|
+
Kernel.stub(: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 'should give an error on STDERR if there is a LoadError' do
|
157
|
-
Kernel.stub
|
157
|
+
Kernel.stub(:load).and_raise(LoadError)
|
158
158
|
STDERR.should_receive(:puts)
|
159
159
|
@maid.load_rules
|
160
160
|
end
|
@@ -183,9 +183,9 @@ module Maid
|
|
183
183
|
maid = Maid.new
|
184
184
|
@logger.should_receive(:info).exactly(n).times
|
185
185
|
rules = (1..n).map do |n|
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
d = double("rule ##{ n }", :description => 'description')
|
187
|
+
d.should_receive(:follow)
|
188
|
+
d
|
189
189
|
end
|
190
190
|
maid.instance_eval { @rules = rules }
|
191
191
|
|
@@ -203,7 +203,7 @@ module Maid
|
|
203
203
|
end
|
204
204
|
|
205
205
|
it 'should report `echo` as a real command' do
|
206
|
-
lambda { @maid.cmd('echo .') }.should_not raise_error
|
206
|
+
lambda { @maid.cmd('echo .') }.should_not raise_error
|
207
207
|
end
|
208
208
|
end
|
209
209
|
end
|
data/spec/lib/maid/tools_spec.rb
CHANGED
@@ -144,14 +144,14 @@ module Maid
|
|
144
144
|
end
|
145
145
|
|
146
146
|
it 'should remove files greater then the remove option size' do
|
147
|
-
@maid.stub
|
147
|
+
@maid.stub(:disk_usage) { 1025 }
|
148
148
|
@maid.trash(@src_file, :remove_over => 1.mb)
|
149
149
|
File.exist?(@src_file).should_not be_true
|
150
150
|
File.exist?(@trash_file).should_not be_true
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'should trash files less then the remove option size' do
|
154
|
-
@maid.stub
|
154
|
+
@maid.stub(:disk_usage) { 1023 }
|
155
155
|
@maid.trash(@src_file, :remove_over => 1.mb)
|
156
156
|
File.exist?(@trash_file).should be_true
|
157
157
|
end
|
@@ -377,9 +377,8 @@ module Maid
|
|
377
377
|
|
378
378
|
describe '#zipfile_contents' do
|
379
379
|
it 'should inspect the contents of a .zip file' do
|
380
|
-
|
381
|
-
|
382
|
-
end
|
380
|
+
entries = [double(:name => 'foo.exe'), double(:name => 'README.txt'), double(:name => 'subdir/anything.txt')]
|
381
|
+
Zip::File.stub(:open).and_yield(entries)
|
383
382
|
|
384
383
|
@maid.zipfile_contents('foo.zip').should == ['README.txt', 'foo.exe', 'subdir/anything.txt']
|
385
384
|
end
|
@@ -7,17 +7,13 @@ module Maid
|
|
7
7
|
system = {
|
8
8
|
'platform' => 'Unix',
|
9
9
|
'platform_version' => '1.0',
|
10
|
-
'languages' => {
|
11
|
-
'ruby' => {
|
12
|
-
'version' => '1.8.8',
|
13
|
-
'platform' => 'pdp7',
|
14
|
-
}
|
15
|
-
}
|
16
10
|
}
|
17
11
|
|
18
12
|
system.stub(:all_plugins)
|
19
13
|
|
20
14
|
Ohai::System.stub(:new) { system }
|
15
|
+
stub_const('RUBY_VERSION', '1.8.8')
|
16
|
+
stub_const('RUBY_PLATFORM', 'pdp7')
|
21
17
|
::Maid.stub(:const_get).with(:VERSION) { '0.0.1' }
|
22
18
|
|
23
19
|
UserAgent.value.should == 'Maid/0.0.1 (Unix/1.0; Ruby/1.8.8 pdp7)'
|
data/spec/lib/maid_spec.rb
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
describe Maid, '.with_instance' do
|
13
13
|
it 'should temporarily set the instance to the given argument and execute the block' do
|
14
|
-
instance =
|
14
|
+
instance = double('instance')
|
15
15
|
Maid.with_instance(instance) { 0 }.should == 0
|
16
16
|
Maid.instance_eval { @instance }.should be_nil
|
17
17
|
end
|
@@ -19,7 +19,7 @@ end
|
|
19
19
|
|
20
20
|
describe Maid, '.rules' do
|
21
21
|
it 'should run in the context of the Maid::Maid instance' do
|
22
|
-
instance =
|
22
|
+
instance = double('instance')
|
23
23
|
instance.should_receive(:foo)
|
24
24
|
|
25
25
|
Maid.with_instance(instance) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.0.
|
4
|
+
version: 0.4.0.beta.1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: escape
|
16
|
-
requirement: &
|
16
|
+
requirement: &15074480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: 0.1.0
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *15074480
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: thor
|
30
|
-
requirement: &
|
30
|
+
requirement: &15072960 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: 0.19.0
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *15072960
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: deprecated
|
44
|
-
requirement: &
|
44
|
+
requirement: &15071660 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
@@ -49,10 +49,10 @@ dependencies:
|
|
49
49
|
version: 3.0.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *15071660
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: mime-types
|
55
|
-
requirement: &
|
55
|
+
requirement: &15071040 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
@@ -60,38 +60,35 @@ dependencies:
|
|
60
60
|
version: '1.21'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *15071040
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: ohai
|
66
|
-
requirement: &
|
66
|
+
requirement: &15070520 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: 6.14.0
|
72
|
-
- -
|
72
|
+
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 6.
|
74
|
+
version: 6.18.0
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
|
-
version_requirements: *
|
77
|
+
version_requirements: *15070520
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rubyzip
|
80
|
-
requirement: &
|
80
|
+
requirement: &15069740 !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 0.5.7
|
86
|
-
- - <
|
83
|
+
- - ~>
|
87
84
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
85
|
+
version: 1.0.0
|
89
86
|
type: :runtime
|
90
87
|
prerelease: false
|
91
|
-
version_requirements: *
|
88
|
+
version_requirements: *15069740
|
92
89
|
- !ruby/object:Gem::Dependency
|
93
90
|
name: xdg
|
94
|
-
requirement: &
|
91
|
+
requirement: &15069280 !ruby/object:Gem::Requirement
|
95
92
|
none: false
|
96
93
|
requirements:
|
97
94
|
- - ~>
|
@@ -99,10 +96,10 @@ dependencies:
|
|
99
96
|
version: 2.2.3
|
100
97
|
type: :runtime
|
101
98
|
prerelease: false
|
102
|
-
version_requirements: *
|
99
|
+
version_requirements: *15069280
|
103
100
|
- !ruby/object:Gem::Dependency
|
104
101
|
name: fakefs
|
105
|
-
requirement: &
|
102
|
+
requirement: &15068800 !ruby/object:Gem::Requirement
|
106
103
|
none: false
|
107
104
|
requirements:
|
108
105
|
- - ~>
|
@@ -110,76 +107,76 @@ dependencies:
|
|
110
107
|
version: 0.4.2
|
111
108
|
type: :development
|
112
109
|
prerelease: false
|
113
|
-
version_requirements: *
|
110
|
+
version_requirements: *15068800
|
114
111
|
- !ruby/object:Gem::Dependency
|
115
112
|
name: guard
|
116
|
-
requirement: &
|
113
|
+
requirement: &15068340 !ruby/object:Gem::Requirement
|
117
114
|
none: false
|
118
115
|
requirements:
|
119
116
|
- - ~>
|
120
117
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
118
|
+
version: 2.2.2
|
122
119
|
type: :development
|
123
120
|
prerelease: false
|
124
|
-
version_requirements: *
|
121
|
+
version_requirements: *15068340
|
125
122
|
- !ruby/object:Gem::Dependency
|
126
123
|
name: guard-rspec
|
127
|
-
requirement: &
|
124
|
+
requirement: &15067880 !ruby/object:Gem::Requirement
|
128
125
|
none: false
|
129
126
|
requirements:
|
130
127
|
- - ~>
|
131
128
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
129
|
+
version: 4.0.3
|
133
130
|
type: :development
|
134
131
|
prerelease: false
|
135
|
-
version_requirements: *
|
132
|
+
version_requirements: *15067880
|
136
133
|
- !ruby/object:Gem::Dependency
|
137
134
|
name: rake
|
138
|
-
requirement: &
|
135
|
+
requirement: &15083620 !ruby/object:Gem::Requirement
|
139
136
|
none: false
|
140
137
|
requirements:
|
141
138
|
- - ~>
|
142
139
|
- !ruby/object:Gem::Version
|
143
|
-
version: 10.0
|
140
|
+
version: 10.1.0
|
144
141
|
type: :development
|
145
142
|
prerelease: false
|
146
|
-
version_requirements: *
|
143
|
+
version_requirements: *15083620
|
147
144
|
- !ruby/object:Gem::Dependency
|
148
145
|
name: redcarpet
|
149
|
-
requirement: &
|
146
|
+
requirement: &15082820 !ruby/object:Gem::Requirement
|
150
147
|
none: false
|
151
148
|
requirements:
|
152
149
|
- - ~>
|
153
150
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
151
|
+
version: 3.0.0
|
155
152
|
type: :development
|
156
153
|
prerelease: false
|
157
|
-
version_requirements: *
|
154
|
+
version_requirements: *15082820
|
158
155
|
- !ruby/object:Gem::Dependency
|
159
156
|
name: rspec
|
160
|
-
requirement: &
|
157
|
+
requirement: &15081680 !ruby/object:Gem::Requirement
|
161
158
|
none: false
|
162
159
|
requirements:
|
163
160
|
- - ~>
|
164
161
|
- !ruby/object:Gem::Version
|
165
|
-
version: 2.
|
162
|
+
version: 2.14.1
|
166
163
|
type: :development
|
167
164
|
prerelease: false
|
168
|
-
version_requirements: *
|
165
|
+
version_requirements: *15081680
|
169
166
|
- !ruby/object:Gem::Dependency
|
170
167
|
name: timecop
|
171
|
-
requirement: &
|
168
|
+
requirement: &15079900 !ruby/object:Gem::Requirement
|
172
169
|
none: false
|
173
170
|
requirements:
|
174
|
-
- -
|
171
|
+
- - ~>
|
175
172
|
- !ruby/object:Gem::Version
|
176
|
-
version: 0.6.
|
173
|
+
version: 0.6.3
|
177
174
|
type: :development
|
178
175
|
prerelease: false
|
179
|
-
version_requirements: *
|
176
|
+
version_requirements: *15079900
|
180
177
|
- !ruby/object:Gem::Dependency
|
181
178
|
name: yard
|
182
|
-
requirement: &
|
179
|
+
requirement: &15079120 !ruby/object:Gem::Requirement
|
183
180
|
none: false
|
184
181
|
requirements:
|
185
182
|
- - ~>
|
@@ -187,10 +184,10 @@ dependencies:
|
|
187
184
|
version: 0.8.4
|
188
185
|
type: :development
|
189
186
|
prerelease: false
|
190
|
-
version_requirements: *
|
187
|
+
version_requirements: *15079120
|
191
188
|
- !ruby/object:Gem::Dependency
|
192
189
|
name: rb-inotify
|
193
|
-
requirement: &
|
190
|
+
requirement: &15077800 !ruby/object:Gem::Requirement
|
194
191
|
none: false
|
195
192
|
requirements:
|
196
193
|
- - ~>
|
@@ -198,10 +195,10 @@ dependencies:
|
|
198
195
|
version: 0.9.0
|
199
196
|
type: :development
|
200
197
|
prerelease: false
|
201
|
-
version_requirements: *
|
198
|
+
version_requirements: *15077800
|
202
199
|
- !ruby/object:Gem::Dependency
|
203
200
|
name: rb-fsevent
|
204
|
-
requirement: &
|
201
|
+
requirement: &15076800 !ruby/object:Gem::Requirement
|
205
202
|
none: false
|
206
203
|
requirements:
|
207
204
|
- - ~>
|
@@ -209,7 +206,7 @@ dependencies:
|
|
209
206
|
version: 0.9.2
|
210
207
|
type: :development
|
211
208
|
prerelease: false
|
212
|
-
version_requirements: *
|
209
|
+
version_requirements: *15076800
|
213
210
|
description: Be lazy. Let Maid clean up after you, based on rules you define. Think
|
214
211
|
of it as "Hazel for hackers".
|
215
212
|
email:
|
@@ -282,7 +279,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
282
279
|
requirements:
|
283
280
|
- - ! '>='
|
284
281
|
- !ruby/object:Gem::Version
|
285
|
-
version: 1.
|
282
|
+
version: 1.9.3
|
286
283
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
287
284
|
none: false
|
288
285
|
requirements:
|