reap 5.10.10 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +400 -8
- data/README +136 -75
- data/bin/reap +2 -2
- data/bin/rubytest +5 -0
- data/data/reap/scaffold/standard/COPYING +403 -0
- data/data/reap/scaffold/{ChangeLog → standard/ChangeLog} +0 -0
- data/data/reap/scaffold/standard/INSTALL +14 -0
- data/data/reap/scaffold/{ProjectInfo → standard/ProjectInfo} +23 -24
- data/data/reap/scaffold/standard/README +3 -0
- data/data/reap/scaffold/standard/Rakefile +10 -0
- data/{Rakefile → data/reap/scaffold/standard/TODO} +0 -0
- data/data/reap/scaffold/{setup.rb → standard/setup.rb} +287 -270
- data/data/reap/scaffold/subversion/trunk/COPYING +403 -0
- data/data/reap/scaffold/{INSTALL → subversion/trunk/ChangeLog} +0 -0
- data/data/reap/scaffold/subversion/trunk/INSTALL +14 -0
- data/data/reap/scaffold/subversion/trunk/ProjectInfo +76 -0
- data/data/reap/scaffold/subversion/trunk/README +3 -0
- data/data/reap/scaffold/subversion/trunk/Rakefile +10 -0
- data/data/reap/scaffold/{README → subversion/trunk/TODO} +0 -0
- data/data/reap/scaffold/subversion/trunk/setup.rb +1568 -0
- data/data/reap/setup.rb +1568 -0
- data/lib/reap/bin/reap.rb +176 -80
- data/lib/reap/bin/rubytest.rb +53 -0
- data/lib/reap/class/announce.rb +220 -0
- data/lib/reap/class/doap.rb +80 -0
- data/lib/reap/class/extest.rb +151 -0
- data/lib/reap/class/filer.rb +62 -0
- data/lib/reap/class/installer.rb +178 -0
- data/lib/reap/class/manifest.rb +72 -0
- data/lib/reap/class/package.rb +468 -0
- data/lib/reap/class/publish.rb +152 -0
- data/lib/reap/class/rdoc.rb +131 -0
- data/lib/reap/class/test.rb +269 -0
- data/lib/reap/projectinfo.rb +187 -30
- data/lib/reap/rake.rb +42 -0
- data/lib/reap/reap.rb +89 -0
- data/lib/reap/tasks.rb +672 -11
- data/lib/reap/taskutils.rb +122 -0
- data/sample/ProjectInfo +96 -0
- data/sample/Rakefile +9 -0
- data/sample/Reapfile +11 -0
- data/sample/task/demo.rb +15 -0
- data/setup.rb +287 -272
- metadata +99 -257
- data/ANN +0 -3
- data/ChangeLog +0 -25
- data/ProjectInfo +0 -65
- data/data/reap/scaffold/COPYING +0 -11
- data/data/reap/scaffold/Rakefile +0 -146
- data/data/reap/scaffold/Todo +0 -0
- data/dev/Rakefile +0 -60
- data/dev/composite_task.rb +0 -27
- data/dev/compositepublisher.rb +0 -24
- data/dev/ftptools.rb +0 -139
- data/dev/license-each.rb +0 -85
- data/dev/publisher.rb +0 -75
- data/dev/rubyforgepublisher.rb +0 -18
- data/dev/sshpublisher.rb +0 -47
- data/dev/suby-cvs.rb +0 -46
- data/dev/template.rb +0 -72
- data/lib/reap/lint.rb +0 -0
- data/lib/reap/readymade.rb +0 -21
- data/lib/reap/task.rb +0 -187
- data/lib/reap/task/announce.rb +0 -156
- data/lib/reap/task/fileperm.rb +0 -82
- data/lib/reap/task/info.rb +0 -20
- data/lib/reap/task/install.rb +0 -33
- data/lib/reap/task/noop.rb +0 -26
- data/lib/reap/task/package.rb +0 -204
- data/lib/reap/task/publish.rb +0 -49
- data/lib/reap/task/rdoc.rb +0 -82
- data/lib/reap/task/scaffold.rb +0 -114
- data/lib/reap/task/test.rb +0 -186
- data/lib/reap/task/testext.rb +0 -110
- data/lib/reap/task/webpublish.rb +0 -43
- data/lib/reap/test.rb +0 -138
- data/test/tc_reap.rb +0 -11
- data/web/ProjectInfo +0 -57
- data/web/images/appleboy.jpg +0 -0
- data/web/images/grape.jpg +0 -0
- data/web/index.html +0 -124
- data/web/rdoc/classes/Object.html +0 -121
- data/web/rdoc/classes/ProjectInfo.html +0 -207
- data/web/rdoc/classes/ProjectInfo.src/M000094.html +0 -18
- data/web/rdoc/classes/ProjectInfo.src/M000095.html +0 -24
- data/web/rdoc/classes/ProjectInfo.src/M000096.html +0 -22
- data/web/rdoc/classes/ProjectInfo.src/M000097.html +0 -21
- data/web/rdoc/classes/ProjectInfo.src/M000098.html +0 -18
- data/web/rdoc/classes/Reap.html +0 -248
- data/web/rdoc/classes/Reap.src/M000023.html +0 -16
- data/web/rdoc/classes/Reap.src/M000024.html +0 -21
- data/web/rdoc/classes/Reap.src/M000025.html +0 -16
- data/web/rdoc/classes/Reap.src/M000026.html +0 -21
- data/web/rdoc/classes/Reap/Announce.html +0 -262
- data/web/rdoc/classes/Reap/Announce.src/M000030.html +0 -18
- data/web/rdoc/classes/Reap/Announce.src/M000031.html +0 -114
- data/web/rdoc/classes/Reap/Announce.src/M000032.html +0 -46
- data/web/rdoc/classes/Reap/Info.html +0 -176
- data/web/rdoc/classes/Reap/Info.src/M000033.html +0 -18
- data/web/rdoc/classes/Reap/Info.src/M000034.html +0 -17
- data/web/rdoc/classes/Reap/Info.src/M000035.html +0 -18
- data/web/rdoc/classes/Reap/Install.html +0 -193
- data/web/rdoc/classes/Reap/Install.src/M000036.html +0 -18
- data/web/rdoc/classes/Reap/Install.src/M000037.html +0 -20
- data/web/rdoc/classes/Reap/Install.src/M000038.html +0 -26
- data/web/rdoc/classes/Reap/Noop.html +0 -192
- data/web/rdoc/classes/Reap/Noop.src/M000027.html +0 -18
- data/web/rdoc/classes/Reap/Noop.src/M000028.html +0 -17
- data/web/rdoc/classes/Reap/Noop.src/M000029.html +0 -18
- data/web/rdoc/classes/Reap/Package.html +0 -310
- data/web/rdoc/classes/Reap/Package.src/M000055.html +0 -18
- data/web/rdoc/classes/Reap/Package.src/M000056.html +0 -68
- data/web/rdoc/classes/Reap/Package.src/M000057.html +0 -84
- data/web/rdoc/classes/Reap/Package.src/M000058.html +0 -61
- data/web/rdoc/classes/Reap/Perm.html +0 -236
- data/web/rdoc/classes/Reap/Perm.src/M000078.html +0 -18
- data/web/rdoc/classes/Reap/Perm.src/M000079.html +0 -21
- data/web/rdoc/classes/Reap/Perm.src/M000080.html +0 -42
- data/web/rdoc/classes/Reap/Perm.src/M000081.html +0 -26
- data/web/rdoc/classes/Reap/Perm.src/M000082.html +0 -18
- data/web/rdoc/classes/Reap/Publish.html +0 -213
- data/web/rdoc/classes/Reap/Publish.src/M000070.html +0 -18
- data/web/rdoc/classes/Reap/Publish.src/M000071.html +0 -22
- data/web/rdoc/classes/Reap/Publish.src/M000072.html +0 -37
- data/web/rdoc/classes/Reap/RDoc.html +0 -218
- data/web/rdoc/classes/Reap/RDoc.src/M000059.html +0 -18
- data/web/rdoc/classes/Reap/RDoc.src/M000060.html +0 -24
- data/web/rdoc/classes/Reap/RDoc.src/M000061.html +0 -70
- data/web/rdoc/classes/Reap/Task.html +0 -396
- data/web/rdoc/classes/Reap/Task.src/M000039.html +0 -18
- data/web/rdoc/classes/Reap/Task.src/M000040.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000041.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000042.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000043.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000044.html +0 -22
- data/web/rdoc/classes/Reap/Task.src/M000045.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000046.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000047.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000048.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000049.html +0 -16
- data/web/rdoc/classes/Reap/Task.src/M000050.html +0 -27
- data/web/rdoc/classes/Reap/Task.src/M000051.html +0 -19
- data/web/rdoc/classes/Reap/Task.src/M000052.html +0 -18
- data/web/rdoc/classes/Reap/Task.src/M000053.html +0 -18
- data/web/rdoc/classes/Reap/Task.src/M000054.html +0 -19
- data/web/rdoc/classes/Reap/Test.html +0 -253
- data/web/rdoc/classes/Reap/Test.src/M000062.html +0 -18
- data/web/rdoc/classes/Reap/Test.src/M000063.html +0 -26
- data/web/rdoc/classes/Reap/Test.src/M000064.html +0 -77
- data/web/rdoc/classes/Reap/Test.src/M000065.html +0 -27
- data/web/rdoc/classes/Reap/Test.src/M000066.html +0 -50
- data/web/rdoc/classes/Reap/Test/TestResults.html +0 -205
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +0 -21
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +0 -21
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +0 -23
- data/web/rdoc/classes/Reap/TestExt.html +0 -234
- data/web/rdoc/classes/Reap/TestExt.src/M000073.html +0 -18
- data/web/rdoc/classes/Reap/TestExt.src/M000074.html +0 -20
- data/web/rdoc/classes/Reap/TestExt.src/M000075.html +0 -49
- data/web/rdoc/classes/Reap/TestExt.src/M000076.html +0 -34
- data/web/rdoc/classes/Reap/TestExt.src/M000077.html +0 -27
- data/web/rdoc/classes/Reap/WebPublish.html +0 -213
- data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +0 -18
- data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +0 -21
- data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +0 -32
- data/web/rdoc/classes/ReapCommand.html +0 -425
- data/web/rdoc/classes/ReapCommand.src/M000001.html +0 -16
- data/web/rdoc/classes/ReapCommand.src/M000003.html +0 -16
- data/web/rdoc/classes/ReapCommand.src/M000005.html +0 -16
- data/web/rdoc/classes/ReapCommand.src/M000007.html +0 -16
- data/web/rdoc/classes/ReapCommand.src/M000009.html +0 -16
- data/web/rdoc/classes/ReapCommand.src/M000011.html +0 -16
- data/web/rdoc/classes/ReapCommand.src/M000013.html +0 -18
- data/web/rdoc/classes/ReapCommand.src/M000014.html +0 -19
- data/web/rdoc/classes/ReapCommand.src/M000015.html +0 -19
- data/web/rdoc/classes/ReapCommand.src/M000016.html +0 -24
- data/web/rdoc/classes/ReapCommand.src/M000018.html +0 -29
- data/web/rdoc/classes/Scaffold.html +0 -211
- data/web/rdoc/classes/Scaffold.src/M000086.html +0 -16
- data/web/rdoc/classes/Scaffold.src/M000087.html +0 -28
- data/web/rdoc/classes/Scaffold.src/M000088.html +0 -32
- data/web/rdoc/classes/Scaffold.src/M000089.html +0 -18
- data/web/rdoc/classes/UnitTestKernel.html +0 -176
- data/web/rdoc/classes/UnitTestKernel.src/M000019.html +0 -18
- data/web/rdoc/classes/UnitTestKernel.src/M000020.html +0 -18
- data/web/rdoc/classes/UnitTestKernel.src/M000021.html +0 -22
- data/web/rdoc/classes/UnitTestKernel.src/M000022.html +0 -22
- data/web/rdoc/classes/UnitTesting.html +0 -165
- data/web/rdoc/classes/UnitTesting.src/M000090.html +0 -34
- data/web/rdoc/classes/UnitTesting.src/M000091.html +0 -18
- data/web/rdoc/classes/UnitTesting/Failure.html +0 -156
- data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +0 -18
- data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +0 -21
- data/web/rdoc/created.rid +0 -1
- data/web/rdoc/files/ANN.html +0 -107
- data/web/rdoc/files/COPYING.html +0 -119
- data/web/rdoc/files/ChangeLog.html +0 -144
- data/web/rdoc/files/ProjectInfo.html +0 -190
- data/web/rdoc/files/README.html +0 -274
- data/web/rdoc/files/Rakefile.html +0 -101
- data/web/rdoc/files/lib/reap/bin/reap_rb.html +0 -129
- data/web/rdoc/files/lib/reap/lint_rb.html +0 -101
- data/web/rdoc/files/lib/reap/projectinfo_rb.html +0 -110
- data/web/rdoc/files/lib/reap/readymade_rb.html +0 -123
- data/web/rdoc/files/lib/reap/task/announce_rb.html +0 -114
- data/web/rdoc/files/lib/reap/task/fileperm_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task/info_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task/install_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task/noop_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task/package_rb.html +0 -109
- data/web/rdoc/files/lib/reap/task/publish_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task/rdoc_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task/scaffold_rb.html +0 -107
- data/web/rdoc/files/lib/reap/task/test_rb.html +0 -110
- data/web/rdoc/files/lib/reap/task/testext_rb.html +0 -109
- data/web/rdoc/files/lib/reap/task/webpublish_rb.html +0 -108
- data/web/rdoc/files/lib/reap/task_rb.html +0 -120
- data/web/rdoc/files/lib/reap/tasks_rb.html +0 -116
- data/web/rdoc/files/lib/reap/test_rb.html +0 -109
- data/web/rdoc/fr_class_index.html +0 -47
- data/web/rdoc/fr_file_index.html +0 -51
- data/web/rdoc/fr_method_index.html +0 -124
- data/web/rdoc/index.html +0 -24
- data/web/rdoc/rdoc-style.css +0 -208
data/lib/reap/projectinfo.rb
CHANGED
@@ -1,51 +1,208 @@
|
|
1
1
|
|
2
2
|
require 'yaml'
|
3
|
-
require 'facet/hash/traverse'
|
3
|
+
#require 'facet/hash/traverse'
|
4
|
+
require 'facet/hash/graph'
|
4
5
|
require 'facet/string/tabto'
|
5
6
|
require 'facet/dir/self/ascend'
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
#require 'facet/basicobject'
|
9
|
+
require 'facet/opencascade'
|
9
10
|
|
10
|
-
|
11
|
+
# Project information.
|
12
|
+
#
|
13
|
+
# ProjectInfo is a Singleton. Access it via the
|
14
|
+
# ProjectInfo.instance method.
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
class ProjectInfo
|
17
|
+
|
18
|
+
include Enumerable
|
19
|
+
|
20
|
+
INFO_FILES = [ 'ProjectInfo','projectinfo' ]
|
21
|
+
|
22
|
+
class << self
|
23
|
+
|
24
|
+
# Singelton Pattern.
|
25
|
+
|
26
|
+
private :new
|
27
|
+
|
28
|
+
def instance( &block )
|
29
|
+
@instance ||= block_given? ? new( &block ) : load
|
30
|
+
end
|
31
|
+
|
32
|
+
# Move to file's location.
|
15
33
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@info_stream = File.read( info_file )
|
24
|
-
puts "(in #{d})" unless dir == Dir.pwd
|
25
|
-
break
|
34
|
+
def prime_location( fpath=nil )
|
35
|
+
if fpath
|
36
|
+
Dir.chdir( File.dirname( fpath ) )
|
37
|
+
else
|
38
|
+
fpath = find
|
39
|
+
if fpath
|
40
|
+
Dir.chdir( File.dirname( fpath ) )
|
26
41
|
end
|
27
42
|
end
|
28
43
|
end
|
29
|
-
|
44
|
+
|
45
|
+
# Find project information file.
|
46
|
+
|
47
|
+
def find
|
48
|
+
info_dir, info_file = nil, nil
|
49
|
+
Dir.ascend(Dir.pwd) do |info_dir|
|
50
|
+
info_file = INFO_FILES.find{ |f| File.file?( File.join( info_dir, f ) ) }
|
51
|
+
break if info_file
|
52
|
+
end
|
53
|
+
return nil unless info_file
|
54
|
+
return File.join( info_dir, info_file )
|
55
|
+
end
|
56
|
+
|
57
|
+
# Load the project information from a file. Generally
|
58
|
+
# no file needs to be specified; the file will be found
|
59
|
+
# by ascending up the current path until a default
|
60
|
+
# file name is found (eg. ProjectInfo or Reapfile).
|
61
|
+
|
62
|
+
def load( fpath=nil )
|
63
|
+
unless fpath
|
64
|
+
fpath = find
|
65
|
+
if fpath
|
66
|
+
Dir.chdir( File.dirname( fpath ) )
|
67
|
+
end
|
68
|
+
end
|
69
|
+
new.read( fpath )
|
70
|
+
end
|
71
|
+
|
72
|
+
def exist?
|
73
|
+
@instance.info_file ? true : false
|
74
|
+
end
|
75
|
+
alias_method :exists?, :exist?
|
76
|
+
|
30
77
|
end
|
31
78
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
79
|
+
|
80
|
+
attr_reader :info, :info_stream, :info_dir, :info_file
|
81
|
+
|
82
|
+
def initialize( &block )
|
83
|
+
@info = {}
|
84
|
+
@info_stream = nil
|
85
|
+
|
86
|
+
# define( &block ) if block_given?
|
87
|
+
end
|
88
|
+
|
89
|
+
# Define project information programmatically.
|
90
|
+
|
91
|
+
# def define( &block )
|
92
|
+
# return unless block
|
93
|
+
#
|
94
|
+
# @info = HashBuilder.new( &block ).to_h
|
95
|
+
# @info_stream = @info.to_yaml
|
96
|
+
# @info_dir = Dir.pwd #?
|
97
|
+
# @info_file = nil
|
98
|
+
#
|
99
|
+
# #validate
|
100
|
+
# defaults
|
101
|
+
#
|
102
|
+
# self
|
103
|
+
# end
|
104
|
+
|
105
|
+
# Load project information from YAML file.
|
106
|
+
|
107
|
+
def read( fpath )
|
108
|
+
return self unless fpath
|
109
|
+
|
110
|
+
@info_dir = File.dirname( fpath )
|
111
|
+
@info_file = fpath #File.basename( fpath )
|
112
|
+
@info_stream = File.read( fpath ).strip
|
113
|
+
@info = YAML::load( info_stream )
|
114
|
+
@info = @info.graph{ |k,v| [k.to_s.downcase, v] }
|
115
|
+
|
116
|
+
#validate
|
117
|
+
defaults
|
118
|
+
=begin
|
119
|
+
# register the task entries
|
120
|
+
@info.each do |key, val|
|
121
|
+
#value = @info[key] = {} if value.nil?
|
122
|
+
if Reap::TaskDef === val
|
123
|
+
val.name = key.to_s
|
124
|
+
end
|
37
125
|
end
|
126
|
+
=end
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
# # Update project information.
|
131
|
+
#
|
132
|
+
# def update( info=nil, &block )
|
133
|
+
# if info
|
134
|
+
# @info.update( info.traverse{ |k,v| [k.to_s.downcase, v] } )
|
135
|
+
# end
|
136
|
+
# if block_given?
|
137
|
+
# @info.update( HashBuilder.new( &block ).to_h )
|
138
|
+
# end
|
139
|
+
# @info_stream = @info.to_yaml
|
140
|
+
#
|
141
|
+
# #validate
|
142
|
+
# defaults
|
143
|
+
#
|
144
|
+
# self
|
145
|
+
# end
|
146
|
+
|
147
|
+
# Project information file exists? (may need to change to info exists?)
|
148
|
+
|
149
|
+
def exists?
|
150
|
+
@info_file
|
38
151
|
end
|
152
|
+
alias_method :exist?, :exists?
|
39
153
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
154
|
+
# Validate project information.
|
155
|
+
|
156
|
+
def validate #( *fields )
|
157
|
+
val = true
|
158
|
+
(puts "NAME is required in project information file."; val=false) unless info['name']
|
159
|
+
(puts "VERSION is required in project information file."; val=false) unless info['version']
|
160
|
+
exit -1 unless val
|
46
161
|
end
|
47
162
|
|
163
|
+
# Project information defaults.
|
164
|
+
|
165
|
+
def defaults
|
166
|
+
self['title'] ||= self['name'].capitalize
|
167
|
+
self['series'] ||= '1'
|
168
|
+
self['date'] ||= Time.now.strftime("%Y-%m-%d")
|
169
|
+
self['author'] ||= "Anonymous"
|
170
|
+
self['maintainer'] ||= self['author']
|
171
|
+
self['arch'] ||= 'Any'
|
172
|
+
self['license'] ||= 'Ruby/GPL'
|
173
|
+
self['status'] ||= 'Beta'
|
174
|
+
self['project'] ||= self['rubyforge'] ? self['rubyforge']['project'] : nil
|
175
|
+
self['homepage'] ||= self['rubyforge'] ? self['rubyforge']['homepage'] : nil
|
176
|
+
self['trunk'] ||= 'trunk' if File.directory?( File.join( @info_dir, 'trunk' ))
|
177
|
+
end
|
178
|
+
|
179
|
+
# Convert to a CascadinOpenObject.
|
180
|
+
|
181
|
+
def to_opencascade
|
182
|
+
OpenCascade.new( @info )
|
183
|
+
end
|
184
|
+
|
185
|
+
# Information fetch.
|
186
|
+
|
48
187
|
def [](name)
|
49
|
-
info[name]
|
188
|
+
@info[name]
|
50
189
|
end
|
190
|
+
|
191
|
+
# Information store.
|
192
|
+
|
193
|
+
def []=(name, x)
|
194
|
+
@info[name] = x
|
195
|
+
end
|
196
|
+
|
197
|
+
def each( &block )
|
198
|
+
@info.each( &block )
|
199
|
+
end
|
200
|
+
|
201
|
+
# Information to hash.
|
202
|
+
|
203
|
+
def to_h
|
204
|
+
@info.dup
|
205
|
+
end
|
206
|
+
|
51
207
|
end
|
208
|
+
|
data/lib/reap/rake.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
require 'facet/hash/to_proc'
|
3
|
+
require 'facet/kernel/require_all'
|
4
|
+
|
5
|
+
require 'facet/openobject'
|
6
|
+
|
7
|
+
require 'reap/projectinfo'
|
8
|
+
|
9
|
+
# Require tasks
|
10
|
+
require 'reap/tasks'
|
11
|
+
require_all('./task/*') if File.directory?('task')
|
12
|
+
|
13
|
+
# Rake doesn't understand help.
|
14
|
+
#def help name, text
|
15
|
+
#end
|
16
|
+
|
17
|
+
# Rake doesn't understand avail.
|
18
|
+
def avail name, cond
|
19
|
+
end
|
20
|
+
|
21
|
+
# Modify Rake's desc method to return the last description
|
22
|
+
# if no comment is given.
|
23
|
+
|
24
|
+
def desc(comment=nil)
|
25
|
+
if comment
|
26
|
+
Rake.application.last_comment = comment
|
27
|
+
else
|
28
|
+
Rake.application.last_comment
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
include Tasks
|
33
|
+
|
34
|
+
# Let the default be the hidden task to display tasks.
|
35
|
+
# You can change it just by overriding the default.
|
36
|
+
|
37
|
+
task :default => [ :__tasks__ ]
|
38
|
+
|
39
|
+
task :__tasks__ do
|
40
|
+
Rake.application.options.show_task_pattern = //
|
41
|
+
Rake.application.display_tasks_and_comments
|
42
|
+
end
|
data/lib/reap/reap.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# = Reap
|
2
|
+
|
3
|
+
#--
|
4
|
+
# NOTE With the latest rendition of Reap the Reap module
|
5
|
+
# is not used as much. Perhaps Tasks and TaskSpace should
|
6
|
+
# move into it but for the moment they are more convenient
|
7
|
+
# outside of it.
|
8
|
+
#++
|
9
|
+
|
10
|
+
module Reap
|
11
|
+
Version = "6.0.0"
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'facet/hash/to_proc'
|
15
|
+
require 'facet/kernel/require_all'
|
16
|
+
|
17
|
+
# Reap project information object.
|
18
|
+
require 'reap/projectinfo'
|
19
|
+
|
20
|
+
# Prime ProjectInfo by moving to file's location.
|
21
|
+
located = ProjectInfo.prime_location
|
22
|
+
|
23
|
+
# Load task system.
|
24
|
+
require 'facets/more/taskable'
|
25
|
+
|
26
|
+
# Load built-in tasks.
|
27
|
+
require 'reap/tasks'
|
28
|
+
|
29
|
+
# Load custom project tasks.
|
30
|
+
if located
|
31
|
+
require_all('./task/*') if File.directory?('task')
|
32
|
+
end
|
33
|
+
|
34
|
+
# Setup YAML load types based on task generators.
|
35
|
+
Tasks.public_instance_methods(false).each do |type|
|
36
|
+
#Task.singleton_methods(true).each do |type|
|
37
|
+
YAML.add_private_type( type.to_s ) do |syck_type, data|
|
38
|
+
data = {} if data == "" or data.nil?
|
39
|
+
data[:task_type] = type
|
40
|
+
data
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# Load the ProjectInfo file.
|
45
|
+
ProjectInfo.instance
|
46
|
+
|
47
|
+
# Create the tasks.
|
48
|
+
module TaskSpace
|
49
|
+
|
50
|
+
# Tasks acts as our DSL for task generation.
|
51
|
+
extend Tasks
|
52
|
+
|
53
|
+
# Include the tools tasks use.
|
54
|
+
include Reap::TaskUtils
|
55
|
+
|
56
|
+
# Look up all defined task with descriptions.
|
57
|
+
def self.visible_tasks
|
58
|
+
described_tasks
|
59
|
+
end
|
60
|
+
|
61
|
+
# Look up all defined task without descriptions.
|
62
|
+
def self.hidden_tasks
|
63
|
+
undescribed_tasks
|
64
|
+
end
|
65
|
+
|
66
|
+
# Create specialty tasks (don't neccessarily require manual definition)
|
67
|
+
Tasks.available.each do |type, cond|
|
68
|
+
if cond.call
|
69
|
+
send( type, type.to_s )
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Create all tasks as define in the ProjectInfo file.
|
74
|
+
ProjectInfo.instance.each do |name, value|
|
75
|
+
if Hash === value and value.key?(:task_type)
|
76
|
+
desc( value['desc'] ) if value.key?('desc') # desc okay?
|
77
|
+
send( value[:task_type], name, &value )
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Create any tasks define by a Reapfile script.
|
82
|
+
[ 'Reapfile', 'reapfile', 'REAPFILE' ].each do |f|
|
83
|
+
if File.file?(f)
|
84
|
+
module_eval( File.read(f) )
|
85
|
+
break
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
data/lib/reap/tasks.rb
CHANGED
@@ -1,13 +1,674 @@
|
|
1
|
+
require 'reap/taskutils'
|
1
2
|
|
2
|
-
|
3
|
-
require 'reap/task/test'
|
4
|
-
require 'reap/task/testext'
|
5
|
-
require 'reap/task/rdoc'
|
6
|
-
require 'reap/task/announce'
|
7
|
-
require 'reap/task/package'
|
8
|
-
require 'reap/task/publish'
|
9
|
-
require 'reap/task/info'
|
10
|
-
require 'reap/task/install'
|
11
|
-
#require 'reap/task/noop'
|
12
|
-
#require 'reap/webpublish'
|
3
|
+
# Tasks is the namespace in which to define task generators.
|
13
4
|
|
5
|
+
module Tasks
|
6
|
+
|
7
|
+
# Even task generators might use the task tools.
|
8
|
+
|
9
|
+
include Reap::TaskUtils
|
10
|
+
|
11
|
+
#--
|
12
|
+
# Help system has been deprecated for the time being.
|
13
|
+
#def self.help( name, text )
|
14
|
+
# @help ||= {}
|
15
|
+
# @help[name] = text
|
16
|
+
#end
|
17
|
+
#++
|
18
|
+
|
19
|
+
# Used to determine task generator availablity.
|
20
|
+
#--
|
21
|
+
# TODO This is kind of a weak point in the design, I think.
|
22
|
+
# And tasks themselves also need to have Rake's #needed? feature.
|
23
|
+
#++
|
24
|
+
|
25
|
+
def self.available
|
26
|
+
@available ||= {}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Used to set task generator availablity condition.
|
30
|
+
|
31
|
+
def self.avail( name, &cond )
|
32
|
+
available[name] = cond
|
33
|
+
end
|
34
|
+
|
35
|
+
# == Announce
|
36
|
+
#
|
37
|
+
# The announce task is intended for sending out a nice
|
38
|
+
# formated email message to a mailing address, especially
|
39
|
+
# mailing-lists.
|
40
|
+
#
|
41
|
+
# Announcement specific settings:
|
42
|
+
#
|
43
|
+
# server Email server to route message.
|
44
|
+
# port Email server's port.
|
45
|
+
# domain Email server's domain name.
|
46
|
+
# account Email account name.
|
47
|
+
# type Login type, either plain, cram_md5 or login.
|
48
|
+
# secure Uses TLS security, true or false?
|
49
|
+
# to Email address to send announcemnt.
|
50
|
+
# from Email address sent from.
|
51
|
+
# subject Subject of email message.
|
52
|
+
# links Array of http links to related sites.
|
53
|
+
# file File that contains announcement message.
|
54
|
+
# memo Embedded announcement message.
|
55
|
+
# slogan Motto for you project.
|
56
|
+
#
|
57
|
+
# Inherited settings:
|
58
|
+
#
|
59
|
+
# title Project title.
|
60
|
+
# summary Brief one-line description.
|
61
|
+
# description Long description of project.
|
62
|
+
# homepage Project homepage web address.
|
63
|
+
#
|
64
|
+
|
65
|
+
def announce( name, &data )
|
66
|
+
|
67
|
+
require 'reap/class/announce.rb'
|
68
|
+
|
69
|
+
desc "Email project announcement" unless desc
|
70
|
+
|
71
|
+
task name do
|
72
|
+
data = data.to_openobject
|
73
|
+
data.title ||= master.title
|
74
|
+
data.version ||= master.version
|
75
|
+
data.from ||= master.email
|
76
|
+
Reap::Announce.new( data ).write_and_email
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
# == Doap
|
82
|
+
#
|
83
|
+
# This task generates an XML DOAP project file.
|
84
|
+
#
|
85
|
+
# DOAP is an XML/RTF format for describing a project. It contains
|
86
|
+
# much of the same information as Reap's ProjectInfo file, but is
|
87
|
+
# more suitable to RESTful interapplication communications, like
|
88
|
+
# RSS/Atom feeds --useful to project tracking sites.
|
89
|
+
#
|
90
|
+
# The task gets almost all of the required parametes from the root
|
91
|
+
# node (i.e. master) of ProjectInfo file.
|
92
|
+
|
93
|
+
def doap( name, &data )
|
94
|
+
|
95
|
+
require 'reap/class/doap.rb'
|
96
|
+
|
97
|
+
desc "Generate DOAP project file" unless desc
|
98
|
+
|
99
|
+
task name do
|
100
|
+
data = data.to_openobject
|
101
|
+
Reap::Doap.new( data.__merge__( master ) ).call
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
avail :doap do
|
107
|
+
ProjectInfo.exists?
|
108
|
+
end
|
109
|
+
|
110
|
+
# == Extract Tests
|
111
|
+
#
|
112
|
+
# This task scans every package script looking for sections of the form:
|
113
|
+
#
|
114
|
+
# =begin test
|
115
|
+
# ...
|
116
|
+
# =end
|
117
|
+
#
|
118
|
+
# With appropriate headers, it copies these sections to files in your
|
119
|
+
# project's test/ dir, which then can be run using the Reap test task.
|
120
|
+
# The exact directory layout of the files to be tested is reflected in
|
121
|
+
# the test directory. You can then use Reap's test task to run the tests.
|
122
|
+
#
|
123
|
+
# Specific Settings:
|
124
|
+
#
|
125
|
+
# dir Specify the test directory. Default is 'test'.
|
126
|
+
# files Specify files to extract. Default is 'lib/**/*.rb'.
|
127
|
+
#
|
128
|
+
|
129
|
+
def extest( name, &data )
|
130
|
+
|
131
|
+
require 'reap/class/extest.rb'
|
132
|
+
|
133
|
+
desc "Extract embedded unit tests from scripts" unless desc
|
134
|
+
|
135
|
+
task name do
|
136
|
+
data = data.to_openobject
|
137
|
+
data.trunk ||= master.trunk
|
138
|
+
Reap::ExTest.new( data ).extract
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
# == File
|
144
|
+
|
145
|
+
def file( name, &exe )
|
146
|
+
|
147
|
+
require 'reap/class/filer'
|
148
|
+
|
149
|
+
name, source = preq_from_name( name )
|
150
|
+
|
151
|
+
task name do
|
152
|
+
Reap::Filer.new( name, source, &exe ).build
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
# == Info
|
158
|
+
#
|
159
|
+
# Displays the ProjectInfo file. This task is of little use
|
160
|
+
# --it's easy enough to look at a ProjectInfo file with
|
161
|
+
# less or your favorite editor. Mainly this task serves as
|
162
|
+
# a development example.
|
163
|
+
|
164
|
+
def info( name )
|
165
|
+
|
166
|
+
desc "Display ProjectInfo file" unless desc
|
167
|
+
|
168
|
+
task name do
|
169
|
+
puts ProjectInfo.instance.info_stream
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
avail :info do
|
175
|
+
ProjectInfo.exists?
|
176
|
+
end
|
177
|
+
|
178
|
+
# == Installer
|
179
|
+
#
|
180
|
+
# The installer task generates a specialized
|
181
|
+
# install.rb script specifically for your
|
182
|
+
# project. It currently does not support c/c++
|
183
|
+
# ext/ compilation.
|
184
|
+
#
|
185
|
+
# template Template for installation. (See below)
|
186
|
+
# options Hash of variable options. Project name
|
187
|
+
# and version are automatically added this.
|
188
|
+
#
|
189
|
+
# The template is a special configuration for installation.
|
190
|
+
# It should be a literal string with each line containing
|
191
|
+
# four parts seprated by spaces.
|
192
|
+
#
|
193
|
+
# [type] [from] [glob] [to]
|
194
|
+
#
|
195
|
+
# There are five types: bin, lib, ext, etc (or conf) and data.
|
196
|
+
#
|
197
|
+
# The template use variables in the from of $name. These are filled
|
198
|
+
# in using the options hash.
|
199
|
+
#
|
200
|
+
# Here's a basic example of an entry:
|
201
|
+
#
|
202
|
+
# ins: !!installer
|
203
|
+
# template: |
|
204
|
+
# bin bin * .
|
205
|
+
# lib lib **/* $name/$version
|
206
|
+
#
|
207
|
+
|
208
|
+
def installer( name, &data )
|
209
|
+
|
210
|
+
require 'reap/class/installer'
|
211
|
+
|
212
|
+
desc "Generate install.rb script" unless desc
|
213
|
+
|
214
|
+
task name do
|
215
|
+
data = data.to_openobject
|
216
|
+
data.options[:name] ||= master.name
|
217
|
+
data.options[:version] ||= master.version
|
218
|
+
Reap::Installer.new( data ).compile_and_write
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
# == Count
|
224
|
+
#
|
225
|
+
# Count the file and lines of code in your project.
|
226
|
+
#
|
227
|
+
# dir The directory of scripts to count.
|
228
|
+
#
|
229
|
+
|
230
|
+
def count( name, &data )
|
231
|
+
|
232
|
+
desc "Line count project scripts" unless desc
|
233
|
+
|
234
|
+
task name do
|
235
|
+
data = data.to_openobject
|
236
|
+
incl = data.include || 'lib/**/*' # TODO maybe check trunk too
|
237
|
+
|
238
|
+
fc, l, c, t, bt, r, rb = 0, 0, 0, 0, false, 0, false
|
239
|
+
Dir.glob( incl ).each do |fname|
|
240
|
+
next unless fname =~ /.*rb/ # TODO should this be done?
|
241
|
+
fc += 1
|
242
|
+
File.open( fname ) do |f|
|
243
|
+
while line = f.gets
|
244
|
+
l += 1
|
245
|
+
next if line =~ /^\s*$/
|
246
|
+
case line
|
247
|
+
when /^=begin\s+test/
|
248
|
+
tb = true; t+=1
|
249
|
+
when /^=begin/
|
250
|
+
rb = true; r+=1
|
251
|
+
when /^=end/
|
252
|
+
r+=1 if !(rb or tb)
|
253
|
+
(rb = false; r+=1) if rb
|
254
|
+
(tb = false; t+=1) if tb
|
255
|
+
when /^\s*#/
|
256
|
+
r += 1
|
257
|
+
else
|
258
|
+
c+=1 if !(rb or tb)
|
259
|
+
r+=1 if rb
|
260
|
+
t+=1 if tb
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
s = l - c - r
|
266
|
+
puts "FILES: #{fc}, LINES: #{l}, CODE: #{c}, DOC: #{r}, TEST: #{t}, SPACE: #{s}"
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
# == Manifest
|
272
|
+
#
|
273
|
+
# Create a manifest file for the package. Presently it is a very simple
|
274
|
+
# md5 + filename manifest. In the future this will be exanded to build
|
275
|
+
# a varity of manifest formats.
|
276
|
+
#
|
277
|
+
# Task specific settings:
|
278
|
+
#
|
279
|
+
# include Files to include
|
280
|
+
# exclude Files to exclude from the included.
|
281
|
+
#
|
282
|
+
|
283
|
+
def manifest( name, &data )
|
284
|
+
|
285
|
+
require 'reap/class/manifest'
|
286
|
+
|
287
|
+
desc "Create a MANIFEST file for this package" unless desc
|
288
|
+
|
289
|
+
task name do
|
290
|
+
data = data.to_openobject
|
291
|
+
data.trunk ||= master.trunk
|
292
|
+
Reap::Manifest.new( data ).generate
|
293
|
+
end
|
294
|
+
|
295
|
+
end
|
296
|
+
|
297
|
+
# == Package
|
298
|
+
#
|
299
|
+
# This task creates standard .zip, .tgz, or .tbz
|
300
|
+
# packages, plus .gem or .deb distributions.
|
301
|
+
#
|
302
|
+
# Builds distribution packages. The package task supports
|
303
|
+
# tar.gz, tar.bz2, zip source packages and gem, pacman and
|
304
|
+
# debian ditribution packages.
|
305
|
+
#
|
306
|
+
# Task specific settings:
|
307
|
+
#
|
308
|
+
# dir Directory in which to store distributions.
|
309
|
+
# include Files to include in distribution.
|
310
|
+
# exclude Files to exclude from those.
|
311
|
+
# distribute List of distribution types desired. Eg.
|
312
|
+
# tgz, tar.gz, tbz, tar.bz2, zip
|
313
|
+
# gem, deb, pac
|
314
|
+
# project Project name.
|
315
|
+
# category Software category.
|
316
|
+
# architecture Can be any, i368, i686, ppc, etc.
|
317
|
+
# dependencies List of packages this program depends.
|
318
|
+
# recommends List of packages that can be used with this package.
|
319
|
+
# replaces List of packages this one replaces.
|
320
|
+
# executables Executable files in this distribution.
|
321
|
+
#
|
322
|
+
# RubyGems specific settings:
|
323
|
+
#
|
324
|
+
# autorequire
|
325
|
+
# platform
|
326
|
+
# require_paths
|
327
|
+
#
|
328
|
+
# The package task also has subsection for each type of distribution.
|
329
|
+
# These can be used to override settings in the package information
|
330
|
+
# if they in some way differ. Possible subsections are:
|
331
|
+
#
|
332
|
+
# gems
|
333
|
+
# pacman
|
334
|
+
# debian
|
335
|
+
#
|
336
|
+
|
337
|
+
def package( name, &data )
|
338
|
+
|
339
|
+
require 'reap/class/package'
|
340
|
+
|
341
|
+
desc "Create distribution packages" unless desc
|
342
|
+
|
343
|
+
task name do
|
344
|
+
data = data.to_openobject
|
345
|
+
|
346
|
+
data.name ||= master.name
|
347
|
+
data.title ||= master.title
|
348
|
+
data.version ||= master.version
|
349
|
+
data.status ||= master.status
|
350
|
+
data.series ||= master.series
|
351
|
+
data.author ||= master.author
|
352
|
+
data.maintainer ||= master.maintainer
|
353
|
+
data.email ||= master.email
|
354
|
+
data.summary ||= master.summary
|
355
|
+
data.architecture ||= master.architecture
|
356
|
+
data.license ||= master.license
|
357
|
+
data.project ||= master.project
|
358
|
+
data.homepage ||= master.homepage
|
359
|
+
data.trunk ||= master.trunk
|
360
|
+
|
361
|
+
Reap::Package.new( data ).generate_packages
|
362
|
+
end
|
363
|
+
|
364
|
+
end
|
365
|
+
|
366
|
+
# == Publish
|
367
|
+
#
|
368
|
+
# Publish documents to hosting service. Three means of
|
369
|
+
# publishing are current supported, ftp uploading, scp,
|
370
|
+
# and web convenience option that recognizes particular
|
371
|
+
# hosts (only RubyForge is currently supported).
|
372
|
+
#
|
373
|
+
# type Type of publishing, 'web', 'scp' or 'ftp'.
|
374
|
+
# host Host server, default is 'rubyforge.org'
|
375
|
+
# username Username for host.
|
376
|
+
# dir Directory of files to publish. Or,
|
377
|
+
# copy Files to publish using from and to.
|
378
|
+
# project Project name (used for Rubyforge)
|
379
|
+
#
|
380
|
+
# If the type is 'scp' or 'ftp' you will also need to provide
|
381
|
+
# the root directory parameter.
|
382
|
+
#
|
383
|
+
# root Document root directory at host.
|
384
|
+
#
|
385
|
+
# The dir parameter allows you to simply specify a local
|
386
|
+
# directory, the contents of which will be published to
|
387
|
+
# host's document root location (directory tree intact).
|
388
|
+
#
|
389
|
+
# If you need more control over which files to publish
|
390
|
+
# where, you can use the copy parameter instead. Provide
|
391
|
+
# an array of pattern strings in the form of "{from} {to}".
|
392
|
+
# If the desitination is the host's document root you do
|
393
|
+
# not need to specify the {to} part. For example:
|
394
|
+
#
|
395
|
+
# copy: [ 'web/*', 'doc/api/* doc/api' ]
|
396
|
+
#
|
397
|
+
# The first copies the files under your project's web directory
|
398
|
+
# to the host's document root. The second copies your projects
|
399
|
+
# doc/api files to the doc/api location on the host.
|
400
|
+
#
|
401
|
+
# When using the 'scp' type the internal template used for
|
402
|
+
# the outbound destination is 'username@host:root/'.
|
403
|
+
|
404
|
+
def publish( name, &data )
|
405
|
+
|
406
|
+
require 'reap/class/publish.rb'
|
407
|
+
|
408
|
+
desc "Publish documents to the web or host" unless desc
|
409
|
+
|
410
|
+
task name do
|
411
|
+
data = data.to_openobject
|
412
|
+
|
413
|
+
data.project ||= master.rubyforge.project || master.name
|
414
|
+
data.username ||= master.rubyforge.username
|
415
|
+
|
416
|
+
Reap::Publish.new( data ).publish
|
417
|
+
end
|
418
|
+
|
419
|
+
end
|
420
|
+
|
421
|
+
# == RDoc
|
422
|
+
#
|
423
|
+
# This task generates RDoc API documentation from source
|
424
|
+
# comments.
|
425
|
+
#
|
426
|
+
# Task specific settings:
|
427
|
+
#
|
428
|
+
# dir Directory to store documentation [doc].
|
429
|
+
# main File to use as main page of RDocs.
|
430
|
+
# template Which RDoc template to use.
|
431
|
+
# include Files to include in RDocs.
|
432
|
+
# exclude Files to exclude from those.
|
433
|
+
# options Pass-thru extra options to RDoc command.
|
434
|
+
#
|
435
|
+
# Inherited settings:
|
436
|
+
#
|
437
|
+
# title Project title to use in RDocs.
|
438
|
+
#
|
439
|
+
|
440
|
+
def rdoc( name, &data )
|
441
|
+
|
442
|
+
require 'reap/class/rdoc'
|
443
|
+
|
444
|
+
desc "Generate RDoc API documentation" unless desc
|
445
|
+
|
446
|
+
task name do
|
447
|
+
data = data.to_openobject
|
448
|
+
|
449
|
+
data.title ||= master.title
|
450
|
+
data.trunk ||= master.trunk
|
451
|
+
|
452
|
+
Reap::RDoc.new( data ).call
|
453
|
+
end
|
454
|
+
|
455
|
+
end
|
456
|
+
|
457
|
+
# == Release
|
458
|
+
#
|
459
|
+
# This task releases files to RubyForge --it should work with other
|
460
|
+
# GForge instaces or SourceForge clones too.
|
461
|
+
#
|
462
|
+
# While defaults are nice, you may want a little more control. You can
|
463
|
+
# specify additional attributes:
|
464
|
+
#
|
465
|
+
# dir Distribution directory
|
466
|
+
# exclude Distribution types to exclude
|
467
|
+
# host URL of host service
|
468
|
+
# username Username of host service
|
469
|
+
# project Project name at host
|
470
|
+
# package Package name
|
471
|
+
# date Date of release (defaults to Time.now)
|
472
|
+
# groupid Group id number
|
473
|
+
# processor Processor/Architecture (Any, i386, PPC, etc.)
|
474
|
+
# release Release name (default is "%s")
|
475
|
+
# is_public Public release?
|
476
|
+
# changelog Change log file
|
477
|
+
# notelog Release notes file
|
478
|
+
#
|
479
|
+
# The release option can be a template by using %s in the
|
480
|
+
# string. The version number of your project will be sub'd
|
481
|
+
# in for the %s. This saves you from having to update
|
482
|
+
# the release name before every release.
|
483
|
+
|
484
|
+
def release( name, &data )
|
485
|
+
|
486
|
+
require 'reap/class/release'
|
487
|
+
|
488
|
+
desc "Release distribution files" unless desc
|
489
|
+
|
490
|
+
task name do
|
491
|
+
data = data.to_openobject
|
492
|
+
|
493
|
+
data.version = master.version
|
494
|
+
data.project ||= master.rubyforge.project || master.name
|
495
|
+
data.username ||= master.rubyforge.username
|
496
|
+
data.package ||= master.rubyforge.package
|
497
|
+
data.groupid ||= master.rubyforge.groupid
|
498
|
+
|
499
|
+
Reap::Release.new( data ).release
|
500
|
+
end
|
501
|
+
|
502
|
+
end
|
503
|
+
|
504
|
+
# == Scaffold
|
505
|
+
#
|
506
|
+
# Generates a project directory layout within the current
|
507
|
+
# directory. The scaffolding includes all the standard
|
508
|
+
# features such as directories lib/ bin/ doc/
|
509
|
+
# and files such as README.
|
510
|
+
#
|
511
|
+
# To use this task you should first create an empty
|
512
|
+
# directory and than change into it. This command will
|
513
|
+
# not create a new project directory. As a safegaurd, this
|
514
|
+
# command will not generate scaffolding in a directory with
|
515
|
+
# files already present, unless you use the -f (force) option.
|
516
|
+
#
|
517
|
+
# There are currently two types of supported scaffoldings:
|
518
|
+
# 'standard', which is the default if no type is given,
|
519
|
+
# and 'subversion' which creates a "trunk" hierarchy.
|
520
|
+
|
521
|
+
def scaffold( name )
|
522
|
+
|
523
|
+
desc "Generate a project directory layout" unless desc
|
524
|
+
|
525
|
+
task name do |type|
|
526
|
+
content = Dir.entries('.') - [ '.', '..' ]
|
527
|
+
if not content.empty? and not $FORCE
|
528
|
+
tell "Directory already has content. Use -f option to force scaffolding."
|
529
|
+
return nil
|
530
|
+
end
|
531
|
+
type ||= 'standard'
|
532
|
+
type = 'standard' if type == 'std'
|
533
|
+
type = 'subversion' if type == 'svn'
|
534
|
+
# gems workaround
|
535
|
+
if dir = Gem.gempath('reap')
|
536
|
+
dir = File.join( dir, 'data', 'reap', 'scaffold', type )
|
537
|
+
else
|
538
|
+
dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', type )
|
539
|
+
end
|
540
|
+
#
|
541
|
+
unless File.directory?( dir )
|
542
|
+
tell "Unrecognized project type."
|
543
|
+
else
|
544
|
+
#FileUtils.mkdir_p( name )
|
545
|
+
FileUtils.cp_r( File.join( dir, '.'), '.' )
|
546
|
+
tell "Project ready."
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
end
|
551
|
+
|
552
|
+
avail :scaffold do
|
553
|
+
! ProjectInfo.exists?
|
554
|
+
end
|
555
|
+
|
556
|
+
# == Setup
|
557
|
+
#
|
558
|
+
# This task manually installs a project using setup.rb.
|
559
|
+
# If setup.rb doesn't exist it will be created.
|
560
|
+
|
561
|
+
def setup( name, &data )
|
562
|
+
|
563
|
+
desc "Locally install package using setup.rb" unless desc
|
564
|
+
|
565
|
+
task name do
|
566
|
+
data = data.to_openobject
|
567
|
+
|
568
|
+
data.trunk ||= master.trunk || '.'
|
569
|
+
data.options ||= []
|
570
|
+
|
571
|
+
unless provide_setup_rb( data.trunk )
|
572
|
+
puts "Setup.rb is missing. Forced to cancel task."
|
573
|
+
return nil
|
574
|
+
end
|
575
|
+
|
576
|
+
puts "Reap is shelling out work to setup.rb..."
|
577
|
+
|
578
|
+
#--
|
579
|
+
# SHELL OUT! This will be fixed with swtich to Reap's installer instead of setup.rb.
|
580
|
+
#++
|
581
|
+
exe = %{ruby setup.rb}
|
582
|
+
exe << ' -q ' unless $VERBOSE
|
583
|
+
exe << data.options.join(' ')
|
584
|
+
exe << ' all'
|
585
|
+
|
586
|
+
success = false
|
587
|
+
Dir.chdir( data.trunk ) do
|
588
|
+
success = sh( exe )
|
589
|
+
end
|
590
|
+
|
591
|
+
puts "Setup complete!" if success
|
592
|
+
end
|
593
|
+
|
594
|
+
end
|
595
|
+
|
596
|
+
# == Template
|
597
|
+
#
|
598
|
+
# Creates an empty ProjectInfo file in the current directory.
|
599
|
+
# It will not overwrite a ProjectInfo file if one is already
|
600
|
+
# present. Unlike 'scaffold', this is especially useful for
|
601
|
+
# pre-existing projects.
|
602
|
+
|
603
|
+
def template( name )
|
604
|
+
|
605
|
+
require 'facet/gem/self/gempath'
|
606
|
+
|
607
|
+
desc "Create a ProjectInfo template" unless desc
|
608
|
+
|
609
|
+
task name do
|
610
|
+
f = nil
|
611
|
+
if ::ProjectInfo::INFO_FILES.any?{ |f| File.exists?(f) }
|
612
|
+
puts "Project file '#{f}' already exists."
|
613
|
+
return
|
614
|
+
end
|
615
|
+
filename = 'ProjectInfo'
|
616
|
+
# if using gems
|
617
|
+
if dir = Gem.gempath('reap')
|
618
|
+
dir = File.join( dir, 'data', 'reap', 'scaffold', 'standard' )
|
619
|
+
else
|
620
|
+
dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', 'standard' )
|
621
|
+
end
|
622
|
+
f = File.join( dir, filename )
|
623
|
+
raise "ProjectInfo template file #{f} is missing." unless File.file?( f )
|
624
|
+
# copy
|
625
|
+
FileUtils.install( f, '.' )
|
626
|
+
tell "#{filename} created. You'll need to fill it out."
|
627
|
+
end
|
628
|
+
|
629
|
+
end
|
630
|
+
|
631
|
+
avail :template do
|
632
|
+
! ProjectInfo.exists?
|
633
|
+
end
|
634
|
+
|
635
|
+
# == Test
|
636
|
+
#
|
637
|
+
# The Reap test class runs each test in it's own
|
638
|
+
# proccess, making for a more pure test facility.
|
639
|
+
# Reap runs each test in a separate proccess to aviod
|
640
|
+
# potential conflicts between scripts.
|
641
|
+
#
|
642
|
+
# files Test files (eg. test/tc_**/*.rb)
|
643
|
+
# Defaults to typcial selection.
|
644
|
+
#
|
645
|
+
# libs List of lookup directories to include in
|
646
|
+
# load path. './lib' is always included.
|
647
|
+
#
|
648
|
+
# live Flag to quickly deactive use of local libs.
|
649
|
+
# Test against installed files instead.
|
650
|
+
#
|
651
|
+
# requires List of any files to pre-require.
|
652
|
+
#
|
653
|
+
# NOTE This works well enough but it is a tad delicate.
|
654
|
+
# It actually marshals test results across stdout->stdin
|
655
|
+
# shell pipe. One consequence of this is that you can't
|
656
|
+
# send debug info to stdout in your tests (including #p and #puts).
|
657
|
+
|
658
|
+
def test( name, &data )
|
659
|
+
|
660
|
+
require 'reap/class/test'
|
661
|
+
|
662
|
+
desc "Run unit-tests (each in a separate process)" unless desc
|
663
|
+
|
664
|
+
task name do
|
665
|
+
data = data.to_openobject
|
666
|
+
|
667
|
+
data.trunk ||= master.trunk
|
668
|
+
|
669
|
+
Reap::Test.new( data ).call
|
670
|
+
end
|
671
|
+
|
672
|
+
end
|
673
|
+
|
674
|
+
end #module Tasks
|