reap 6.0.0 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/ProjectInfo ADDED
@@ -0,0 +1,102 @@
1
+ --- %YAML:1.0
2
+
3
+ version : 6.0.1
4
+ status : 'beta'
5
+
6
+ title : Reap
7
+ name : reap
8
+ author : Thomas Sawyer
9
+ created : '2004-04-01'
10
+ email : &email transfire@gmail.com
11
+ homepage : "http://reap.rubyforge.org"
12
+
13
+ summary : The Flexible Ruby Project Management Assistant
14
+
15
+ description: >
16
+ Reap comprises a set of tasks commonly needed by Ruby package
17
+ developers/deployers, such as testing, packaging, releasing, etc.
18
+ You can also use Reap to create your own custom tasks.
19
+ Reap utilizes a YAML configuration file to harvest common project
20
+ information, significantly simplifying these chores.
21
+
22
+ rubyforge:
23
+ project : reap
24
+ username : transami
25
+
26
+ # not used yet
27
+ revision:
28
+ type: darcs
29
+ exclude:
30
+ - 'forge'
31
+ - 'note'
32
+ - 'web/doc/api'
33
+ - 'web/images'
34
+ - 'setup.rb'
35
+
36
+ rdoc: !!rdoc
37
+ dir: 'web/doc/api'
38
+ main: README
39
+
40
+ package: !!package
41
+ distribute : [ tar.bz2, gem, deb ] #pac
42
+ dependencies : [ facets ]
43
+ executables : [ reap, rubytest ]
44
+ dir : release
45
+ #source : 'http://rubyforge.org/frs/download.php/10311/reap-6.0.1.tar.bz2'
46
+ exclude:
47
+ - release
48
+ - web/doc/api
49
+
50
+ release: !!release
51
+ host : rubyforge.org
52
+ username : transami
53
+ project : reap
54
+ groupid : 811
55
+ package : Reap
56
+ dir : release
57
+
58
+ publish: !!publish
59
+ target : rubyforge
60
+ type : web
61
+ host : rubyforge.org
62
+ username : transami
63
+ dir : web
64
+
65
+ ann: !!announce
66
+ to : transfire@gmail.com # ruby-talk@ruby-lang.org
67
+ from : *email
68
+ domain : unit.rubyforge.org
69
+ server : smtp.gmail.com
70
+ port : 587
71
+ account : *email # transfire@gmail.com
72
+ type : login # cram_md5, plain
73
+ security : tls # ~, tls, ssl (not working yet)
74
+ file : note/LATEST # which file contains announcement
75
+ slogan : REAP THE REWARDS!
76
+ links : []
77
+
78
+ doap: !!doap
79
+ dir: note
80
+
81
+ count: !!count
82
+ include: 'lib/**/*'
83
+
84
+ setup: !!setup
85
+
86
+ # perm: !!perm
87
+ # filemod: 644
88
+ # dirmod: 755
89
+ # user: trans
90
+ # group: users
91
+
92
+ # TESTING PURPOSES
93
+
94
+ # demo: !!demo
95
+ # desc: Alternate description for a task
96
+ # message: Hello Baby!
97
+
98
+ # mytask: !!custom
99
+ # desc: This is a test of a cutom task.
100
+ # task:
101
+ # puts "Hello Moto!"
102
+
@@ -0,0 +1,62 @@
1
+
2
+ class String
3
+ def /(str)
4
+ File.join( self, str.to_s )
5
+ end
6
+ end
7
+
8
+ # XXX use pathname
9
+ def self.config(name)
10
+ prefix = Regexp.quote(Config::CONFIG["prefix"])
11
+ exec_prefix = Regexp.quote(Config::CONFIG["exec_prefix"])
12
+ Config::CONFIG[name].gsub(/\A\/?(#{prefix}|#{exec_prefix})\/?/, '')
13
+ end
14
+
15
+ KINDS = [
16
+ :bin, :lib, :ext, :data, :conf, :doc
17
+ ]
18
+
19
+ SITE_DIRS = {
20
+ :bin => config("bindir"),
21
+ :lib => config("sitelibdir"),
22
+ :ext => config("sitearchdir"),
23
+ :data => config("datadir"),
24
+ :conf => config("sysconfdir"),
25
+ :doc => File.join(config("datadir"), "doc")
26
+ }
27
+
28
+ VEND_DIRS = {
29
+ :bin => config("bindir"),
30
+ :lib => config("rubylibdir"),
31
+ :ext => config("archdir"),
32
+ :data => config("datadir"),
33
+ :conf => config("sysconfdir"),
34
+ :doc => File.join(config("datadir"), "doc")
35
+ }
36
+
37
+ MODES = {
38
+ :bin => 0755,
39
+ :lib => 0644,
40
+ :ext => 0755, # was: 0555,
41
+ :data => 0644,
42
+ :conf => 0644,
43
+ :doc => 0644
44
+ }
45
+
46
+ # Return installation prefix.
47
+ def prefix #( kind )
48
+ Config::CONFIG["prefix"]
49
+ end
50
+
51
+ # Return the installation directory.
52
+ def dir( kind, type=:site )
53
+ case type
54
+ when :site
55
+ prefix / SITE_DIRS[ kind ]
56
+ when :vendor
57
+ prefix / VEND_DIRS[ kind ]
58
+ else
59
+ raise ArgumentError, "unknown install type -- #{type}"
60
+ end
61
+ end
62
+
data/forge/ProjectInfo ADDED
@@ -0,0 +1,38 @@
1
+ --- %YAML:1.0
2
+
3
+ version : 6.0.1
4
+ status : 'beta'
5
+
6
+ title : Reap
7
+ name : reap
8
+ author : Thomas Sawyer
9
+ created : '2004-04-01'
10
+ email : &email transfire@gmail.com
11
+ homepage : "http://reap.rubyforge.org"
12
+
13
+ summary : The Flexible Ruby Project Management Assistant
14
+
15
+ description: >
16
+ Reap comprises a set of tasks commonly needed by Ruby package
17
+ developers/deployers, such as testing, packaging, releasing, etc.
18
+ You can also use Reap to create your own custom tasks.
19
+ Reap utilizes a YAML configuration file to harvest common project
20
+ information, significantly simplifying these chores.
21
+
22
+ rubyforge:
23
+ project : reap
24
+ username : transami
25
+
26
+ revision:
27
+ type: darcs
28
+ include:
29
+ - '[A-Z]*'
30
+ - 'trunk/*'
31
+ - 'web/*.html'
32
+ exclude:
33
+ - 'trunk/setup.rb'
34
+
35
+ trunk: !!subinfo
36
+ merge: true
37
+ location: trunk
38
+
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This is an intersing example of a pure Ruby alternative to the
4
+ # YAML based project file. I someway I find it more attractive
5
+ # than the YAML. But of course, YAML is not limited to one langauge
6
+ # so it is much better for that.
7
+
8
+ title 'Reap'
9
+ name 'reap'
10
+ version '4.3.4'
11
+ date '2006-04-07'
12
+ created '2004-04-01'
13
+ status 'beta/stable'
14
+
15
+ author 'Thomas Sawyer'
16
+ email 'transfire@gmail.com'
17
+ homepage 'http://reap.rubyforge.org'
18
+ summary 'Tools for Ruby project testing, management and assistance.'
19
+
20
+ description %{
21
+ Reap comprises a set of commonly needed tools for Ruby package
22
+ developers/deployers. Because of the commonality,
23
+ Reap utilizes a YAML configuration file to harvest project
24
+ information, significantly simplifying usage.
25
+ }
26
+
27
+ distribute [ 'gem', 'deb' ] # zip, tar.gz, tbz, tgz, deb
28
+ dependencies [ 'facets' ]
29
+ executables [ 'reap' ]
30
+
31
+ package {
32
+ dir '../DISTRIBUTION'
33
+ distribute [ 'deb' ]
34
+ exclude [ 'dist', 'dev', 'scrap', 'web' ]
35
+ }
36
+
37
+ rubyforge {
38
+ project 'reap'
39
+ username 'transami'
40
+ }
41
+
42
+ release {
43
+ host 'rubyforge.org'
44
+ username 'transami'
45
+ project 'reap'
46
+ groupid '811'
47
+ package 'Reap'
48
+ dir '../DISTRIBUTION'
49
+ }
50
+
51
+ publish {
52
+ type 'web'
53
+ host 'rubyforge.org'
54
+ username 'transami'
55
+ dir 'web'
56
+ }
57
+
58
+ rdoc {
59
+ dir 'web/doc/api'
60
+ include [ 'A-Z*', 'lib/**/*' ]
61
+ exclude [ 'lib/reap/data' ]
62
+ }
63
+
64
+ anncounce {
65
+ to 'transfire@gmail.com' # ruby-talk@ruby-lang.org
66
+ from 'transfire@gmail.com'
67
+ domain 'unit.rubyforge.org'
68
+ server 'smtp.gmail.com'
69
+ port '587'
70
+ account 'transfire@gmail.com'
71
+ type 'login' # cram_md5, plain
72
+ security 'tls' # ~, tls, ssl (not working yet)
73
+ #file 'ANN' # which file contains announcement
74
+ slogan 'REAP THE REWARDS!'
75
+ links []
76
+ }
data/forge/TODO ADDED
@@ -0,0 +1,10 @@
1
+
2
+ 2006-06-04:
3
+
4
+ Allow pattern amtching in tags? For exmaple
5
+
6
+ % reap rdoc-*
7
+
8
+ Would run all tasks with names starting with 'rdoc-'.
9
+
10
+
@@ -0,0 +1,250 @@
1
+ require 'rbconfig'
2
+ require 'fileutils'
3
+
4
+ module Reap
5
+
6
+ # = Installer
7
+ #
8
+ # The Installer class generates a specialized install.rb
9
+ # script specifically for your project. It currently
10
+ # does not support c/c++ ext/ compilation.
11
+
12
+ class Installer
13
+
14
+ # Installer can not use the TaskUtils b/c it must also
15
+ # be able to run as a stand alone accplication.
16
+ #include TaskUtils
17
+
18
+ # def self.config(name)
19
+ # # XXX use pathname
20
+ # prefix = Regexp.quote(Config::CONFIG["prefix"])
21
+ # exec_prefix = Regexp.quote(Config::CONFIG["exec_prefix"])
22
+ # Config::CONFIG[name].gsub(/\A\/?(#{prefix}|#{exec_prefix})\/?/, '')
23
+ # end
24
+
25
+ KINDS = [
26
+ :bin, :lib, :ext, :data, :conf, :doc
27
+ ]
28
+
29
+ # SITE_DIRS = {
30
+ # :bin => config("bindir"),
31
+ # :lib => config("sitelibdir"),
32
+ # :ext => config("sitearchdir"),
33
+ # :data => config("datadir"),
34
+ # :conf => config("sysconfdir"),
35
+ # :doc => File.join(config("datadir"), "doc")
36
+ # }
37
+ #
38
+ # VEND_DIRS = {
39
+ # :bin => config("bindir"),
40
+ # :lib => config("rubylibdir"),
41
+ # :ext => config("archdir"),
42
+ # :data => config("datadir"),
43
+ # :conf => config("sysconfdir"),
44
+ # :doc => File.join(config("datadir"), "doc")
45
+ # }
46
+ #
47
+ # MODES = {
48
+ # :bin => 0755,
49
+ # :lib => 0644,
50
+ # :ext => 0755, # was: 0555,
51
+ # :data => 0644,
52
+ # :conf => 0644,
53
+ # :doc => 0644
54
+ # }
55
+
56
+ attr_accessor :trunk, :template, :name, :version #, :options
57
+
58
+ def initialize( options )
59
+ # prime attributes
60
+ options.each do |k,v|
61
+ send( "#{k}=", v ) if respond_to?("#{k}=")
62
+ end
63
+
64
+ @trunk = '.' unless @trunk
65
+ @transfer = Hash.new { |h,k| h[k] = [] }
66
+ @spec = parse( @template )
67
+ end
68
+
69
+ #--
70
+ # TODO use shellwords
71
+ #++
72
+ def parse( spec )
73
+ lines = spec.strip.split("\n")
74
+ lines.each { |line|
75
+ words = line.strip.split(/\s+/)
76
+ #send( *words )
77
+ kind, from, glob, to = *words
78
+ @transfer[kind.to_sym] << { :from=>vsub(from), :glob=>vsub(glob), :to=>vsub(to) }
79
+ }
80
+ end
81
+
82
+ # substitute variables
83
+ def vsub( str )
84
+ return nil if str.nil?
85
+ str = str.gsub( '$version', @version.to_s ) #@options[:version].to_s )
86
+ str = str.gsub( '$name', @name.to_s ) #options[:name].to_s )
87
+ str
88
+ end
89
+
90
+
91
+ # # Return the installation directory.
92
+ # def dir( kind, mode=:site )
93
+ # case mode
94
+ # when :site
95
+ # SITE_DIRS[ kind ]
96
+ # when :vendor
97
+ # VEND_DIRS[ kind ]
98
+ # else
99
+ # raise ArgumentError, "unknown mode -- #{mode}"
100
+ # end
101
+ # end
102
+ #
103
+ # # Return installation prefix.
104
+ # def prefix #( kind )
105
+ # Config::CONFIG["prefix"]
106
+ # end
107
+
108
+
109
+ # #--
110
+ # # DSL methods for setting installation spec.
111
+ # #++
112
+ #
113
+ # # Setup a lib installation transfer.
114
+ # def lib( from, glob, to )
115
+ # to = '' if to == '.'
116
+ # @transfer[:lib] << { :from=>vsub(from), :glob=>vsub(glob), :to=>vsub(to) }
117
+ # end
118
+ #
119
+ # # Setup a bin installation transfer.
120
+ # def bin( from, glob, to=nil )
121
+ # #to = '' if to == '.'
122
+ # @transfer[:bin] << { :from=>vsub(from), :glob=>vsub(glob), :to=>vsub(to) }
123
+ # end
124
+ #
125
+ # # Setup a data installation transfer.
126
+ # def data( from, glob, to=nil )
127
+ # #to = '' if to == '.'
128
+ # @transfer[:data] << { :from=>vsub(from), :glob=>vsub(glob), :to=>vsub(to) }
129
+ # end
130
+
131
+ # Compile script and write to install file (install.rb).
132
+
133
+ def compile_and_write
134
+ #write( compile )
135
+ compile
136
+ end
137
+
138
+ alias_method :call, :compile_and_write
139
+
140
+ # def compile
141
+ # script = ""
142
+ # script << "# INSTALL SCRIPT\n"
143
+ # script << "# Generated by Reap\n"
144
+ # script << "# #{Time.now}\n"
145
+ # script << "\n"
146
+ # script << instructions
147
+ # script << "\n"
148
+ # script << "# END"
149
+ # script
150
+ # end
151
+
152
+
153
+ private
154
+
155
+ # Compile installation instructions.
156
+
157
+ def instructions
158
+ KINDS.each do |kind|
159
+ @transfer[kind].each { |trans|
160
+ package( kind, trans[:from], trans[:glob], trans[:to] )
161
+ }
162
+ end
163
+ end
164
+
165
+
166
+
167
+ def package( kind, from, glob, to )
168
+ mkdirp = []
169
+ #script = ''
170
+ Dir.chdir( @trunk ) do
171
+ #KINDS.each { |kind|
172
+ #@transfer[kind].each { |trans|
173
+ next unless File.directory?( from )
174
+ files = []
175
+ Dir.chdir( from ) {
176
+ files = Dir.glob( glob ).reject { |f| File.directory?( f ) }
177
+ }
178
+ files.each { |file|
179
+ f = File.join( from, file )
180
+ t = to ? File.join( @mirror_path, to, file ) : File.join( @mirror_path, file )
181
+
182
+ m = "mode(:#{kind})" # MODES[kind]
183
+
184
+ d = File.dirname(t)
185
+ unless mkdirp.include?(d)
186
+ #script << %{makedir :#{kind}, "%s"\n} % d
187
+ puts "makedir_p #{d}"
188
+ mkdirp << d
189
+ end
190
+
191
+ #script << %{install :#{kind}, "%s" => "%s"\n} % [ f, t ]
192
+
193
+ puts "safe_ln #{from}, #{to}"
194
+
195
+ #script << %{install "%s" =>\n dir(:#{kind})/"%s", :mode=>%s\n} % [ f, t, m ]
196
+ #script << "install_#{kind} '%s', '%s', :mode=>%o\n" % [ f, t, m ]
197
+ #}
198
+ #}
199
+ }
200
+ end
201
+ #script
202
+ end
203
+
204
+ end
205
+
206
+ end #module Reap
207
+
208
+
209
+ # def write( script )
210
+ # install_file = File.join( @trunk, 'install.rb' )
211
+ # if File.file?( install_file )
212
+ # script_template = File.read( install_file )
213
+ # script = script_template.gsub(/\# INSTALL SCRIPT.*\# END/, script)
214
+ # exit 0
215
+ # File.open( install_file, 'w+' ) do |f|
216
+ # f << script
217
+ # end
218
+ # end
219
+ # end
220
+
221
+ # # Move to install.rb script
222
+ # def package( kind, from, glob, to )
223
+ # mkdirp = []
224
+ # script = ''
225
+ # Dir.chdir( @trunk ) do
226
+ # @transfer[kind].each { |trans|
227
+ # next unless File.directory?( transfrom )
228
+ # files = []
229
+ # Dir.chdir( from ) {
230
+ # files = Dir.glob( trans[:glob] ).reject { |f| File.directory?( f ) }
231
+ # }
232
+ # files.each { |file|
233
+ # f = File.join( trans[:from], file )
234
+ # #t = File.join( prefix(kind), dir(kind), trans[:to], file )
235
+ # t = trans[:to] ? File.join( trans[:to], file ) : file
236
+ # m = "mode(:#{kind})" # MODES[kind]
237
+ # d = File.dirname(t)
238
+ # unless mkdirp.include?(d)
239
+ # script << %{makedir :#{kind}, "%s"\n} % d
240
+ # mkdirp << d
241
+ # end
242
+ # script << %{install :#{kind}, "%s" => "%s"\n} % [ f, t ]
243
+ # #script << %{install "%s" =>\n dir(:#{kind})/"%s", :mode=>%s\n} % [ f, t, m ]
244
+ # #script << "install_#{kind} '%s', '%s', :mode=>%o\n" % [ f, t, m ]
245
+ # }
246
+ # }
247
+ # end
248
+ # script
249
+ # end
250
+
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env ruby rake
2
+ # Rakefile for Calibre
3
+
4
+ require 'rake/rdoctask'
5
+
6
+ desc "Run all the tests"
7
+ task :default => [:test]
8
+
9
+
10
+ # tests
11
+
12
+ desc "Run all tests"
13
+ task :test => [:"test-facets", :"test-carats"]
14
+
15
+ desc "Run tests for Ruby Facets"
16
+ Rake::TestTask.new(:"test-facets") do |t|
17
+ t.libs << "packages/facets/lib"
18
+ t.test_files = FileList['packages/facets/test/**/tc*.rb']
19
+ t.verbose = true
20
+ end
21
+
22
+ desc "Run tests for Ruby Carats"
23
+ Rake::TestTask.new(:"test-carats") do |t|
24
+ t.libs << "packages/carats/lib"
25
+ t.test_files = FileList['packages/carats/test/**/tc*.rb']
26
+ t.verbose = true
27
+ end
28
+
29
+
30
+ # rdocs
31
+
32
+ desc "Generate All RDoc documentation"
33
+ task :rdoc => [:"rdoc-facets", :"rdoc-carats"]
34
+
35
+ desc "Generate RDoc documentation for Facets"
36
+ Rake::RDocTask.new(:"rdoc-facets") do |rd|
37
+ cdir = Dir.pwd
38
+ Dir.chdir 'packages/facets'
39
+ rd.main = 'README'
40
+ rd.template = 'html'
41
+ rd.rdoc_dir = 'pub/facet/doc'
42
+ rd.rdoc_files.include('README', 'LIC*', 'lib/facet/')
43
+ rd.rdoc_files.exclude 'InstalledFiles'
44
+ rd.options << '--promiscuous --merge --all'
45
+ Dir.chdir(cdir)
46
+ end
47
+
48
+ desc "Generate RDoc documentation for Carats"
49
+ Rake::RDocTask.new(:"carat-doc") do |rd|
50
+ cdir = Dir.pwd
51
+ Dir.chdir 'packages/carats'
52
+ rd.main = 'README'
53
+ rd.template = 'html'
54
+ rd.rdoc_dir = 'doc'
55
+ rd.rdoc_files.include('README', 'LIC*', 'lib/carat/')
56
+ rd.rdoc_files.exclude 'InstalledFiles'
57
+ rd.options << '--promiscuous --merge --all'
58
+ Dir.chdir(cdir)
59
+ end
60
+
61
+ # web publish
62
+
63
+ desc "Publish Rubyforge Website"
64
+ task :webpub do
65
+ rubyforge_project = 'calibre'
66
+ username = 'transami'
67
+ web_dir = 'pub/www'
68
+ # do it
69
+ current_dir = Dir.pwd
70
+ Dir.chdir( web_dir )
71
+ web_files = FileList.new
72
+ web_files.include('**/*')
73
+ web_files = '"' << web_files.join('" "') << '"'
74
+ cmd = "scp #{web_files} #{username}@rubyforge.org:/var/www/gforge-projects/#{rubyforge_project}/"
75
+ system cmd
76
+ Dir.chdir( current_dir )
77
+ end
78
+
79
+
80
+ #desc "Do predistribution stuff"
81
+ #task :predist => [:changelog, :doc]
82
+
83
+
84
+
85
+ desc "Make an archive as .tar.gz"
86
+ task :dist => :test do
87
+ system "export DARCS_REPO=#{File.expand_path "."}; " +
88
+ "darcs dist -d rand#{get_darcs_tree_version}"
89
+ end
90
+
91
+ desc "Generate a ChangeLog"
92
+ task :changelog do
93
+ system "darcs changes --repo=#{ENV["DARCS_REPO"] || "."} >ChangeLog"
94
+ end
95
+
96
+
97
+ # --- Helper Methods ---
98
+
99
+ # Helper to retrieve the "revision number" of the darcs tree.
100
+ def get_darcs_tree_version
101
+
102
+ return "" unless File.directory? "_darcs"
103
+
104
+ changes = `darcs changes`
105
+ count = 0
106
+ tag = "0.0"
107
+
108
+ changes.each("\n\n") { |change|
109
+ head, title, desc = change.split("\n", 3)
110
+
111
+ if title =~ /^ \*/
112
+ # Normal change.
113
+ count += 1
114
+ elsif title =~ /tagged (.*)/
115
+ # Tag. We look for these.
116
+ tag = $1
117
+ break
118
+ else
119
+ warn "Unparsable change: #{change}"
120
+ end
121
+ }
122
+
123
+ "-" + tag + "." + count.to_s
124
+ end