maid 0.1.2 → 0.1.3.beta.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.
@@ -0,0 +1,76 @@
1
+ require 'fileutils'
2
+
3
+ require 'spec_helper'
4
+
5
+ module Maid
6
+ describe TrashMigration, :fakefs => true do
7
+ context 'when running on Linux' do
8
+ before do
9
+ Platform.stub(:linux?) { true }
10
+ end
11
+
12
+ context 'and the incorrect trash path does not exist' do
13
+ it 'is not needed' do
14
+ subject.needed?.should be_false
15
+ end
16
+ end
17
+
18
+ context 'and the incorrect trash path exists' do
19
+ before do
20
+ FileUtils.mkdir_p(subject.incorrect_trash)
21
+ end
22
+
23
+ it 'is needed' do
24
+ subject.needed?.should be_true
25
+ end
26
+
27
+ context 'and the kill switch is activated' do
28
+ before do
29
+ ENV.stub(:[]).with('MAID_NO_MIGRATE_TRASH') { 'any-value' }
30
+ end
31
+
32
+ it 'is not needed' do
33
+ subject.needed?.should be_false
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ context 'when running on OS X' do
40
+ before do
41
+ Platform.stub(:linux?) { false }
42
+ end
43
+
44
+ it 'is not needed' do
45
+ subject.needed?.should be_false
46
+ end
47
+ end
48
+
49
+ describe 'performing' do
50
+ before do
51
+ Logger.stub(:new) { mock('Logger').as_null_object }
52
+ end
53
+
54
+ it 'moves files from the incorrect trash to the correct trash' do
55
+ # This will only be performed on Linux, but we test on both platforms, so stub:
56
+ subject.stub(:correct_trash) { File.expand_path('~/.local/share/Trash/files/') }
57
+
58
+ filename = 'foo.txt'
59
+ FileUtils.mkdir_p(subject.incorrect_trash)
60
+ FileUtils.touch(subject.incorrect_trash + filename)
61
+
62
+ FileUtils.mkdir_p(subject.correct_trash)
63
+ Dir["#{ subject.correct_trash }/*"].should be_empty
64
+
65
+ subject.perform
66
+
67
+ # For some reason (perhaps a bug in fakefs), `File.exists?` wasn't giving the results I expected, but `Dir[]` did.
68
+ Dir[subject.incorrect_trash].should be_empty
69
+ trash_contents = Dir["#{ subject.correct_trash }/*"]
70
+ trash_contents.length.should == 2
71
+ trash_contents[0].should match(/files\/\.Trash$/)
72
+ trash_contents[1].should match(/files\/foo.txt$/)
73
+ end
74
+ end
75
+ end
76
+ end
@@ -1,9 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Maid do
4
- it 'should include Maid::NumericExtensions' do
4
+ it 'should include Maid::NumericExtensions::Time' do
5
5
  1.minute.should == 60
6
6
  end
7
+ it 'should include Maid::NumericExtensions::SizeToKb' do
8
+ 1.megabyte.should == 1024
9
+ end
7
10
  end
8
11
 
9
12
  describe Maid, '.with_instance' do
@@ -1,9 +1,17 @@
1
1
  require 'rubygems'
2
2
  require 'rspec'
3
3
  require 'timecop'
4
+ require 'fakefs/spec_helpers'
4
5
 
5
6
  require 'maid'
6
7
 
7
- Rspec.configure do |c|
8
+ RSpec.configure do |c|
8
9
  c.mock_with :rspec
10
+ c.include FakeFS::SpecHelpers, :fakefs => true
11
+ end
12
+
13
+ RSpec::Matchers.define :have_deprecated_method do |expected|
14
+ match do |actual|
15
+ actual.should_receive(:__deprecated_run_action__).with(expected, anything)
16
+ end
9
17
  end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
4
+ hash: 62196393
5
+ prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ - beta
11
+ - 1
12
+ version: 0.1.3.beta.1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Benjamin Oakes
@@ -15,88 +17,170 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-09-03 00:00:00 Z
20
+ date: 2012-10-15 00:00:00 -05:00
21
+ default_executable:
19
22
  dependencies:
20
23
  - !ruby/object:Gem::Dependency
21
- prerelease: false
22
24
  name: thor
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
24
27
  none: false
25
28
  requirements:
26
29
  - - ~>
27
30
  - !ruby/object:Gem::Version
28
- hash: 43
31
+ hash: 95
29
32
  segments:
30
33
  - 0
31
- - 14
32
- - 6
33
- version: 0.14.6
34
- requirement: *id001
34
+ - 16
35
+ - 0
36
+ version: 0.16.0
35
37
  type: :runtime
38
+ version_requirements: *id001
36
39
  - !ruby/object:Gem::Dependency
40
+ name: deprecated
37
41
  prerelease: false
38
- name: rake
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
42
+ requirement: &id002 !ruby/object:Gem::Requirement
40
43
  none: false
