directory_watcher 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +0 -6
- data/README.txt +6 -1
- data/Rakefile +11 -6
- data/lib/directory_watcher.rb +2 -2
- data/tasks/ann.rake +80 -0
- data/tasks/bones.rake +20 -0
- data/tasks/gem.rake +138 -35
- data/tasks/git.rake +40 -0
- data/tasks/manifest.rake +30 -23
- data/tasks/notes.rake +27 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/{doc.rake → rdoc.rake} +11 -10
- data/tasks/rubyforge.rake +11 -13
- data/tasks/setup.rb +201 -66
- data/tasks/spec.rake +54 -0
- data/tasks/svn.rake +47 -0
- data/tasks/test.rake +40 -0
- metadata +24 -8
- data/tasks/annotations.rake +0 -30
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -20,7 +20,12 @@ This is a pure ruby library. There are no requirements for using this code.
|
|
20
20
|
|
21
21
|
== INSTALL:
|
22
22
|
|
23
|
-
sudo gem install directory_watcher
|
23
|
+
sudo gem install directory_watcher
|
24
|
+
|
25
|
+
You will need have Mr Bones installed in order to develop or modify directory
|
26
|
+
watcher.
|
27
|
+
|
28
|
+
sudo gem install bones
|
24
29
|
|
25
30
|
== LICENSE:
|
26
31
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
# $Id: Rakefile 442 2008-01-02 04:39:32Z tim_pease $
|
2
1
|
|
3
|
-
|
2
|
+
begin
|
3
|
+
require 'bones'
|
4
|
+
Bones.setup
|
5
|
+
rescue LoadError
|
6
|
+
load 'tasks/setup.rb'
|
7
|
+
end
|
8
|
+
|
4
9
|
ensure_in_path 'lib'
|
5
10
|
require 'directory_watcher'
|
6
11
|
|
@@ -11,10 +16,10 @@ PROJ.summary = 'A class for watching files within a directory and generating eve
|
|
11
16
|
PROJ.authors = 'Tim Pease'
|
12
17
|
PROJ.email = 'tim.pease@gmail.com'
|
13
18
|
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
19
|
PROJ.version = DirectoryWatcher::VERSION
|
20
|
+
PROJ.rubyforge.name = 'codeforpeople'
|
21
|
+
|
22
|
+
PROJ.rdoc.remote_dir = 'directory_watcher'
|
23
|
+
PROJ.spec.opts << '--color'
|
19
24
|
|
20
25
|
# 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.2' # :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:
|
@@ -199,7 +199,7 @@ class DirectoryWatcher
|
|
199
199
|
raise ArgumentError, "'#{@dir}' is not a directory"
|
200
200
|
end
|
201
201
|
else
|
202
|
-
Dir.
|
202
|
+
Dir.mkdir @dir
|
203
203
|
end
|
204
204
|
|
205
205
|
self.glob = opts[:glob] || '*'
|
data/tasks/ann.rake
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'bones/smtp_tls'
|
4
|
+
rescue LoadError
|
5
|
+
require 'net/smtp'
|
6
|
+
end
|
7
|
+
require 'time'
|
8
|
+
|
9
|
+
namespace :ann do
|
10
|
+
|
11
|
+
# A prerequisites task that all other tasks depend upon
|
12
|
+
task :prereqs
|
13
|
+
|
14
|
+
file PROJ.ann.file do
|
15
|
+
ann = PROJ.ann
|
16
|
+
puts "Generating #{ann.file}"
|
17
|
+
File.open(ann.file,'w') do |fd|
|
18
|
+
fd.puts("#{PROJ.name} version #{PROJ.version}")
|
19
|
+
fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
|
20
|
+
fd.puts(" #{PROJ.url}") if PROJ.url.valid?
|
21
|
+
fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
|
22
|
+
fd.puts
|
23
|
+
fd.puts("== DESCRIPTION")
|
24
|
+
fd.puts
|
25
|
+
fd.puts(PROJ.description)
|
26
|
+
fd.puts
|
27
|
+
fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
|
28
|
+
fd.puts
|
29
|
+
ann.paragraphs.each do |p|
|
30
|
+
fd.puts "== #{p.upcase}"
|
31
|
+
fd.puts
|
32
|
+
fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
|
33
|
+
fd.puts
|
34
|
+
end
|
35
|
+
fd.puts ann.text if ann.text
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Create an announcement file"
|
40
|
+
task :announcement => ['ann:prereqs', PROJ.ann.file]
|
41
|
+
|
42
|
+
desc "Send an email announcement"
|
43
|
+
task :email => ['ann:prereqs', PROJ.ann.file] do
|
44
|
+
ann = PROJ.ann
|
45
|
+
from = ann.email[:from] || Array(PROJ.authors).first || PROJ.email
|
46
|
+
to = Array(ann.email[:to])
|
47
|
+
|
48
|
+
### build a mail header for RFC 822
|
49
|
+
rfc822msg = "From: #{from}\n"
|
50
|
+
rfc822msg << "To: #{to.join(',')}\n"
|
51
|
+
rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
|
52
|
+
rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
|
53
|
+
rfc822msg << "\n"
|
54
|
+
rfc822msg << "Date: #{Time.new.rfc822}\n"
|
55
|
+
rfc822msg << "Message-Id: "
|
56
|
+
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
|
57
|
+
rfc822msg << File.read(ann.file)
|
58
|
+
|
59
|
+
params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
|
60
|
+
ann.email[key]
|
61
|
+
end
|
62
|
+
|
63
|
+
params[3] = PROJ.email if params[3].nil?
|
64
|
+
|
65
|
+
if params[4].nil?
|
66
|
+
STDOUT.write "Please enter your e-mail password (#{params[3]}): "
|
67
|
+
params[4] = STDIN.gets.chomp
|
68
|
+
end
|
69
|
+
|
70
|
+
### send email
|
71
|
+
Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
|
72
|
+
end
|
73
|
+
end # namespace :ann
|
74
|
+
|
75
|
+
desc 'Alias to ann:announcement'
|
76
|
+
task :ann => 'ann:announcement'
|
77
|
+
|
78
|
+
CLOBBER << PROJ.ann.file
|
79
|
+
|
80
|
+
# EOF
|
data/tasks/bones.rake
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
if HAVE_BONES
|
3
|
+
|
4
|
+
namespace :bones do
|
5
|
+
|
6
|
+
desc 'Show the PROJ open struct'
|
7
|
+
task :debug do |t|
|
8
|
+
atr = if t.application.top_level_tasks.length == 2
|
9
|
+
t.application.top_level_tasks.pop
|
10
|
+
end
|
11
|
+
|
12
|
+
if atr then Bones::Debug.show_attr(PROJ, atr)
|
13
|
+
else Bones::Debug.show PROJ end
|
14
|
+
end
|
15
|
+
|
16
|
+
end # namespace :bones
|
17
|
+
|
18
|
+
end # HAVE_BONES
|
19
|
+
|
20
|
+
# EOF
|
data/tasks/gem.rake
CHANGED
@@ -1,89 +1,192 @@
|
|
1
|
-
# $Id: gem.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
1
|
|
3
|
-
require '
|
2
|
+
require 'find'
|
3
|
+
require 'rake/packagetask'
|
4
|
+
require 'rubygems/user_interaction'
|
5
|
+
require 'rubygems/builder'
|
6
|
+
|
7
|
+
module Bones
|
8
|
+
class GemPackageTask < Rake::PackageTask
|
9
|
+
# Ruby GEM spec containing the metadata for this package. The
|
10
|
+
# name, version and package_files are automatically determined
|
11
|
+
# from the GEM spec and don't need to be explicitly provided.
|
12
|
+
#
|
13
|
+
attr_accessor :gem_spec
|
14
|
+
|
15
|
+
# Tasks from the Bones gem directory
|
16
|
+
attr_reader :bones_files
|
17
|
+
|
18
|
+
# Create a GEM Package task library. Automatically define the gem
|
19
|
+
# if a block is given. If no block is supplied, then +define+
|
20
|
+
# needs to be called to define the task.
|
21
|
+
#
|
22
|
+
def initialize(gem_spec)
|
23
|
+
init(gem_spec)
|
24
|
+
yield self if block_given?
|
25
|
+
define if block_given?
|
26
|
+
end
|
27
|
+
|
28
|
+
# Initialization tasks without the "yield self" or define
|
29
|
+
# operations.
|
30
|
+
#
|
31
|
+
def init(gem)
|
32
|
+
super(gem.name, gem.version)
|
33
|
+
@gem_spec = gem
|
34
|
+
@package_files += gem_spec.files if gem_spec.files
|
35
|
+
@bones_files = []
|
36
|
+
|
37
|
+
local_setup = File.join(Dir.pwd, %w[tasks setup.rb])
|
38
|
+
if !test(?e, local_setup)
|
39
|
+
Dir.glob(::Bones.path(%w[lib bones tasks *])).each {|fn| bones_files << fn}
|
40
|
+
gem_spec.files = (gem_spec.files +
|
41
|
+
bones_files.map {|fn| File.join('tasks', File.basename(fn))}).sort
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create the Rake tasks and actions specified by this
|
46
|
+
# GemPackageTask. (+define+ is automatically called if a block is
|
47
|
+
# given to +new+).
|
48
|
+
#
|
49
|
+
def define
|
50
|
+
super
|
51
|
+
task :prereqs
|
52
|
+
task :package => ['gem:prereqs', "#{package_dir_path}/#{gem_file}"]
|
53
|
+
file "#{package_dir_path}/#{gem_file}" => [package_dir_path] + package_files + bones_files do
|
54
|
+
when_writing("Creating GEM") {
|
55
|
+
chdir(package_dir_path) do
|
56
|
+
Gem::Builder.new(gem_spec).build
|
57
|
+
verbose(true) {
|
58
|
+
mv gem_file, "../#{gem_file}"
|
59
|
+
}
|
60
|
+
end
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
file package_dir_path => bones_files do
|
65
|
+
mkdir_p package_dir rescue nil
|
66
|
+
bones_files.each do |fn|
|
67
|
+
base_fn = File.join('tasks', File.basename(fn))
|
68
|
+
f = File.join(package_dir_path, base_fn)
|
69
|
+
fdir = File.dirname(f)
|
70
|
+
mkdir_p(fdir) if !File.exist?(fdir)
|
71
|
+
if File.directory?(fn)
|
72
|
+
mkdir_p(f)
|
73
|
+
else
|
74
|
+
raise "file name conflict for '#{base_fn}' (conflicts with '#{fn}')" if test(?e, f)
|
75
|
+
safe_ln(fn, f)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def gem_file
|
82
|
+
if @gem_spec.platform == Gem::Platform::RUBY
|
83
|
+
"#{package_name}.gem"
|
84
|
+
else
|
85
|
+
"#{package_name}-#{@gem_spec.platform}.gem"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end # class GemPackageTask
|
89
|
+
end # module Bones
|
4
90
|
|
5
91
|
namespace :gem do
|
6
92
|
|
7
|
-
PROJ.
|
93
|
+
PROJ.gem._spec = Gem::Specification.new do |s|
|
8
94
|
s.name = PROJ.name
|
9
95
|
s.version = PROJ.version
|
10
96
|
s.summary = PROJ.summary
|
11
97
|
s.authors = Array(PROJ.authors)
|
12
98
|
s.email = PROJ.email
|
13
99
|
s.homepage = Array(PROJ.url).first
|
14
|
-
s.rubyforge_project = PROJ.
|
100
|
+
s.rubyforge_project = PROJ.rubyforge.name
|
15
101
|
|
16
102
|
s.description = PROJ.description
|
17
103
|
|
18
|
-
PROJ.dependencies.each do |dep|
|
104
|
+
PROJ.gem.dependencies.each do |dep|
|
19
105
|
s.add_dependency(*dep)
|
20
106
|
end
|
21
107
|
|
22
|
-
|
23
|
-
|
24
|
-
|
108
|
+
PROJ.gem.development_dependencies.each do |dep|
|
109
|
+
s.add_development_dependency(*dep)
|
110
|
+
end
|
111
|
+
|
112
|
+
s.files = PROJ.gem.files
|
113
|
+
s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
|
114
|
+
s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
|
25
115
|
|
26
116
|
s.bindir = 'bin'
|
27
117
|
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
28
118
|
s.require_paths = dirs unless dirs.empty?
|
29
119
|
|
30
|
-
incl = Regexp.new(PROJ.
|
31
|
-
excl = PROJ.
|
120
|
+
incl = Regexp.new(PROJ.rdoc.include.join('|'))
|
121
|
+
excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
32
122
|
excl = Regexp.new(excl.join('|'))
|
33
|
-
rdoc_files = PROJ.files.find_all do |fn|
|
123
|
+
rdoc_files = PROJ.gem.files.find_all do |fn|
|
34
124
|
case fn
|
35
125
|
when excl; false
|
36
126
|
when incl; true
|
37
127
|
else false end
|
38
128
|
end
|
39
|
-
s.rdoc_options = PROJ.
|
129
|
+
s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
|
40
130
|
s.extra_rdoc_files = rdoc_files
|
41
131
|
s.has_rdoc = true
|
42
132
|
|
43
|
-
if test ?f, PROJ.
|
44
|
-
s.test_file = PROJ.
|
133
|
+
if test ?f, PROJ.test.file
|
134
|
+
s.test_file = PROJ.test.file
|
45
135
|
else
|
46
|
-
s.test_files = PROJ.
|
136
|
+
s.test_files = PROJ.test.files.to_a
|
47
137
|
end
|
48
138
|
|
49
139
|
# Do any extra stuff the user wants
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
140
|
+
PROJ.gem.extras.each do |msg, val|
|
141
|
+
case val
|
142
|
+
when Proc
|
143
|
+
val.call(s.send(msg))
|
144
|
+
else
|
145
|
+
s.send "#{msg}=", val
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end # Gem::Specification.new
|
59
149
|
|
60
|
-
|
61
|
-
|
62
|
-
|
150
|
+
Bones::GemPackageTask.new(PROJ.gem._spec) do |pkg|
|
151
|
+
pkg.need_tar = PROJ.gem.need_tar
|
152
|
+
pkg.need_zip = PROJ.gem.need_zip
|
63
153
|
end
|
64
154
|
|
65
|
-
|
66
|
-
|
67
|
-
|
155
|
+
desc 'Show information about the gem'
|
156
|
+
task :debug => 'gem:prereqs' do
|
157
|
+
puts PROJ.gem._spec.to_ruby
|
68
158
|
end
|
69
159
|
|
70
160
|
desc 'Install the gem'
|
71
|
-
task :install => [:clobber, :package] do
|
72
|
-
sh "#{SUDO} #{GEM} install pkg/#{PROJ.
|
161
|
+
task :install => [:clobber, 'gem:package'] do
|
162
|
+
sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
|
163
|
+
|
164
|
+
# use this version of the command for rubygems > 1.0.0
|
165
|
+
#sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
|
73
166
|
end
|
74
167
|
|
75
168
|
desc 'Uninstall the gem'
|
76
169
|
task :uninstall do
|
77
|
-
|
170
|
+
installed_list = Gem.source_index.find_name(PROJ.name)
|
171
|
+
if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
|
172
|
+
sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
|
173
|
+
end
|
78
174
|
end
|
79
175
|
|
176
|
+
desc 'Reinstall the gem'
|
177
|
+
task :reinstall => [:uninstall, :install]
|
178
|
+
|
179
|
+
desc 'Cleanup the gem'
|
180
|
+
task :cleanup do
|
181
|
+
sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
|
182
|
+
end
|
80
183
|
end # namespace :gem
|
81
184
|
|
185
|
+
|
82
186
|
desc 'Alias to gem:package'
|
83
187
|
task :gem => 'gem:package'
|
84
188
|
|
85
189
|
task :clobber => 'gem:clobber_package'
|
86
|
-
|
87
|
-
remove_desc_for_task %w(gem:clobber_package)
|
190
|
+
remove_desc_for_task 'gem:clobber_package'
|
88
191
|
|
89
192
|
# EOF
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
if HAVE_GIT
|
3
|
+
|
4
|
+
namespace :git do
|
5
|
+
|
6
|
+
# A prerequisites task that all other tasks depend upon
|
7
|
+
task :prereqs
|
8
|
+
|
9
|
+
desc 'Show tags from the Git repository'
|
10
|
+
task :show_tags => 'git:prereqs' do |t|
|
11
|
+
puts %x/git tag/
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Create a new tag in the Git repository'
|
15
|
+
task :create_tag => 'git:prereqs' do |t|
|
16
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
17
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
18
|
+
|
19
|
+
tag = "%s-%s" % [PROJ.name, PROJ.version]
|
20
|
+
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
21
|
+
|
22
|
+
puts "Creating Git tag '#{tag}'"
|
23
|
+
unless system "git tag -a -m '#{msg}' #{tag}"
|
24
|
+
abort "Tag creation failed"
|
25
|
+
end
|
26
|
+
|
27
|
+
if %x/git remote/ =~ %r/^origin\s*$/
|
28
|
+
unless system "git push origin #{tag}"
|
29
|
+
abort "Could not push tag to remote Git repository"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end # namespace :git
|
35
|
+
|
36
|
+
task 'gem:release' => 'git:create_tag'
|
37
|
+
|
38
|
+
end # if HAVE_GIT
|
39
|
+
|
40
|
+
# EOF
|
data/tasks/manifest.rake
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# $Id: manifest.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
1
|
|
3
2
|
require 'find'
|
4
3
|
|
@@ -6,36 +5,44 @@ namespace :manifest do
|
|
6
5
|
|
7
6
|
desc 'Verify the manifest'
|
8
7
|
task :check do
|
9
|
-
fn = '
|
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
|
8
|
+
fn = PROJ.manifest_file + '.tmp'
|
9
|
+
files = manifest_files
|
18
10
|
|
19
|
-
File.open(fn, 'w') {|fp| fp.puts files
|
20
|
-
|
11
|
+
File.open(fn, 'w') {|fp| fp.puts files}
|
12
|
+
lines = %x(#{DIFF} -du #{PROJ.manifest_file} #{fn}).split("\n")
|
13
|
+
if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
|
14
|
+
lines.map! do |line|
|
15
|
+
case line
|
16
|
+
when %r/^(-{3}|\+{3})/; nil
|
17
|
+
when %r/^@/; ANSICode.blue line
|
18
|
+
when %r/^\+/; ANSICode.green line
|
19
|
+
when %r/^\-/; ANSICode.red line
|
20
|
+
else line end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
puts lines.compact
|
21
24
|
rm fn rescue nil
|
22
25
|
end
|
23
26
|
|
24
27
|
desc 'Create a new manifest'
|
25
28
|
task :create do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
path.sub! %r/^(\.\/|\/)/o, ''
|
31
|
-
next unless test ?f, path
|
32
|
-
next if path =~ exclude
|
33
|
-
files << path
|
29
|
+
files = manifest_files
|
30
|
+
unless test(?f, PROJ.manifest_file)
|
31
|
+
files << PROJ.manifest_file
|
32
|
+
files.sort!
|
34
33
|
end
|
34
|
+
File.open(PROJ.manifest_file, 'w') {|fp| fp.puts files}
|
35
|
+
end
|
35
36
|
|
36
|
-
|
37
|
-
|
37
|
+
task :assert do
|
38
|
+
files = manifest_files
|
39
|
+
manifest = File.read(PROJ.manifest_file).split($/)
|
40
|
+
raise "ERROR: #{PROJ.manifest_file} is out of date" unless files == manifest
|
38
41
|
end
|
39
|
-
|
42
|
+
|
43
|
+
end # namespace :manifest
|
44
|
+
|
45
|
+
desc 'Alias to manifest:check'
|
46
|
+
task :manifest => 'manifest:check'
|
40
47
|
|
41
48
|
# EOF
|
data/tasks/notes.rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
if HAVE_BONES
|
3
|
+
|
4
|
+
desc "Enumerate all annotations"
|
5
|
+
task :notes do |t|
|
6
|
+
id = if t.application.top_level_tasks.length > 1
|
7
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
8
|
+
end
|
9
|
+
Bones::AnnotationExtractor.enumerate(
|
10
|
+
PROJ, PROJ.notes.tags.join('|'), id, :tag => true)
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :notes do
|
14
|
+
PROJ.notes.tags.each do |tag|
|
15
|
+
desc "Enumerate all #{tag} annotations"
|
16
|
+
task tag.downcase.to_sym do |t|
|
17
|
+
id = if t.application.top_level_tasks.length > 1
|
18
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
19
|
+
end
|
20
|
+
Bones::AnnotationExtractor.enumerate(PROJ, tag, id)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end # if HAVE_BONES
|
26
|
+
|
27
|
+
# EOF
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
# This file does not define any rake tasks. It is used to load some project
|
3
|
+
# settings if they are not defined by the user.
|
4
|
+
|
5
|
+
PROJ.rdoc.exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
|
6
|
+
PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
|
7
|
+
"^#{Regexp.escape(PROJ.rdoc.dir)}/",
|
8
|
+
"^#{Regexp.escape(PROJ.rcov.dir)}/"]
|
9
|
+
|
10
|
+
flatten_arrays = lambda do |this,os|
|
11
|
+
os.instance_variable_get(:@table).each do |key,val|
|
12
|
+
next if key == :dependencies \
|
13
|
+
or key == :development_dependencies
|
14
|
+
case val
|
15
|
+
when Array; val.flatten!
|
16
|
+
when OpenStruct; this.call(this,val)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
flatten_arrays.call(flatten_arrays,PROJ)
|
21
|
+
|
22
|
+
PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
|
23
|
+
|
24
|
+
PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
|
25
|
+
|
26
|
+
PROJ.summary ||= PROJ.description.split('.').first
|
27
|
+
|
28
|
+
PROJ.gem.files ||=
|
29
|
+
if test(?f, PROJ.manifest_file)
|
30
|
+
files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
|
31
|
+
files.delete ''
|
32
|
+
files
|
33
|
+
else [] end
|
34
|
+
|
35
|
+
PROJ.gem.executables ||= PROJ.gem.files.find_all {|fn| fn =~ %r/^bin/}
|
36
|
+
|
37
|
+
PROJ.rdoc.main ||= PROJ.readme_file
|
38
|
+
|
39
|
+
# EOF
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# $Id: doc.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
1
|
|
3
2
|
require 'rake/rdoctask'
|
4
3
|
|
@@ -6,13 +5,13 @@ namespace :doc do
|
|
6
5
|
|
7
6
|
desc 'Generate RDoc documentation'
|
8
7
|
Rake::RDocTask.new do |rd|
|
9
|
-
|
10
|
-
rd.
|
11
|
-
rd.rdoc_dir =
|
8
|
+
rdoc = PROJ.rdoc
|
9
|
+
rd.main = rdoc.main
|
10
|
+
rd.rdoc_dir = rdoc.dir
|
12
11
|
|
13
|
-
incl = Regexp.new(
|
14
|
-
excl = Regexp.new(
|
15
|
-
files = PROJ.files.find_all do |fn|
|
12
|
+
incl = Regexp.new(rdoc.include.join('|'))
|
13
|
+
excl = Regexp.new(rdoc.exclude.join('|'))
|
14
|
+
files = PROJ.gem.files.find_all do |fn|
|
16
15
|
case fn
|
17
16
|
when excl; false
|
18
17
|
when incl; true
|
@@ -21,9 +20,12 @@ namespace :doc do
|
|
21
20
|
rd.rdoc_files.push(*files)
|
22
21
|
|
23
22
|
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
24
|
-
|
23
|
+
|
24
|
+
rf_name = PROJ.rubyforge.name
|
25
|
+
title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
|
25
26
|
|
26
27
|
rd.options << "-t #{title}"
|
28
|
+
rd.options.concat(rdoc.opts)
|
27
29
|
end
|
28
30
|
|
29
31
|
desc 'Generate ri locally for testing'
|
@@ -31,7 +33,6 @@ namespace :doc do
|
|
31
33
|
sh "#{RDOC} --ri -o ri ."
|
32
34
|
end
|
33
35
|
|
34
|
-
desc 'Remove ri products'
|
35
36
|
task :clobber_ri do
|
36
37
|
rm_r 'ri' rescue nil
|
37
38
|
end
|
@@ -44,6 +45,6 @@ task :doc => 'doc:rdoc'
|
|
44
45
|
desc 'Remove all build products'
|
45
46
|
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
46
47
|
|
47
|
-
remove_desc_for_task %w(doc:clobber_rdoc
|
48
|
+
remove_desc_for_task %w(doc:clobber_rdoc)
|
48
49
|
|
49
50
|
# EOF
|
data/tasks/rubyforge.rake
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
# $Id: rubyforge.rake 441 2008-01-02 04:25:01Z tim_pease $
|
2
1
|
|
3
|
-
if PROJ.
|
2
|
+
if PROJ.rubyforge.name.valid? && HAVE_RUBYFORGE
|
4
3
|
|
5
4
|
require 'rubyforge'
|
6
5
|
require 'rake/contrib/sshpublisher'
|
7
6
|
|
8
7
|
namespace :gem do
|
9
8
|
desc 'Package and upload to RubyForge'
|
10
|
-
task :release => [:clobber,
|
9
|
+
task :release => [:clobber, 'gem'] do |t|
|
11
10
|
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
12
11
|
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
13
|
-
pkg = "pkg/#{PROJ.
|
12
|
+
pkg = "pkg/#{PROJ.gem._spec.full_name}"
|
14
13
|
|
15
14
|
if $DEBUG then
|
16
|
-
puts "release_id = rf.add_release #{PROJ.
|
17
|
-
puts "rf.add_file #{PROJ.
|
15
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
16
|
+
puts "rf.add_file #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
18
17
|
end
|
19
18
|
|
20
19
|
rf = RubyForge.new
|
20
|
+
rf.configure rescue nil
|
21
21
|
puts 'Logging in'
|
22
22
|
rf.login
|
23
23
|
|
@@ -26,12 +26,10 @@ namespace :gem do
|
|
26
26
|
c['release_changes'] = PROJ.changes if PROJ.changes
|
27
27
|
c['preformatted'] = true
|
28
28
|
|
29
|
-
files =
|
30
|
-
(PROJ.need_zip ? "#{pkg}.zip" : nil),
|
31
|
-
"#{pkg}.gem"].compact
|
29
|
+
files = Dir.glob("#{pkg}*.*")
|
32
30
|
|
33
31
|
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
34
|
-
rf.add_release PROJ.
|
32
|
+
rf.add_release PROJ.rubyforge.name, PROJ.name, PROJ.version, *files
|
35
33
|
end
|
36
34
|
end # namespace :gem
|
37
35
|
|
@@ -44,9 +42,9 @@ namespace :doc do
|
|
44
42
|
)
|
45
43
|
|
46
44
|
host = "#{config['username']}@rubyforge.org"
|
47
|
-
remote_dir = "/var/www/gforge-projects/#{PROJ.
|
48
|
-
remote_dir << PROJ.
|
49
|
-
local_dir = PROJ.
|
45
|
+
remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge.name}/"
|
46
|
+
remote_dir << PROJ.rdoc.remote_dir if PROJ.rdoc.remote_dir
|
47
|
+
local_dir = PROJ.rdoc.dir
|
50
48
|
|
51
49
|
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
52
50
|
end
|
data/tasks/setup.rb
CHANGED
@@ -1,70 +1,129 @@
|
|
1
|
-
# $Id: setup.rb 441 2008-01-02 04:25:01Z tim_pease $
|
2
1
|
|
3
2
|
require 'rubygems'
|
4
3
|
require 'rake'
|
4
|
+
require 'rake/clean'
|
5
5
|
require 'fileutils'
|
6
6
|
require 'ostruct'
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
PROJ
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
8
|
+
class OpenStruct; undef :gem; end
|
9
|
+
|
10
|
+
# TODO: make my own openstruct type object that includes descriptions
|
11
|
+
# TODO: use the descriptions to output help on the available bones options
|
12
|
+
|
13
|
+
PROJ = OpenStruct.new(
|
14
|
+
# Project Defaults
|
15
|
+
:name => nil,
|
16
|
+
:summary => nil,
|
17
|
+
:description => nil,
|
18
|
+
:changes => nil,
|
19
|
+
:authors => nil,
|
20
|
+
:email => nil,
|
21
|
+
:url => "\000",
|
22
|
+
:version => ENV['VERSION'] || '0.0.0',
|
23
|
+
:exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
|
24
|
+
:release_name => ENV['RELEASE'],
|
25
|
+
|
26
|
+
# System Defaults
|
27
|
+
:ruby_opts => %w(-w),
|
28
|
+
:libs => [],
|
29
|
+
:history_file => 'History.txt',
|
30
|
+
:manifest_file => 'Manifest.txt',
|
31
|
+
:readme_file => 'README.txt',
|
32
|
+
|
33
|
+
# Announce
|
34
|
+
:ann => OpenStruct.new(
|
35
|
+
:file => 'announcement.txt',
|
36
|
+
:text => nil,
|
37
|
+
:paragraphs => [],
|
38
|
+
:email => {
|
39
|
+
:from => nil,
|
40
|
+
:to => %w(ruby-talk@ruby-lang.org),
|
41
|
+
:server => 'localhost',
|
42
|
+
:port => 25,
|
43
|
+
:domain => ENV['HOSTNAME'],
|
44
|
+
:acct => nil,
|
45
|
+
:passwd => nil,
|
46
|
+
:authtype => :plain
|
47
|
+
}
|
48
|
+
),
|
49
|
+
|
50
|
+
# Gem Packaging
|
51
|
+
:gem => OpenStruct.new(
|
52
|
+
:dependencies => [],
|
53
|
+
:development_dependencies => [],
|
54
|
+
:executables => nil,
|
55
|
+
:extensions => FileList['ext/**/extconf.rb'],
|
56
|
+
:files => nil,
|
57
|
+
:need_tar => true,
|
58
|
+
:need_zip => false,
|
59
|
+
:extras => {}
|
60
|
+
),
|
61
|
+
|
62
|
+
# File Annotations
|
63
|
+
:notes => OpenStruct.new(
|
64
|
+
:exclude => %w(^tasks/setup\.rb$),
|
65
|
+
:extensions => %w(.txt .rb .erb .rdoc) << '',
|
66
|
+
:tags => %w(FIXME OPTIMIZE TODO)
|
67
|
+
),
|
68
|
+
|
69
|
+
# Rcov
|
70
|
+
:rcov => OpenStruct.new(
|
71
|
+
:dir => 'coverage',
|
72
|
+
:opts => %w[--sort coverage -T],
|
73
|
+
:threshold => 90.0,
|
74
|
+
:threshold_exact => false
|
75
|
+
),
|
76
|
+
|
77
|
+
# Rdoc
|
78
|
+
:rdoc => OpenStruct.new(
|
79
|
+
:opts => [],
|
80
|
+
:include => %w(^lib/ ^bin/ ^ext/ \.txt$ \.rdoc$),
|
81
|
+
:exclude => %w(extconf\.rb$),
|
82
|
+
:main => nil,
|
83
|
+
:dir => 'doc',
|
84
|
+
:remote_dir => nil
|
85
|
+
),
|
46
86
|
|
47
|
-
#
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
87
|
+
# Rubyforge
|
88
|
+
:rubyforge => OpenStruct.new(
|
89
|
+
:name => "\000"
|
90
|
+
),
|
91
|
+
|
92
|
+
# Rspec
|
93
|
+
:spec => OpenStruct.new(
|
94
|
+
:files => FileList['spec/**/*_spec.rb'],
|
95
|
+
:opts => []
|
96
|
+
),
|
97
|
+
|
98
|
+
# Subversion Repository
|
99
|
+
:svn => OpenStruct.new(
|
100
|
+
:root => nil,
|
101
|
+
:path => '',
|
102
|
+
:trunk => 'trunk',
|
103
|
+
:tags => 'tags',
|
104
|
+
:branches => 'branches'
|
105
|
+
),
|
106
|
+
|
107
|
+
# Test::Unit
|
108
|
+
:test => OpenStruct.new(
|
109
|
+
:files => FileList['test/**/test_*.rb'],
|
110
|
+
:file => 'test/all.rb',
|
111
|
+
:opts => []
|
112
|
+
)
|
113
|
+
)
|
62
114
|
|
63
115
|
# Load the other rake files in the tasks folder
|
64
|
-
|
116
|
+
tasks_dir = File.expand_path(File.dirname(__FILE__))
|
117
|
+
post_load_fn = File.join(tasks_dir, 'post_load.rake')
|
118
|
+
rakefiles = Dir.glob(File.join(tasks_dir, '*.rake')).sort
|
119
|
+
rakefiles.unshift(rakefiles.delete(post_load_fn)).compact!
|
120
|
+
import(*rakefiles)
|
121
|
+
|
122
|
+
# Setup the project libraries
|
123
|
+
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
|
65
124
|
|
66
125
|
# Setup some constants
|
67
|
-
WIN32 = %r/
|
126
|
+
WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
|
68
127
|
|
69
128
|
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
70
129
|
|
@@ -76,6 +135,7 @@ def quiet( &block )
|
|
76
135
|
ensure
|
77
136
|
STDOUT.reopen io.first
|
78
137
|
STDERR.reopen io.last
|
138
|
+
$stdout, $stderr = STDOUT, STDERR
|
79
139
|
end
|
80
140
|
|
81
141
|
DIFF = if WIN32 then 'diff.exe'
|
@@ -90,10 +150,11 @@ SUDO = if WIN32 then ''
|
|
90
150
|
else '' end
|
91
151
|
end
|
92
152
|
|
93
|
-
RCOV = WIN32 ? 'rcov.
|
94
|
-
|
153
|
+
RCOV = WIN32 ? 'rcov.bat' : 'rcov'
|
154
|
+
RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
|
155
|
+
GEM = WIN32 ? 'gem.bat' : 'gem'
|
95
156
|
|
96
|
-
%w(rcov spec/rake/spectask rubyforge bones).each do |lib|
|
157
|
+
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
|
97
158
|
begin
|
98
159
|
require lib
|
99
160
|
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
@@ -101,6 +162,16 @@ GEM = WIN32 ? 'gem.cmd' : 'gem'
|
|
101
162
|
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
102
163
|
end
|
103
164
|
end
|
165
|
+
HAVE_SVN = (Dir.entries(Dir.pwd).include?('.svn') and
|
166
|
+
system("svn --version 2>&1 > #{DEV_NULL}"))
|
167
|
+
HAVE_GIT = (Dir.entries(Dir.pwd).include?('.git') and
|
168
|
+
system("git --version 2>&1 > #{DEV_NULL}"))
|
169
|
+
|
170
|
+
# Add bones as a development dependency
|
171
|
+
#
|
172
|
+
if HAVE_BONES
|
173
|
+
PROJ.gem.development_dependencies << ['bones', ">= #{Bones::VERSION}"]
|
174
|
+
end
|
104
175
|
|
105
176
|
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
106
177
|
# specified.
|
@@ -108,8 +179,28 @@ end
|
|
108
179
|
# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
109
180
|
# summary, *description = paragraphs_of('README.txt', 3, 3..8)
|
110
181
|
#
|
111
|
-
def paragraphs_of(path, *paragraphs)
|
112
|
-
|
182
|
+
def paragraphs_of( path, *paragraphs )
|
183
|
+
title = String === paragraphs.first ? paragraphs.shift : nil
|
184
|
+
ary = File.read(path).delete("\r").split(/\n\n+/)
|
185
|
+
|
186
|
+
result = if title
|
187
|
+
tmp, matching = [], false
|
188
|
+
rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
|
189
|
+
paragraphs << (0..-1) if paragraphs.empty?
|
190
|
+
|
191
|
+
ary.each do |val|
|
192
|
+
if val =~ rgxp
|
193
|
+
break if matching
|
194
|
+
matching = true
|
195
|
+
rgxp = %r/^=+/i
|
196
|
+
elsif matching
|
197
|
+
tmp << val
|
198
|
+
end
|
199
|
+
end
|
200
|
+
tmp
|
201
|
+
else ary end
|
202
|
+
|
203
|
+
result.values_at(*paragraphs)
|
113
204
|
end
|
114
205
|
|
115
206
|
# Adds the given gem _name_ to the current project's dependency list. An
|
@@ -120,14 +211,19 @@ def depend_on( name, version = nil )
|
|
120
211
|
spec = Gem.source_index.find_name(name).last
|
121
212
|
version = spec.version.to_s if version.nil? and !spec.nil?
|
122
213
|
|
123
|
-
PROJ.dependencies <<
|
214
|
+
PROJ.gem.dependencies << case version
|
215
|
+
when nil; [name]
|
216
|
+
when %r/^\d/; [name, ">= #{version}"]
|
217
|
+
else [name, version] end
|
124
218
|
end
|
125
219
|
|
126
|
-
# Adds the given
|
220
|
+
# Adds the given arguments to the include path if they are not already there
|
127
221
|
#
|
128
|
-
def ensure_in_path(
|
129
|
-
|
130
|
-
|
222
|
+
def ensure_in_path( *args )
|
223
|
+
args.each do |path|
|
224
|
+
path = File.expand_path(path)
|
225
|
+
$:.unshift(path) if test(?d, path) and not $:.include?(path)
|
226
|
+
end
|
131
227
|
end
|
132
228
|
|
133
229
|
# Find a rake task using the task name and remove any description text. This
|
@@ -141,4 +237,43 @@ def remove_desc_for_task( names )
|
|
141
237
|
end
|
142
238
|
end
|
143
239
|
|
240
|
+
# Change working directories to _dir_, call the _block_ of code, and then
|
241
|
+
# change back to the original working directory (the current directory when
|
242
|
+
# this method was called).
|
243
|
+
#
|
244
|
+
def in_directory( dir, &block )
|
245
|
+
curdir = pwd
|
246
|
+
begin
|
247
|
+
cd dir
|
248
|
+
return block.call
|
249
|
+
ensure
|
250
|
+
cd curdir
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Scans the current working directory and creates a list of files that are
|
255
|
+
# candidates to be in the manifest.
|
256
|
+
#
|
257
|
+
def manifest_files
|
258
|
+
files = []
|
259
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
260
|
+
Find.find '.' do |path|
|
261
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
262
|
+
next unless test ?f, path
|
263
|
+
next if path =~ exclude
|
264
|
+
files << path
|
265
|
+
end
|
266
|
+
files.sort!
|
267
|
+
end
|
268
|
+
|
269
|
+
# We need a "valid" method thtat determines if a string is suitable for use
|
270
|
+
# in the gem specification.
|
271
|
+
#
|
272
|
+
class Object
|
273
|
+
def valid?
|
274
|
+
return !(self.empty? or self == "\000") if self.respond_to?(:to_str)
|
275
|
+
return false
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
144
279
|
# EOF
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
if HAVE_SPEC_RAKE_SPECTASK and not PROJ.spec.files.to_a.empty?
|
3
|
+
require 'spec/rake/verify_rcov'
|
4
|
+
|
5
|
+
namespace :spec do
|
6
|
+
|
7
|
+
desc 'Run all specs with basic output'
|
8
|
+
Spec::Rake::SpecTask.new(:run) do |t|
|
9
|
+
t.ruby_opts = PROJ.ruby_opts
|
10
|
+
t.spec_opts = PROJ.spec.opts
|
11
|
+
t.spec_files = PROJ.spec.files
|
12
|
+
t.libs += PROJ.libs
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run all specs with text output'
|
16
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
17
|
+
t.ruby_opts = PROJ.ruby_opts
|
18
|
+
t.spec_opts = PROJ.spec.opts + ['--format', 'specdoc']
|
19
|
+
t.spec_files = PROJ.spec.files
|
20
|
+
t.libs += PROJ.libs
|
21
|
+
end
|
22
|
+
|
23
|
+
if HAVE_RCOV
|
24
|
+
desc 'Run all specs with RCov'
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
26
|
+
t.ruby_opts = PROJ.ruby_opts
|
27
|
+
t.spec_opts = PROJ.spec.opts
|
28
|
+
t.spec_files = PROJ.spec.files
|
29
|
+
t.libs += PROJ.libs
|
30
|
+
t.rcov = true
|
31
|
+
t.rcov_dir = PROJ.rcov.dir
|
32
|
+
t.rcov_opts = PROJ.rcov.opts + ['--exclude', 'spec']
|
33
|
+
end
|
34
|
+
|
35
|
+
RCov::VerifyTask.new(:verify) do |t|
|
36
|
+
t.threshold = PROJ.rcov.threshold
|
37
|
+
t.index_html = File.join(PROJ.rcov.dir, 'index.html')
|
38
|
+
t.require_exact_threshold = PROJ.rcov.threshold_exact
|
39
|
+
end
|
40
|
+
|
41
|
+
task :verify => :rcov
|
42
|
+
remove_desc_for_task %w(spec:clobber_rcov)
|
43
|
+
end
|
44
|
+
|
45
|
+
end # namespace :spec
|
46
|
+
|
47
|
+
desc 'Alias to spec:run'
|
48
|
+
task :spec => 'spec:run'
|
49
|
+
|
50
|
+
task :clobber => 'spec:clobber_rcov' if HAVE_RCOV
|
51
|
+
|
52
|
+
end # if HAVE_SPEC_RAKE_SPECTASK
|
53
|
+
|
54
|
+
# EOF
|
data/tasks/svn.rake
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
if HAVE_SVN
|
3
|
+
|
4
|
+
unless PROJ.svn.root
|
5
|
+
info = %x/svn info ./
|
6
|
+
m = %r/^Repository Root:\s+(.*)$/.match(info)
|
7
|
+
PROJ.svn.root = (m.nil? ? '' : m[1])
|
8
|
+
end
|
9
|
+
PROJ.svn.root = File.join(PROJ.svn.root, PROJ.svn.path) unless PROJ.svn.path.empty?
|
10
|
+
|
11
|
+
namespace :svn do
|
12
|
+
|
13
|
+
# A prerequisites task that all other tasks depend upon
|
14
|
+
task :prereqs
|
15
|
+
|
16
|
+
desc 'Show tags from the SVN repository'
|
17
|
+
task :show_tags => 'svn:prereqs' do |t|
|
18
|
+
tags = %x/svn list #{File.join(PROJ.svn.root, PROJ.svn.tags)}/
|
19
|
+
tags.gsub!(%r/\/$/, '')
|
20
|
+
tags = tags.split("\n").sort {|a,b| b <=> a}
|
21
|
+
puts tags
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Create a new tag in the SVN repository'
|
25
|
+
task :create_tag => 'svn:prereqs' do |t|
|
26
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
27
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
28
|
+
|
29
|
+
svn = PROJ.svn
|
30
|
+
trunk = File.join(svn.root, svn.trunk)
|
31
|
+
tag = "%s-%s" % [PROJ.name, PROJ.version]
|
32
|
+
tag = File.join(svn.root, svn.tags, tag)
|
33
|
+
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
34
|
+
|
35
|
+
puts "Creating SVN tag '#{tag}'"
|
36
|
+
unless system "svn cp -m '#{msg}' #{trunk} #{tag}"
|
37
|
+
abort "Tag creation failed"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end # namespace :svn
|
42
|
+
|
43
|
+
task 'gem:release' => 'svn:create_tag'
|
44
|
+
|
45
|
+
end # if PROJ.svn.path
|
46
|
+
|
47
|
+
# EOF
|
data/tasks/test.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
if test(?e, PROJ.test.file) or not PROJ.test.files.to_a.empty?
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
namespace :test do
|
6
|
+
|
7
|
+
Rake::TestTask.new(:run) do |t|
|
8
|
+
t.libs = PROJ.libs
|
9
|
+
t.test_files = if test(?f, PROJ.test.file) then [PROJ.test.file]
|
10
|
+
else PROJ.test.files end
|
11
|
+
t.ruby_opts += PROJ.ruby_opts
|
12
|
+
t.ruby_opts += PROJ.test.opts
|
13
|
+
end
|
14
|
+
|
15
|
+
if HAVE_RCOV
|
16
|
+
desc 'Run rcov on the unit tests'
|
17
|
+
task :rcov => :clobber_rcov do
|
18
|
+
opts = PROJ.rcov.opts.dup << '-o' << PROJ.rcov.dir
|
19
|
+
opts = opts.join(' ')
|
20
|
+
files = if test(?f, PROJ.test.file) then [PROJ.test.file]
|
21
|
+
else PROJ.test.files end
|
22
|
+
files = files.join(' ')
|
23
|
+
sh "#{RCOV} #{files} #{opts}"
|
24
|
+
end
|
25
|
+
|
26
|
+
task :clobber_rcov do
|
27
|
+
rm_r 'coverage' rescue nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end # namespace :test
|
32
|
+
|
33
|
+
desc 'Alias to test:run'
|
34
|
+
task :test => 'test:run'
|
35
|
+
|
36
|
+
task :clobber => 'test:clobber_rcov' if HAVE_RCOV
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# EOF
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: directory_watcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Pease
|
@@ -9,11 +9,20 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bones
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.1.1
|
24
|
+
version:
|
25
|
+
description: ""
|
17
26
|
email: tim.pease@gmail.com
|
18
27
|
executables: []
|
19
28
|
|
@@ -28,12 +37,19 @@ files:
|
|
28
37
|
- README.txt
|
29
38
|
- Rakefile
|
30
39
|
- lib/directory_watcher.rb
|
31
|
-
- tasks/
|
32
|
-
- tasks/
|
40
|
+
- tasks/ann.rake
|
41
|
+
- tasks/bones.rake
|
33
42
|
- tasks/gem.rake
|
43
|
+
- tasks/git.rake
|
34
44
|
- tasks/manifest.rake
|
45
|
+
- tasks/notes.rake
|
46
|
+
- tasks/post_load.rake
|
47
|
+
- tasks/rdoc.rake
|
35
48
|
- tasks/rubyforge.rake
|
36
49
|
- tasks/setup.rb
|
50
|
+
- tasks/spec.rake
|
51
|
+
- tasks/svn.rake
|
52
|
+
- tasks/test.rake
|
37
53
|
has_rdoc: true
|
38
54
|
homepage: http://codeforpeople.rubyforge.org/directory_watcher
|
39
55
|
post_install_message:
|
@@ -57,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
73
|
requirements: []
|
58
74
|
|
59
75
|
rubyforge_project: codeforpeople
|
60
|
-
rubygems_version: 1.
|
76
|
+
rubygems_version: 1.3.1
|
61
77
|
signing_key:
|
62
78
|
specification_version: 2
|
63
79
|
summary: A class for watching files within a directory and generating events when those files change
|
data/tasks/annotations.rake
DELETED
@@ -1,30 +0,0 @@
|
|
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
|