directory_watcher 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +25 -0
- data/Manifest.txt +8 -1
- data/README.txt +44 -4
- data/Rakefile +15 -40
- data/lib/directory_watcher.rb +1 -1
- data/tasks/annotations.rake +30 -0
- data/tasks/doc.rake +49 -0
- data/tasks/gem.rake +89 -0
- data/tasks/manifest.rake +41 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +144 -0
- metadata +50 -44
data/History.txt
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
== 1.1.1 / 2008-01-01
|
2
|
+
|
3
|
+
* 1 minor enhancement
|
4
|
+
- now using Mr Bones framework instead of Hoe
|
5
|
+
|
6
|
+
== 1.1.0 / 2007-11-28
|
7
|
+
* directory watcher now works with Ruby 1.9
|
8
|
+
|
9
|
+
== 1.0.0 / 2007-08-21
|
10
|
+
* added a join method (much like Thread#join)
|
11
|
+
|
12
|
+
== 0.1.4 / 2007-08-20
|
13
|
+
* added version information to the class
|
14
|
+
|
15
|
+
== 0.1.3 / 2006-12-07
|
16
|
+
* fixed documentation generation bug
|
17
|
+
|
18
|
+
== 0.1.2 / 2006-11-26
|
19
|
+
* fixed warnings
|
20
|
+
|
21
|
+
== 0.1.1 / 2006-11-10
|
22
|
+
* removed explicit dependency on hoe
|
23
|
+
|
24
|
+
== 0.1.0 / 2006-11-10
|
25
|
+
* initial release
|
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -1,7 +1,47 @@
|
|
1
|
+
directory_watcher
|
2
|
+
by Tim Pease
|
3
|
+
http://codeforpeople.rubyforge.org/directory_watcher
|
1
4
|
|
2
|
-
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
The directory watcher operates by scanning a directory at some interval and
|
8
|
+
generating a list of files based on a user supplied glob pattern. As the file
|
9
|
+
list changes from one interval to the next, events are generated and
|
10
|
+
dispatched to registered observers. Three types of events are supported --
|
11
|
+
added, modified, and removed.
|
3
12
|
|
4
|
-
|
5
|
-
|
13
|
+
== FEATURES:
|
14
|
+
|
15
|
+
See DirectoryWatcher for detailed documentation and usage.
|
6
16
|
|
7
|
-
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
This is a pure ruby library. There are no requirements for using this code.
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
sudo gem install directory_watcher
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
MIT License
|
28
|
+
Copyright (c) 2007 - 2008
|
29
|
+
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
31
|
+
a copy of this software and associated documentation files (the
|
32
|
+
'Software'), to deal in the Software without restriction, including
|
33
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
34
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
35
|
+
permit persons to whom the Software is furnished to do so, subject to
|
36
|
+
the following conditions:
|
37
|
+
|
38
|
+
The above copyright notice and this permission notice shall be
|
39
|
+
included in all copies or substantial portions of the Software.
|
40
|
+
|
41
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
42
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
43
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
44
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
45
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
46
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
47
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,45 +1,20 @@
|
|
1
|
+
# $Id: Rakefile 442 2008-01-02 04:39:32Z tim_pease $
|
1
2
|
|
2
|
-
|
3
|
+
load 'tasks/setup.rb'
|
4
|
+
ensure_in_path 'lib'
|
3
5
|
require 'directory_watcher'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
list changes from one interval to the next, events are generated and
|
18
|
-
dispatched to registered observers. Three types of events are supported --
|
19
|
-
added, modified, and removed.
|
20
|
-
DESC
|
21
|
-
proj.changes = <<-CHANGES
|
22
|
-
Version 1.1.0 / 2007-11-28
|
23
|
-
* directory watcher now works with Ruby 1.9
|
24
|
-
|
25
|
-
Version 1.0.0 / 2007-08-21
|
26
|
-
* added a join method (much like Thread#join)
|
27
|
-
|
28
|
-
Version 0.1.4 / 2007-08-20
|
29
|
-
* added version information to the class
|
30
|
-
|
31
|
-
Version 0.1.3 / 2006-12-07
|
32
|
-
* fixed documentation generation bug
|
33
|
-
|
34
|
-
Version 0.1.2 / 2006-11-26
|
35
|
-
* fixed warnings
|
36
|
-
|
37
|
-
Version 0.1.1 / 2006-11-10
|
38
|
-
* removed explicit dependency on hoe
|
39
|
-
|
40
|
-
Version 0.1.0 / 2006-11-10
|
41
|
-
* initial release
|
42
|
-
CHANGES
|
43
|
-
end
|
7
|
+
task :default => 'spec:run'
|
8
|
+
|
9
|
+
PROJ.name = 'directory_watcher'
|
10
|
+
PROJ.summary = 'A class for watching files within a directory and generating events when those files change'
|
11
|
+
PROJ.authors = 'Tim Pease'
|
12
|
+
PROJ.email = 'tim.pease@gmail.com'
|
13
|
+
PROJ.url = 'http://codeforpeople.rubyforge.org/directory_watcher'
|
14
|
+
PROJ.description = paragraphs_of('README.txt', 1).join("\n\n")
|
15
|
+
PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
16
|
+
PROJ.rubyforge_name = 'codeforpeople'
|
17
|
+
PROJ.rdoc_remote_dir = 'directory_watcher'
|
18
|
+
PROJ.version = DirectoryWatcher::VERSION
|
44
19
|
|
45
20
|
# EOF
|
data/lib/directory_watcher.rb
CHANGED
@@ -150,7 +150,7 @@ require 'observer'
|
|
150
150
|
#
|
151
151
|
class DirectoryWatcher
|
152
152
|
|
153
|
-
VERSION = '1.1.
|
153
|
+
VERSION = '1.1.1' # :nodoc:
|
154
154
|
|
155
155
|
# An +Event+ structure contains the _type_ of the event and the file _path_
|
156
156
|
# to which the event pertains. The type can be one of the following:
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# $Id: annotations.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do
|
7
|
+
Bones::AnnotationExtractor.enumerate(
|
8
|
+
PROJ, "OPTIMIZE|FIXME|TODO", :tag => true)
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :notes do
|
12
|
+
desc "Enumerate all OPTIMIZE annotations"
|
13
|
+
task :optimize do
|
14
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "OPTIMIZE")
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Enumerate all FIXME annotations"
|
18
|
+
task :fixme do
|
19
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "FIXME")
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Enumerate all TODO annotations"
|
23
|
+
task :todo do
|
24
|
+
Bones::AnnotationExtractor.enumerate(PROJ, "TODO")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end # if HAVE_BONES
|
29
|
+
|
30
|
+
# EOF
|
data/tasks/doc.rake
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# $Id: doc.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
|
+
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
namespace :doc do
|
6
|
+
|
7
|
+
desc 'Generate RDoc documentation'
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rd.main = PROJ.rdoc_main
|
10
|
+
rd.options << '-d' if !WIN32 and `which dot` =~ %r/\/dot/
|
11
|
+
rd.rdoc_dir = PROJ.rdoc_dir
|
12
|
+
|
13
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
14
|
+
excl = Regexp.new(PROJ.rdoc_exclude.join('|'))
|
15
|
+
files = PROJ.files.find_all do |fn|
|
16
|
+
case fn
|
17
|
+
when excl; false
|
18
|
+
when incl; true
|
19
|
+
else false end
|
20
|
+
end
|
21
|
+
rd.rdoc_files.push(*files)
|
22
|
+
|
23
|
+
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
24
|
+
title = "#{PROJ.rubyforge_name}'s " + title if PROJ.rubyforge_name != title
|
25
|
+
|
26
|
+
rd.options << "-t #{title}"
|
27
|
+
end
|
28
|
+
|
29
|
+
desc 'Generate ri locally for testing'
|
30
|
+
task :ri => :clobber_ri do
|
31
|
+
sh "#{RDOC} --ri -o ri ."
|
32
|
+
end
|
33
|
+
|
34
|
+
desc 'Remove ri products'
|
35
|
+
task :clobber_ri do
|
36
|
+
rm_r 'ri' rescue nil
|
37
|
+
end
|
38
|
+
|
39
|
+
end # namespace :doc
|
40
|
+
|
41
|
+
desc 'Alias to doc:rdoc'
|
42
|
+
task :doc => 'doc:rdoc'
|
43
|
+
|
44
|
+
desc 'Remove all build products'
|
45
|
+
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
46
|
+
|
47
|
+
remove_desc_for_task %w(doc:clobber_rdoc doc:clobber_ri)
|
48
|
+
|
49
|
+
# EOF
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# $Id: gem.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
|
+
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
|
5
|
+
namespace :gem do
|
6
|
+
|
7
|
+
PROJ.spec = Gem::Specification.new do |s|
|
8
|
+
s.name = PROJ.name
|
9
|
+
s.version = PROJ.version
|
10
|
+
s.summary = PROJ.summary
|
11
|
+
s.authors = Array(PROJ.authors)
|
12
|
+
s.email = PROJ.email
|
13
|
+
s.homepage = Array(PROJ.url).first
|
14
|
+
s.rubyforge_project = PROJ.rubyforge_name
|
15
|
+
|
16
|
+
s.description = PROJ.description
|
17
|
+
|
18
|
+
PROJ.dependencies.each do |dep|
|
19
|
+
s.add_dependency(*dep)
|
20
|
+
end
|
21
|
+
|
22
|
+
s.files = PROJ.files
|
23
|
+
s.executables = PROJ.executables.map {|fn| File.basename(fn)}
|
24
|
+
s.extensions = PROJ.files.grep %r/extconf\.rb$/
|
25
|
+
|
26
|
+
s.bindir = 'bin'
|
27
|
+
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
28
|
+
s.require_paths = dirs unless dirs.empty?
|
29
|
+
|
30
|
+
incl = Regexp.new(PROJ.rdoc_include.join('|'))
|
31
|
+
excl = PROJ.rdoc_exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
32
|
+
excl = Regexp.new(excl.join('|'))
|
33
|
+
rdoc_files = PROJ.files.find_all do |fn|
|
34
|
+
case fn
|
35
|
+
when excl; false
|
36
|
+
when incl; true
|
37
|
+
else false end
|
38
|
+
end
|
39
|
+
s.rdoc_options = PROJ.rdoc_opts + ['--main', PROJ.rdoc_main]
|
40
|
+
s.extra_rdoc_files = rdoc_files
|
41
|
+
s.has_rdoc = true
|
42
|
+
|
43
|
+
if test ?f, PROJ.test_file
|
44
|
+
s.test_file = PROJ.test_file
|
45
|
+
else
|
46
|
+
s.test_files = PROJ.tests.to_a
|
47
|
+
end
|
48
|
+
|
49
|
+
# Do any extra stuff the user wants
|
50
|
+
# spec_extras.each do |msg, val|
|
51
|
+
# case val
|
52
|
+
# when Proc
|
53
|
+
# val.call(s.send(msg))
|
54
|
+
# else
|
55
|
+
# s.send "#{msg}=", val
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Show information about the gem'
|
61
|
+
task :debug do
|
62
|
+
puts PROJ.spec.to_ruby
|
63
|
+
end
|
64
|
+
|
65
|
+
Rake::GemPackageTask.new(PROJ.spec) do |pkg|
|
66
|
+
pkg.need_tar = PROJ.need_tar
|
67
|
+
pkg.need_zip = PROJ.need_zip
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Install the gem'
|
71
|
+
task :install => [:clobber, :package] do
|
72
|
+
sh "#{SUDO} #{GEM} install pkg/#{PROJ.spec.file_name}"
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'Uninstall the gem'
|
76
|
+
task :uninstall do
|
77
|
+
sh "#{SUDO} #{GEM} uninstall -v '#{PROJ.version}' #{PROJ.name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
end # namespace :gem
|
81
|
+
|
82
|
+
desc 'Alias to gem:package'
|
83
|
+
task :gem => 'gem:package'
|
84
|
+
|
85
|
+
task :clobber => 'gem:clobber_package'
|
86
|
+
|
87
|
+
remove_desc_for_task %w(gem:clobber_package)
|
88
|
+
|
89
|
+
# EOF
|
data/tasks/manifest.rake
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# $Id: manifest.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
|
+
|
3
|
+
require 'find'
|
4
|
+
|
5
|
+
namespace :manifest do
|
6
|
+
|
7
|
+
desc 'Verify the manifest'
|
8
|
+
task :check do
|
9
|
+
fn = 'Manifest.tmp'
|
10
|
+
files = []
|
11
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
12
|
+
Find.find '.' do |path|
|
13
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
14
|
+
next unless test ?f, path
|
15
|
+
next if path =~ exclude
|
16
|
+
files << path
|
17
|
+
end
|
18
|
+
|
19
|
+
File.open(fn, 'w') {|fp| fp.puts files.sort}
|
20
|
+
system "#{DIFF} -du Manifest.txt #{fn}"
|
21
|
+
rm fn rescue nil
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Create a new manifest'
|
25
|
+
task :create do
|
26
|
+
fn = 'Manifest.txt'
|
27
|
+
files = []
|
28
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
29
|
+
Find.find '.' do |path|
|
30
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
31
|
+
next unless test ?f, path
|
32
|
+
next if path =~ exclude
|
33
|
+
files << path
|
34
|
+
end
|
35
|
+
|
36
|
+
files << fn unless test ?f, fn
|
37
|
+
File.open(fn, 'w') {|fp| fp.puts files.sort}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# EOF
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# $Id: rubyforge.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
|
+
|
3
|
+
if PROJ.rubyforge_name && HAVE_RUBYFORGE
|
4
|
+
|
5
|
+
require 'rubyforge'
|
6
|
+
require 'rake/contrib/sshpublisher'
|
7
|
+
|
8
|
+
namespace :gem do
|
9
|
+
desc 'Package and upload to RubyForge'
|
10
|
+
task :release => [:clobber, :package] do |t|
|
11
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
12
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
13
|
+
pkg = "pkg/#{PROJ.spec.full_name}"
|
14
|
+
|
15
|
+
if $DEBUG then
|
16
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge_name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
17
|
+
puts "rf.add_file #{PROJ.rubyforge_name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
18
|
+
end
|
19
|
+
|
20
|
+
rf = RubyForge.new
|
21
|
+
puts 'Logging in'
|
22
|
+
rf.login
|
23
|
+
|
24
|
+
c = rf.userconfig
|
25
|
+
c['release_notes'] = PROJ.description if PROJ.description
|
26
|
+
c['release_changes'] = PROJ.changes if PROJ.changes
|
27
|
+
c['preformatted'] = true
|
28
|
+
|
29
|
+
files = [(PROJ.need_tar ? "#{pkg}.tgz" : nil),
|
30
|
+
(PROJ.need_zip ? "#{pkg}.zip" : nil),
|
31
|
+
"#{pkg}.gem"].compact
|
32
|
+
|
33
|
+
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
34
|
+
rf.add_release PROJ.rubyforge_name, PROJ.name, PROJ.version, *files
|
35
|
+
end
|
36
|
+
end # namespace :gem
|
37
|
+
|
38
|
+
|
39
|
+
namespace :doc do
|
40
|
+
desc "Publish RDoc to RubyForge"
|
41
|
+
task :release => %w(doc:clobber_rdoc doc:rdoc) do
|
42
|
+
config = YAML.load(
|
43
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
44
|
+
)
|
45
|
+
|
46
|
+
host = "#{config['username']}@rubyforge.org"
|
47
|
+
remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge_name}/"
|
48
|
+
remote_dir << PROJ.rdoc_remote_dir || PROJ.name
|
49
|
+
local_dir = PROJ.rdoc_dir
|
50
|
+
|
51
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
52
|
+
end
|
53
|
+
end # namespace :doc
|
54
|
+
|
55
|
+
end # if HAVE_RUBYFORGE
|
56
|
+
|
57
|
+
# EOF
|
data/tasks/setup.rb
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# $Id: setup.rb 441 2008-01-02 04:25:01Z tim_pease $
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'ostruct'
|
7
|
+
|
8
|
+
PROJ = OpenStruct.new
|
9
|
+
|
10
|
+
PROJ.name = nil
|
11
|
+
PROJ.summary = nil
|
12
|
+
PROJ.description = nil
|
13
|
+
PROJ.changes = nil
|
14
|
+
PROJ.authors = nil
|
15
|
+
PROJ.email = nil
|
16
|
+
PROJ.url = nil
|
17
|
+
PROJ.version = ENV['VERSION'] || '0.0.0'
|
18
|
+
PROJ.rubyforge_name = nil
|
19
|
+
PROJ.exclude = %w(tmp$ bak$ ~$ CVS \.svn ^pkg ^doc)
|
20
|
+
|
21
|
+
# Rspec
|
22
|
+
PROJ.specs = FileList['spec/**/*_spec.rb']
|
23
|
+
PROJ.spec_opts = []
|
24
|
+
|
25
|
+
# Test::Unit
|
26
|
+
PROJ.tests = FileList['test/**/test_*.rb']
|
27
|
+
PROJ.test_file = 'test/all.rb'
|
28
|
+
PROJ.test_opts = []
|
29
|
+
|
30
|
+
# Rcov
|
31
|
+
PROJ.rcov_opts = ['--sort', 'coverage', '-T']
|
32
|
+
|
33
|
+
# Rdoc
|
34
|
+
PROJ.rdoc_opts = []
|
35
|
+
PROJ.rdoc_include = %w(^lib ^bin ^ext txt$)
|
36
|
+
PROJ.rdoc_exclude = %w(extconf\.rb$ ^Manifest\.txt$)
|
37
|
+
PROJ.rdoc_main = 'README.txt'
|
38
|
+
PROJ.rdoc_dir = 'doc'
|
39
|
+
PROJ.rdoc_remote_dir = nil
|
40
|
+
|
41
|
+
# Extensions
|
42
|
+
PROJ.extensions = FileList['ext/**/extconf.rb']
|
43
|
+
PROJ.ruby_opts = %w(-w)
|
44
|
+
PROJ.libs = []
|
45
|
+
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
|
46
|
+
|
47
|
+
# Gem Packaging
|
48
|
+
PROJ.files =
|
49
|
+
if test ?f, 'Manifest.txt'
|
50
|
+
files = File.readlines('Manifest.txt').map {|fn| fn.chomp.strip}
|
51
|
+
files.delete ''
|
52
|
+
files
|
53
|
+
else [] end
|
54
|
+
PROJ.executables = PROJ.files.find_all {|fn| fn =~ %r/^bin/}
|
55
|
+
PROJ.dependencies = []
|
56
|
+
PROJ.need_tar = true
|
57
|
+
PROJ.need_zip = false
|
58
|
+
|
59
|
+
# File Annotations
|
60
|
+
PROJ.annotation_exclude = []
|
61
|
+
PROJ.annotation_extensions = %w(.txt .rb .erb) << ''
|
62
|
+
|
63
|
+
# Load the other rake files in the tasks folder
|
64
|
+
Dir.glob('tasks/*.rake').sort.each {|fn| import fn}
|
65
|
+
|
66
|
+
# Setup some constants
|
67
|
+
WIN32 = %r/win32/ =~ RUBY_PLATFORM unless defined? WIN32
|
68
|
+
|
69
|
+
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
70
|
+
|
71
|
+
def quiet( &block )
|
72
|
+
io = [STDOUT.dup, STDERR.dup]
|
73
|
+
STDOUT.reopen DEV_NULL
|
74
|
+
STDERR.reopen DEV_NULL
|
75
|
+
block.call
|
76
|
+
ensure
|
77
|
+
STDOUT.reopen io.first
|
78
|
+
STDERR.reopen io.last
|
79
|
+
end
|
80
|
+
|
81
|
+
DIFF = if WIN32 then 'diff.exe'
|
82
|
+
else
|
83
|
+
if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
|
84
|
+
else 'diff' end
|
85
|
+
end unless defined? DIFF
|
86
|
+
|
87
|
+
SUDO = if WIN32 then ''
|
88
|
+
else
|
89
|
+
if quiet {system 'which sudo'} then 'sudo'
|
90
|
+
else '' end
|
91
|
+
end
|
92
|
+
|
93
|
+
RCOV = WIN32 ? 'rcov.cmd' : 'rcov'
|
94
|
+
GEM = WIN32 ? 'gem.cmd' : 'gem'
|
95
|
+
|
96
|
+
%w(rcov spec/rake/spectask rubyforge bones).each do |lib|
|
97
|
+
begin
|
98
|
+
require lib
|
99
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
100
|
+
rescue LoadError
|
101
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
106
|
+
# specified.
|
107
|
+
#
|
108
|
+
# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
109
|
+
# summary, *description = paragraphs_of('README.txt', 3, 3..8)
|
110
|
+
#
|
111
|
+
def paragraphs_of(path, *paragraphs)
|
112
|
+
File.read(path).delete("\r").split(/\n\n+/).values_at(*paragraphs)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Adds the given gem _name_ to the current project's dependency list. An
|
116
|
+
# optional gem _version_ can be given. If omitted, the newest gem version
|
117
|
+
# will be used.
|
118
|
+
#
|
119
|
+
def depend_on( name, version = nil )
|
120
|
+
spec = Gem.source_index.find_name(name).last
|
121
|
+
version = spec.version.to_s if version.nil? and !spec.nil?
|
122
|
+
|
123
|
+
PROJ.dependencies << (version.nil? ? [name] : [name, ">= #{version}"])
|
124
|
+
end
|
125
|
+
|
126
|
+
# Adds the given _path_ to the include path if it is not already there
|
127
|
+
#
|
128
|
+
def ensure_in_path( path )
|
129
|
+
path = File.expand_path(path)
|
130
|
+
$:.unshift(path) if test(?d, path) and not $:.include?(path)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Find a rake task using the task name and remove any description text. This
|
134
|
+
# will prevent the task from being displayed in the list of available tasks.
|
135
|
+
#
|
136
|
+
def remove_desc_for_task( names )
|
137
|
+
Array(names).each do |task_name|
|
138
|
+
task = Rake.application.tasks.find {|t| t.name == task_name}
|
139
|
+
next if task.nil?
|
140
|
+
task.instance_variable_set :@comment, nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# EOF
|
metadata
CHANGED
@@ -1,59 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: directory_watcher
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date: 2007-11-28 00:00:00 -07:00
|
8
|
-
summary: A class for watching files within a directory and generating events when those files change
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: tim.pease@gmail.com
|
12
|
-
homepage:
|
13
|
-
rubyforge_project: codeforpeople
|
14
|
-
description: The directory watcher operates by scanning a directory at some interval and generating a list of files based on a user supplied glob pattern. As the file list changes from one interval to the next, events are generated and dispatched to registered observers. Three types of events are supported -- added, modified, and removed.
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 1.1.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Tim Pease
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-01-01 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: "== DESCRIPTION: The directory watcher operates by scanning a directory at some interval and generating a list of files based on a user supplied glob pattern. As the file list changes from one interval to the next, events are generated and dispatched to registered observers. Three types of events are supported -- added, modified, and removed."
|
17
|
+
email: tim.pease@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- History.txt
|
24
|
+
- README.txt
|
31
25
|
files:
|
26
|
+
- History.txt
|
32
27
|
- Manifest.txt
|
33
|
-
- Rakefile
|
34
28
|
- README.txt
|
29
|
+
- Rakefile
|
35
30
|
- lib/directory_watcher.rb
|
36
|
-
|
37
|
-
|
31
|
+
- tasks/annotations.rake
|
32
|
+
- tasks/doc.rake
|
33
|
+
- tasks/gem.rake
|
34
|
+
- tasks/manifest.rake
|
35
|
+
- tasks/rubyforge.rake
|
36
|
+
- tasks/setup.rb
|
37
|
+
has_rdoc: true
|
38
|
+
homepage: http://codeforpeople.rubyforge.org/directory_watcher
|
39
|
+
post_install_message:
|
38
40
|
rdoc_options:
|
39
41
|
- --main
|
40
42
|
- README.txt
|
41
|
-
|
42
|
-
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
48
57
|
requirements: []
|
49
58
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
version: 1.3.0
|
59
|
-
version:
|
59
|
+
rubyforge_project: codeforpeople
|
60
|
+
rubygems_version: 1.0.1
|
61
|
+
signing_key:
|
62
|
+
specification_version: 2
|
63
|
+
summary: A class for watching files within a directory and generating events when those files change
|
64
|
+
test_files: []
|
65
|
+
|