41
44
  requirements:
42
45
  - - ~>
43
46
  - !ruby/object:Gem::Version
44
- hash: 49
47
+ hash: 5
45
48
  segments:
49
+ - 3
46
50
  - 0
47
- - 8
48
- - 7
49
- version: 0.8.7
50
- requirement: *id002
51
+ - 1
52
+ version: 3.0.1
53
+ type: :runtime
54
+ version_requirements: *id002
55
+ - !ruby/object:Gem::Dependency
56
+ name: xdg
57
+ prerelease: false
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 2
66
+ - 2
67
+ - 2
68
+ version: 2.2.2
69
+ type: :runtime
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: guard
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ hash: 7
80
+ segments:
81
+ - 1
82
+ - 4
83
+ - 0
84
+ version: 1.4.0
51
85
  type: :development
86
+ version_requirements: *id004
52
87
  - !ruby/object:Gem::Dependency
88
+ name: guard-rspec
53
89
  prerelease: false
54
- name: rspec
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
90
+ requirement: &id005 !ruby/object:Gem::Requirement
56
91
  none: false
57
92
  requirements:
58
93
  - - ~>
59
94
  - !ruby/object:Gem::Version
60
- hash: 27
95
+ hash: 11
61
96
  segments:
62
97
  - 2
63
- - 5
98
+ - 1
99
+ - 0
100
+ version: 2.1.0
101
+ type: :development
102
+ version_requirements: *id005
103
+ - !ruby/object:Gem::Dependency
104
+ name: rake
105
+ prerelease: false
106
+ requirement: &id006 !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ~>
110
+ - !ruby/object:Gem::Version
111
+ hash: 11
112
+ segments:
64
113
  - 0
65
- version: 2.5.0
66
- requirement: *id003
114
+ - 9
115
+ - 2
116
+ - 2
117
+ version: 0.9.2.2
67
118
  type: :development
119
+ version_requirements: *id006
68
120
  - !ruby/object:Gem::Dependency
121
+ name: rspec
69
122
  prerelease: false
123
+ requirement: &id007 !ruby/object:Gem::Requirement
124
+ none: false
125
+ requirements:
126
+ - - ~>
127
+ - !ruby/object:Gem::Version
128
+ hash: 35
129
+ segments:
130
+ - 2
131
+ - 11
132
+ - 0
133
+ version: 2.11.0
134
+ type: :development
135
+ version_requirements: *id007
136
+ - !ruby/object:Gem::Dependency
70
137
  name: timecop
71
- version_requirements: &id004 !ruby/object:Gem::Requirement
138
+ prerelease: false
139
+ requirement: &id008 !ruby/object:Gem::Requirement
72
140
  none: false
73
141
  requirements:
74
142
  - - ~>
75
143
  - !ruby/object:Gem::Version
76
- hash: 25
144
+ hash: 15
77
145
  segments:
78
146
  - 0
79
- - 3
80
147
  - 5
81
- version: 0.3.5
82
- requirement: *id004
148
+ - 2
149
+ version: 0.5.2
83
150
  type: :development
151
+ version_requirements: *id008
84
152
  - !ruby/object:Gem::Dependency
153
+ name: fakefs
85
154
  prerelease: false
86
- name: ZenTest
87
- version_requirements: &id005 !ruby/object:Gem::Requirement
155
+ requirement: &id009 !ruby/object:Gem::Requirement
88
156
  none: false
89
157
  requirements:
90
158
  - - ~>
91
159
  - !ruby/object:Gem::Version
92
- hash: 43
160
+ hash: 15
93
161
  segments:
162
+ - 0
94
163
  - 4
95
- - 4
164
+ - 0
165
+ version: 0.4.0
166
+ type: :development
167
+ version_requirements: *id009
168
+ - !ruby/object:Gem::Dependency
169
+ name: rb-fsevent
170
+ prerelease: false
171
+ requirement: &id010 !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ~>
175
+ - !ruby/object:Gem::Version
176
+ hash: 63
177
+ segments:
178
+ - 0
179
+ - 9
96
180
  - 2
97
- version: 4.4.2
98
- requirement: *id005
181
+ version: 0.9.2
99
182
  type: :development
183
+ version_requirements: *id010
100
184
  description: Be lazy. Let Maid clean up after you, based on rules you define.
101
185
  email:
102
186
  - hello@benjaminoakes.com
@@ -111,34 +195,40 @@ files:
111
195
  - .rspec
112
196
  - .rvmrc
113
197
  - .travis.yml
114
- - CONTRIBUTING.rdoc
115
198
  - Gemfile
116
- - Gemfile.lock
199
+ - Guardfile
117
200
  - LICENSE
118
201
  - Maidfile
119
202
  - README.md
120
203
  - Rakefile
121
204
  - TODO.rdoc
205
+ - Vagrantfile
122
206
  - bin/maid
