reap 6.0.2 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. data/CHANGES +6 -0
  2. data/COPYING +666 -395
  3. data/MANIFEST +139 -0
  4. data/NOTES +12 -0
  5. data/README +19 -163
  6. data/bin/reap-announce +7 -0
  7. data/bin/reap-check-load +8 -0
  8. data/bin/reap-check-syntax +7 -0
  9. data/bin/reap-clean +7 -0
  10. data/bin/reap-clobber +7 -0
  11. data/bin/reap-doc +7 -0
  12. data/bin/reap-doc-rdoc +7 -0
  13. data/bin/reap-doc-ri +7 -0
  14. data/bin/reap-init +69 -0
  15. data/bin/reap-inspect +7 -0
  16. data/bin/reap-install +8 -0
  17. data/bin/reap-install-gem +8 -0
  18. data/bin/reap-log +7 -0
  19. data/bin/reap-log-changes +8 -0
  20. data/bin/reap-log-notes +8 -0
  21. data/bin/reap-make +7 -0
  22. data/bin/reap-make-clean +7 -0
  23. data/bin/reap-make-distclean +7 -0
  24. data/bin/reap-make-extconf +7 -0
  25. data/bin/reap-make-static +8 -0
  26. data/bin/reap-package +8 -0
  27. data/bin/reap-package-gem +7 -0
  28. data/bin/reap-package-tgz +7 -0
  29. data/bin/reap-package-zip +7 -0
  30. data/bin/reap-prepare +7 -0
  31. data/bin/reap-publish +7 -0
  32. data/bin/reap-release +7 -0
  33. data/bin/reap-scaffold +8 -0
  34. data/bin/reap-scm-branch +7 -0
  35. data/bin/reap-scm-tag +7 -0
  36. data/bin/reap-spec +7 -0
  37. data/bin/reap-spec-doc +8 -0
  38. data/bin/reap-stamp +7 -0
  39. data/bin/reap-stats +7 -0
  40. data/bin/reap-test +7 -0
  41. data/bin/reap-test-cross +7 -0
  42. data/bin/reap-test-load +9 -0
  43. data/bin/reap-test-solo +7 -0
  44. data/bin/reap-uninstall +7 -0
  45. data/bin/reap-uninstall-gem +7 -0
  46. data/data/reap/base/CHANGES +19 -0
  47. data/data/reap/base/COPYING +674 -0
  48. data/data/reap/base/NOTES +12 -0
  49. data/data/reap/base/README +8 -0
  50. data/data/reap/build/rake/Rakefile +130 -0
  51. data/{forge/reference/installers → data/reap/build/rake}/setup.rb +155 -97
  52. data/data/reap/build/rake-lite/install.rb +79 -0
  53. data/data/reap/build/tasks/task/rdoc +211 -0
  54. data/data/reap/{setup.rb → build/tasks/task/setup} +248 -200
  55. data/data/reap/build/tasks/task/test +38 -0
  56. data/data/reap/init/meta/project.yaml +21 -0
  57. data/demo/README +15 -0
  58. data/demo/lib/foo/foo.rb +7 -0
  59. data/demo/meta/VERSION +1 -0
  60. data/demo/meta/project.yaml +21 -0
  61. data/lib/reap/application.rb +80 -0
  62. data/lib/reap/default.yaml +77 -0
  63. data/lib/reap/extensions/array.rb +50 -0
  64. data/lib/reap/extensions/hash.rb +63 -0
  65. data/lib/reap/extensions/string.rb +31 -0
  66. data/lib/reap/extensions.rb +6 -0
  67. data/lib/reap/iobject.rb +264 -0
  68. data/lib/reap/manager/announce.rb +193 -0
  69. data/lib/reap/manager/check.rb +109 -0
  70. data/lib/reap/manager/clean.rb +58 -0
  71. data/lib/reap/manager/gem.rb +200 -0
  72. data/lib/reap/manager/html.rb +69 -0
  73. data/lib/reap/manager/log.rb +214 -0
  74. data/lib/reap/manager/make.rb +109 -0
  75. data/lib/reap/manager/pack.rb +232 -0
  76. data/lib/reap/manager/publish.rb +72 -0
  77. data/lib/reap/manager/rdoc.rb +194 -0
  78. data/lib/reap/manager/release.rb +78 -0
  79. data/lib/reap/manager/rubyforge.rb +44 -0
  80. data/lib/reap/manager/scaffold.rb +138 -0
  81. data/lib/reap/manager/scm.rb +66 -0
  82. data/lib/reap/manager/site.rb +27 -0
  83. data/lib/reap/manager/spec.rb +94 -0
  84. data/lib/reap/manager/stats.rb +145 -0
  85. data/lib/reap/manager/svn.rb +76 -0
  86. data/lib/reap/manager/test.rb +389 -0
  87. data/lib/reap/manager.rb +74 -0
  88. data/lib/reap/metadata.rb +603 -0
  89. data/lib/reap/project.rb +165 -0
  90. data/lib/reap/settings.rb +67 -0
  91. data/lib/reap/systems/rubyforge.rb +737 -0
  92. data/lib/reap/systems/subversion.rb +333 -0
  93. data/lib/reap/utilities/fileutils.rb +304 -0
  94. data/lib/reap/utilities/netutils.rb +221 -0
  95. data/lib/reap/utilities/setuputils.rb +124 -0
  96. data/lib/reap/utilities/shellutils.rb +175 -0
  97. data/log/Changelog.txt +107 -0
  98. data/log/FIXME.txt +25 -0
  99. data/log/TODO.txt +72 -0
  100. data/meta/VERSION +1 -0
  101. data/meta/description +4 -0
  102. data/meta/project.yaml +20 -0
  103. data/task/man +14 -0
  104. data/task/rdoc +20 -0
  105. data/{data/reap/scaffold/standard/setup.rb → task/setup} +248 -200
  106. metadata +225 -153
  107. data/ProjectInfo +0 -105
  108. data/bin/reap +0 -5
  109. data/bin/rubytest +0 -5
  110. data/data/reap/install.rb +0 -62
  111. data/data/reap/scaffold/standard/COPYING +0 -403
  112. data/data/reap/scaffold/standard/ChangeLog +0 -0
  113. data/data/reap/scaffold/standard/INSTALL +0 -14
  114. data/data/reap/scaffold/standard/ProjectInfo +0 -77
  115. data/data/reap/scaffold/standard/README +0 -3
  116. data/data/reap/scaffold/standard/Rakefile +0 -10
  117. data/data/reap/scaffold/standard/TODO +0 -0
  118. data/data/reap/scaffold/subversion/trunk/COPYING +0 -403
  119. data/data/reap/scaffold/subversion/trunk/ChangeLog +0 -0
  120. data/data/reap/scaffold/subversion/trunk/INSTALL +0 -14
  121. data/data/reap/scaffold/subversion/trunk/ProjectInfo +0 -76
  122. data/data/reap/scaffold/subversion/trunk/README +0 -3
  123. data/data/reap/scaffold/subversion/trunk/Rakefile +0 -10
  124. data/data/reap/scaffold/subversion/trunk/TODO +0 -0
  125. data/data/reap/scaffold/subversion/trunk/setup.rb +0 -1568
  126. data/forge/ProjectInfo +0 -38
  127. data/forge/ProjectInfo.rb +0 -76
  128. data/forge/TODO +0 -10
  129. data/forge/installer.rb +0 -250
  130. data/forge/reference/Rakefile +0 -124
  131. data/forge/reference/Rakefile.htm +0 -69
  132. data/forge/reference/aRakefile +0 -60
  133. data/forge/reference/compositepublisher.rb +0 -24
  134. data/forge/reference/ftptools.rb +0 -139
  135. data/forge/reference/installers/package.rb +0 -629
  136. data/forge/reference/license-each.rb +0 -85
  137. data/forge/reference/publisher.rb +0 -75
  138. data/forge/reference/rubyforge.rb +0 -247
  139. data/forge/reference/rubyforgepublisher.rb +0 -18
  140. data/forge/reference/sshpublisher.rb +0 -47
  141. data/forge/reference/suby-cvs.rb +0 -46
  142. data/forge/scaffold.rb +0 -126
  143. data/forge/unit_runner/README +0 -6
  144. data/forge/unit_runner/commentrunner.rb +0 -62
  145. data/forge/unit_runner/cunit.rb +0 -17
  146. data/forge/unit_runner/forkedrunner.rb +0 -91
  147. data/forge/unit_runner/sample.rb +0 -16
  148. data/lib/reap/bin/reap.rb +0 -230
  149. data/lib/reap/bin/rubytest.rb +0 -53
  150. data/lib/reap/class/announce.rb +0 -220
  151. data/lib/reap/class/doap.rb +0 -80
  152. data/lib/reap/class/extest.rb +0 -146
  153. data/lib/reap/class/filer.rb +0 -62
  154. data/lib/reap/class/manifest.rb +0 -68
  155. data/lib/reap/class/package.rb +0 -576
  156. data/lib/reap/class/publish.rb +0 -152
  157. data/lib/reap/class/rdoc.rb +0 -123
  158. data/lib/reap/class/test.rb +0 -264
  159. data/lib/reap/projectinfo.rb +0 -208
  160. data/lib/reap/rake.rb +0 -42
  161. data/lib/reap/reap.rb +0 -89
  162. data/lib/reap/tasks.rb +0 -756
  163. data/lib/reap/taskutils.rb +0 -122
  164. data/note/LATEST +0 -44
  165. data/note/doap.xml +0 -28
  166. data/note/history/Rakefile-0.1 +0 -308
  167. data/sample/ProjectInfo +0 -96
  168. data/sample/Rakefile +0 -9
  169. data/sample/Reapfile +0 -11
  170. data/sample/task/demo.rb +0 -15
  171. data/setup.rb +0 -1568
  172. data/web/ProjectInfo.html +0 -75
  173. data/web/images/grape.jpg +0 -0
  174. data/web/index.html +0 -312
