reap 5.0.0 → 5.10.10
Sign up to get free protection for your applications and to get access to all the features.
- data/ANN +3 -0
- data/COPYING +11 -0
- data/ChangeLog +25 -0
- data/ProjectInfo +41 -66
- data/README +125 -0
- data/Rakefile +0 -10
- data/bin/reap +3 -4
- data/data/reap/scaffold/COPYING +11 -0
- data/data/reap/scaffold/{standard/ChangeLog → ChangeLog} +0 -0
- data/data/reap/scaffold/{standard/TODO → INSTALL} +0 -0
- data/data/reap/scaffold/{standard/ProjectInfo → ProjectInfo} +20 -20
- data/data/reap/scaffold/{subversion/trunk/ChangeLog → README} +0 -0
- data/data/reap/scaffold/Rakefile +146 -0
- data/data/reap/scaffold/{subversion/trunk/TODO → Todo} +0 -0
- data/{doc/note → data/reap/scaffold}/setup.rb +11 -18
- data/{doc/note/aRakefile → dev/Rakefile} +0 -0
- data/{doc/note → dev}/composite_task.rb +0 -0
- data/{doc/note → dev}/compositepublisher.rb +0 -0
- data/{doc/note → dev}/ftptools.rb +0 -0
- data/{doc/note → dev}/license-each.rb +0 -0
- data/{doc/note → dev}/publisher.rb +0 -0
- data/{doc/note → dev}/rubyforgepublisher.rb +0 -0
- data/{doc/note → dev}/sshpublisher.rb +0 -0
- data/{doc/note → dev}/suby-cvs.rb +0 -0
- data/{doc/note → dev}/template.rb +0 -0
- data/lib/reap/bin/reap.rb +67 -84
- data/{doc/note/interface/interface.rb → lib/reap/lint.rb} +0 -0
- data/lib/reap/projectinfo.rb +28 -206
- data/lib/reap/readymade.rb +21 -0
- data/lib/reap/task.rb +118 -184
- data/lib/reap/task/announce.rb +93 -181
- data/lib/reap/task/fileperm.rb +16 -46
- data/lib/reap/task/info.rb +7 -33
- data/lib/reap/task/install.rb +17 -52
- data/{task → lib/reap/task}/noop.rb +9 -4
- data/lib/reap/task/package.rb +102 -348
- data/lib/reap/task/publish.rb +29 -155
- data/lib/reap/task/rdoc.rb +40 -92
- data/lib/reap/task/scaffold.rb +98 -41
- data/lib/reap/task/test.rb +52 -147
- data/lib/reap/task/testext.rb +110 -0
- data/lib/reap/task/webpublish.rb +43 -0
- data/lib/reap/tasks.rb +13 -0
- data/lib/reap/test.rb +138 -0
- data/setup.rb +272 -287
- data/test/tc_reap.rb +1 -1
- data/web/ProjectInfo +57 -0
- data/web/images/appleboy.jpg +0 -0
- data/web/images/grape.jpg +0 -0
- data/web/index.html +124 -0
- data/web/rdoc/classes/Object.html +121 -0
- data/web/rdoc/classes/ProjectInfo.html +207 -0
- data/web/rdoc/classes/ProjectInfo.src/M000094.html +18 -0
- data/web/rdoc/classes/ProjectInfo.src/M000095.html +24 -0
- data/web/rdoc/classes/ProjectInfo.src/M000096.html +22 -0
- data/web/rdoc/classes/ProjectInfo.src/M000097.html +21 -0
- data/web/rdoc/classes/ProjectInfo.src/M000098.html +18 -0
- data/web/rdoc/classes/Reap.html +248 -0
- data/web/rdoc/classes/Reap.src/M000023.html +16 -0
- data/web/rdoc/classes/Reap.src/M000024.html +21 -0
- data/web/rdoc/classes/Reap.src/M000025.html +16 -0
- data/web/rdoc/classes/Reap.src/M000026.html +21 -0
- data/web/rdoc/classes/Reap/Announce.html +262 -0
- data/web/rdoc/classes/Reap/Announce.src/M000030.html +18 -0
- data/web/rdoc/classes/Reap/Announce.src/M000031.html +114 -0
- data/web/rdoc/classes/Reap/Announce.src/M000032.html +46 -0
- data/web/rdoc/classes/Reap/Info.html +176 -0
- data/web/rdoc/classes/Reap/Info.src/M000033.html +18 -0
- data/web/rdoc/classes/Reap/Info.src/M000034.html +17 -0
- data/web/rdoc/classes/Reap/Info.src/M000035.html +18 -0
- data/web/rdoc/classes/Reap/Install.html +193 -0
- data/web/rdoc/classes/Reap/Install.src/M000036.html +18 -0
- data/web/rdoc/classes/Reap/Install.src/M000037.html +20 -0
- data/web/rdoc/classes/Reap/Install.src/M000038.html +26 -0
- data/web/rdoc/classes/Reap/Noop.html +192 -0
- data/web/rdoc/classes/Reap/Noop.src/M000027.html +18 -0
- data/web/rdoc/classes/Reap/Noop.src/M000028.html +17 -0
- data/web/rdoc/classes/Reap/Noop.src/M000029.html +18 -0
- data/web/rdoc/classes/Reap/Package.html +310 -0
- data/web/rdoc/classes/Reap/Package.src/M000055.html +18 -0
- data/web/rdoc/classes/Reap/Package.src/M000056.html +68 -0
- data/web/rdoc/classes/Reap/Package.src/M000057.html +84 -0
- data/web/rdoc/classes/Reap/Package.src/M000058.html +61 -0
- data/web/rdoc/classes/Reap/Perm.html +236 -0
- data/web/rdoc/classes/Reap/Perm.src/M000078.html +18 -0
- data/web/rdoc/classes/Reap/Perm.src/M000079.html +21 -0
- data/web/rdoc/classes/Reap/Perm.src/M000080.html +42 -0
- data/web/rdoc/classes/Reap/Perm.src/M000081.html +26 -0
- data/web/rdoc/classes/Reap/Perm.src/M000082.html +18 -0
- data/web/rdoc/classes/Reap/Publish.html +213 -0
- data/web/rdoc/classes/Reap/Publish.src/M000070.html +18 -0
- data/web/rdoc/classes/Reap/Publish.src/M000071.html +22 -0
- data/web/rdoc/classes/Reap/Publish.src/M000072.html +37 -0
- data/web/rdoc/classes/Reap/RDoc.html +218 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000059.html +18 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000060.html +24 -0
- data/web/rdoc/classes/Reap/RDoc.src/M000061.html +70 -0
- data/web/rdoc/classes/Reap/Task.html +396 -0
- data/web/rdoc/classes/Reap/Task.src/M000039.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000040.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000041.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000042.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000043.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000044.html +22 -0
- data/web/rdoc/classes/Reap/Task.src/M000045.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000046.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000047.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000048.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000049.html +16 -0
- data/web/rdoc/classes/Reap/Task.src/M000050.html +27 -0
- data/web/rdoc/classes/Reap/Task.src/M000051.html +19 -0
- data/web/rdoc/classes/Reap/Task.src/M000052.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000053.html +18 -0
- data/web/rdoc/classes/Reap/Task.src/M000054.html +19 -0
- data/web/rdoc/classes/Reap/Test.html +253 -0
- data/web/rdoc/classes/Reap/Test.src/M000062.html +18 -0
- data/web/rdoc/classes/Reap/Test.src/M000063.html +26 -0
- data/web/rdoc/classes/Reap/Test.src/M000064.html +77 -0
- data/web/rdoc/classes/Reap/Test.src/M000065.html +27 -0
- data/web/rdoc/classes/Reap/Test.src/M000066.html +50 -0
- data/web/rdoc/classes/Reap/Test/TestResults.html +205 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000067.html +21 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000068.html +21 -0
- data/web/rdoc/classes/Reap/Test/TestResults.src/M000069.html +23 -0
- data/web/rdoc/classes/Reap/TestExt.html +234 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000073.html +18 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000074.html +20 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000075.html +49 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000076.html +34 -0
- data/web/rdoc/classes/Reap/TestExt.src/M000077.html +27 -0
- data/web/rdoc/classes/Reap/WebPublish.html +213 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000083.html +18 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000084.html +21 -0
- data/web/rdoc/classes/Reap/WebPublish.src/M000085.html +32 -0
- data/web/rdoc/classes/ReapCommand.html +425 -0
- data/web/rdoc/classes/ReapCommand.src/M000001.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000003.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000005.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000007.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000009.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000011.html +16 -0
- data/web/rdoc/classes/ReapCommand.src/M000013.html +18 -0
- data/web/rdoc/classes/ReapCommand.src/M000014.html +19 -0
- data/web/rdoc/classes/ReapCommand.src/M000015.html +19 -0
- data/web/rdoc/classes/ReapCommand.src/M000016.html +24 -0
- data/web/rdoc/classes/ReapCommand.src/M000018.html +29 -0
- data/web/rdoc/classes/Scaffold.html +211 -0
- data/web/rdoc/classes/Scaffold.src/M000086.html +16 -0
- data/web/rdoc/classes/Scaffold.src/M000087.html +28 -0
- data/web/rdoc/classes/Scaffold.src/M000088.html +32 -0
- data/web/rdoc/classes/Scaffold.src/M000089.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.html +176 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000019.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000020.html +18 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000021.html +22 -0
- data/web/rdoc/classes/UnitTestKernel.src/M000022.html +22 -0
- data/web/rdoc/classes/UnitTesting.html +165 -0
- data/web/rdoc/classes/UnitTesting.src/M000090.html +34 -0
- data/web/rdoc/classes/UnitTesting.src/M000091.html +18 -0
- data/web/rdoc/classes/UnitTesting/Failure.html +156 -0
- data/web/rdoc/classes/UnitTesting/Failure.src/M000092.html +18 -0
- data/web/rdoc/classes/UnitTesting/Failure.src/M000093.html +21 -0
- data/web/rdoc/created.rid +1 -0
- data/web/rdoc/files/ANN.html +107 -0
- data/web/rdoc/files/COPYING.html +119 -0
- data/web/rdoc/files/ChangeLog.html +144 -0
- data/web/rdoc/files/ProjectInfo.html +190 -0
- data/web/rdoc/files/README.html +274 -0
- data/web/rdoc/files/Rakefile.html +101 -0
- data/web/rdoc/files/lib/reap/bin/reap_rb.html +129 -0
- data/web/rdoc/files/lib/reap/lint_rb.html +101 -0
- data/web/rdoc/files/lib/reap/projectinfo_rb.html +110 -0
- data/web/rdoc/files/lib/reap/readymade_rb.html +123 -0
- data/web/rdoc/files/lib/reap/task/announce_rb.html +114 -0
- data/web/rdoc/files/lib/reap/task/fileperm_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/info_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/install_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/noop_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/package_rb.html +109 -0
- data/web/rdoc/files/lib/reap/task/publish_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/rdoc_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task/scaffold_rb.html +107 -0
- data/web/rdoc/files/lib/reap/task/test_rb.html +110 -0
- data/web/rdoc/files/lib/reap/task/testext_rb.html +109 -0
- data/web/rdoc/files/lib/reap/task/webpublish_rb.html +108 -0
- data/web/rdoc/files/lib/reap/task_rb.html +120 -0
- data/web/rdoc/files/lib/reap/tasks_rb.html +116 -0
- data/web/rdoc/files/lib/reap/test_rb.html +109 -0
- data/web/rdoc/fr_class_index.html +47 -0
- data/web/rdoc/fr_file_index.html +51 -0
- data/web/rdoc/fr_method_index.html +124 -0
- data/web/rdoc/index.html +24 -0
- data/web/rdoc/rdoc-style.css +208 -0
- metadata +257 -138
- data/bin/rubytest +0 -5
- data/data/reap/scaffold/standard/COPYING +0 -403
- data/data/reap/scaffold/standard/INSTALL +0 -14
- data/data/reap/scaffold/standard/README +0 -3
- data/data/reap/scaffold/standard/Rakefile +0 -10
- data/data/reap/scaffold/standard/setup.rb +0 -1568
- data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
- data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
- data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -78
- data/data/reap/scaffold/subversion/trunk/README +0 -3
- data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
- data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
- data/data/reap/setup.rb +0 -1568
- data/doc/COPYING +0 -403
- data/doc/ChangeLog +0 -18
- data/doc/LATEST +0 -29
- data/doc/README +0 -182
- data/doc/doap.xml +0 -27
- data/doc/note/ProjectInfo.rb +0 -88
- data/doc/note/Rakefile.0 +0 -118
- data/doc/note/Rakefile.htm +0 -69
- data/doc/note/application.rb +0 -124
- data/doc/note/interface/rubyforge.rb +0 -247
- data/doc/note/intro.txt +0 -42
- data/doc/note/package.rb +0 -629
- data/doc/note/package.rb.0 +0 -394
- data/doc/note/scaffold.rb +0 -123
- data/lib/reap/app.rb +0 -74
- data/lib/reap/bin/rubylint.rb +0 -1
- data/lib/reap/bin/rubytest.rb +0 -45
- data/lib/reap/rake.rb +0 -12
- data/lib/reap/rakeadapter.rb +0 -50
- data/lib/reap/reap.rb +0 -32
- data/lib/reap/task/custom.rb +0 -12
- data/lib/reap/task/doap.rb +0 -85
- data/lib/reap/task/extest.rb +0 -161
- data/lib/reap/task/manifest.rb +0 -70
- data/lib/reap/task/release.rb +0 -512
- data/lib/reap/task/template.rb +0 -46
- data/lib/reap/vendor/http-access2.rb +0 -1590
- data/lib/reap/vendor/http-access2/cookie.rb +0 -538
- data/lib/reap/vendor/http-access2/http.rb +0 -542
data/lib/reap/task/publish.rb
CHANGED
@@ -1,175 +1,49 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
|
3
2
|
require 'reap/task'
|
4
|
-
require 'shellwords'
|
5
3
|
|
6
|
-
# ___ _ _ _ _ _____ _
|
7
|
-
# | _ \_ _| |__| (_)__| |_ |_ _|_ _ __| |__
|
8
|
-
# | _/ || | '_ \ | (_-< ' \ | |/ _` (_-< / /
|
9
|
-
# |_| \_,_|_.__/_|_/__/_||_| |_|\__,_/__/_\_\
|
10
4
|
#
|
11
|
-
|
12
|
-
#
|
13
|
-
|
5
|
+
# Publish Task
|
6
|
+
#
|
14
7
|
class Reap::Publish < Reap::Task
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
task_help %{
|
19
|
-
|
20
|
-
reap publish
|
21
|
-
|
22
|
-
Publish documents to hosting service. Three means of
|
23
|
-
publishing are current supported, ftp uploading, scp,
|
24
|
-
and web convenience option that recognizes particular
|
25
|
-
hosts (only RubyForge is currently supported).
|
26
|
-
|
27
|
-
type Type of publishing, 'web', 'scp' or 'ftp'.
|
28
|
-
host Host server, default is 'rubyforge.org'
|
29
|
-
username Username for host.
|
30
|
-
dir Directory of files to publish. Or,
|
31
|
-
copy Files to publish using from and to.
|
32
|
-
project Project name (used for Rubyforge)
|
33
|
-
|
34
|
-
If the type is 'scp' or 'ftp' you will also need to provide
|
35
|
-
the root directory parameter.
|
36
|
-
|
37
|
-
root Document root directory at host.
|
38
|
-
|
39
|
-
The dir parameter allows you to simply specify a local
|
40
|
-
directory, the contents of which will be published to
|
41
|
-
host's document root location (directory tree intact).
|
42
|
-
|
43
|
-
If you need more control over which files to publish
|
44
|
-
where, you can use the copy parameter instead. Provide
|
45
|
-
an array of pattern strings in the form of "{from} {to}".
|
46
|
-
If the desitination is the host's document root you do
|
47
|
-
not need to specify the {to} part. For example:
|
48
|
-
|
49
|
-
copy: [ 'web/*', 'doc/api/* doc/api' ]
|
50
|
-
|
51
|
-
The first copies the files under your project's web directory
|
52
|
-
to the host's document root. The second copies your projects
|
53
|
-
doc/api files to the doc/api location on the host.
|
54
|
-
|
55
|
-
When using the 'scp' type the internal template used for
|
56
|
-
the outbound destination is 'username@host:root/'.
|
57
|
-
|
58
|
-
}
|
59
|
-
|
60
|
-
#attr_accessor :host, :type, :dir, :project, :username
|
61
|
-
#attr_accessor :exclude # not using yet
|
62
|
-
|
63
|
-
task_attr :pub
|
64
|
-
|
65
|
-
# Run the publishing task.
|
66
|
-
|
67
|
-
def run( target=nil, copy_from=nil, copy_to=nil )
|
68
|
-
|
69
|
-
return nil if target and target != pub.target
|
70
|
-
|
71
|
-
# setup
|
72
|
-
|
73
|
-
pub.type ||= 'web'
|
74
|
-
pub.host ||= 'rubyforge.org'
|
75
|
-
pub.root ||= 'var/www/gforge-projects/'
|
76
|
-
pub.project ||= master.rubyforge.project || master.name
|
77
|
-
pub.username ||= master.rubyforge.username
|
78
|
-
pub.copy ||= [ "#{pub.dir}/*" ]
|
79
|
-
|
80
|
-
if copy_from
|
81
|
-
pub.copy = [ "#{copy_from} #{copy_to}".strip ]
|
82
|
-
end
|
83
|
-
|
84
|
-
# validate
|
9
|
+
section_required true
|
85
10
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
unless pub.username
|
91
|
-
puts "Username not specified." ; return nil
|
92
|
-
end
|
11
|
+
def task_desc
|
12
|
+
"Publish documents to the web."
|
13
|
+
end
|
93
14
|
|
94
|
-
|
15
|
+
attr_accessor :host, :type, :dir, :project, :username
|
16
|
+
attr_accessor :exclude # not using yet
|
95
17
|
|
96
|
-
|
18
|
+
def init
|
19
|
+
@type ||= 'www'
|
20
|
+
@host ||= 'rubyforge.org'
|
21
|
+
@project ||= master['rubyforge']['project'] || master['name']
|
22
|
+
@username ||= master['rubyforge']['username']
|
23
|
+
@exclude ||= []
|
24
|
+
end
|
97
25
|
|
98
|
-
|
26
|
+
def run
|
27
|
+
cmd = ''; skip = false
|
99
28
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
run_scp
|
29
|
+
case @host
|
30
|
+
when 'rubyforge', 'rubyforge.org'
|
31
|
+
case @type
|
32
|
+
when 'www', 'web'
|
33
|
+
cmd = %{scp -r #{@dir}/* #{@username}@rubyforge.org:/var/www/gforge-projects/#{@project}/}
|
106
34
|
else
|
107
|
-
puts %{Unrecognized publishing host '#{
|
108
|
-
|
35
|
+
puts %{Unrecognized publishing kind '#{@type}' for host '#{@host}'. Skipped.}
|
36
|
+
skip = true
|
109
37
|
end
|
110
|
-
|
111
|
-
when 'scp'
|
112
|
-
run_scp
|
113
|
-
|
114
|
-
when 'ftp'
|
115
|
-
run_ftp
|
116
|
-
|
117
38
|
else
|
118
|
-
puts %{Unrecognized publishing
|
119
|
-
|
39
|
+
puts %{Unrecognized publishing host '#{@host}'. Skipped.}
|
40
|
+
skip = true
|
120
41
|
end
|
121
42
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
#--
|
127
|
-
# SHELL OUT! Need a net/ssh library to fix.
|
128
|
-
#++
|
129
|
-
|
130
|
-
def run_scp
|
131
|
-
pub.copy.each { |c|
|
132
|
-
from, to = *Shellwords.shellwords(c)
|
133
|
-
to = '' if to.nil?
|
134
|
-
to = to[1..-1] if to[0,1] == '/'
|
135
|
-
cmd = "scp -r #{from} #{pub.username}@#{pub.host}:#{pub.root}/#{to}"
|
136
|
-
sh( cmd )
|
137
|
-
}
|
138
|
-
end
|
139
|
-
|
140
|
-
def run_ftp
|
141
|
-
require 'net/ftp'
|
142
|
-
return if $PRETEND
|
143
|
-
Net::FTP.open( pub.host ) do |ftp|
|
144
|
-
ftp.login( pub.username )
|
145
|
-
ftp.chdir( pub.root )
|
146
|
-
|
147
|
-
pub.copy.each { |c|
|
148
|
-
from, to = *Shellwords.shellwords(c)
|
149
|
-
to = '' if to.nil?
|
150
|
-
to = to[1..-1] if to[0,1] == '/'
|
151
|
-
from.sub('*', '**/*') unless from =~ /\*\*/
|
152
|
-
files = FileList.new( from )
|
153
|
-
files.each { |f|
|
154
|
-
t = File.join( to, f.basename )
|
155
|
-
ftp.putbinaryfile( f, t, 1024 )
|
156
|
-
}
|
157
|
-
}
|
43
|
+
unless skip
|
44
|
+
puts "Reap is shelling out publishing work..."
|
45
|
+
sh(cmd) unless $PRETEND
|
158
46
|
end
|
159
47
|
end
|
160
48
|
|
161
49
|
end
|
162
|
-
|
163
|
-
|
164
|
-
# Rake interface.
|
165
|
-
|
166
|
-
if defined?(Rake)
|
167
|
-
|
168
|
-
#require 'reap/rake/adapter'
|
169
|
-
|
170
|
-
module Rake
|
171
|
-
ReapPublish = ::Reap::RakeAdapter( ::Reap::Publish )
|
172
|
-
end
|
173
|
-
|
174
|
-
end
|
175
|
-
|
data/lib/reap/task/rdoc.rb
CHANGED
@@ -1,84 +1,50 @@
|
|
1
1
|
|
2
2
|
require 'reap/task'
|
3
3
|
|
4
|
-
# ___ _ _____ _
|
5
|
-
# | _ \__| |___ __ |_ _|_ _ __| |__
|
6
|
-
# | / _` / _ \/ _| | |/ _` (_-< / /
|
7
|
-
# |_|_\__,_\___/\__| |_|\__,_/__/_\_\
|
8
4
|
#
|
9
|
-
|
10
|
-
# = RDoc Task
|
11
|
-
#
|
12
|
-
# This task generates RDoc API documentation trom source
|
13
|
-
# comments.
|
5
|
+
# RDoc Task
|
14
6
|
#
|
15
|
-
# rdoc:
|
16
|
-
# dir Directory to store documentation [doc].
|
17
|
-
# main File to use as main page of RDocs.
|
18
|
-
# title Project title to use in RDocs.
|
19
|
-
# template Which RDoc template to use.
|
20
|
-
# include Files to include in RDocs.
|
21
|
-
# exclude Files to exclude from those.
|
22
|
-
# options Pass-thru extra options to RDoc command.
|
23
|
-
#
|
24
|
-
|
25
7
|
class Reap::RDoc < Reap::Task
|
26
8
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
task_help %{
|
32
|
-
|
33
|
-
Generate RDoc doumentation.
|
34
|
-
|
35
|
-
dir Directory to store documentation [doc].
|
36
|
-
main File to use as main page of RDocs.
|
37
|
-
title Project title to use in RDocs.
|
38
|
-
template Which RDoc template to use.
|
39
|
-
include Files to include in RDocs.
|
40
|
-
exclude Files to exclude from those.
|
41
|
-
options Pass-thru extra options to RDoc command.
|
42
|
-
|
43
|
-
}
|
9
|
+
def task_desc
|
10
|
+
"Generate RDocs (in #{dir})."
|
11
|
+
end
|
44
12
|
|
45
|
-
|
13
|
+
attr_accessor :dir, :main, :title, :template,
|
14
|
+
:include, :exclude, :options
|
15
|
+
|
16
|
+
def init
|
17
|
+
@dir ||= 'doc'
|
18
|
+
@main ||= 'README'
|
19
|
+
@title ||= master["title"]
|
20
|
+
@template ||= 'html' # 'jamis'
|
21
|
+
@include ||= [ 'A-Z*', 'lib/**/*', 'ext/**/*' ]
|
22
|
+
@exclude ||= [ 'demo/**/*', 'example/**/*', 'sample/**/*' ]
|
23
|
+
@options ||= ['--merge', '--all']
|
24
|
+
end
|
46
25
|
|
47
26
|
def run
|
27
|
+
must_exclude = [ 'InstalledFiles', 'CVS/**/*' ]
|
48
28
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
doc.main ||= 'README'
|
53
|
-
doc.title ||= master.title
|
54
|
-
doc.template ||= 'html' # 'jamis'
|
55
|
-
doc.include ||= [ 'A-Z*', 'lib/**/*', 'ext/**/*', doc.main ]
|
56
|
-
doc.exclude ||= [ 'demo/**/*', 'example/**/*', 'sample/**/*' ]
|
57
|
-
doc.options ||= ['--merge', '--all']
|
58
|
-
|
59
|
-
doc.include = [ doc.include ].flatten
|
60
|
-
doc.exclude = [ doc.exclude ].flatten
|
61
|
-
doc.options = [ doc.options ].flatten
|
62
|
-
|
63
|
-
# document
|
64
|
-
|
65
|
-
if !File.exists?(doc.main) or File.directory?(doc.main)
|
66
|
-
warn "WARNING! Specified RDoc Main file #{doc.main} not found."
|
67
|
-
doc.main = nil
|
29
|
+
if !File.exists?(@main) or File.directory?(@main)
|
30
|
+
warn "Specified RDoc Main file #{@main} not found. Ignored."
|
31
|
+
@main = nil
|
68
32
|
end
|
69
33
|
|
70
|
-
rdoc_dir = File.expand_path(
|
71
|
-
|
72
|
-
if FileTest.directory?(
|
73
|
-
|
74
|
-
|
75
|
-
inp
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
FileUtils.rm_r(
|
34
|
+
rdoc_dir = File.expand_path(@dir)
|
35
|
+
|
36
|
+
if FileTest.directory?(@dir)
|
37
|
+
print "Directory '#{@dir}' already exists. Clobber? [y/N] "
|
38
|
+
until inp = $stdin.gets[0,1] ; sleep 1 ; end ; puts
|
39
|
+
if (inp || 'y').downcase == 'y'
|
40
|
+
puts "Removing old directory '#{rdoc_dir}'..."
|
41
|
+
#FileUtils.mkdir_p(".trash") unless FileTest.directory?(".trash")
|
42
|
+
#trashdir = ".trash/#{File.basename(@dir)}"
|
43
|
+
#FileUtils.rm_r(trashdir) if FileTest.exists?(trashdir)
|
44
|
+
#FileUtils.mv(@dir, trashdir)
|
45
|
+
FileUtils.rm_r(@dir) unless $PRETEND
|
80
46
|
else
|
81
|
-
|
47
|
+
puts "Reap rdoc task canceled."
|
82
48
|
return nil
|
83
49
|
end
|
84
50
|
end
|
@@ -86,13 +52,13 @@ class Reap::RDoc < Reap::Task
|
|
86
52
|
rdoc_target = "#{rdoc_dir}/index.html"
|
87
53
|
|
88
54
|
exc = []
|
89
|
-
(
|
55
|
+
(@exclude + must_exclude).each{ |e|
|
90
56
|
exc << e
|
91
57
|
exc |= Dir.glob(e+'/**/*')
|
92
58
|
}
|
93
59
|
|
94
60
|
inc = Dir.glob('[A-Z]*')
|
95
|
-
|
61
|
+
@include.each{ |i| inc |= Dir.glob(i) }
|
96
62
|
inc -= exc
|
97
63
|
|
98
64
|
inc = inc.select{ |f| File.file?(f) }
|
@@ -102,33 +68,15 @@ class Reap::RDoc < Reap::Task
|
|
102
68
|
|
103
69
|
# build options string
|
104
70
|
build = []
|
105
|
-
build +=
|
106
|
-
build << "--main '#{
|
107
|
-
build << "--title '#{
|
108
|
-
build << "-T '#{
|
71
|
+
build += @options
|
72
|
+
build << "--main '#{@main}'" if @main
|
73
|
+
build << "--title '#{@title}'" if @title
|
74
|
+
build << "-T '#{@template}'" if @template
|
109
75
|
rdoc_opts = build.join(' ')
|
110
76
|
|
111
|
-
#--
|
112
|
-
# SHELL OUT! Can RDoc be called from code?
|
113
|
-
#++
|
114
|
-
|
115
77
|
# do it!
|
116
|
-
|
78
|
+
puts "Reap is shelling work out to RDoc..."
|
117
79
|
sh %{rdoc -o #{rdoc_dir} #{rdoc_opts} #{rdoc_files}}
|
118
80
|
end
|
119
81
|
|
120
82
|
end
|
121
|
-
|
122
|
-
|
123
|
-
# Rake interface.
|
124
|
-
|
125
|
-
if defined?(Rake)
|
126
|
-
|
127
|
-
#require 'reap/rake/adapter'
|
128
|
-
|
129
|
-
module Rake
|
130
|
-
ReapRDoc = ::Reap::RakeAdapter( ::Reap::RDoc )
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
|
data/lib/reap/task/scaffold.rb
CHANGED
@@ -1,57 +1,114 @@
|
|
1
|
-
require 'reap/task'
|
2
|
-
require 'facet/gem/self/gempath'
|
3
1
|
|
4
|
-
|
2
|
+
#require 'rbconfig'
|
3
|
+
#require 'reap/projectinfo'
|
5
4
|
|
6
|
-
|
5
|
+
module Scaffold
|
6
|
+
extend self
|
7
7
|
|
8
|
-
|
8
|
+
SCMPaths => %w{
|
9
|
+
trunk
|
10
|
+
branch
|
11
|
+
tag
|
12
|
+
scrap
|
13
|
+
package
|
14
|
+
}
|
9
15
|
|
10
|
-
|
16
|
+
TrunkPaths = %w{
|
17
|
+
bin
|
18
|
+
lib
|
19
|
+
ext
|
20
|
+
dev
|
21
|
+
data
|
22
|
+
test
|
23
|
+
demo
|
24
|
+
}
|
11
25
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
26
|
+
TrunkFiles = %w{
|
27
|
+
README
|
28
|
+
INSTALL
|
29
|
+
COPYING
|
30
|
+
ProjectInfo
|
31
|
+
ChangeLog
|
32
|
+
Todo
|
33
|
+
RakeFile
|
34
|
+
setup.rb
|
35
|
+
}
|
16
36
|
|
17
|
-
|
18
|
-
directory and than change into it. It will not generate
|
19
|
-
a scaffolding into a directory with any files already in
|
20
|
-
it unless you use the -f (force) option. Also, the scaffold
|
21
|
-
task is not available if a ProjectInfo file exists.
|
37
|
+
def go(name) ; scaffold(name) ; end
|
22
38
|
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
# Main method.
|
40
|
+
def scaffold(name=nil)
|
41
|
+
name ||= 'yourlib.projectdomain.org'
|
42
|
+
t = Time.now.strftime("%Y-%m-%d")
|
43
|
+
libdir = File.join( 'lib', "#{@name},#{t}" )
|
26
44
|
|
27
|
-
|
45
|
+
if @scm
|
46
|
+
SCMPaths.each { |d| makedir( d ) }
|
47
|
+
Dir.chdir 'trunk'
|
48
|
+
end
|
49
|
+
TrunkPaths.each { |d| makedir( d ) }
|
50
|
+
makedir_with_check( libdir )
|
51
|
+
TrunkFiles.each { |f| temlpate( f ) }
|
52
|
+
end
|
28
53
|
|
29
|
-
|
54
|
+
private
|
30
55
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
type = 'subversion' if type == 'svn'
|
40
|
-
# gems workaround
|
41
|
-
if dir = Gem.gempath('reap')
|
42
|
-
dir = File.join( dir, 'data', 'reap', 'scaffold', type )
|
43
|
-
else
|
44
|
-
dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', type )
|
56
|
+
# Copy a file from lib/data to the current dir.
|
57
|
+
def template( filename )
|
58
|
+
dir = File.join(File.dirname(__FILE__), 'data' )
|
59
|
+
#dir = File.join( ::Config::CONFIG['datadir'], DATA_DIR )
|
60
|
+
f = File.join( dir, filename )
|
61
|
+
unless File.file?( f )
|
62
|
+
puts f
|
63
|
+
raise "Tempfile is missing."
|
45
64
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
#FileUtils.mkdir_p( name )
|
51
|
-
FileUtils.cp_r( File.join( dir, '.'), '.' )
|
52
|
-
tell "Project ready."
|
65
|
+
|
66
|
+
if File.exists?(filename)
|
67
|
+
puts "#{filename} already exists."
|
68
|
+
return
|
53
69
|
end
|
70
|
+
# copy tmpf to Reapfile
|
71
|
+
FileUtils.cp( f, filename )
|
72
|
+
#puts "#{filename} created. You'll need to fill it out."
|
73
|
+
end
|
74
|
+
|
75
|
+
# Make a directory as long as it doesn't already exist.
|
76
|
+
def makedir( dir )
|
77
|
+
FileUtils.makedir_p( dir ) unless File.directory?( dir )
|
54
78
|
end
|
55
79
|
|
56
80
|
end
|
57
81
|
|
82
|
+
|
83
|
+
|
84
|
+
=begin
|
85
|
+
def scaffold
|
86
|
+
require 'reap/scaffold'
|
87
|
+
name =
|
88
|
+
domain =
|
89
|
+
Scaffold.go( name, domain )
|
90
|
+
end
|
91
|
+
|
92
|
+
def template( file_name = ProjectInfo )
|
93
|
+
#dir = File.dirname(File.dirname(__FILE__))
|
94
|
+
dir = File.join( ::Config::CONFIG['datadir'], DATA_DIR )
|
95
|
+
|
96
|
+
tmpf = File.join( dir, 'template.yaml' )
|
97
|
+
unless File.file?( tmpf )
|
98
|
+
puts tmpf
|
99
|
+
raise "Tempfile is missing."
|
100
|
+
end
|
101
|
+
|
102
|
+
if File.directory?(filename)
|
103
|
+
puts "#{filename} a directory. Cannot comply."
|
104
|
+
return
|
105
|
+
elsif File.file?(filename)
|
106
|
+
puts "#{filename} already exists."
|
107
|
+
return
|
108
|
+
end
|
109
|
+
# copy tmpf to Reapfile
|
110
|
+
FileUtils.cp( tmpf, filename )
|
111
|
+
puts "#{filename} created. You'll need to fill it out."
|
112
|
+
end
|
113
|
+
=end
|
114
|
+
|