maid 0.6.0.beta.1 → 0.6.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2 -1
- data/README.md +14 -13
- data/lib/maid/tools.rb +12 -0
- data/lib/maid/version.rb +1 -1
- data/maid.gemspec +1 -0
- data/spec/dependency_spec.rb +7 -0
- data/spec/fixtures/files/283x240.jpg +0 -0
- data/spec/lib/maid/tools_spec.rb +18 -3
- metadata +52 -37
data/ChangeLog
CHANGED
@@ -2,7 +2,7 @@ maid (0.6.0) unstable; urgency=low
|
|
2
2
|
|
3
3
|
* Stats! { 'collaborators' => 17, 'downloads' => 16684, 'forks' => 48,
|
4
4
|
'open_issues' => 35, 'closed_issues' => 98, 'stars' => 1045,
|
5
|
-
'users_sharing_rules' =>
|
5
|
+
'users_sharing_rules' => 42 }
|
6
6
|
* Started official support for Ruby 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, and 2.2.0.
|
7
7
|
* Updated dependencies: "thor", "listen", "rufus-scheduler"
|
8
8
|
* Jayson Rhynas: Add Safari download detection to "downloading?" (Closes: #121)
|
@@ -11,6 +11,7 @@ maid (0.6.0) unstable; urgency=low
|
|
11
11
|
* Jurriaan Pruis: Add "ignore" option support for "watch" (Closes: #132)
|
12
12
|
* Nico Ritschel: Add "copy" tool (Closes: #72, #133)
|
13
13
|
* Add maid introduction and links (Closes: #128)
|
14
|
+
* Add "dimensions_px" tool, inspired by Coby Chapple's rules
|
14
15
|
|
15
16
|
-- Benjamin Oakes <hello@benjaminoakes.com> TODO
|
16
17
|
|
data/README.md
CHANGED
@@ -195,8 +195,7 @@ For help with command line usage, run `maid help`. For more help, please see th
|
|
195
195
|
Once you get a hang for what you can do with Maid, let it do its stuff automatically throughout the day. You'll find
|
196
196
|
your computer stays a little tidier with as you teach it how to handle your common files.
|
197
197
|
|
198
|
-
**Note:**
|
199
|
-
That said, I find `cron` to take care of most of my needs. Pull requests are welcome, however. :)
|
198
|
+
**Note:** Daemon support (using `fsevent`/`inotify`) was recently added. That said, `cron` takes care of the needs of many users.
|
200
199
|
|
201
200
|
To do this, edit your crontab in your tool of choice:
|
202
201
|
|
@@ -217,24 +216,26 @@ To run Maid as a daemon you first have to specify watch/repeat rules.
|
|
217
216
|
They are defined like this:
|
218
217
|
|
219
218
|
```ruby
|
220
|
-
|
221
|
-
|
222
|
-
|
219
|
+
Maid.rules do
|
220
|
+
repeat '1s' do
|
221
|
+
rule 'This rule will run every second' do
|
222
|
+
# some task
|
223
|
+
end
|
223
224
|
end
|
224
|
-
end
|
225
225
|
|
226
|
-
watch '/home/user/Downloads' do
|
227
|
-
|
228
|
-
|
226
|
+
watch '/home/user/Downloads' do
|
227
|
+
rule 'This rule will run on every change to the downloads directory' do
|
228
|
+
# another task
|
229
|
+
end
|
229
230
|
end
|
230
|
-
end
|
231
231
|
|
232
|
-
watch '~/Desktop', ignore: /some_directory/ do
|
233
|
-
|
232
|
+
watch '~/Desktop', ignore: /some_directory/ do
|
233
|
+
# rules in here
|
234
|
+
end
|
234
235
|
end
|
235
236
|
```
|
236
237
|
|
237
|
-
To run the daemon run `maid daemon
|
238
|
+
To run the daemon run `maid daemon`. Starting the daemon on login depends on the platform.
|
238
239
|
|
239
240
|
### Rake Tasks
|
240
241
|
|
data/lib/maid/tools.rb
CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'time'
|
5
5
|
|
6
6
|
require 'mime/types'
|
7
|
+
require 'dimensions'
|
7
8
|
require 'zip'
|
8
9
|
|
9
10
|
# These "tools" are methods available in the Maid DSL.
|
@@ -398,6 +399,17 @@ module Maid::Tools
|
|
398
399
|
flatten
|
399
400
|
end
|
400
401
|
|
402
|
+
# Determine the dimensions of GIF, PNG, JPEG, or TIFF images.
|
403
|
+
#
|
404
|
+
# Value returned is [width, height].
|
405
|
+
#
|
406
|
+
# ## Examples
|
407
|
+
#
|
408
|
+
# dimensions_px('image.jpg') # => [1024, 768]
|
409
|
+
def dimensions_px(path)
|
410
|
+
Dimensions.dimensions(path)
|
411
|
+
end
|
412
|
+
|
401
413
|
# [Mac OS X] Use Spotlight metadata to determine audio length.
|
402
414
|
#
|
403
415
|
# ## Examples
|
data/lib/maid/version.rb
CHANGED
data/maid.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
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', '< 1.0.0')
|
23
23
|
s.add_dependency('deprecated', '~> 3.0.0')
|
24
|
+
s.add_dependency('dimensions', '>= 1.0.0', '< 2.0')
|
24
25
|
s.add_dependency('mime-types', '~> 2.0')
|
25
26
|
s.add_dependency('rubyzip', '~> 1.1.0')
|
26
27
|
s.add_dependency('xdg', '~> 2.2.3') # previous versions had bugs
|
data/spec/dependency_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'dimensions'
|
1
2
|
require 'logger'
|
2
3
|
require 'mime/types'
|
3
4
|
require 'rbconfig'
|
@@ -77,4 +78,10 @@ describe 'Dependency expectations' do
|
|
77
78
|
end
|
78
79
|
end
|
79
80
|
end
|
81
|
+
|
82
|
+
describe Dimensions do
|
83
|
+
it 'returns dimensions as an array' do
|
84
|
+
expect(Dimensions.dimensions("#@file_fixtures_path/283x240.jpg")).to eq([283, 240])
|
85
|
+
end
|
86
|
+
end
|
80
87
|
end
|
Binary file
|
data/spec/lib/maid/tools_spec.rb
CHANGED
@@ -630,6 +630,20 @@ module Maid
|
|
630
630
|
end
|
631
631
|
end
|
632
632
|
|
633
|
+
describe '#dimensions_px' do
|
634
|
+
context 'given a JPEG image' do
|
635
|
+
it 'reports the known size' do
|
636
|
+
expect(@maid.dimensions_px(image_path)).to eq([32, 32])
|
637
|
+
end
|
638
|
+
end
|
639
|
+
|
640
|
+
context 'given an unknown type' do
|
641
|
+
it 'returns nil' do
|
642
|
+
expect(@maid.dimensions_px(unknown_path)).to be_nil
|
643
|
+
end
|
644
|
+
end
|
645
|
+
end
|
646
|
+
|
633
647
|
describe '#mime_type' do
|
634
648
|
context 'given a JPEG image' do
|
635
649
|
it 'reports "image/jpeg"' do
|
@@ -660,11 +674,12 @@ module Maid
|
|
660
674
|
|
661
675
|
describe '#where_content_type' do
|
662
676
|
context 'given "image"' do
|
663
|
-
it 'only lists the fixture
|
677
|
+
it 'only lists the fixture JPEGs' do
|
664
678
|
matches = @maid.where_content_type(@maid.dir(file_fixtures_glob), 'image')
|
665
679
|
|
666
|
-
expect(matches.length).to eq(
|
667
|
-
expect(matches.first).to end_with('spec/fixtures/files/
|
680
|
+
expect(matches.length).to eq(2)
|
681
|
+
expect(matches.first).to end_with('spec/fixtures/files/283x240.jpg')
|
682
|
+
expect(matches.last).to end_with('spec/fixtures/files/ruby.jpg')
|
668
683
|
end
|
669
684
|
end
|
670
685
|
end
|
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.6.0.beta.
|
4
|
+
version: 0.6.0.beta.2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-12-31 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: escape
|
16
|
-
requirement: &
|
16
|
+
requirement: &12511240 !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: *12511240
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: thor
|
30
|
-
requirement: &
|
30
|
+
requirement: &12508320 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: 1.0.0
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *12508320
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: deprecated
|
44
|
-
requirement: &
|
44
|
+
requirement: &12506260 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
@@ -49,10 +49,24 @@ dependencies:
|
|
49
49
|
version: 3.0.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *12506260
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: dimensions
|
55
|
+
requirement: &12503140 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.0.0
|
61
|
+
- - <
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '2.0'
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: *12503140
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: mime-types
|
55
|
-
requirement: &
|
69
|
+
requirement: &12501680 !ruby/object:Gem::Requirement
|
56
70
|
none: false
|
57
71
|
requirements:
|
58
72
|
- - ~>
|
@@ -60,10 +74,10 @@ dependencies:
|
|
60
74
|
version: '2.0'
|
61
75
|
type: :runtime
|
62
76
|
prerelease: false
|
63
|
-
version_requirements: *
|
77
|
+
version_requirements: *12501680
|
64
78
|
- !ruby/object:Gem::Dependency
|
65
79
|
name: rubyzip
|
66
|
-
requirement: &
|
80
|
+
requirement: &12499880 !ruby/object:Gem::Requirement
|
67
81
|
none: false
|
68
82
|
requirements:
|
69
83
|
- - ~>
|
@@ -71,10 +85,10 @@ dependencies:
|
|
71
85
|
version: 1.1.0
|
72
86
|
type: :runtime
|
73
87
|
prerelease: false
|
74
|
-
version_requirements: *
|
88
|
+
version_requirements: *12499880
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: xdg
|
77
|
-
requirement: &
|
91
|
+
requirement: &12496640 !ruby/object:Gem::Requirement
|
78
92
|
none: false
|
79
93
|
requirements:
|
80
94
|
- - ~>
|
@@ -82,10 +96,10 @@ dependencies:
|
|
82
96
|
version: 2.2.3
|
83
97
|
type: :runtime
|
84
98
|
prerelease: false
|
85
|
-
version_requirements: *
|
99
|
+
version_requirements: *12496640
|
86
100
|
- !ruby/object:Gem::Dependency
|
87
101
|
name: listen
|
88
|
-
requirement: &
|
102
|
+
requirement: &12495320 !ruby/object:Gem::Requirement
|
89
103
|
none: false
|
90
104
|
requirements:
|
91
105
|
- - ~>
|
@@ -93,10 +107,10 @@ dependencies:
|
|
93
107
|
version: 2.8.0
|
94
108
|
type: :runtime
|
95
109
|
prerelease: false
|
96
|
-
version_requirements: *
|
110
|
+
version_requirements: *12495320
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rufus-scheduler
|
99
|
-
requirement: &
|
113
|
+
requirement: &12493620 !ruby/object:Gem::Requirement
|
100
114
|
none: false
|
101
115
|
requirements:
|
102
116
|
- - ~>
|
@@ -104,10 +118,10 @@ dependencies:
|
|
104
118
|
version: 3.0.6
|
105
119
|
type: :runtime
|
106
120
|
prerelease: false
|
107
|
-
version_requirements: *
|
121
|
+
version_requirements: *12493620
|
108
122
|
- !ruby/object:Gem::Dependency
|
109
123
|
name: fakefs
|
110
|
-
requirement: &
|
124
|
+
requirement: &12492700 !ruby/object:Gem::Requirement
|
111
125
|
none: false
|
112
126
|
requirements:
|
113
127
|
- - ~>
|
@@ -115,10 +129,10 @@ dependencies:
|
|
115
129
|
version: 0.4.2
|
116
130
|
type: :development
|
117
131
|
prerelease: false
|
118
|
-
version_requirements: *
|
132
|
+
version_requirements: *12492700
|
119
133
|
- !ruby/object:Gem::Dependency
|
120
134
|
name: guard
|
121
|
-
requirement: &
|
135
|
+
requirement: &12491920 !ruby/object:Gem::Requirement
|
122
136
|
none: false
|
123
137
|
requirements:
|
124
138
|
- - ~>
|
@@ -126,10 +140,10 @@ dependencies:
|
|
126
140
|
version: 2.10.4
|
127
141
|
type: :development
|
128
142
|
prerelease: false
|
129
|
-
version_requirements: *
|
143
|
+
version_requirements: *12491920
|
130
144
|
- !ruby/object:Gem::Dependency
|
131
145
|
name: guard-rspec
|
132
|
-
requirement: &
|
146
|
+
requirement: &12490940 !ruby/object:Gem::Requirement
|
133
147
|
none: false
|
134
148
|
requirements:
|
135
149
|
- - ~>
|
@@ -137,10 +151,10 @@ dependencies:
|
|
137
151
|
version: 4.5.0
|
138
152
|
type: :development
|
139
153
|
prerelease: false
|
140
|
-
version_requirements: *
|
154
|
+
version_requirements: *12490940
|
141
155
|
- !ruby/object:Gem::Dependency
|
142
156
|
name: rake
|
143
|
-
requirement: &
|
157
|
+
requirement: &12489340 !ruby/object:Gem::Requirement
|
144
158
|
none: false
|
145
159
|
requirements:
|
146
160
|
- - ~>
|
@@ -148,10 +162,10 @@ dependencies:
|
|
148
162
|
version: 10.4.2
|
149
163
|
type: :development
|
150
164
|
prerelease: false
|
151
|
-
version_requirements: *
|
165
|
+
version_requirements: *12489340
|
152
166
|
- !ruby/object:Gem::Dependency
|
153
167
|
name: redcarpet
|
154
|
-
requirement: &
|
168
|
+
requirement: &12488580 !ruby/object:Gem::Requirement
|
155
169
|
none: false
|
156
170
|
requirements:
|
157
171
|
- - ~>
|
@@ -159,10 +173,10 @@ dependencies:
|
|
159
173
|
version: 3.2.2
|
160
174
|
type: :development
|
161
175
|
prerelease: false
|
162
|
-
version_requirements: *
|
176
|
+
version_requirements: *12488580
|
163
177
|
- !ruby/object:Gem::Dependency
|
164
178
|
name: rspec
|
165
|
-
requirement: &
|
179
|
+
requirement: &12487780 !ruby/object:Gem::Requirement
|
166
180
|
none: false
|
167
181
|
requirements:
|
168
182
|
- - ~>
|
@@ -170,10 +184,10 @@ dependencies:
|
|
170
184
|
version: 3.1.0
|
171
185
|
type: :development
|
172
186
|
prerelease: false
|
173
|
-
version_requirements: *
|
187
|
+
version_requirements: *12487780
|
174
188
|
- !ruby/object:Gem::Dependency
|
175
189
|
name: timecop
|
176
|
-
requirement: &
|
190
|
+
requirement: &12483760 !ruby/object:Gem::Requirement
|
177
191
|
none: false
|
178
192
|
requirements:
|
179
193
|
- - ~>
|
@@ -181,10 +195,10 @@ dependencies:
|
|
181
195
|
version: 0.7.0
|
182
196
|
type: :development
|
183
197
|
prerelease: false
|
184
|
-
version_requirements: *
|
198
|
+
version_requirements: *12483760
|
185
199
|
- !ruby/object:Gem::Dependency
|
186
200
|
name: yard
|
187
|
-
requirement: &
|
201
|
+
requirement: &12456320 !ruby/object:Gem::Requirement
|
188
202
|
none: false
|
189
203
|
requirements:
|
190
204
|
- - ~>
|
@@ -192,10 +206,10 @@ dependencies:
|
|
192
206
|
version: 0.8.4
|
193
207
|
type: :development
|
194
208
|
prerelease: false
|
195
|
-
version_requirements: *
|
209
|
+
version_requirements: *12456320
|
196
210
|
- !ruby/object:Gem::Dependency
|
197
211
|
name: rb-inotify
|
198
|
-
requirement: &
|
212
|
+
requirement: &12454800 !ruby/object:Gem::Requirement
|
199
213
|
none: false
|
200
214
|
requirements:
|
201
215
|
- - ~>
|
@@ -203,10 +217,10 @@ dependencies:
|
|
203
217
|
version: 0.9.0
|
204
218
|
type: :development
|
205
219
|
prerelease: false
|
206
|
-
version_requirements: *
|
220
|
+
version_requirements: *12454800
|
207
221
|
- !ruby/object:Gem::Dependency
|
208
222
|
name: rb-fsevent
|
209
|
-
requirement: &
|
223
|
+
requirement: &12452460 !ruby/object:Gem::Requirement
|
210
224
|
none: false
|
211
225
|
requirements:
|
212
226
|
- - ~>
|
@@ -214,7 +228,7 @@ dependencies:
|
|
214
228
|
version: 0.9.2
|
215
229
|
type: :development
|
216
230
|
prerelease: false
|
217
|
-
version_requirements: *
|
231
|
+
version_requirements: *12452460
|
218
232
|
description: Be lazy. Let Maid clean up after you, based on rules you define. Think
|
219
233
|
of it as "Hazel for hackers".
|
220
234
|
email:
|
@@ -267,6 +281,7 @@ files:
|
|
267
281
|
- script/vagrant-test-all
|
268
282
|
- spec/dependency_spec.rb
|
269
283
|
- spec/fixtures/files/1.zip
|
284
|
+
- spec/fixtures/files/283x240.jpg
|
270
285
|
- spec/fixtures/files/bar.zip
|
271
286
|
- spec/fixtures/files/foo.zip
|
272
287
|
- spec/fixtures/files/ruby.jpg
|