@@ -0,0 +1,214 @@
1
+ require 'reap/manager/scm'
2
+
3
+ module Reap
4
+
5
+ class Manager
6
+
7
+ # Update all logs.
8
+
9
+ def log(*args)
10
+ log_changes(*args)
11
+ log_notes(*args)
12
+ end
13
+
14
+ # Generate ChangeLog. This routes to the
15
+ # source control manager library.
16
+
17
+ def log_changes(options=nil)
18
+ options = configure_options(options, 'log-changes', 'log')
19
+ scm_log(options)
20
+ end
21
+
22
+ # TODO: Add ability to read header notes.
23
+
24
+ # Collect embedded notes.
25
+ #
26
+ # This task scans source code for developer notes and writes to
27
+ # well organized files. This tool can lookup and list TODO, FIXME
28
+ # and other types of labeled comments from source code.
29
+ #
30
+ # files Glob(s) of files to search.
31
+ # labels Labels to search for. Defaults to [ 'TODO', 'FIXME' ].
32
+ # output Output directory. Defaults to log/.
33
+ #
34
+ # TODO: Remove format field, and ultimately use XML as primary format?
35
+
36
+ def log_notes(options={})
37
+ options = configure_options(options, 'log-notes', 'log')
38
+
39
+ loadpath = options['loadpath'] || metadata.loadpath
40
+ labels = options['labels'] || ['TODO', 'FIXME', 'OPTIMIZE']
41
+ output = options['output'] || 'log'
42
+
43
+ labels = labels.split(',') if String === labels
44
+ labels = [labels].flatten.compact
45
+
46
+ output.chomp!('/')
47
+
48
+ records, counts = log_notes_extract(labels, loadpath)
49
+ notes = log_notes_format(labels, records, (format=nil))
50
+
51
+ if records.empty?
52
+ puts "No #{labels.join(', ')} notes."
53
+ else
54
+ log_notes_save(output, notes, labels)
55
+ puts counts.collect{|l,n| "#{n} #{l}s"}.join(', ')
56
+ puts "Notes saved in #{output} folder."
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ # Gather notes.
63
+
64
+ def log_notes_extract(labels, loadpath=nil)
65
+ files = Dir.multiglob_r(*loadpath)
66
+
67
+ counts = Hash.new(0)
68
+ records = []
69
+
70
+ files.each do |fname|
71
+ next unless fname =~ /.*rb/ # TODO should this be done?
72
+ File.open(fname) do |f|
73
+ line_no, save, text = 0, nil, nil
74
+ while line = f.gets
75
+ line_no += 1
76
+ labels.each do |label|
77
+ if line =~ /^\s*#\s*#{Regexp.escape(label)}[:]?\s*(.*?)$/
78
+ file = fname
79
+ text = ''
80
+ save = {'label'=>label,'file'=>file,'line'=>line_no,'note'=>text}
81
+ records << save
82
+ counts[label] += 1
83
+ end
84
+ end
85
+ if text
86
+ if line =~ /^\s*[#]{0,1}\s*$/ or line !~ /^\s*#/ or line =~ /^\s*#[+][+]/
87
+ text.strip!
88
+ text = nil
89
+ #records << save
90
+ else
91
+ text << line.gsub(/^\s*#\s*/,'')
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ return records, counts
98
+ end
99
+
100
+ # Format notes.
101
+
102
+ def log_notes_format(labels, records, format=nil)
103
+ #return "No #{labels.join('/')} notes." if records.empty?
104
+ #return {} if records.empty?
105
+ notes = {}
106
+ labels.each do |label|
107
+ recs = records.select{ |r| r['label'] == label }
108
+ next if recs.empty?
109
+ out = "\n= #{label}\n"
110
+ last_file = nil
111
+ recs.sort!{ |a,b| a['file'] <=> b['file'] }
112
+ recs.each do |record|
113
+ if last_file != record['file']
114
+ out << "\n"
115
+ last_file = record['file']
116
+ out << "file://#{record['file']}\n"
117
+ end
118
+ out << "* #{record['note'].rstrip} (#{record['line']})\n"
119
+ end
120
+ notes[label] = out
121
+ end
122
+ return notes
123
+ end
124
+
125
+ # Save notes.
126
+
127
+ def log_notes_save(dir, notes, labels)
128
+ mkdir_p(dir)
129
+ # Remove empty note files.
130
+ (labels - notes.keys).each do |label|
131
+ file = File.join(dir,label)
132
+ rm(file) if File.file?(file)
133
+ end
134
+ # Create note files.
135
+ notes.each do |label, note|
136
+ file = apply_naming_policy(label, 'txt')
137
+ file = File.join(dir,file)
138
+ if dryrun?
139
+ puts "write #{file}"
140
+ else
141
+ File.open(file,'w') do |f| f << note end
142
+ end
143
+ end
144
+ end
145
+
146
+ #
147
+
148
+ def naming_policy
149
+ @naming_policy ||= (
150
+ logconfig = configuration['log'] || {}
151
+ logconfig['policy'] || DEFAULT['log']['policy']
152
+ )
153
+ end
154
+
155
+ # TODO: Naming policy needs to be apply to changelog too.
156
+
157
+ def apply_naming_policy(name, ext)
158
+ policy = naming_policy
159
+ name = name.downcase if /low/i =~ policy
160
+ name = name.upcase if /up/i =~ policy
161
+ name = name.capitalize if /cap/i =~ policy
162
+ name = name + ".#{ext}" if /ext/i =~ policy
163
+ name
164
+ end
165
+
166
+ end
167
+
168
+ end
169
+
170
+ # out = ''
171
+ #
172
+ # case format
173
+ # when 'yaml'
174
+ # out << records.to_yaml
175
+ # when 'list'
176
+ # records.each do |record|
177
+ # out << "* #{record['note']}\n"
178
+ # end
179
+ # else #when 'rdoc'
180
+ # labels.each do |label|
181
+ # recs = records.select{ |r| r['label'] == label }
182
+ # next if recs.empty?
183
+ # out << "\n= #{label}\n"
184
+ # last_file = nil
185
+ # recs.sort!{ |a,b| a['file'] <=> b['file'] }
186
+ # recs.each do |record|
187
+ # if last_file != record['file']
188
+ # out << "\n"
189
+ # last_file = record['file']
190
+ # out << "file://#{record['file']}\n"
191
+ # end
192
+ # out << "* #{record['note'].rstrip} (#{record['line']})\n"
193
+ # end
194
+ # end
195
+ # out << "\n---\n"
196
+ # out << counts.collect{|l,n| "#{n} #{l}s"}.join(' ')
197
+ # out << "\n"
198
+ # end
199
+
200
+ # # List TODO notes. Same as notes --label=TODO.
201
+ #
202
+ # def todo( options={} )
203
+ # options = options.to_openhash
204
+ # options.label = 'TODO'
205
+ # notes(options)
206
+ # end
207
+ #
208
+ # # List FIXME notes. Same as notes --label=FIXME.
209
+ #
210
+ # def fixme( options={} )
211
+ # options = options.to_openhash
212
+ # options.label = 'FIXME'
213
+ # notes(options)
214
+ # end
@@ -0,0 +1,109 @@
1
+ #
2
+ # The Make tool routes to extension Makefile(s).
3
+ # At this point it's designed to support extconf.rb design.
4
+ #
5
+ # TODO: Perhaps make a true compiler class in the future.
6
+ # TODO: win32 cross-compile.
7
+
8
+ module Reap
9
+
10
+ class Manager
11
+
12
+ def extensions
13
+ @extensions ||= metadata.extensions || 'ext/**/extconf.rb'
14
+ end
15
+
16
+ # Return list of extconf.rb scripts.
17
+
18
+ def extension_scripts
19
+ [extensions].flatten.collect do |ext|
20
+ Dir.glob(ext)
21
+ end.flatten
22
+ end
23
+
24
+ # Return list of directory locations of extconf.rb scripts.
25
+
26
+ def extension_directories
27
+ glob(extension_scripts).map do |ext|
28
+ File.dirname(ext)
29
+ end
30
+ end
31
+
32
+ # Check to see if this project has extensions that need to be compiled.
33
+
34
+ def compiles?
35
+ !extension_directories.empty?
36
+ end
37
+
38
+ # Compile extensions.
39
+
40
+ def make
41
+ make_extconf
42
+ make_target
43
+ end
44
+
45
+ # Compile static.
46
+
47
+ def make_static
48
+ make_extconf
49
+ make_target 'static'
50
+ end
51
+
52
+ # Remove enouhg compile products for a clean compile.
53
+
54
+ def make_clean
55
+ make_target 'clean'
56
+ end
57
+
58
+ # Remove all compile products.
59
+
60
+ def make_distclean
61
+ make_target 'distclean'
62
+ end
63
+
64
+ # Create Makefile(s).
65
+
66
+ def make_extconf
67
+ extensions.each do |file|
68
+ directory = File.dirname(file)
69
+ next if File.exist?(File.join(directory, 'Makefile'))
70
+ cd(directory) do
71
+ sh "ruby #{File.basename(file)}"
72
+ end
73
+ end
74
+ end
75
+
76
+ private
77
+
78
+ def make_target(target='')
79
+ extension_directories.each do |directory|
80
+ cd(directory) do
81
+ sh "make #{target}"
82
+ end
83
+ end
84
+ end
85
+
86
+
87
+ # Eric Hodel said NOT to copy the compiled libs.
88
+ #
89
+ #task :copy_files do
90
+ # cp "ext/**/*.#{dlext}", "lib/**/#{arch}/"
91
+ #end
92
+ #
93
+ #def dlext
94
+ # Config::CONFIG['DLEXT']
95
+ #end
96
+ #
97
+ #def arch
98
+ # Config::CONFIG['arch']
99
+ #end
100
+
101
+ # Cross-compile for Windows. (TODO)
102
+
103
+ #def make_mingw
104
+ # abort "NOT YET IMPLEMENTED"
105
+ #end
106
+
107
+ end
108
+
109
+ end
@@ -0,0 +1,232 @@
1
+ require 'reap/manager/gem'
2
+
3
+ module Reap
4
+
5
+ class Manager
6
+
7
+ # Remove packages.
8
+
9
+ def clobber_packages(options=nil)
10
+ options = configure_options(options, 'package')
11
+
12
+ store = 'pkg'
13
+
14
+ packages = glob(File.join(store, '*'))
15
+
16
+ packages.each do |path|
17
+ rm_r(path)
18
+ puts "Removed #{path}" unless dryrun?
19
+ end
20
+ end
21
+
22
+ # General pack command.
23
+
24
+ def package(options=nil)
25
+ packopts = configure_options(options, 'package')
26
+
27
+ formats = packopts['formats'] || ['zip']
28
+ formats = [formats].flatten
29
+
30
+ puts
31
+ formats.each do |format|
32
+ send("package_#{format}", options)
33
+ puts
34
+ end
35
+ end
36
+
37
+ # Routes to $gem_package.
38
+
39
+ def package_gem(options=nil)
40
+ gem_package(options)
41
+ end
42
+
43
+ # Create a Tar'd Gzip package.
44
+
45
+ def package_tgz(options=nil)
46
+ status "Creating .tgz package"
47
+
48
+ options = configure_options(options, 'package-tgz', 'package')
49
+
50
+ package = metadata.clone
51
+ package.update(options)
52
+
53
+ abort "No name" unless package.name
54
+ abort "No version" unless package.version
55
+
56
+ store = 'pkg' #package.package_directory
57
+ fname = package.stage_name
58
+ files = package.filelist
59
+
60
+ stage = File.join(store, fname)
61
+ pfile = stage + ".tgz"
62
+
63
+ unless out_of_date?(pfile, *files) or force?
64
+ report_package_already_built(pfile)
65
+ return
66
+ end
67
+
68
+ rm_r(stage) if File.exist?(stage) # remove old stage
69
+ stage(stage, files) # make new stage
70
+ package_manifest(stage) # generate stage manifest
71
+
72
+ if dryrun?
73
+ status "tar -cxf #{fname}.tgz"
74
+ else
75
+ file = nil
76
+ cd(store) do
77
+ file = tgz(fname) # FIXME: Prefer .tgz as extensions.
78
+ end
79
+ transfer(file, store)
80
+ report_package_built(file)
81
+ end
82
+ end
83
+
84
+ # Create Zip package.
85
+
86
+ def package_zip(options=nil)
87
+ status "Creating .zip package"
88
+
89
+ options = configure_options(options, 'package-zip', 'package')
90
+
91
+ package = metadata.clone
92
+ package.update(options)
93
+
94
+ abort "No name" unless package.name
95
+ abort "No version" unless package.version
96
+
97
+ store = 'pkg' #package.package_directory
98
+ fname = package.stage_name
99
+ files = package.filelist
100
+
101
+ stage = File.join(store, fname)
102
+ pfile = stage + ".zip"
103
+
104
+ unless out_of_date?(pfile, *files) or force?
105
+ report_package_already_built(pfile)
106
+ return
107
+ end
108
+
109
+ rm_r(stage) if File.exist?(stage) # remove old stage
110
+ stage(stage, files) # make new stage
111
+ package_manifest(stage) # generate manifest
112
+
113
+ if dryrun?
114
+ status "zip -r #{fname}.zip ."
115
+ else
116
+ file = nil
117
+ cd(store) do
118
+ file = zip(fname)
119
+ end
120
+ transfer(file, store)
121
+ report_package_built(file)
122
+ end
123
+ end
124
+
125
+ # Create off-line documentation package.
126
+ #
127
+ # FIXME: package_docs is not yet ready for use.
128
+
129
+ def package_docs(options=nil)
130
+ options = configure_options(options, 'package-doc')
131
+
132
+ dir = options['dir'] || 'doc'
133
+ name = options['name'] || metadata.name
134
+ ver = options['version'] || metadata.version
135
+
136
+ cd(dir) do
137
+ zip "-czhvf #{name}-docs-#{ver}.zip *"
138
+ end
139
+ end
140
+
141
+ private
142
+
143
+ # Transfer package file to storage location.
144
+
145
+ def transfer(file, store)
146
+ # move to store, unless already there
147
+ dest = File.join(store, File.basename(file))
148
+ dest = File.expand_path(dest)
149
+ mv(file, store) unless file == dest
150
+ end
151
+
152
+ # Generate manifest.
153
+
154
+ def package_manifest(dir)
155
+ return if dryrun?
156
+ Dir.chdir(dir) do
157
+ files = Dir['**/*']
158
+ rm('MANIFEST') if File.exist?('MANIFEST')
159
+ File.open('MANIFEST', 'w') do |f|
160
+ f << files.join("\n")
161
+ end
162
+ end
163
+ end
164
+
165
+ # Report that a package has been built.
166
+ # FIXME: will type, name and version always be right?
167
+
168
+ def report_package_built(file)
169
+ file = File.basename(file)
170
+ type = File.extname(file)
171
+ name = file[0...file.rindex('-')]
172
+ vers = file[file.rindex('-')+1..-1].chomp(type)
173
+
174
+ puts " Successfully built #{type}"
175
+ puts " Name: #{name}"
176
+ puts " Version: #{vers}"
177
+ puts " File: #{file}"
178
+ end
179
+
180
+ # Report that a package has been built.
181
+ # FIXME: will type, name and version always be right?
182
+
183
+ def report_package_already_built(file)
184
+ file = File.basename(file)
185
+ type = File.extname(file)
186
+ name = file[0...file.rindex('-')]
187
+ vers = file[file.rindex('-')+1..-1].chomp(type)
188
+
189
+ puts " Package #{file} is already current."
190
+ #puts " Name: #{name}"
191
+ #puts " Version: #{vers}"
192
+ #puts " File: #{file}"
193
+ end
194
+
195
+ end
196
+ end
197
+
198
+ # # Build packages.
199
+ # # TODO Move this to Manager ?
200
+ #
201
+ # def generate_packages
202
+ # package_files = formats.collect do |format|
203
+ # #format = clean_type(format)
204
+ # say '' if format == 'gem' # FIXME This is here b/c Gems outputs on it's own.
205
+ # file = create_package(format)
206
+ # unless dryrun? or (format == 'gem')
207
+ # report_package_built(format, file) if file
208
+ # end
209
+ # file
210
+ # end
211
+ # report_packaging_complete(package_files.size)
212
+ # end
213
+ #
214
+ # # Create package.
215
+ #
216
+ # def create_package(type)
217
+ # package.format = type
218
+ #
219
+ # builder_class = FormatBuilder.registry[type]
220
+ # builder = builder_class.new(package, stage_directory, options)
221
+ # file = builder.build
222
+ #
223
+ # transfer(file) unless dryrun?
224
+ #
225
+ # return file
226
+ # end
227
+ #
228
+ # # Report that packaging is complete.
229
+ #
230
+ # def report_packaging_complete(size)
231
+ # say "\nSuccessfully built #{size} packages at #{store}/."
232
+ # end
@@ -0,0 +1,72 @@
1
+ module Reap
2
+
3
+ class Manager
4
+
5
+ # Publish website to rubyforge.
6
+ #
7
+ # This task publishes the source dir (deafult 'doc')
8
+ # to a rubyforge website.
9
+ #
10
+ # Uses RSync to upload files to webserver.
11
+ #
12
+ # TODO: Add FTP/SFTP support.
13
+
14
+ def publish(options=nil)
15
+ options = configure_options(options, 'publish', 'rubyforge')
16
+
17
+ project = options['project'] || metadata.project
18
+ webdir = options['webdir']
19
+ source = options['source']
20
+ username = options['username']
21
+ clear = options['clear']
22
+ protect = options['protect']
23
+ exclude = options['exclude']
24
+
25
+ source ||= "doc"
26
+ username ||= ENV['RUBYFORGE_USERNAME']
27
+
28
+ if clear
29
+ protect = protect().to_a
30
+ exclude = exclude().to_a
31
+ else
32
+ protect = %w{usage statcvs statsvn robot.txt wiki} + [protect].flatten
33
+ exclude = %w{.svn} + [exclude].flatten
34
+ end
35
+
36
+ abort "No project name." unless project
37
+ abort "No username." unless username
38
+
39
+ if webdir and webdir != '.'
40
+ destination = File.join(project, webdir)
41
+ else
42
+ destination = project
43
+ end
44
+
45
+ dir = source.chomp('/') + '/'
46
+ url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{destination}"
47
+
48
+ op = ['-rLvz', '--delete-after'] # maybe -p ?
49
+
50
+ # Using commandline filter options didn't seem
51
+ # to work, so I opted for creating an .rsync_filter file for
52
+ # all cases.
53
+
54
+ unless protect.empty? && exclude.empty?
55
+ rsync_file = File.join(source,'.rsync-filter')
56
+ unless file?(rsync_file)
57
+ File.open(rsync_file, 'w') do |f|
58
+ exclude.each{|e| f << "- #{e}\n"}
59
+ protect.each{|e| f << "P #{e}\n"}
60
+ end
61
+ end
62
+ op << "--filter='dir-merge #{rsync_file}'"
63
+ end
64
+
65
+ args = op + [dir, url]
66
+
67
+ sh "rsync #{args.to_params}"
68
+ end
69
+
70
+ end
71
+
72
+ end