123
- - configure
124
207
  - lib/maid.rb
125
208
  - lib/maid/app.rb
126
209
  - lib/maid/maid.rb
127
210
  - lib/maid/numeric_extensions.rb
211
+ - lib/maid/platform.rb
128
212
  - lib/maid/rule.rb
129
213
  - lib/maid/rules.sample.rb
130
214
  - lib/maid/tools.rb
215
+ - lib/maid/trash_migration.rb
131
216
  - lib/maid/version.rb
132
217
  - maid.gemspec
218
+ - resources/OneThingWell.png
133
219
  - resources/download-for-ubuntu.png
134
- - script/micro-maid.sh
220
+ - resources/ruby5.gif
221
+ - script/provision
135
222
  - spec/lib/maid/app_spec.rb
136
223
  - spec/lib/maid/maid_spec.rb
137
224
  - spec/lib/maid/numeric_extensions_spec.rb
225
+ - spec/lib/maid/platform_spec.rb
138
226
  - spec/lib/maid/rule_spec.rb
139
227
  - spec/lib/maid/tools_spec.rb
228
+ - spec/lib/maid/trash_migration_spec.rb
140
229
  - spec/lib/maid_spec.rb
141
230
  - spec/spec_helper.rb
231
+ has_rdoc: true
142
232
  homepage: http://github.com/benjaminoakes/maid
143
233
  licenses: []
144
234
 
@@ -159,18 +249,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
249
  required_rubygems_version: !ruby/object:Gem::Requirement
160
250
  none: false
161
251
  requirements:
162
- - - ">="
252
+ - - ">"
163
253
  - !ruby/object:Gem::Version
164
- hash: 3
254
+ hash: 25
165
255
  segments:
166
- - 0
167
- version: "0"
256
+ - 1
257
+ - 3
258
+ - 1
259
+ version: 1.3.1
168
260
  requirements: []
169
261
 
170
262
  rubyforge_project: maid
171
- rubygems_version: 1.8.24
263
+ rubygems_version: 1.6.2
172
264
  signing_key:
173
265
  specification_version: 3
174
266
  summary: Be lazy. Let Maid clean up after you, based on rules you define.
175
- test_files: []
176
-
267
+ test_files:
268
+ - spec/lib/maid/app_spec.rb
269
+ - spec/lib/maid/maid_spec.rb
270
+ - spec/lib/maid/numeric_extensions_spec.rb
271
+ - spec/lib/maid/platform_spec.rb
272
+ - spec/lib/maid/rule_spec.rb
273
+ - spec/lib/maid/tools_spec.rb
274
+ - spec/lib/maid/trash_migration_spec.rb
275
+ - spec/lib/maid_spec.rb
276
+ - spec/spec_helper.rb
@@ -1,25 +0,0 @@
1
- = Contributing
2
-
3
- Wow, you want to contribute? That's awesome! Thanks!
4
-
5
- To make things easier on you, I've compiled some Notes and Guidelines.
6
-
7
- == Notes
8
-
9
- * This is a Ruby Gem, built using Bundler. For a walkthrough of how that works, see http://railscasts.com/episodes/245-new-gem-with-bundler.
10
- * `rake install` builds and installs the gem, but you'll probably need to do `sudo rake install`. This lets you test the `maid` command.
11
- * Keep in mind that the gemspec only looks at files in the VCS (git).
12
- * Developing using Ruby 1.9.2? Use "irb -I lib -r maid" to have access to Maid in irb.
13
-
14
- == Guidelines
15
-
16
- * Looking for something to do? Anything in the TODO file is a good place to start.
17
- * Whenever possible, retain compatibility with Ruby 1.8.7.
18
-
19
- == Note on Patches/Pull Requests
20
-
21
- * Fork the project.
22
- * Make your feature addition or bug fix.
23
- * Add tests for it. This is important so I don't break it in a future version unintentionally.
24
- * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
25
- * Send me a pull request. Bonus points for topic branches.
@@ -1,32 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- maid (0.1.2)
5
- thor (~> 0.14.6)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- ZenTest (4.4.2)
11
- diff-lcs (1.1.2)
12
- rake (0.8.7)
13
- rspec (2.5.0)
14
- rspec-core (~> 2.5.0)
15
- rspec-expectations (~> 2.5.0)
16
- rspec-mocks (~> 2.5.0)
17
- rspec-core (2.5.2)
18
- rspec-expectations (2.5.0)
19
- diff-lcs (~> 1.1.2)
20
- rspec-mocks (2.5.0)
21
- thor (0.14.6)
22
- timecop (0.3.5)
23
-
24
- PLATFORMS
25
- ruby
26
-
27
- DEPENDENCIES
28
- ZenTest (~> 4.4.2)
29
- maid!
30
- rake (~> 0.8.7)
31
- rspec (~> 2.5.0)
32
- timecop (~> 0.3.5)