fssm 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 0
4
+ :patch: 1
5
5
  :build:
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fssm}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Travis Tilley"]
12
- s.date = %q{2010-11-13}
12
+ s.date = %q{2010-12-10}
13
13
  s.description = %q{file system state monitor}
14
14
  s.email = %q{ttilley@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
38
38
  "lib/fssm/tree.rb",
39
39
  "profile/prof-cache.rb",
40
40
  "profile/prof-fssm-pathname.html",
41
+ "profile/prof-pathname-rubinius.rb",
41
42
  "profile/prof-pathname.rb",
42
43
  "profile/prof-plain-pathname.html",
43
44
  "profile/prof.html",
@@ -52,7 +53,7 @@ Gem::Specification.new do |s|
52
53
  ]
53
54
  s.homepage = %q{http://github.com/ttilley/fssm}
54
55
  s.require_paths = ["lib"]
55
- s.rubygems_version = %q{1.3.6}
56
+ s.rubygems_version = %q{1.3.7}
56
57
  s.summary = %q{file system state monitor}
57
58
  s.test_files = [
58
59
  "spec/monitor_spec.rb",
@@ -65,7 +66,7 @@ Gem::Specification.new do |s|
65
66
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
67
  s.specification_version = 3
67
68
 
68
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
70
  s.add_development_dependency(%q<rspec>, [">= 0"])
70
71
  else
71
72
  s.add_dependency(%q<rspec>, [">= 0"])
@@ -11,13 +11,13 @@ module FSSM
11
11
 
12
12
  class << self
13
13
  def for(path)
14
- path.is_a?(::FSSM::Pathname) ? path : new("#{path}")
14
+ path.is_a?(::FSSM::Pathname) ? path : new(path.to_s)
15
15
  end
16
16
  end
17
17
 
18
18
  def initialize(path)
19
- raise ArgumentError, "path cannot contain ASCII NULLs" if path =~ %r{\0}
20
- super(path)
19
+ raise ArgumentError, "path cannot contain ASCII NULLs" if path.to_s =~ %r{\0}
20
+ super(path.to_s)
21
21
  end
22
22
 
23
23
  def <=>(other)
@@ -183,16 +183,17 @@ module FSSM
183
183
  end
184
184
 
185
185
  def to_s
186
- "#{self}"
186
+ # this is required to work in rubinius
187
+ String.allocate.replace(self)
187
188
  end
188
189
 
189
190
  alias to_str to_s
190
191
 
191
192
  def unlink
192
- Dir.unlink(self)
193
+ Dir.unlink(self.to_s)
193
194
  true
194
195
  rescue Errno::ENOTDIR
195
- File.unlink(self)
196
+ File.unlink(self.to_s)
196
197
  true
197
198
  end
198
199
  end
@@ -207,19 +208,19 @@ module FSSM
207
208
  end
208
209
 
209
210
  def entries
210
- Dir.entries(self).map! {|e| FSSM::Pathname.new(e) }
211
+ Dir.entries(self.to_s).map! {|e| FSSM::Pathname.new(e) }
211
212
  end
212
213
 
213
214
  def mkdir(mode = 0777)
214
- Dir.mkdir(self, mode)
215
+ Dir.mkdir(self.to_s, mode)
215
216
  end
216
217
 
217
218
  def opendir(&blk)
218
- Dir.open(self, &blk)
219
+ Dir.open(self.to_s, &blk)
219
220
  end
220
221
 
221
222
  def rmdir
222
- Dir.rmdir(self)
223
+ Dir.rmdir(self.to_s)
223
224
  end
224
225
 
225
226
  def self.glob(pattern, flags = 0)
@@ -242,127 +243,127 @@ module FSSM
242
243
 
243
244
  def chdir
244
245
  blk = lambda { yield self } if block_given?
245
- Dir.chdir(self, &blk)
246
+ Dir.chdir(self.to_s, &blk)
246
247
  end
247
248
  end
248
249
 
249
250
  class Pathname
250
251
  def blockdev?
251
- FileTest.blockdev?(self)
252
+ FileTest.blockdev?(self.to_s)
252
253
  end
253
254
 
254
255
  def chardev?
255
- FileTest.chardev?(self)
256
+ FileTest.chardev?(self.to_s)
256
257
  end
257
258
 
258
259
  def directory?
259
- FileTest.directory?(self)
260
+ FileTest.directory?(self.to_s)
260
261
  end
261
262
 
262
263
  def executable?
263
- FileTest.executable?(self)
264
+ FileTest.executable?(self.to_s)
264
265
  end
265
266
 
266
267
  def executable_real?
267
- FileTest.executable_real?(self)
268
+ FileTest.executable_real?(self.to_s)
268
269
  end
269
270
 
270
271
  def exists?
271
- FileTest.exists?(self)
272
+ FileTest.exists?(self.to_s)
272
273
  end
273
274
 
274
275
  def file?
275
- FileTest.file?(self)
276
+ FileTest.file?(self.to_s)
276
277
  end
277
278
 
278
279
  def grpowned?
279
- FileTest.grpowned?(self)
280
+ FileTest.grpowned?(self.to_s)
280
281
  end
281
282
 
282
283
  def owned?
283
- FileTest.owned?(self)
284
+ FileTest.owned?(self.to_s)
284
285
  end
285
286
 
286
287
  def pipe?
287
- FileTest.pipe?(self)
288
+ FileTest.pipe?(self.to_s)
288
289
  end
289
290
 
290
291
  def readable?
291
- FileTest.readable?(self)
292
+ FileTest.readable?(self.to_s)
292
293
  end
293
294
 
294
295
  def readable_real?
295
- FileTest.readable_real?(self)
296
+ FileTest.readable_real?(self.to_s)
296
297
  end
297
298
 
298
299
  def setgid?
299
- FileTest.setgit?(self)
300
+ FileTest.setgit?(self.to_s)
300
301
  end
301
302
 
302
303
  def setuid?
303
- FileTest.setuid?(self)
304
+ FileTest.setuid?(self.to_s)
304
305
  end
305
306
 
306
307
  def socket?
307
- FileTest.socket?(self)
308
+ FileTest.socket?(self.to_s)
308
309
  end
309
310
 
310
311
  def sticky?
311
- FileTest.sticky?(self)
312
+ FileTest.sticky?(self.to_s)
312
313
  end
313
314
 
314
315
  def symlink?
315
- FileTest.symlink?(self)
316
+ FileTest.symlink?(self.to_s)
316
317
  end
317
318
 
318
319
  def world_readable?
319
- FileTest.world_readable?(self)
320
+ FileTest.world_readable?(self.to_s)
320
321
  end
321
322
 
322
323
  def world_writable?
323
- FileTest.world_writable?(self)
324
+ FileTest.world_writable?(self.to_s)
324
325
  end
325
326
 
326
327
  def writable?
327
- FileTest.writable?(self)
328
+ FileTest.writable?(self.to_s)
328
329
  end
329
330
 
330
331
  def writable_real?
331
- FileTest.writable_real?(self)
332
+ FileTest.writable_real?(self.to_s)
332
333
  end
333
334
 
334
335
  def zero?
335
- FileTest.zero?(self)
336
+ FileTest.zero?(self.to_s)
336
337
  end
337
338
  end
338
339
 
339
340
  class Pathname
340
341
  def atime
341
- File.atime(self)
342
+ File.atime(self.to_s)
342
343
  end
343
344
 
344
345
  def ctime
345
- File.ctime(self)
346
+ File.ctime(self.to_s)
346
347
  end
347
348
 
348
349
  def ftype
349
- File.ftype(self)
350
+ File.ftype(self.to_s)
350
351
  end
351
352
 
352
353
  def lstat
353
- File.lstat(self)
354
+ File.lstat(self.to_s)
354
355
  end
355
356
 
356
357
  def mtime
357
- File.mtime(self)
358
+ File.mtime(self.to_s)
358
359
  end
359
360
 
360
361
  def stat
361
- File.stat(self)
362
+ File.stat(self.to_s)
362
363
  end
363
364
 
364
365
  def utime(atime, mtime)
365
- File.utime(self, atime, mtime)
366
+ File.utime(self.to_s, atime, mtime)
366
367
  end
367
368
  end
368
369
 
@@ -374,118 +375,118 @@ module FSSM
374
375
  end
375
376
 
376
377
  def basename
377
- self.class.new(File.basename(self))
378
+ self.class.new(File.basename(self.to_s))
378
379
  end
379
380
 
380
381
  def chmod(mode)
381
- File.chmod(mode, self)
382
+ File.chmod(mode, self.to_s)
382
383
  end
383
384
 
384
385
  def chown(owner, group)
385
- File.chown(owner, group, self)
386
+ File.chown(owner, group, self.to_s)
386
387
  end
387
388
 
388
389
  def dirname
389
- self.class.new(File.dirname(self))
390
+ self.class.new(File.dirname(self.to_s))
390
391
  end
391
392
 
392
393
  def expand_path(from = nil)
393
- self.class.new(File.expand_path(self, from))
394
+ self.class.new(File.expand_path(self.to_s, from))
394
395
  end
395
396
 
396
397
  def extname
397
- File.extname(self)
398
+ File.extname(self.to_s)
398
399
  end
399
400
 
400
401
  def fnmatch?(pat, flags = 0)
401
- File.fnmatch(pat, self, flags)
402
+ File.fnmatch(pat, self.to_s, flags)
402
403
  end
403
404
 
404
405
  def join(*parts)
405
- self.class.join(self, *parts)
406
+ self.class.join(self.to_s, *parts)
406
407
  end
407
408
 
408
409
  def lchmod(mode)
409
- File.lchmod(mode, self)
410
+ File.lchmod(mode, self.to_s)
410
411
  end
411
412
 
412
413
  def lchown(owner, group)
413
- File.lchown(owner, group, self)
414
+ File.lchown(owner, group, self.to_s)
414
415
  end
415
416
 
416
417
  def link(to)
417
- File.link(self, to)
418
+ File.link(self.to_s, to)
418
419
  end
419
420
 
420
421
  def open(mode = 'r', perm = nil, &blk)
421
- File.open(self, mode, perm, &blk)
422
+ File.open(self.to_s, mode, perm, &blk)
422
423
  end
423
424
 
424
425
  def readlink
425
- self.class.new(File.readlink(self))
426
+ self.class.new(File.readlink(self.to_s))
426
427
  end
427
428
 
428
429
  def rename(to)
429
- File.rename(self, to)
430
+ File.rename(self.to_s, to)
430
431
  replace(to)
431
432
  end
432
433
 
433
434
  def size
434
- File.size(self)
435
+ File.size(self.to_s)
435
436
  end
436
437
 
437
438
  def size?
438
- File.size?(self)
439
+ File.size?(self.to_s)
439
440
  end
440
441
 
441
442
  def split
442
- File.split(self).map {|part| FSSM::Pathname.new(part) }
443
+ File.split(self.to_s).map {|part| FSSM::Pathname.new(part) }
443
444
  end
444
445
 
445
446
  def symlink(to)
446
- File.symlink(self, to)
447
+ File.symlink(self.to_s, to)
447
448
  end
448
449
 
449
- def truncate
450
- File.truncate(self)
450
+ def truncate(size)
451
+ File.truncate(self.to_s, size)
451
452
  end
452
453
  end
453
454
 
454
455
  class Pathname
455
456
  def mkpath
456
- self.class.new(FileUtils.mkpath(self))
457
+ self.class.new(FileUtils.mkpath(self.to_s))
457
458
  end
458
459
 
459
460
  def rmtree
460
- self.class.new(FileUtils.rmtree(self).first)
461
+ self.class.new(FileUtils.rmtree(self.to_s).first)
461
462
  end
462
463
 
463
464
  def touch
464
- self.class.new(FileUtils.touch(self).first)
465
+ self.class.new(FileUtils.touch(self.to_s).first)
465
466
  end
466
467
  end
467
468
 
468
469
  class Pathname
469
470
  def each_line(sep = $/, &blk)
470
- IO.foreach(self, sep, &blk)
471
+ IO.foreach(self.to_s, sep, &blk)
471
472
  end
472
473
 
473
474
  def read(len = nil, off = 0)
474
- IO.read(self, len, off)
475
+ IO.read(self.to_s, len, off)
475
476
  end
476
477
 
477
478
  def readlines(sep = $/)
478
- IO.readlines(self, sep)
479
+ IO.readlines(self.to_s, sep)
479
480
  end
480
481
 
481
482
  def sysopen(mode = 'r', perm = nil)
482
- IO.sysopen(self, mode, perm)
483
+ IO.sysopen(self.to_s, mode, perm)
483
484
  end
484
485
  end
485
486
 
486
487
  class Pathname
487
488
  def find
488
- Find.find(self) {|path| yield FSSM::Pathname.new(path) }
489
+ Find.find(self.to_s) {|path| yield FSSM::Pathname.new(path) }
489
490
  end
490
491
  end
491
492
 
@@ -0,0 +1,35 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+
3
+ require 'pathname'
4
+
5
+ $test_path = "#{Pathname.new('..').expand_path}"
6
+ $iterations = 900000
7
+
8
+ if ARGV.first == 'native'
9
+ puts "Using native Pathname"
10
+
11
+ class Pathname
12
+ # original segments implementation I was using with
13
+ # the plain ruby Pathname library.
14
+ def segments
15
+ prefix, names = split_names(@path)
16
+ names.unshift(prefix) unless prefix.empty?
17
+ names.shift if names[0] == '.'
18
+ names
19
+ end
20
+ end
21
+
22
+ $iterations.times do |num|
23
+ p = ::Pathname.new($test_path)
24
+ segments = p.segments
25
+ end
26
+ else
27
+ puts "Using FSSM::Pathname"
28
+
29
+ require 'fssm'
30
+
31
+ $iterations.times do |num|
32
+ p = FSSM::Pathname.new($test_path)
33
+ segments = p.segments
34
+ end
35
+ end
metadata CHANGED
@@ -1,34 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fssm
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
- - 0
7
- - 2
8
- - 0
9
- version: 0.2.0
7
+ - 0
8
+ - 2
9
+ - 1
10
+ version: 0.2.1
10
11
  platform: ruby
11
12
  authors:
12
- - Travis Tilley
13
+ - Travis Tilley
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-11-13 00:00:00 -05:00
18
+ date: 2010-12-10 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: rspec
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- version: "0"
30
- type: :development
31
- version_requirements: *id001
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
32
35
  description: file system state monitor
33
36
  email: ttilley@gmail.com
34
37
  executables: []
@@ -36,41 +39,42 @@ executables: []
36
39
  extensions: []
37
40
 
38
41
  extra_rdoc_files:
39
- - LICENSE
40
- - README.markdown
42
+ - LICENSE
43
+ - README.markdown
41
44
  files:
42
- - .document
43
- - LICENSE
44
- - README.markdown
45
- - Rakefile
46
- - VERSION.yml
47
- - example.rb
48
- - fssm.gemspec
49
- - lib/fssm.rb
50
- - lib/fssm/backends/fsevents.rb
51
- - lib/fssm/backends/inotify.rb
52
- - lib/fssm/backends/polling.rb
53
- - lib/fssm/backends/rubycocoa/fsevents.rb
54
- - lib/fssm/monitor.rb
55
- - lib/fssm/path.rb
56
- - lib/fssm/pathname.rb
57
- - lib/fssm/state/directory.rb
58
- - lib/fssm/state/file.rb
59
- - lib/fssm/support.rb
60
- - lib/fssm/tree.rb
61
- - profile/prof-cache.rb
62
- - profile/prof-fssm-pathname.html
63
- - profile/prof-pathname.rb
64
- - profile/prof-plain-pathname.html
65
- - profile/prof.html
66
- - spec/monitor_spec.rb
67
- - spec/path_spec.rb
68
- - spec/root/duck/quack.txt
69
- - spec/root/file.css
70
- - spec/root/file.rb
71
- - spec/root/file.yml
72
- - spec/root/moo/cow.txt
73
- - spec/spec_helper.rb
45
+ - .document
46
+ - LICENSE
47
+ - README.markdown
48
+ - Rakefile
49
+ - VERSION.yml
50
+ - example.rb
51
+ - fssm.gemspec
52
+ - lib/fssm.rb
53
+ - lib/fssm/backends/fsevents.rb
54
+ - lib/fssm/backends/inotify.rb
55
+ - lib/fssm/backends/polling.rb
56
+ - lib/fssm/backends/rubycocoa/fsevents.rb
57
+ - lib/fssm/monitor.rb
58
+ - lib/fssm/path.rb
59
+ - lib/fssm/pathname.rb
60
+ - lib/fssm/state/directory.rb
61
+ - lib/fssm/state/file.rb
62
+ - lib/fssm/support.rb
63
+ - lib/fssm/tree.rb
64
+ - profile/prof-cache.rb
65
+ - profile/prof-fssm-pathname.html
66
+ - profile/prof-pathname-rubinius.rb
67
+ - profile/prof-pathname.rb
68
+ - profile/prof-plain-pathname.html
69
+ - profile/prof.html
70
+ - spec/monitor_spec.rb
71
+ - spec/path_spec.rb
72
+ - spec/root/duck/quack.txt
73
+ - spec/root/file.css
74
+ - spec/root/file.rb
75
+ - spec/root/file.yml
76
+ - spec/root/moo/cow.txt
77
+ - spec/spec_helper.rb
74
78
  has_rdoc: true
75
79
  homepage: http://github.com/ttilley/fssm
76
80
  licenses: []
@@ -79,30 +83,34 @@ post_install_message:
79
83
  rdoc_options: []
80
84
 
81
85
  require_paths:
82
- - lib
86
+ - lib
83
87
  required_ruby_version: !ruby/object:Gem::Requirement
88
+ none: false
84
89
  requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
- version: "0"
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
90
96
  required_rubygems_version: !ruby/object:Gem::Requirement
97
+ none: false
91
98
  requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- segments:
95
- - 0
96
- version: "0"
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ hash: 3
102
+ segments:
103
+ - 0
104
+ version: "0"
97
105
  requirements: []
98
106
 
99
107
  rubyforge_project:
100
- rubygems_version: 1.3.6
108
+ rubygems_version: 1.3.7
101
109
  signing_key:
102
110
  specification_version: 3
103
111
  summary: file system state monitor
104
112
  test_files:
105
- - spec/monitor_spec.rb
106
- - spec/path_spec.rb
107
- - spec/root/file.rb
108
- - spec/spec_helper.rb
113
+ - spec/monitor_spec.rb
114
+ - spec/path_spec.rb
115
+ - spec/root/file.rb
116
+ - spec/spec_helper.rb