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/bin/reap.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
|
2
|
-
require 'facets'
|
3
2
|
require 'rbconfig'
|
4
|
-
require '
|
5
|
-
require 'reap/tasks'
|
3
|
+
require 'fileutils'
|
6
4
|
|
7
|
-
|
5
|
+
require 'facets' # Next two may be moved in the future to:
|
6
|
+
require 'consoleapp' # 'console/command'
|
7
|
+
require 'ansicode' # 'console/ansicode'
|
8
|
+
require 'string/tabto'
|
9
|
+
require 'gem/self/gempath'
|
8
10
|
|
9
|
-
|
11
|
+
require 'reap/reap'
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
# ReapCommand is the CLI interface to Reap.
|
14
|
+
|
15
|
+
class ReapCommand < Console::Command
|
14
16
|
|
15
|
-
|
17
|
+
INFO_FILES = [ 'ProjectInfo', 'projectinfo' ]
|
16
18
|
|
17
19
|
# Options
|
18
20
|
|
@@ -20,15 +22,28 @@ class ReapCommand < ShellCommand
|
|
20
22
|
def __verbose ; $VERBOSE = true ; end
|
21
23
|
alias_method :_V, :__verbose
|
22
24
|
|
23
|
-
#
|
24
|
-
def
|
25
|
-
alias_method :
|
25
|
+
# force mode
|
26
|
+
def __force ; $FORCE = true ; end
|
27
|
+
alias_method :_f, :__force
|
26
28
|
|
27
29
|
# pretend mode (under construction)
|
30
|
+
#--
|
31
|
+
# A few tasks have some support for pretending
|
32
|
+
# but this has to be developed much more
|
33
|
+
# before it can be commonly avaialble.
|
34
|
+
# Notice it is not mentioned in the Help.
|
35
|
+
#++
|
28
36
|
def __pretend; $PRETEND = true ; end
|
29
37
|
alias_method :_P, :__pretend
|
30
38
|
|
31
|
-
#
|
39
|
+
# debug mode (under construction)
|
40
|
+
def __debug; $DEBUG = true ; end
|
41
|
+
alias_method :_D, :__debug
|
42
|
+
|
43
|
+
def __password( pass ); $PASSWORD = pass ; end
|
44
|
+
alias_method :_p, :__password
|
45
|
+
|
46
|
+
# display reap version
|
32
47
|
def __version ; version ; end
|
33
48
|
alias_method :_v, :__version
|
34
49
|
|
@@ -39,96 +54,177 @@ class ReapCommand < ShellCommand
|
|
39
54
|
# option to display tasks
|
40
55
|
def __tasks; tasks ; end
|
41
56
|
alias_method :_t, :__tasks
|
57
|
+
alias_method :_T, :__tasks
|
42
58
|
|
43
|
-
#
|
44
|
-
|
45
|
-
#alias_method :_r, :__require
|
59
|
+
#option for build version (only for package task)
|
60
|
+
def _b ; $BUILD_VERSION = true ; end
|
46
61
|
|
47
|
-
#
|
62
|
+
#def _f( pif ) ; $PROJECT_FILE = pif ; end
|
63
|
+
#alias_method :_f, :__file
|
64
|
+
|
65
|
+
# Default subcommand is to display tasks.
|
48
66
|
|
49
|
-
# default action
|
50
67
|
def default
|
51
68
|
tasks
|
52
69
|
end
|
53
70
|
|
54
|
-
#
|
71
|
+
# Display version.
|
72
|
+
|
55
73
|
def version
|
56
|
-
puts "Reap
|
57
|
-
exit 0
|
74
|
+
puts "Reap v#{Reap::Version}"
|
75
|
+
exit 0 # shortcuts execution when called via the --version option.
|
58
76
|
end
|
59
77
|
|
60
|
-
#
|
78
|
+
# Display help.
|
79
|
+
|
61
80
|
def help
|
62
81
|
puts HELP
|
63
|
-
exit 0
|
82
|
+
exit 0 # shortcuts execution when called via the --help option.
|
64
83
|
end
|
65
84
|
|
66
85
|
# list available tasks
|
86
|
+
|
67
87
|
def tasks
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
88
|
+
# TODO How to deal with windows or other ansi not support?
|
89
|
+
hi = Console::ANSICode.bold #+ Console::ANSICode.yellow
|
90
|
+
lo = Console::ANSICode.reset #+ Console::ANSICode.blue
|
91
|
+
re = Console::ANSICode.reset
|
92
|
+
|
93
|
+
tasklist = TaskSpace.visible_tasks
|
94
|
+
if tasklist.empty?
|
95
|
+
puts "No tasks available."
|
96
|
+
else
|
97
|
+
sorted = tasklist.collect{ |e| e.to_s }.sort
|
98
|
+
outlist = []
|
99
|
+
margin = sorted.collect{ |t| t.size }.max + 2
|
100
|
+
sorted.each do |name|
|
101
|
+
outlist << hi + " #{name}".ljust(margin) + lo + " #{TaskSpace.instance_task(name).description}" + re
|
102
|
+
end
|
103
|
+
puts "[from #{Dir.pwd}]"
|
104
|
+
#puts
|
105
|
+
puts outlist.join("\n")
|
106
|
+
#puts
|
72
107
|
end
|
73
|
-
puts
|
74
|
-
exit 0
|
75
108
|
end
|
76
|
-
alias_method :ls, :tasks
|
77
109
|
|
78
|
-
#
|
79
|
-
def template
|
80
|
-
if INFO_FILES.any?{ |f| File.exists?(f) }
|
81
|
-
puts "Project file already exists."
|
82
|
-
exit 0
|
83
|
-
end
|
84
|
-
filename = 'ProjectInfo'
|
85
|
-
dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold' )
|
86
|
-
f = File.join( dir, filename )
|
87
|
-
raise "ProjectInfo template file #{f} is missing." unless File.file?( f )
|
88
|
-
# copy
|
89
|
-
FileUtils.cp( f, filename )
|
90
|
-
puts "#{filename} created. You'll need to fill it out."
|
91
|
-
exit 0
|
92
|
-
end
|
110
|
+
# Command shows task dependencies.
|
93
111
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
112
|
+
def prerequisite
|
113
|
+
Reap.tasks.each { |name, t|
|
114
|
+
print name
|
115
|
+
print " => "
|
116
|
+
puts TaskSpace.instance_task(name.to_sym).prerequisite.inspect
|
117
|
+
}
|
98
118
|
end
|
99
119
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
reap v#{::Reap::Version}
|
106
|
-
|
107
|
-
USAGE: reap [options...] <command> [arguments...]
|
108
|
-
|
109
|
-
COMMANDS:
|
120
|
+
# Define a CLI callable method for each described tasks.
|
121
|
+
#
|
122
|
+
# NOTE The use of the launcher class seems a touch hackish,
|
123
|
+
# and indicates to me that there might be a better
|
124
|
+
# way to organize the tasks, but as long as it works!
|
110
125
|
|
111
|
-
|
112
|
-
Copies a ProjectInfo template into the current
|
113
|
-
directory, if it doesn't already exist. If it does
|
114
|
-
exist will build the project directory based on it.
|
115
|
-
This will not destroy any structure already in place!
|
126
|
+
launcher = Class.new{ include TaskSpace }.new()
|
116
127
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
-v --version
|
123
|
-
Display the current version.
|
124
|
-
|
125
|
-
-V --verbose
|
126
|
-
Provides extra verbose processing information.
|
127
|
-
|
128
|
-
-D --debug
|
129
|
-
Provides extra verbose processing information.
|
128
|
+
TaskSpace.visible_tasks.each do |t|
|
129
|
+
define_method(t) do |*args|
|
130
|
+
launcher.send(t, *args)
|
131
|
+
end
|
132
|
+
end
|
130
133
|
|
131
|
-
|
132
|
-
|
134
|
+
# Help text
|
135
|
+
|
136
|
+
HELP = <<-HERE.tabto(2)
|
137
|
+
|
138
|
+
reap [options...] <command> [arguments...]
|
139
|
+
|
140
|
+
COMMANDS:
|
141
|
+
|
142
|
+
tasks
|
143
|
+
List all the current tasks with descriptions.
|
144
|
+
(This is the default if no command is given.)
|
145
|
+
|
146
|
+
help [type]
|
147
|
+
Displays this help information. If a task type is given, it
|
148
|
+
will provide help information specific to that kind of task.
|
149
|
+
|
150
|
+
OPTIONS:
|
151
|
+
|
152
|
+
-h --help Display this help information.
|
153
|
+
-v --version Display the current version.
|
154
|
+
-V --verbose Provides extra verbose processing information.
|
155
|
+
-f --force Forces certain operations to be performed.
|
156
|
+
-D --debug Provides extra verbose processing information.
|
157
|
+
-f --file Specify alternate project file.
|
158
|
+
|
159
|
+
HERE
|
160
|
+
|
161
|
+
#--
|
162
|
+
#
|
163
|
+
# HELP = <<-HERE.tabto(2)
|
164
|
+
#
|
165
|
+
# reap [options...] <command> [arguments...]
|
166
|
+
#
|
167
|
+
# COMMANDS:
|
168
|
+
#
|
169
|
+
# tasks
|
170
|
+
# List all the current tasks with descriptions.
|
171
|
+
# (This is the default if no command is given.)
|
172
|
+
#
|
173
|
+
# scaffold [type]
|
174
|
+
# Generates a project directory layout within the current
|
175
|
+
# directory. For more details type 'reap help scaffold'.
|
176
|
+
#
|
177
|
+
# template | projectinfo
|
178
|
+
# Create a ProjectInfo template file in the current directory
|
179
|
+
# Unlike 'scaffold', this is especially useful for pre-existing
|
180
|
+
# projects.
|
181
|
+
#
|
182
|
+
# help [type]
|
183
|
+
# Displays this help information. If a task type is given, it
|
184
|
+
# will provide help information specific to that kind of task.
|
185
|
+
#
|
186
|
+
# OPTIONS:
|
187
|
+
#
|
188
|
+
# -h --help Display this help information.
|
189
|
+
# -v --version Display the current version.
|
190
|
+
# -V --verbose Provides extra verbose processing information.
|
191
|
+
# -f --force Forces certain operations to be performed.
|
192
|
+
# -D --debug Provides extra verbose processing information.
|
193
|
+
# -f --file Specify alternate project file.
|
194
|
+
#
|
195
|
+
# HERE
|
196
|
+
#
|
197
|
+
# HELP_SCAFFOLD = <<-HERE.tabto(2)
|
198
|
+
#
|
199
|
+
# reap scaffold [type]
|
200
|
+
#
|
201
|
+
# Generates a project directory layout within the current
|
202
|
+
# directory. The scaffolding includes all the standard
|
203
|
+
# features such as directories lib/ bin/ doc/ and files
|
204
|
+
# like README.
|
205
|
+
#
|
206
|
+
# To use this task you should first create an empty
|
207
|
+
# directory and than change into it. This command will
|
208
|
+
# not create a new project directory. As a safegaurd, this
|
209
|
+
# command will not generate scaffolding in a directory with
|
210
|
+
# files already present, unless you use the -f (force) option.
|
211
|
+
#
|
212
|
+
# There are currently two types of supported scaffoldings:
|
213
|
+
# 'standard', which is the default if no type is given,
|
214
|
+
# and 'subversion' which creates a "trunk" hierarchy.
|
215
|
+
#
|
216
|
+
# HERE
|
217
|
+
#
|
218
|
+
# HELP_TEMPLATE = <<-HERE.tabto(2)
|
219
|
+
#
|
220
|
+
# reap template | reap projectinfo
|
221
|
+
#
|
222
|
+
# Create a ProjectInfo template file in the current directory
|
223
|
+
# Unlike 'scaffold', this is especially useful for pre-existing
|
224
|
+
# projects.
|
225
|
+
#
|
226
|
+
# HERE
|
227
|
+
#
|
228
|
+
#++
|
133
229
|
|
134
|
-
|
230
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'facet/consoleapp'
|
4
|
+
|
5
|
+
# Run commented tests.
|
6
|
+
#
|
7
|
+
#--
|
8
|
+
# One wonders if this should be built as a Test::Unit::CommentAutoRunner
|
9
|
+
#++
|
10
|
+
|
11
|
+
class RubyCommentTester < Console::Application
|
12
|
+
|
13
|
+
RETEST = /^=begin\s+test.*?\n(.*)\n=end/mi
|
14
|
+
|
15
|
+
# option to display help
|
16
|
+
def __verbose ; $VERBOSE = true ; end
|
17
|
+
alias_method :_v, :__verbose
|
18
|
+
|
19
|
+
# option to display help
|
20
|
+
def __help
|
21
|
+
puts HELP
|
22
|
+
exit 0
|
23
|
+
end
|
24
|
+
alias_method :_h, :__help
|
25
|
+
|
26
|
+
def main( *filepaths )
|
27
|
+
filepaths.each { |fp|
|
28
|
+
run_comment_test( fp )
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def run_comment_test( filepath )
|
35
|
+
code = File.read( filepath )
|
36
|
+
test_code = nil
|
37
|
+
md = RETEST.match( code )
|
38
|
+
test_code = md[1] if md
|
39
|
+
unless test_code
|
40
|
+
puts "No test found for #{filepath}."
|
41
|
+
return nil
|
42
|
+
end
|
43
|
+
offset = code.split(/\n/).size - test_code.split(/\n/).size - 1
|
44
|
+
|
45
|
+
require filepath
|
46
|
+
eval test_code, TOPLEVEL_BINDING, File.basename(filepath), offset
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
HELP = <<-EOS
|
52
|
+
rubytest filename [filename ...]
|
53
|
+
EOS
|
@@ -0,0 +1,220 @@
|
|
1
|
+
#--
|
2
|
+
# _
|
3
|
+
# /_\ _ _ _ _ ___ _ _ _ _ __ ___
|
4
|
+
# / _ \| ' \| ' \/ _ \ || | ' \/ _/ -_)
|
5
|
+
# /_/ \_\_||_|_||_\___/\_,_|_||_\__\___|
|
6
|
+
#
|
7
|
+
#++
|
8
|
+
|
9
|
+
require 'net/smtp'
|
10
|
+
|
11
|
+
require 'facet/string/margin'
|
12
|
+
require 'facet/string/tab'
|
13
|
+
require 'facet/string/align_center'
|
14
|
+
require 'facet/string/fold'
|
15
|
+
require 'facet/string/word_wrap'
|
16
|
+
|
17
|
+
module Reap
|
18
|
+
|
19
|
+
# = Announce
|
20
|
+
#
|
21
|
+
# The announce task is intended for sending out a nice
|
22
|
+
# formated email message to a mailing address, especially
|
23
|
+
# mailing-lists.
|
24
|
+
#
|
25
|
+
# Announcement specific settings:
|
26
|
+
#
|
27
|
+
# server Email server to route message.
|
28
|
+
# port Email server's port.
|
29
|
+
# domain Email server's domain name.
|
30
|
+
# account Email account name.
|
31
|
+
# type Login type, either plain, cram_md5 or login.
|
32
|
+
# secure Uses TLS security, true or false?
|
33
|
+
# to Email address to send announcemnt.
|
34
|
+
# from Email address sent from.
|
35
|
+
# subject Subject of email message.
|
36
|
+
# links Array of http links to related sites.
|
37
|
+
# file File that contains announcement message.
|
38
|
+
# memo Embedded announcement message.
|
39
|
+
# slogan Motto for you project.
|
40
|
+
#
|
41
|
+
# Inherited settings:
|
42
|
+
#
|
43
|
+
# title Project title.
|
44
|
+
# summary Brief one-line description.
|
45
|
+
# description Long description of project.
|
46
|
+
# homepage Project homepage web address.
|
47
|
+
#
|
48
|
+
|
49
|
+
class Announce
|
50
|
+
|
51
|
+
include TaskUtils
|
52
|
+
|
53
|
+
attr :anc
|
54
|
+
|
55
|
+
def initialize( anc )
|
56
|
+
@anc = anc.to_openobject
|
57
|
+
|
58
|
+
anc.to = (anc.to || 'ruby-talk@ruby-lang.org').to_s.strip
|
59
|
+
anc.from = anc.from.to_s.strip
|
60
|
+
anc.server = anc.server.to_s.strip
|
61
|
+
anc.port = (anc.port || 25).to_i
|
62
|
+
anc.domain = anc.domain.to_s.strip if anc.domain
|
63
|
+
anc.account = anc.account.to_s.strip
|
64
|
+
anc.type = (anc.type || 'plain').to_s.strip #cram_md5 #plain #login
|
65
|
+
|
66
|
+
#anc.title ||= master.title
|
67
|
+
#anc.version ||= master.version || master.date
|
68
|
+
anc.links ||= []
|
69
|
+
anc.subject ||= "[ANN] #{anc.title}, v#{anc.version}"
|
70
|
+
|
71
|
+
anc.address = anc.to # TODO
|
72
|
+
end
|
73
|
+
|
74
|
+
# Validate data.
|
75
|
+
|
76
|
+
def valid?
|
77
|
+
return false, "server is a require announce field" if anc.server.empty?
|
78
|
+
return false, "account is a require announce field" if anc.account.empty?
|
79
|
+
#return false, "DOMAIN is a required field" if anc.domain.empty?
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
83
|
+
def call ; write_and_email ; end
|
84
|
+
|
85
|
+
# Generate announcement and email it.
|
86
|
+
|
87
|
+
def write_and_email
|
88
|
+
|
89
|
+
message = build_message
|
90
|
+
|
91
|
+
puts "\n#{message}\n\n"
|
92
|
+
print "Send? [y/N] "
|
93
|
+
until inp = $stdin.gets[0,1] ; sleep 1 ; end
|
94
|
+
|
95
|
+
unless inp.downcase == 'y'
|
96
|
+
puts "Reap announce task canceled."
|
97
|
+
return nil
|
98
|
+
end
|
99
|
+
|
100
|
+
# ask for password
|
101
|
+
print "Password for #{anc.account}: "
|
102
|
+
until passwd = $stdin.gets.strip ; sleep 1 ; end
|
103
|
+
|
104
|
+
mail = %Q{
|
105
|
+
|From: #{anc.from}
|
106
|
+
|To: #{anc.address}
|
107
|
+
|Subject: #{anc.subject}
|
108
|
+
|
|
109
|
+
|#{message}
|
110
|
+
}.margin
|
111
|
+
begin
|
112
|
+
# --- Send using SMTP object and an adaptor
|
113
|
+
Net::SMTP.enable_tls if Net::SMTP.respond_to?(:enable_tls) and anc.secure # == :tls
|
114
|
+
Net::SMTP.start(anc.server, anc.port, anc.domain, anc.account, passwd, anc.type) do |s|
|
115
|
+
s.send_message mail, anc.from, anc.address
|
116
|
+
end
|
117
|
+
puts "Email sent successfully to #{anc.address}."
|
118
|
+
rescue => e
|
119
|
+
puts "Email delivery failed."
|
120
|
+
puts e
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def build_message
|
128
|
+
|
129
|
+
ver = anc.version.chomp('.0').chomp('.0')
|
130
|
+
|
131
|
+
# header
|
132
|
+
announce = %Q{
|
133
|
+
|
|
134
|
+
|A N N O U N C I N G
|
135
|
+
|
|
136
|
+
|#{anc.title} #{ver}
|
137
|
+
|
|
138
|
+
|#{anc.summary}
|
139
|
+
|
|
140
|
+
|#{anc.homepage}
|
141
|
+
}.margin.align_center(66)
|
142
|
+
|
143
|
+
# abstract
|
144
|
+
abstract = ''
|
145
|
+
if anc.description
|
146
|
+
abstract << "\n\n"
|
147
|
+
abstract << "ABSTRACT\n--------\n\n#{anc.description}"
|
148
|
+
abstract << "\n"
|
149
|
+
end
|
150
|
+
|
151
|
+
# more info
|
152
|
+
info = ''
|
153
|
+
unless anc.links.empty?
|
154
|
+
info << "\n\n"
|
155
|
+
info << "\nRELATED LINKS\n-------------\n\n" #.center(67)
|
156
|
+
anc.links.each{ |mi| info << "#{mi}" << "\n" } #.center(67) << "\n" }
|
157
|
+
info << "\n"
|
158
|
+
end
|
159
|
+
|
160
|
+
# slogan
|
161
|
+
slogan = ''
|
162
|
+
if anc.slogan
|
163
|
+
slogan << "\n\n"
|
164
|
+
slogan << anc.slogan.center(67)
|
165
|
+
slogan << "\n\n"
|
166
|
+
end
|
167
|
+
|
168
|
+
# memo
|
169
|
+
memo = ''
|
170
|
+
if anc.memo
|
171
|
+
memo = ''
|
172
|
+
#memo << "\n---\n" #<< ('-' * 72) << "\n"
|
173
|
+
memo << "\nRELEASE MEMO\n------------\n\n"
|
174
|
+
memo << anc.memo.strip.fold(true) #.word_wrap(67)
|
175
|
+
#memo << "\n"
|
176
|
+
end
|
177
|
+
|
178
|
+
# msg file
|
179
|
+
msg = ''
|
180
|
+
if anc.file and File.file?( anc.file )
|
181
|
+
msg << "\nRELEASE MEMO\n------------\n\n"
|
182
|
+
#msg << "\n---\n" #<< ("-" * 68) << "\n"
|
183
|
+
#msg << "(from #{anc.file})\n\n"
|
184
|
+
mg = File.read( anc.file )
|
185
|
+
msg << mg.strip.fold(true) #.word_wrap(67)
|
186
|
+
end
|
187
|
+
|
188
|
+
# stamp
|
189
|
+
stamp = "\n\n\n"
|
190
|
+
#stamp << "\n\n---\n" #<< ("-" * 68) << "\n"
|
191
|
+
stamp << %q{
|
192
|
+
! Generated by
|
193
|
+
! ___
|
194
|
+
! | _ \___ __ _ _ __
|
195
|
+
! | ) -_) _` | '_ \
|
196
|
+
! |_|_\___\__,_| .__)
|
197
|
+
! |_|
|
198
|
+
!
|
199
|
+
! The Ruby Project Assistant
|
200
|
+
!
|
201
|
+
! Do you Ruby? (http://www.ruby-lang.org)
|
202
|
+
}.margin(12) #.indent(12)
|
203
|
+
stamp << "\n"
|
204
|
+
|
205
|
+
message = ''
|
206
|
+
message << announce
|
207
|
+
message << slogan
|
208
|
+
message << abstract
|
209
|
+
message << memo
|
210
|
+
message << msg
|
211
|
+
message << info
|
212
|
+
message << stamp
|
213
|
+
|
214
|
+
message
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end #module Reap
|
220
|
+
|