reap 6.0.2 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
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,194 @@
1
+ module Reap
2
+
3
+ class Manager
4
+
5
+ # DEFAULT['rdoc'] = {
6
+ # 'template' => 'html',
7
+ # 'output' => 'doc/rdoc',
8
+ # 'main' => 'README',
9
+ # 'inline' => true,
10
+ # 'merge' => true,
11
+ # 'exclude' => [],
12
+ # 'include' => ['lib', '[A-Z]*'],
13
+ # 'adfile' => 'doc/ads/rdoc.html',
14
+ # 'targets' => nil
15
+ # }
16
+
17
+ # Generate rdocs.
18
+ #
19
+ # Generate Rdoc documentation. Settings are the
20
+ # same as the rdoc command's option, with two
21
+ # exceptions: +inline+ for +inline-source+ and
22
+ # +output+ for +op+.
23
+
24
+ def rdoc(options=nil)
25
+ options = configure_options(options, 'doc-rdoc', 'rdoc', 'doc')
26
+ #options = DEFAULT['rdoc'].merge(options)
27
+
28
+ options['title'] ||= metadata.title
29
+
30
+ targets = options.delete('targets') || {'' => options}
31
+ output = options['output']
32
+ adfile = options['adfile']
33
+
34
+ adfile = [adfile].flatten.find do |f|
35
+ File.exist?(f)
36
+ end
37
+
38
+ targets.each do |subdir, target|
39
+ target = options.merge(target)
40
+
41
+ target_solo = target['solo']
42
+ target_main = Dir.glob(target['main'].to_s, File::FNM_CASEFOLD).first
43
+
44
+ #target_main = File.expand_path(target_main) if target_main
45
+ #target_output = File.expand_path(File.join(output, subdir))
46
+ target_output = File.join(output, subdir)
47
+
48
+ cmdopts = {}
49
+ #cmdopts['op'] = target_output
50
+ cmdopts['main'] = target_main if target_main
51
+ cmdopts['template'] = target['template']
52
+ cmdopts['merge'] = target['merge']
53
+ cmdopts['inline-source'] = target['inline']
54
+ cmdopts['exclude'] = target['exclude']
55
+
56
+ files = target['include']
57
+ folder = target['chdir'] || '.'
58
+
59
+ #puts "cd #{folder}" if dryrun? # TODO: Shouldn't chdir do this automatically?
60
+ #chdir(folder) do
61
+ if target_solo
62
+ input_files = files.collect{ |i| multiglob_r(i) }.flatten.reject{ |f| dir?(f) }
63
+ input_files.each do |input_file|
64
+ out = File.join(target_output, File.basename(input_file).chomp(File.extname(input_file)))
65
+ rdoc_target(out, input_file, cmdopts)
66
+ rdoc_insert_ads(target_output, adfile)
67
+ end
68
+ else
69
+ input_files = files.collect{ |i| dir?(i) ? File.join(i,'**','*') : i }
70
+ rdoc_target(target_output, input_files, cmdopts)
71
+ rdoc_insert_ads(target_output, adfile)
72
+ end
73
+ #end
74
+ end
75
+ end
76
+
77
+ # Remove rdocs products.
78
+
79
+ def clobber_rdoc(options=nil)
80
+ options = configure_options(options, 'doc-rdoc', 'rdoc')
81
+
82
+ output = options['output']
83
+
84
+ if File.directory?(output)
85
+ rm_r(output)
86
+ puts "Removed #{output}" unless dryrun?
87
+ end
88
+ end
89
+
90
+ private
91
+
92
+ #
93
+
94
+ def rdoc_target(output, input, rdocopt={})
95
+ if out_of_date?(output, *input) or force?
96
+ rm_r(output) if exist?(output) and safe?(output) # remove old rdocs
97
+ rdocopt['op'] = output
98
+ sh "rdoc " + [input, rdocopt].to_console
99
+ else
100
+ puts "RDocs are current -- #{output}"
101
+ end
102
+ end
103
+
104
+ # Insert an ad if available.
105
+
106
+ def rdoc_insert_ads(site, adfile)
107
+ return if dryrun?
108
+ return unless adfile && File.file?(adfile)
109
+ adtext = File.read(adfile)
110
+ #puts
111
+ dirs = Dir.glob(File.join(site,'*/'))
112
+ dirs.each do |dir|
113
+ files = Dir.glob(File.join(dir, '**/*.html'))
114
+ files.each do |file|
115
+ html = file_read(file)
116
+ bodi = html.index('<body>')
117
+ html[bodi + 7] = "\n" + adtext
118
+ #print "Augmenting #{file}..."
119
+ file_write(file, html) unless dryrun?
120
+ #puts "[done]"
121
+ end
122
+ end
123
+ end
124
+
125
+ public
126
+
127
+ DEFAULT['ri'] = {
128
+ 'output' => 'ri',
129
+ 'exclude' => [],
130
+ 'include' => ['lib']
131
+ }
132
+
133
+ # generate local ri docs
134
+ #
135
+ # Generate RI documentation. This utilizes
136
+ # rdoc to produce the appropriate files.
137
+
138
+ def ridoc(options=nil)
139
+ options = configure_options(options, 'doc-ri', 'ri')
140
+ options = DEFAULT['ri'].merge(options)
141
+
142
+ cmdopts = {}
143
+ cmdopts['op'] = options['output']
144
+ cmdopts['exclude'] = options['exclude']
145
+
146
+ output = options['output']
147
+ files = options['include'] # || ['lib', '[A-Z]*']
148
+
149
+ input = files.collect do |i|
150
+ dir?(i) ? File.join(i,'**','*') : i
151
+ end
152
+
153
+ if out_of_date?(output, *input) or force?
154
+ rm_r(output) if exist?(output) and safe?(output) # remove old ridocs
155
+
156
+ #input = input.collect{ |i| glob(i) }.flatten
157
+ vector = [input, cmdopts]
158
+ sh "rdoc --ri #{vector.to_console}"
159
+ else
160
+ puts "RI Docs are current."
161
+ end
162
+ end
163
+
164
+ # Remove ri products.
165
+
166
+ def clobber_ridoc(options=nil)
167
+ options = configure_options(options, 'doc-ri', 'ri')
168
+
169
+ output = options['output']
170
+
171
+ if File.directory?(output)
172
+ rm_r(output)
173
+ puts "Removed #{output}" unless dryrun?
174
+ end
175
+ end
176
+
177
+ private
178
+
179
+ # # Shell out to rdoc to create ri docs.
180
+ #
181
+ # def ridoc_shell(files, config)
182
+ # output = config['op']
183
+ # input = config.delete('include')
184
+ #
185
+ # # Check for 'doc' directory.
186
+ # # (Helps to ensure we're in the right place.)
187
+ # #dir!(File.dirname(site))
188
+ #
189
+ # end
190
+
191
+ end
192
+
193
+ end
194
+
@@ -0,0 +1,78 @@
1
+ require 'reap/manager/rubyforge'
2
+
3
+ module Reap
4
+
5
+ class Manager
6
+
7
+ # Update VERSION stamp file.
8
+ #
9
+ # TODO: Should we also update a lib/version.rb file?
10
+
11
+ def stamp(options={})
12
+ options = configure_options(options, 'stamp')
13
+
14
+ meta = File.directory?('meta')
15
+
16
+ version = options['version'] || metadata.version || '0.0.0'
17
+ status = options['status'] || metadata.status || 'alpha'
18
+
19
+ abort "Invalid version -- #{version}" unless /^[0-9]/ =~ version
20
+
21
+ file = glob('{,meta/}version{,.txt}', File::FNM_CASEFOLD).first
22
+ file = (meta ? 'meta/VERSION' : 'VERSION') unless file
23
+
24
+ text = "#{version} #{status} (#{Time.now.strftime('%Y-%m-%d')})"
25
+
26
+ if File.exist?(file)
27
+ old_text = File.read(file).strip
28
+ return if text == old_text
29
+ end
30
+
31
+ if dryrun?
32
+ puts file + ":"
33
+ puts text
34
+ else
35
+ File.open(file, 'w'){|f| f << text}
36
+ puts "#{file} updated."
37
+ end
38
+
39
+ # TODO: Stamp .roll if roll file exists.
40
+ # should we read current .roll file and use as defaults?
41
+ if File.exist?('.roll')
42
+ str = []
43
+ str << "name = #{metadata.name}"
44
+ str << "version = #{metadata.version}"
45
+ str << "status = #{metadata.status}"
46
+ str << "date = #{metadata.date}"
47
+ str << "default = #{metadata.default}"
48
+ str << "libpath = #{metadata.libpath}"
49
+ # File.open('.roll','w'){ |f| f << str.join("\n") }
50
+ end
51
+ end
52
+
53
+ # Clean, stamp if need be and package.
54
+
55
+ def prepare(options={})
56
+ clean
57
+ make_distclean if compiles?
58
+ stamp(options)
59
+ package(options)
60
+ end
61
+
62
+ # Prepare and release to rubyforge.
63
+
64
+ def release(options={})
65
+ prepare(options)
66
+ rubyforge_release(options)
67
+ #announce(options)
68
+ puts "\nBe sure to tag and announce this release if need be."
69
+ end
70
+
71
+ #def release(options)
72
+ #name, version = release.name, release.version
73
+ #sh "icli rubyforge release --version=#{version}"
74
+ #end
75
+
76
+ end
77
+
78
+ end
@@ -0,0 +1,44 @@
1
+ require 'reap/systems/rubyforge'
2
+
3
+ module Reap
4
+
5
+ class Manager
6
+
7
+ #DEFAULT['rubyforge'] = {
8
+ # 'changelog' => 'CHANGES',
9
+ # 'notelog' => 'NOTES'
10
+ #}
11
+
12
+ # Release packages to rubyforge.
13
+
14
+ def rubyforge_release(options)
15
+ options = configure_options(options, 'release', 'rubyforge')
16
+
17
+ rubyforge_options = {}
18
+ rubyforge_options[:dryrun] = dryrun?
19
+ rubyforge_options[:trace] = trace?
20
+ rubyforge_options[:project] = options.delete('project') || metadata.project
21
+ rubyforge_options[:username] = options.delete('username') || ENV['RUBYFORGE_USERNAME']
22
+ rubyforge_options[:group_id] = options.delete('group')
23
+
24
+ host = Rubyforge.new(rubyforge_options)
25
+
26
+ options['version'] = metadata.version
27
+ options['store'] = 'pkg'
28
+
29
+ changelog = options['changelog'] #|| DEFAULT['release']['changelog'] || DEFAULT['rubyforge']['changelog']
30
+ notelog = options['notelog'] #|| DEFAULT['release']['notelog'] || DEFAULT['rubyforge']['notelog']
31
+
32
+ changelog = Dir.glob(changelog.to_s, File::FNM_CASEFOLD).first
33
+ notelog = Dir.glob(notelog.to_s, File::FNM_CASEFOLD).first
34
+
35
+ options['changelog'] = changelog if File.exist?(changelog)
36
+ options['notelog'] = notelog if File.exist?(notelog)
37
+
38
+ host.release(options)
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
@@ -0,0 +1,138 @@
1
+ module Reap
2
+
3
+ class Manager
4
+
5
+ def scaffold(options)
6
+ requests = options['arguments']
7
+
8
+ if requests
9
+ requests.each do |f|
10
+ case f
11
+ #when /^(meta\/)?project(info)?(.yaml|.yml)?$/i
12
+ # scaffold_projectfile(f)
13
+ when /^rake(file)?$/i
14
+ scaffold_rakefile(f)
15
+ when /^setup[.]rb$/
16
+ scaffold_setup_rb(f)
17
+ when /^(task|script)s?\//i
18
+ scaffold_task(f)
19
+ when /^(task|script)(s)?$/
20
+ scaffold_tasks(f)
21
+ else
22
+ raise "Unknown scaffolding."
23
+ end
24
+ end
25
+ else
26
+ scaffold_skeleton(options=nil)
27
+ end
28
+ end
29
+
30
+ # Add project file template to project.
31
+ #
32
+ # FIXME: This doesn't yet work b/c reap doesn't work unless
33
+ # a project file is already in place.
34
+
35
+ #def scaffold_projectfile(fname)
36
+ # from = File.join(data_dir, 'metaset', 'meta', 'project.yaml')
37
+ # cp(from, fname) unless File.exist?(fname)
38
+ #end
39
+
40
+ # Add tasks in Rakefile form to project.
41
+
42
+ def scaffold_rakefile(fname)
43
+ from = File.join(data_dir, 'buildset', 'rake', 'Rakefile')
44
+ cp(from, fname) unless File.exist?(fname)
45
+ end
46
+
47
+ #
48
+
49
+ def scaffold_setup_rb(fname)
50
+ from = File.join(data_dir, 'buidset', 'rake', 'setup.rb')
51
+ cp(from, fname) unless File.exist?(fname)
52
+ end
53
+
54
+ # Add a user tasks to the project.
55
+
56
+ def scaffold_task(fname)
57
+ from = File.join(data_dir, 'buildset', 'tasks', 'task', File.basename(fname))
58
+ cp(from, fname) unless File.exist?(fname)
59
+ end
60
+
61
+ # Add all user tasks to the project.
62
+
63
+ def scaffold_tasks(fname)
64
+ dir = File.join(data_dir, 'buildset', 'tasks', 'task')
65
+ cp_r(dir, fname)
66
+ end
67
+
68
+ # Create a project skeleton.
69
+ #
70
+ # TODO: Improve scaffolding. Make more intelligent.
71
+
72
+ def scaffold_skeleton(options=nil)
73
+ options = (options || {}).rekey(:to_s)
74
+
75
+ files = glob('**/*') - glob('meta/**/*') - ['.reap']
76
+
77
+ unless files.empty?
78
+ ans = ask("Directory isn't empty. Are you sure you want to add scaffolding?", 'yN')
79
+ case ans.downcase
80
+ when 'y', 'yes'
81
+ else
82
+ abort "Scaffolding aborted."
83
+ end
84
+ end
85
+
86
+ # if options['svn']
87
+ # if glob('**/*').empty?
88
+ # mkdir_p('trunk')
89
+ # mkdir_p('branches')
90
+ # mkdir_p('tags')
91
+ # chdir('trunk')
92
+ # else
93
+ # abort "Can't create a svn repo unless directory is empty."
94
+ # end
95
+ # end
96
+
97
+ paths = nil
98
+ dir = File.join(data_dir, 'base')
99
+ chdir(dir){ paths = Dir['**/*'] }
100
+
101
+ dirs = paths.select{ |f| File.directory?(File.join(dir, f)) }
102
+ files = (paths - dirs).reject{ |f| /[.]svn/ =~ f }
103
+
104
+ dirs.each do |dname|
105
+ if File.exist?(dname) and !File.directory?(dname)
106
+ abort "Directory to be created clashes with a prexistent file -- #{dname}"
107
+ end
108
+ end
109
+
110
+ dirs.each do |dname|
111
+ mkdir_p(dname) unless File.exist?(dname)
112
+ end
113
+
114
+ files.each do |fname|
115
+ file = File.join(dir, fname)
116
+ cp(file, fname) unless File.exist?(fname)
117
+ end
118
+ end
119
+
120
+ private
121
+
122
+ # FIXME: RubyGems has a new way to do this. Use that instead and fix Rolls to use it too.
123
+
124
+ def data_dir
125
+ @datadir ||= (
126
+ if defined?(::Library) and Library['reap']
127
+ dd = Library['reap'].datadir
128
+ else
129
+ dd = File.join(Config::CONFIG['datadir'], 'reap')
130
+ end
131
+ File.join(dd, 'reap')
132
+ )
133
+ end
134
+
135
+ end
136
+
137
+ end
138
+
@@ -0,0 +1,66 @@
1
+ require 'reap/manager/svn'
2
+
3
+ module Reap
4
+
5
+ class Manager
6
+
7
+ # Generate ChangeLog. This method routes to the
8
+ # appropriate method for the project's source
9
+ # control manager.
10
+ #
11
+ #
12
+
13
+ def scm_log(options={})
14
+ create_txtlog = (options['txtlog'] != false)
15
+ create_xmllog = (options['xmllog'] != false)
16
+
17
+ xmlout = options['xmloutput'] || 'doc/log' # TODO: How to set doc/?
18
+
19
+ if create_txtlog
20
+ txtlog = apply_naming_policy('changelog', 'txt')
21
+ txtlog = File.join('log', txtlog)
22
+ end
23
+
24
+ if create_xmllog
25
+ xmllog = apply_naming_policy('changelog', 'xml')
26
+ xmllog = File.join(xmlout, xmllog)
27
+ end
28
+
29
+ #txtlog = File.join('lib', txtlog) unless txtlog.include?('/')
30
+ #xmllog = File.join(xmldir, xmllog) unless xmllog.include?('/')
31
+
32
+ if File.directory?('.svn')
33
+ svn_log('txtlog' => txtlog, 'xmllog' => xmllog)
34
+ else
35
+ abort "Only Subversion is currently supported."
36
+ end
37
+ end
38
+
39
+ # Tag current versoin of project. This method routes
40
+ # to the appropriate method for the project's source
41
+ # control manager.
42
+
43
+ def scm_tag(*args)
44
+ if File.directory?('.svn')
45
+ svn_tag(*args)
46
+ else
47
+ abort "Only Subversion is currently supported."
48
+ end
49
+ end
50
+
51
+ # Branch current version of project. This method routes
52
+ # to the appropriate method for the project's source
53
+ # control manager.
54
+
55
+ def scm_branch(*args)
56
+ if File.directory?('.svn')
57
+ svn_branch(*args)
58
+ else
59
+ abort "Only Subversion is currently supported."
60
+ end
61
+ end
62
+
63
+ end
64
+
65
+ end
66
+
@@ -0,0 +1,27 @@
1
+ module Reap
2
+
3
+ class Manager
4
+
5
+ # Install via project's install/setup script.
6
+ #
7
+ # TODO: Remove special reap options from command line.
8
+
9
+ def site_install
10
+ script = glob("setup.rb,install.rb,task/setup,task/install").first
11
+ if script
12
+ sh "#{script} #{ARGV.join(' ')}"
13
+ else
14
+ abort "Project needs an install/setup script."
15
+ end
16
+ end
17
+
18
+ # TODO: Create uninstall task.
19
+
20
+ def site_uninstall
21
+ abort "Not yet implemented."
22
+ end
23
+
24
+ end
25
+
26
+ end
27
+
@@ -0,0 +1,94 @@
1
+ module Reap
2
+
3
+ class Manager
4
+
5
+ # DEFAULT['spec'] = {
6
+ # 'specs' => ['spec/**/*_spec.rb', 'spec/**/spec_*.rb'],
7
+ # 'require' => [],
8
+ # 'warning' => false,
9
+ # 'command' => ['spec']
10
+ # }
11
+
12
+ # Run all specs with basic output.
13
+ #
14
+ # Options:
15
+ # specs File glob(s) of spec files. Defaults to ['spec/**/*_spec.rb', 'spec/**/spec_*.rb'].
16
+ # loadpath Paths to add $LOAD_PATH. Defaults to ['lib'].
17
+ # live Ignore loadpath, use installed libraries instead. Default is false.
18
+ # require Lib(s) to require before excuting specifications.
19
+ # warning Whether to show warnings or not. Default is false.
20
+ # command Spec command to use. Defaults to 'spec'.
21
+ # format Format of RSpec output.
22
+ # rubyopt Additional options to pass to the ruby command.
23
+ # specopt Additional commandline options for spec command.
24
+ #--
25
+ # RCOV suppot?
26
+ # ruby [ruby_opts] -Ilib -S rcov [rcov_opts] bin/spec -- examples [spec_opts]
27
+ #++
28
+
29
+ def spec(options=nil)
30
+ options = configure_options(options, 'spec')
31
+
32
+ #specs = options['specs'] || DEFAULT['spec']['specs']
33
+ #reqs = options['require'] || DEFAULT['spec']['require']
34
+ #warning = options['warning'] || DEFAULT['spec']['false']
35
+ #command = options['command'] || DEFAULT['spec']['command']
36
+
37
+ specs = options['specs']
38
+ warning = options['warning']
39
+ command = options['command'] || 'spec'
40
+ loadpath = options['loadpath'] || metadata.loadpath
41
+ format = options['format']
42
+ rubyopt = options['rubyopt']
43
+ specopt = options['specopt']
44
+ live = options['live']
45
+
46
+ specs = list_options(specs)
47
+ loadpath = list_options(loadpath)
48
+ requires = list_options(requires)
49
+
50
+ files = multiglob(*specs)
51
+
52
+ if files.empty?
53
+ puts "No specifications."
54
+ else
55
+ #RakeFileUtils.verbose(verbose) do
56
+ # ruby [ruby_opts] -Ilib bin/spec examples [spec_opts]
57
+ cmd = "ruby"
58
+ cmd << " -w" if warning
59
+ cmd << %[ -I"#{loadpath.join(':')}"] unless loadpath.empty?
60
+ cmd << %[ -r"#{requires.join(':')}"] unless requires.empty?
61
+ cmd << rubyopt #.join(" ")
62
+ cmd << " "
63
+ #rb_opts << "-S rcov" if rcov
64
+ #cmd << rcov_option_list
65
+ #cmd << %[ -o "#{rcov_dir}" ] if rcov
66
+ cmd << command
67
+ cmd << " "
68
+ #cmd << "-- " if rcov
69
+ cmd << files.join(' ')
70
+ cmd << " "
71
+ cmd << specopt #.join(' ')
72
+ cmd << " --format #{format}" if format
73
+
74
+ puts cmd if verbose?
75
+ unless system(cmd)
76
+ STDERR.puts failure_message if failure_message
77
+ raise("Command #{cmd} failed") if fail_on_error
78
+ end
79
+ #end
80
+ end
81
+ end
82
+
83
+ # Run all specs with text output
84
+
85
+ def spec_doc(options=nil)
86
+ options ||= {}
87
+ options['format'] = 'specdoc'
88
+ spec(options)
89
+ end
90
+
91
+ end
92
+
93
+ end
94
+