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/doc/note/application.rb
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
module Reap
|
4
|
-
|
5
|
-
class Application
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@tasks = {}
|
9
|
-
end
|
10
|
-
|
11
|
-
attr :tasks
|
12
|
-
attr_accessor :last_desc
|
13
|
-
|
14
|
-
def define_task( args, &block )
|
15
|
-
raise ArgumentError, "#{args.size} for 1" if Hash===args and args.size != 1
|
16
|
-
name, deps = parse_args( args )
|
17
|
-
new_task = Task.new( last_desc, deps, &block )
|
18
|
-
new_task.application = self
|
19
|
-
last_desc = nil
|
20
|
-
@tasks[name] = new_task
|
21
|
-
end
|
22
|
-
|
23
|
-
def attach_help( task, doc )
|
24
|
-
raise unless @tasks.has_key?(task.to_sym)
|
25
|
-
@tasks[task].help = doc
|
26
|
-
end
|
27
|
-
|
28
|
-
def run( task )
|
29
|
-
@tasks[task.to_sym].call
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def parse_args( args )
|
35
|
-
if Hash === args
|
36
|
-
raise ArgumentError, "#{args.size} for 1" if args.size != 1
|
37
|
-
name, deps = *(args.to_a.flatten)
|
38
|
-
name = name.to_sym
|
39
|
-
deps = [deps].compact.collect{ |e| e.to_sym }
|
40
|
-
else
|
41
|
-
name, deps = args.to_sym, []
|
42
|
-
end
|
43
|
-
return name, deps
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
class Task
|
50
|
-
|
51
|
-
def initialize( name, deps, &action )
|
52
|
-
@name = name
|
53
|
-
@dependencies = deps
|
54
|
-
@action = action
|
55
|
-
@complete = false
|
56
|
-
end
|
57
|
-
|
58
|
-
attr :dependencies
|
59
|
-
attr_accessor :help, :application
|
60
|
-
|
61
|
-
def complete?
|
62
|
-
@complete
|
63
|
-
end
|
64
|
-
|
65
|
-
def call
|
66
|
-
@dependencies.each{ |d|
|
67
|
-
application.tasks[d].call unless application.tasks[d].complete?
|
68
|
-
}
|
69
|
-
@action.call
|
70
|
-
@complete = true
|
71
|
-
end
|
72
|
-
|
73
|
-
def to_proc
|
74
|
-
@action
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
module Reap
|
84
|
-
|
85
|
-
def application
|
86
|
-
@application ||= Reap::Application.new
|
87
|
-
end
|
88
|
-
|
89
|
-
def desc( line )
|
90
|
-
application.last_desc = line.gsub("\n",'')
|
91
|
-
end
|
92
|
-
|
93
|
-
def task( args, &block )
|
94
|
-
application.define_task( args, &block )
|
95
|
-
end
|
96
|
-
|
97
|
-
# Define help documentation for a task.
|
98
|
-
def help( task_name, doc )
|
99
|
-
application.attach_help( task_name, doc )
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
include Reap
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
desc "Milk the cow!"
|
111
|
-
task :milk do
|
112
|
-
puts "milk"
|
113
|
-
end
|
114
|
-
|
115
|
-
desc "Jump over the moon!"
|
116
|
-
task :jump => [ :milk, :milk ] do
|
117
|
-
#milk; milk
|
118
|
-
puts "jump"
|
119
|
-
end
|
120
|
-
|
121
|
-
task :package, Package
|
122
|
-
|
123
|
-
application.run( :jump )
|
124
|
-
|
@@ -1,247 +0,0 @@
|
|
1
|
-
|
2
|
-
require "enumerator"
|
3
|
-
require "http-access2"
|
4
|
-
|
5
|
-
require 'reap/iface/interface.rb'
|
6
|
-
|
7
|
-
|
8
|
-
class RubyForgeInterface < Interface
|
9
|
-
|
10
|
-
attr_accessor :username, :password, :cookie_jar
|
11
|
-
|
12
|
-
def initialize( master, section )
|
13
|
-
|
14
|
-
@name = master['name']
|
15
|
-
|
16
|
-
@username = master['rubyforge']['username'] || section['username']
|
17
|
-
|
18
|
-
@packge_id = section['package_id']
|
19
|
-
@lockfile_id = section['lockfile_id']
|
20
|
-
|
21
|
-
@group_id = section['group_id'] || 1024 # this is codeforpeople. it's just a default...
|
22
|
-
@private = section['private'] ? 0 : 1
|
23
|
-
|
24
|
-
# internal use
|
25
|
-
@uri = "http://rubyforge.org"
|
26
|
-
@cookie_jar = File::join(File::expand_path("~"), ".rubyforge.cookie_jar")
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
# config = {
|
32
|
-
# "username" => "username", # this must be your username
|
33
|
-
# "password" => "password", # this must be your password
|
34
|
-
#
|
35
|
-
# "group_id" => 1024, # this is codeforpeople. it's just a default...
|
36
|
-
#
|
37
|
-
# "package_ids" => { # configure shortcuts for your packages here
|
38
|
-
# "traits" => 1241,
|
39
|
-
# "lockfile" => 1242,
|
40
|
-
# },
|
41
|
-
#
|
42
|
-
# "uri" => "http://rubyforge.org",
|
43
|
-
# "cookie_jar" => File::join(File::expand_path("~"), ".rubyforge.cookie_jar"),
|
44
|
-
# }
|
45
|
-
#
|
46
|
-
# opts =
|
47
|
-
# GetoptLong::new(
|
48
|
-
# [ "--username" , "-u" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
49
|
-
# [ "--password" , "-p" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
50
|
-
# [ "--cookie_jar" , "-c" , GetoptLong::REQUIRED_ARGUMENT ]
|
51
|
-
# ).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
52
|
-
#
|
53
|
-
# username = opts['username'] || config['username']
|
54
|
-
# password = opts['password'] || config['password']
|
55
|
-
# cookie_jar = opts["cookie_jar"] || config['cookie_jar']
|
56
|
-
#
|
57
|
-
# setup
|
58
|
-
#
|
59
|
-
# mode = ARGV.shift
|
60
|
-
# abort "#{ $0 } [login|create_package (package_name)|add_package (package_id release_name release.ext)]" unless mode
|
61
|
-
|
62
|
-
def setup
|
63
|
-
|
64
|
-
page, form, method = nil
|
65
|
-
extheader = {}
|
66
|
-
|
67
|
-
case mode
|
68
|
-
|
69
|
-
when %r/login/
|
70
|
-
page = "/account/login.php"
|
71
|
-
method = "post_content"
|
72
|
-
|
73
|
-
form = {
|
74
|
-
"return_to" => "",
|
75
|
-
"form_loginname" => username,
|
76
|
-
"form_pw" => password,
|
77
|
-
"login" => "Login"
|
78
|
-
}
|
79
|
-
|
80
|
-
when %r/create_package/
|
81
|
-
page = "/frs/admin/index.php"
|
82
|
-
method = "post_content"
|
83
|
-
|
84
|
-
opts =
|
85
|
-
GetoptLong::new(
|
86
|
-
[ "--group_id" , "-g" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
87
|
-
[ "--is_private" , "-P" , GetoptLong::REQUIRED_ARGUMENT ]
|
88
|
-
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
89
|
-
|
90
|
-
package_name = ARGV.shift
|
91
|
-
abort "#{ $0 } package_name" unless package_name
|
92
|
-
|
93
|
-
group_id = opts["group_id"] || config["group_id"]
|
94
|
-
is_public = opts["is_private"] ? 0 : 1
|
95
|
-
|
96
|
-
form = {
|
97
|
-
"group_id" => group_id,
|
98
|
-
"package_name" => package_name,
|
99
|
-
"func" => "add_package",
|
100
|
-
"is_public" => is_public,
|
101
|
-
"submit" => "Create This Package",
|
102
|
-
}
|
103
|
-
|
104
|
-
when %r/add_release/
|
105
|
-
page = "/frs/admin/qrs.php"
|
106
|
-
method = "post_content"
|
107
|
-
|
108
|
-
opts =
|
109
|
-
GetoptLong::new(
|
110
|
-
[ "--group_id" , "-g" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
111
|
-
[ "--release_date" , "-r" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
112
|
-
[ "--type_id" , "-t" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
113
|
-
[ "--processor_id" , "-P" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
114
|
-
[ "--release_nots" , "-n" , GetoptLong::REQUIRED_ARGUMENT ] ,
|
115
|
-
[ "--release_changes" , "-a" , GetoptLong::REQUIRED_ARGUMENT ]
|
116
|
-
).enum_for.inject({}){|h,kv| h.update Hash[*kv]}
|
117
|
-
|
118
|
-
package_id, release_name, userfile, ignored = ARGV
|
119
|
-
abort "#{ $0 } package_name" unless
|
120
|
-
package_id and release_name and userfile
|
121
|
-
|
122
|
-
package_id = config["package_ids"][package_id] unless
|
123
|
-
package_id =~ %r/^\d+$/
|
124
|
-
|
125
|
-
group_id = opts["group_id"] || config["group_id"]
|
126
|
-
release_date = opts["release_date"] || Time::now.strftime('%Y-%m-%d %H:%M')
|
127
|
-
|
128
|
-
type_id = opts['type_id'] || userfile[%r|\.[^\./]+$|]
|
129
|
-
type_id = {
|
130
|
-
".deb" => 1000,
|
131
|
-
".rpm" => 2000,
|
132
|
-
".zip" => 3000,
|
133
|
-
".bz2" => 3100,
|
134
|
-
".gz" => 3110,
|
135
|
-
".src.zip" => 5000,
|
136
|
-
".src.bz2" => 5010,
|
137
|
-
".src.gz" => 5020,
|
138
|
-
".src.rpm" => 5100,
|
139
|
-
".src" => 5900,
|
140
|
-
".jpg" => 8000,
|
141
|
-
".txt" => 8100,
|
142
|
-
".text" => 8100,
|
143
|
-
".htm" => 8200,
|
144
|
-
".html" => 8200,
|
145
|
-
".pdf" => 8300,
|
146
|
-
".oth" => 9999,
|
147
|
-
".ebuild" => 1300,
|
148
|
-
".exe" => 1100,
|
149
|
-
".dmg" => 1200,
|
150
|
-
".tar.gz" => 5000,
|
151
|
-
".tgz" => 5000,
|
152
|
-
".gem" => 1400,
|
153
|
-
".pgp" => 8150,
|
154
|
-
".sig" => 8150,
|
155
|
-
}[type_id]
|
156
|
-
|
157
|
-
processor_id = opts['processor_id'] || 'Any'
|
158
|
-
processor_id = {
|
159
|
-
"i386" => 1000,
|
160
|
-
"IA64" => 6000,
|
161
|
-
"Alpha" => 7000,
|
162
|
-
"Any" => 8000,
|
163
|
-
"PPC" => 2000,
|
164
|
-
"MIPS" => 3000,
|
165
|
-
"Sparc" => 4000,
|
166
|
-
"UltraSparc" => 5000,
|
167
|
-
"Other" => 9999,
|
168
|
-
}[processor_id]
|
169
|
-
|
170
|
-
release_notes = opts['release_notes'] || nil
|
171
|
-
release_notes = open(release_notes) if release_notes
|
172
|
-
|
173
|
-
release_changes = opts['release_changes'] || nil
|
174
|
-
release_changes = open(release_changes) if release_changes
|
175
|
-
|
176
|
-
userfile = open(userfile)
|
177
|
-
|
178
|
-
preformatted = '1'
|
179
|
-
|
180
|
-
form = {
|
181
|
-
"group_id" => group_id,
|
182
|
-
"package_id" => package_id,
|
183
|
-
"release_name" => release_name,
|
184
|
-
"release_date" => release_date,
|
185
|
-
"type_id" => type_id,
|
186
|
-
"processor_id" => processor_id,
|
187
|
-
"preformatted" => preformatted,
|
188
|
-
"userfile" => userfile,
|
189
|
-
"submit" => "Release File"
|
190
|
-
}
|
191
|
-
|
192
|
-
boundary = Array::new(8){ "%2.2d" % rand(42) }.join('__')
|
193
|
-
extheader['content-type'] = "multipart/form-data; boundary=___#{ boundary }___"
|
194
|
-
|
195
|
-
else
|
196
|
-
abort "#{ $0 } login create_package add_release"
|
197
|
-
|
198
|
-
end
|
199
|
-
#
|
200
|
-
# http transaction
|
201
|
-
#
|
202
|
-
client = HTTPAccess2::Client::new ENV['HTTP_PROXY']
|
203
|
-
client.debug_dev = STDERR if ENV['DEBUG']
|
204
|
-
|
205
|
-
client.set_cookie_store cookie_jar
|
206
|
-
|
207
|
-
# fixes http-access2 bug
|
208
|
-
client.redirect_uri_callback = lambda do |res|
|
209
|
-
page = res.header['location'].first
|
210
|
-
page = page =~ %r/http/ ? page : "#{ config['uri'] }/#{ page }"
|
211
|
-
page
|
212
|
-
end
|
213
|
-
|
214
|
-
response = client.send "#{ method }", "#{ config['uri'] }/#{ page }", form, extheader
|
215
|
-
|
216
|
-
client.save_cookie_store
|
217
|
-
|
218
|
-
# fixes http-access2 bug
|
219
|
-
BEGIN {
|
220
|
-
require "http-access2"
|
221
|
-
module WebAgent::CookieUtils
|
222
|
-
def domain_match(host, domain)
|
223
|
-
case domain
|
224
|
-
when /\d+\.\d+\.\d+\.\d+/
|
225
|
-
return (host == domain)
|
226
|
-
when '.'
|
227
|
-
return true
|
228
|
-
when /^\./
|
229
|
-
#return tail_match?(domain, host)
|
230
|
-
return tail_match?(host, domain)
|
231
|
-
else
|
232
|
-
return (host == domain)
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
}
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
end
|
245
|
-
|
246
|
-
|
247
|
-
|
data/doc/note/intro.txt
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
|
2
|
-
An Introduction to Reap
|
3
|
-
A Ruby Package Assitant
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
task :name do
|
8
|
-
|
9
|
-
when { projectfile? }
|
10
|
-
|
11
|
-
help <<-end
|
12
|
-
Help information.
|
13
|
-
end
|
14
|
-
|
15
|
-
run do |x|
|
16
|
-
# do the task
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
desc "This is a description"
|
25
|
-
|
26
|
-
task :name do |x|
|
27
|
-
# do the task
|
28
|
-
end
|
29
|
-
|
30
|
-
cont do
|
31
|
-
|
32
|
-
help <<-end
|
33
|
-
This is help text.
|
34
|
-
end
|
35
|
-
|
36
|
-
when do
|
37
|
-
projectfile?
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
|
data/doc/note/package.rb
DELETED
@@ -1,629 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
require 'fileutils'
|
3
|
-
require 'pp'
|
4
|
-
require 'optparse'
|
5
|
-
require 'yaml'
|
6
|
-
|
7
|
-
module Package
|
8
|
-
|
9
|
-
class SpecificationError < StandardError; end
|
10
|
-
# forward declaration of the specification classes so we can keep all
|
11
|
-
# constants here
|
12
|
-
class PackageSpecification_1_0; end
|
13
|
-
# Default semantics
|
14
|
-
PackageSpecification = PackageSpecification_1_0
|
15
|
-
|
16
|
-
#TODO: could get this collected automatically with Class#inherited etc
|
17
|
-
SEMANTICS = { "1.0" => PackageSpecification_1_0 }
|
18
|
-
|
19
|
-
KINDS = [
|
20
|
-
:bin, :lib, :ext, :data, :conf, :doc
|
21
|
-
]
|
22
|
-
|
23
|
-
#{{{ list of files to be ignored stolen from setup.rb
|
24
|
-
mapping = { '.' => '\.', '$' => '\$', '#' => '\#', '*' => '.*' }
|
25
|
-
ignore_files = %w[core RCSLOG tags TAGS .make.state .nse_depinfo
|
26
|
-
#* .#* cvslog.* ,* .del-* *.olb *~ *.old *.bak *.BAK *.orig *.rej _$* *$
|
27
|
-
*.org *.in .* ]
|
28
|
-
#end of robbery
|
29
|
-
IGNORE_FILES = ignore_files.map do |x|
|
30
|
-
Regexp.new('\A' + x.gsub(/[\.\$\#\*]/){|c| mapping[c]} + '\z')
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.config(name)
|
34
|
-
# XXX use pathname
|
35
|
-
prefix = Regexp.quote(Config::CONFIG["prefix"])
|
36
|
-
exec_prefix = Regexp.quote(Config::CONFIG["exec_prefix"])
|
37
|
-
Config::CONFIG[name].gsub(/\A\/?(#{prefix}|#{exec_prefix})\/?/, '')
|
38
|
-
end
|
39
|
-
|
40
|
-
SITE_DIRS = {
|
41
|
-
:bin => config("bindir"),
|
42
|
-
:lib => config("sitelibdir"),
|
43
|
-
:ext => config("sitearchdir"),
|
44
|
-
:data => config("datadir"),
|
45
|
-
:conf => config("sysconfdir"),
|
46
|
-
:doc => File.join(config("datadir"), "doc"),
|
47
|
-
}
|
48
|
-
|
49
|
-
VENDOR_DIRS = {
|
50
|
-
:bin => config("bindir"),
|
51
|
-
:lib => config("rubylibdir"),
|
52
|
-
:ext => config("archdir"),
|
53
|
-
:data => config("datadir"),
|
54
|
-
:conf => config("sysconfdir"),
|
55
|
-
:doc => File.join(config("datadir"), "doc"),
|
56
|
-
}
|
57
|
-
|
58
|
-
MODES = {
|
59
|
-
:bin => 0755,
|
60
|
-
:lib => 0644,
|
61
|
-
:ext => 0755, # was: 0555,
|
62
|
-
:data => 0644,
|
63
|
-
:conf => 0644,
|
64
|
-
:doc => 0644,
|
65
|
-
}
|
66
|
-
|
67
|
-
|
68
|
-
SETUP_OPTIONS = {:parse_cmdline => true, :load_conf => true, :run_tasks => true}
|
69
|
-
|
70
|
-
def self.setup(version, options = {}, &instructions)
|
71
|
-
prefixes = dirs = nil
|
72
|
-
options = SETUP_OPTIONS.dup.update(options)
|
73
|
-
|
74
|
-
if options[:load_conf] && File.exist?("config.save")
|
75
|
-
config = YAML.load_file "config.save"
|
76
|
-
prefixes = config[:prefixes]
|
77
|
-
dirs = config[:dirs]
|
78
|
-
end
|
79
|
-
|
80
|
-
pkg = package_specification_with_semantics(version).new(prefixes, dirs)
|
81
|
-
pkg.parse_command_line if options[:parse_cmdline]
|
82
|
-
pkg.instance_eval(&instructions)
|
83
|
-
|
84
|
-
pkg.run_tasks if options[:run_tasks]
|
85
|
-
|
86
|
-
# pkg.install
|
87
|
-
pkg
|
88
|
-
end
|
89
|
-
|
90
|
-
def self.package_specification_with_semantics(version)
|
91
|
-
#XXX: implement the full x.y(.z)? semantics
|
92
|
-
r = SEMANTICS[version]
|
93
|
-
raise SpecificationError, "Unknown version #{version}." unless r
|
94
|
-
r
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
module Actions
|
99
|
-
|
100
|
-
class InstallFile
|
101
|
-
|
102
|
-
attr_reader :source, :destination, :mode
|
103
|
-
|
104
|
-
def initialize(source, destination, mode, options)
|
105
|
-
@source = source
|
106
|
-
@destination = destination
|
107
|
-
@mode = mode
|
108
|
-
@options = options
|
109
|
-
end
|
110
|
-
|
111
|
-
def install
|
112
|
-
FileUtils.install @source, File.join(@options.destdir, @destination),
|
113
|
-
{:verbose => @options.verbose,
|
114
|
-
:noop => @options.noop, :mode => @mode }
|
115
|
-
end
|
116
|
-
|
117
|
-
def hash
|
118
|
-
[@source.hash, @destination.hash].hash
|
119
|
-
end
|
120
|
-
|
121
|
-
def eql?(other)
|
122
|
-
self.class == other.class &&
|
123
|
-
@source == other.source &&
|
124
|
-
@destination == other.destination &&
|
125
|
-
@mode == other.mode
|
126
|
-
end
|
127
|
-
|
128
|
-
def <=>(other)
|
129
|
-
FULL_ORDER[self, other] || self.destination <=> other.destination
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
class MkDir
|
134
|
-
|
135
|
-
attr_reader :directory
|
136
|
-
|
137
|
-
def initialize(directory, options)
|
138
|
-
@directory = directory
|
139
|
-
@options = options
|
140
|
-
end
|
141
|
-
|
142
|
-
def install
|
143
|
-
FileUtils.mkdir_p File.join(@options.destdir, @directory),
|
144
|
-
{:verbose => @options.verbose,
|
145
|
-
:noop => @options.noop }
|
146
|
-
end
|
147
|
-
|
148
|
-
def <=>(other)
|
149
|
-
FULL_ORDER[self, other] || self.directory <=> other.directory
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
class FixShebang
|
154
|
-
|
155
|
-
attr_reader :destination
|
156
|
-
|
157
|
-
def initialize(destination, options)
|
158
|
-
@options = options
|
159
|
-
@destination = destination
|
160
|
-
end
|
161
|
-
|
162
|
-
def install
|
163
|
-
path = File.join(@options.destdir, @destination)
|
164
|
-
fix_shebang(path)
|
165
|
-
end
|
166
|
-
|
167
|
-
# taken from rpa-base, originally based on setup.rb's
|
168
|
-
# modify: #!/usr/bin/ruby
|
169
|
-
# modify: #! /usr/bin/ruby
|
170
|
-
# modify: #!ruby
|
171
|
-
# not modify: #!/usr/bin/env ruby
|
172
|
-
SHEBANG_RE = /\A\#!\s*\S*ruby\S*/
|
173
|
-
|
174
|
-
#TODO allow the ruby-prog to be placed in the shebang line to be passed as
|
175
|
-
# an option
|
176
|
-
def fix_shebang(path)
|
177
|
-
tmpfile = path + '.tmp'
|
178
|
-
begin
|
179
|
-
#XXX: needed at all?
|
180
|
-
# it seems that FileUtils doesn't expose its default output
|
181
|
-
# @fileutils_output = $stderr
|
182
|
-
# we might want to allow this to be redirected.
|
183
|
-
$stderr.puts "shebang:open #{tmpfile}" if @options.verbose
|
184
|
-
unless @options.noop
|
185
|
-
File.open(path) do |r|
|
186
|
-
File.open(tmpfile, 'w', 0755) do |w|
|
187
|
-
first = r.gets
|
188
|
-
return unless SHEBANG_RE =~ first
|
189
|
-
w.print first.sub(SHEBANG_RE, '#!' + Config::CONFIG['ruby-prog'])
|
190
|
-
w.write r.read
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
FileUtils.mv(tmpfile, path, :verbose => @options.verbose,
|
195
|
-
:noop => @options.noop)
|
196
|
-
ensure
|
197
|
-
FileUtils.rm_f(tmpfile, :verbose => @options.verbose,
|
198
|
-
:noop => @options.noop)
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
def <=>(other)
|
203
|
-
FULL_ORDER[self, other] || self.destination <=> other.destination
|
204
|
-
end
|
205
|
-
|
206
|
-
def hash
|
207
|
-
@destination.hash
|
208
|
-
end
|
209
|
-
|
210
|
-
def eql?(other)
|
211
|
-
self.class == other.class && self.destination == other.destination
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
|
-
order = [MkDir, InstallFile, FixShebang]
|
216
|
-
FULL_ORDER = lambda do |me, other|
|
217
|
-
a, b = order.index(me.class), order.index(other.class)
|
218
|
-
if a && b
|
219
|
-
(r = a - b) == 0 ? nil : r
|
220
|
-
else
|
221
|
-
-1 # arbitrary
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
class ActionList < Array
|
226
|
-
|
227
|
-
def directories!(options)
|
228
|
-
dirnames = []
|
229
|
-
map! { |d|
|
230
|
-
if d.kind_of?(InstallFile) && !dirnames.include?(File.dirname(d.destination))
|
231
|
-
dirnames << File.dirname(d.destination)
|
232
|
-
[MkDir.new(File.dirname(d.destination), options), d]
|
233
|
-
else
|
234
|
-
d
|
235
|
-
end
|
236
|
-
}
|
237
|
-
flatten!
|
238
|
-
end
|
239
|
-
|
240
|
-
def run(task)
|
241
|
-
each { |action| action.__send__ task }
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
end # module Actions
|
246
|
-
|
247
|
-
Options = Struct.new(:noop, :verbose, :destdir)
|
248
|
-
|
249
|
-
class PackageSpecification_1_0
|
250
|
-
|
251
|
-
TASKS = %w[config setup install test show]
|
252
|
-
# default options for translate(foo => bar)
|
253
|
-
TRANSLATE_DEFAULT_OPTIONS = { :inherit => true }
|
254
|
-
|
255
|
-
def self.declare_file_type(args, &handle_arg)
|
256
|
-
str_arr_p = lambda{|x| Array === x && x.all?{|y| String === y}}
|
257
|
-
|
258
|
-
# strict type checking --- we don't want this to be extended arbitrarily
|
259
|
-
unless args.size == 1 && Hash === args.first &&
|
260
|
-
args.first.all?{|f,r| [Proc, String, NilClass].include?(r.class) &&
|
261
|
-
(String === f || str_arr_p[f])} or
|
262
|
-
args.all?{|x| String === x || str_arr_p[x]}
|
263
|
-
raise SpecificationError,
|
264
|
-
"Unspecified semantics for the given arguments: #{args.inspect}"
|
265
|
-
end
|
266
|
-
|
267
|
-
if args.size == 1 && Hash === args.first
|
268
|
-
args.first.to_a.each do |file, rename_info|
|
269
|
-
if Array === file
|
270
|
-
# ignoring boring files
|
271
|
-
handle_arg.call(file, true, rename_info)
|
272
|
-
else
|
273
|
-
# we do want "boring" files given explicitly
|
274
|
-
handle_arg.call([file], false, rename_info)
|
275
|
-
end
|
276
|
-
end
|
277
|
-
else
|
278
|
-
args.each do |a|
|
279
|
-
if Array === a
|
280
|
-
a.each{|file| handle_arg.call(file, true, nil)}
|
281
|
-
else
|
282
|
-
handle_arg.call(a, false, nil)
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
#{{{ define the file tagging methods
|
289
|
-
KINDS.each { |kind|
|
290
|
-
define_method(kind) { |*args| # if this were 1.9 we could also take a block
|
291
|
-
bin_callback = lambda do |kind_, type, dest, options|
|
292
|
-
next if kind_ != :bin || type == :dir
|
293
|
-
@actions << Actions::FixShebang.new(dest, options)
|
294
|
-
end
|
295
|
-
#TODO: refactor
|
296
|
-
self.class.declare_file_type(args) do |files, ignore_p, opt_rename_info|
|
297
|
-
files.each do |file|
|
298
|
-
next if ignore_p && IGNORE_FILES.any?{|re| re.match(file)}
|
299
|
-
add_file(kind, file, opt_rename_info, &bin_callback)
|
300
|
-
end
|
301
|
-
end
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
|
-
def unit_test(*files)
|
306
|
-
@unit_tests.concat files.flatten
|
307
|
-
end
|
308
|
-
|
309
|
-
attr_accessor :actions, :options
|
310
|
-
|
311
|
-
def self.metadata(name)
|
312
|
-
define_method(name) { |*args|
|
313
|
-
if args.size == 1
|
314
|
-
@metadata[name] = args.first
|
315
|
-
end
|
316
|
-
@metadata[name]
|
317
|
-
}
|
318
|
-
end
|
319
|
-
|
320
|
-
metadata :name
|
321
|
-
metadata :version
|
322
|
-
metadata :author
|
323
|
-
|
324
|
-
|
325
|
-
def translate_dir(kind, dir)
|
326
|
-
replaced_dir_parts = dir.split(%r{/})
|
327
|
-
kept_dir_parts = []
|
328
|
-
loop do
|
329
|
-
replaced_path = replaced_dir_parts.join("/")
|
330
|
-
target, options = @translate[kind][replaced_path]
|
331
|
-
options ||= TRANSLATE_DEFAULT_OPTIONS
|
332
|
-
if target && (replaced_path == dir || options[:inherit])
|
333
|
-
dir = (target != '' ? File.join(target, *kept_dir_parts) :
|
334
|
-
File.join(*kept_dir_parts))
|
335
|
-
break
|
336
|
-
end
|
337
|
-
break if replaced_dir_parts.empty?
|
338
|
-
kept_dir_parts.unshift replaced_dir_parts.pop
|
339
|
-
end
|
340
|
-
dir
|
341
|
-
end
|
342
|
-
|
343
|
-
def add_file(kind, filename, new_filename_info, &callback)
|
344
|
-
#TODO: refactor!!!
|
345
|
-
if File.directory? filename #XXX setup.rb and rpa-base defined File.dir?
|
346
|
-
# to cope with some win32 issue
|
347
|
-
dir = filename.sub(/\A\.\//, "").sub(/\/\z/, "")
|
348
|
-
dest = File.join(@prefixes[kind], @dirs[kind], translate_dir(kind, dir))
|
349
|
-
@actions << Actions::MkDir.new(dest, @options)
|
350
|
-
callback.call(kind, :dir, dest, @options) if block_given?
|
351
|
-
else
|
352
|
-
if new_filename_info
|
353
|
-
case new_filename_info
|
354
|
-
when Proc
|
355
|
-
dest_name = new_filename_info.call(filename.dup)
|
356
|
-
else
|
357
|
-
dest_name = new_filename_info.dup
|
358
|
-
end
|
359
|
-
else
|
360
|
-
dest_name = filename.dup
|
361
|
-
end
|
362
|
-
|
363
|
-
dirname = File.dirname(dest_name)
|
364
|
-
dirname = "" if dirname == "."
|
365
|
-
dest_name = File.join(translate_dir(kind, dirname), File.basename(dest_name))
|
366
|
-
|
367
|
-
dest = File.join(@prefixes[kind], @dirs[kind], dest_name)
|
368
|
-
@actions << Actions::InstallFile.new(filename, dest, MODES[kind], @options)
|
369
|
-
callback.call(kind, :file, dest, @options) if block_given?
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
def initialize(prefixes = nil, dirs = nil)
|
374
|
-
@prefix = Config::CONFIG["prefix"].gsub(/\A\//, '')
|
375
|
-
@translate = {}
|
376
|
-
@prefixes = (prefixes || {}).dup
|
377
|
-
KINDS.each { |kind|
|
378
|
-
@prefixes[kind] = @prefix unless prefixes
|
379
|
-
@translate[kind] = {}
|
380
|
-
}
|
381
|
-
|
382
|
-
@dirs = (dirs || {}).dup
|
383
|
-
@dirs.update SITE_DIRS unless dirs
|
384
|
-
|
385
|
-
@actions = Actions::ActionList.new
|
386
|
-
|
387
|
-
@metadata = {}
|
388
|
-
@unit_tests = []
|
389
|
-
|
390
|
-
@options = Options.new
|
391
|
-
@options.verbose = true
|
392
|
-
@options.noop = true # XXX for testing
|
393
|
-
@options.destdir = ''
|
394
|
-
|
395
|
-
@tasks = []
|
396
|
-
end
|
397
|
-
|
398
|
-
def aoki
|
399
|
-
(KINDS - [:ext]).each { |kind|
|
400
|
-
translate(kind, kind.to_s => "", :inherit => true)
|
401
|
-
__send__ kind, Dir["#{kind}/**/*"]
|
402
|
-
}
|
403
|
-
translate(:ext, "ext/*" => "", :inherit => true)
|
404
|
-
ext Dir["ext/**/*.#{Config::CONFIG['DLEXT']}"]
|
405
|
-
end
|
406
|
-
|
407
|
-
def install
|
408
|
-
puts "Installing #{name || "unknown package"} #{version}..." if options.verbose
|
409
|
-
|
410
|
-
actions.uniq!
|
411
|
-
actions.sort!
|
412
|
-
actions.directories!(options)
|
413
|
-
|
414
|
-
#pp self
|
415
|
-
|
416
|
-
actions.run :install
|
417
|
-
end
|
418
|
-
|
419
|
-
def test
|
420
|
-
unless @unit_tests.empty?
|
421
|
-
puts "Testing #{name || "unknown package"} #{version}..." if options.verbose
|
422
|
-
require 'test/unit'
|
423
|
-
unless options.noop
|
424
|
-
t = Test::Unit::AutoRunner.new(true)
|
425
|
-
t.process_args(@unit_tests)
|
426
|
-
t.run
|
427
|
-
end
|
428
|
-
end
|
429
|
-
end
|
430
|
-
|
431
|
-
def config
|
432
|
-
File.open("config.save", "w") { |f|
|
433
|
-
YAML.dump({:prefixes => @prefixes, :dirs => @dirs}, f)
|
434
|
-
}
|
435
|
-
end
|
436
|
-
|
437
|
-
def show
|
438
|
-
KINDS.each { |kind|
|
439
|
-
puts "#{kind}\t#{File.join(options.destdir, @prefixes[kind], @dirs[kind])}"
|
440
|
-
}
|
441
|
-
end
|
442
|
-
|
443
|
-
def translate(kind, additional_translations)
|
444
|
-
default_opts = TRANSLATE_DEFAULT_OPTIONS.dup
|
445
|
-
key_val_pairs = additional_translations.to_a
|
446
|
-
option_pairs = key_val_pairs.select{|(k,v)| Symbol === k}
|
447
|
-
default_opts.update(Hash[*option_pairs.flatten])
|
448
|
-
|
449
|
-
(key_val_pairs - option_pairs).each do |key, val|
|
450
|
-
add_translation(kind, key, val, default_opts)
|
451
|
-
end
|
452
|
-
end
|
453
|
-
|
454
|
-
def add_translation(kind, src, dest, options)
|
455
|
-
if is_glob?(src)
|
456
|
-
dirs = expand_dir_glob(src)
|
457
|
-
else
|
458
|
-
dirs = [src]
|
459
|
-
end
|
460
|
-
dirs.each do |dirname|
|
461
|
-
dirname = dirname.sub(%r{\A\./}, "").sub(%r{/\z}, "")
|
462
|
-
@translate[kind].update({dirname => [dest, options]})
|
463
|
-
end
|
464
|
-
end
|
465
|
-
|
466
|
-
def is_glob?(x)
|
467
|
-
/(^|[^\\])[*?{\[]/.match(x)
|
468
|
-
end
|
469
|
-
|
470
|
-
def expand_dir_glob(src)
|
471
|
-
Dir[src].select{|x| File.directory?(x)}
|
472
|
-
end
|
473
|
-
|
474
|
-
def clean_path(path)
|
475
|
-
path.gsub(/\A\//, '').gsub(/\/+\Z/, '').squeeze("/")
|
476
|
-
end
|
477
|
-
|
478
|
-
def parse_command_line
|
479
|
-
opts = OptionParser.new(nil, 24, ' ') { |opts|
|
480
|
-
opts.banner = "Usage: setup.rb [options] [task]"
|
481
|
-
|
482
|
-
opts.separator ""
|
483
|
-
opts.separator "Tasks:"
|
484
|
-
opts.separator " config configures paths"
|
485
|
-
opts.separator " show shows paths"
|
486
|
-
opts.separator " setup compiles ruby extentions and others XXX"
|
487
|
-
opts.separator " install installs files"
|
488
|
-
opts.separator " test runs unit tests"
|
489
|
-
|
490
|
-
opts.separator ""
|
491
|
-
opts.separator "Specific options:"
|
492
|
-
|
493
|
-
opts.on "--prefix=PREFIX",
|
494
|
-
"path prefix of target environment [#@prefix]" do |prefix|
|
495
|
-
@prefix.replace clean_path(prefix) # Shared!
|
496
|
-
end
|
497
|
-
|
498
|
-
opts.separator ""
|
499
|
-
|
500
|
-
KINDS.each { |kind|
|
501
|
-
opts.on "--#{kind}prefix=PREFIX",
|
502
|
-
"path prefix for #{kind} files [#{@prefixes[kind]}]" do |prefix|
|
503
|
-
@prefixes[kind] = clean_path(prefix)
|
504
|
-
end
|
505
|
-
}
|
506
|
-
|
507
|
-
opts.separator ""
|
508
|
-
|
509
|
-
KINDS.each { |kind|
|
510
|
-
opts.on "--#{kind}dir=PREFIX",
|
511
|
-
"directory for #{kind} files [#{@dirs[kind]}]" do |prefix|
|
512
|
-
@dirs[kind] = clean_path(prefix)
|
513
|
-
end
|
514
|
-
}
|
515
|
-
|
516
|
-
opts.separator ""
|
517
|
-
|
518
|
-
KINDS.each { |kind|
|
519
|
-
opts.on "--#{kind}=PREFIX",
|
520
|
-
"absolute directory for #{kind} files [#{File.join(@prefixes[kind], @dirs[kind])}]" do |prefix|
|
521
|
-
@prefixes[kind] = clean_path(prefix)
|
522
|
-
end
|
523
|
-
}
|
524
|
-
|
525
|
-
opts.separator ""
|
526
|
-
opts.separator "Predefined path configurations:"
|
527
|
-
opts.on "--site", "install into site-local directories (default)" do
|
528
|
-
@dirs.update SITE_DIRS
|
529
|
-
end
|
530
|
-
|
531
|
-
opts.on "--vendor", "install into distribution directories (for packagers)" do
|
532
|
-
@dirs.update VENDOR_DIRS
|
533
|
-
end
|
534
|
-
|
535
|
-
opts.separator ""
|
536
|
-
opts.separator "General options:"
|
537
|
-
|
538
|
-
opts.on "--destdir=DESTDIR",
|
539
|
-
"install all files relative to DESTDIR (/)" do |destdir|
|
540
|
-
@options.destdir = destdir
|
541
|
-
end
|
542
|
-
|
543
|
-
opts.on "--dry-run", "only display what to do if given [#{@options.noop}]" do
|
544
|
-
@options.noop = true
|
545
|
-
end
|
546
|
-
|
547
|
-
opts.on "--no-harm", "only display what to do if given" do
|
548
|
-
@options.noop = true
|
549
|
-
end
|
550
|
-
|
551
|
-
opts.on "--[no-]verbose", "output messages verbosely [#{@options.verbose}]" do |verbose|
|
552
|
-
@options.verbose = verbose
|
553
|
-
end
|
554
|
-
|
555
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
556
|
-
puts opts
|
557
|
-
exit
|
558
|
-
end
|
559
|
-
}
|
560
|
-
|
561
|
-
opts.parse! ARGV
|
562
|
-
|
563
|
-
if (ARGV - TASKS).empty? # Only existing tasks?
|
564
|
-
@tasks = ARGV
|
565
|
-
@tasks = ["install"] if @tasks.empty?
|
566
|
-
else
|
567
|
-
abort "Unknown task(s) #{(ARGV-TASKS).join ", "}."
|
568
|
-
end
|
569
|
-
end
|
570
|
-
|
571
|
-
def run_tasks
|
572
|
-
@tasks.each { |task| __send__ task }
|
573
|
-
end
|
574
|
-
end
|
575
|
-
|
576
|
-
end # module Package
|
577
|
-
|
578
|
-
#XXX incomplete setup.rb support for the hooks
|
579
|
-
require 'rbconfig'
|
580
|
-
def config(x)
|
581
|
-
Config::CONFIG[x]
|
582
|
-
end
|
583
|
-
|
584
|
-
|
585
|
-
if $0 == __FILE__
|
586
|
-
|
587
|
-
version = "4.5.1"
|
588
|
-
|
589
|
-
Package.setup("1.0") {
|
590
|
-
|
591
|
-
translate :bin, 'bin' => ''
|
592
|
-
bin *Dir['bin/**/*']
|
593
|
-
|
594
|
-
translate :lib, 'lib/reap' => "reap/#{version}"
|
595
|
-
lib *Dir['lib/**/*']
|
596
|
-
|
597
|
-
translate :doc, 'doc' => "reap/#{version}"
|
598
|
-
doc *Dir['doc/**/*']
|
599
|
-
|
600
|
-
translate :ext, 'ext' => "reap/#{version}"
|
601
|
-
ext *Dir['ext/**/*']
|
602
|
-
|
603
|
-
translate :data, 'data/reap' => "reap/#{version}"
|
604
|
-
data *Dir['data/**/*']
|
605
|
-
|
606
|
-
translate :conf, 'conf/reap' => "reap/#{version}"
|
607
|
-
conf *Dir['conf/**/*']
|
608
|
-
|
609
|
-
#translate(:lib, '' => 'fuutils', 'blerg' => '', 'blorg' => 'borg')
|
610
|
-
#lib "feeble.rb", "fooble.rb", "fuuble.rb"
|
611
|
-
#lib "fooble.rb"
|
612
|
-
#lib "blerg/foo.rb", "blorg/foo.rb"
|
613
|
-
#lib "fruubar.rb" => "fuubar.rb"
|
614
|
-
#lib "friibar.rb" => lambda{|x| "fiibar.rb"}
|
615
|
-
#lib ["stuff.orig", "core", ".bla.rb.swp"] # will be ignored
|
616
|
-
#doc "bla.orig" # will not be ignored
|
617
|
-
#doc "foo.orig" => "bla.txt" # ditto
|
618
|
-
#lib ["lfoo1", "lbar1"]
|
619
|
-
#lib ["lfoo", "lbar"] => lambda{|x| "#{x}.rb"}
|
620
|
-
#translate(:data, '_darcs' => 'DARCS')
|
621
|
-
#data "_darcs/" # just to test MkDir generation
|
622
|
-
|
623
|
-
#pp self
|
624
|
-
}
|
625
|
-
|
626
|
-
end
|
627
|
-
|
628
|
-
|
629
|
-
# vim: sw=2 sts=2 et ts=8
|