reap 9.2.1 → 9.3.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.
- data/CHANGES +4 -0
- data/COPYING +675 -674
- data/MANIFEST +37 -44
- data/NOTES +4 -4
- data/Rakefile +1486 -0
- data/data/reap/base/COPYING +674 -674
- data/data/reap/base/README +23 -2
- data/data/reap/base/Rakefile +1486 -0
- data/data/reap/base/test/template.rb +16 -0
- data/data/reap/init/meta/project.yaml +19 -14
- data/lib/reap/default.yaml +57 -45
- data/lib/reap/extensions/file.rb +8 -0
- data/lib/reap/extensions/net/smtp_tls.rb +108 -0
- data/lib/reap/extensions.rb +2 -0
- data/lib/reap/metadata.rb +3 -2
- data/lib/reap/{manager → project}/announce.rb +3 -3
- data/lib/reap/{manager → project}/check.rb +1 -1
- data/lib/reap/{manager → project}/clean.rb +1 -1
- data/lib/reap/{manager → project}/gem.rb +5 -5
- data/lib/reap/{manager → project}/html.rb +25 -24
- data/lib/reap/{manager → project}/log.rb +19 -9
- data/lib/reap/{manager → project}/make.rb +29 -36
- data/lib/reap/{manager → project}/package.rb +4 -8
- data/lib/reap/{manager → project}/publish.rb +3 -3
- data/lib/reap/{manager → project}/rdoc.rb +13 -30
- data/lib/reap/{manager → project}/release.rb +5 -5
- data/lib/reap/{manager → project}/rubyforge.rb +7 -6
- data/lib/reap/{manager → project}/scaffold.rb +7 -2
- data/lib/reap/{manager → project}/scm.rb +3 -3
- data/lib/reap/{manager → project}/site.rb +1 -1
- data/lib/reap/{manager → project}/spec.rb +1 -1
- data/lib/reap/{manager → project}/stamp.rb +14 -11
- data/lib/reap/{manager → project}/stats.rb +1 -1
- data/lib/reap/{manager → project}/svn.rb +1 -1
- data/lib/reap/{manager → project}/test.rb +2 -20
- data/lib/reap/project.rb +34 -2
- data/lib/reap/systems/rubyforge.rb +5 -12
- data/lib/reap/systems/subversion.rb +4 -6
- data/lib/reap/{utilities/fileutils.rb → utilities.rb} +148 -60
- data/log/Changelog.txt +118 -0
- data/log/Fixme.txt +26 -0
- data/log/Todo.txt +94 -0
- data/meta/VERSION +1 -1
- data/meta/project.yaml +1 -1
- data/meta/unixname +1 -0
- data/test/unit/lib/reap/extensions/test_array.rb +12 -0
- metadata +44 -46
- data/data/reap/build/rake/Rakefile +0 -130
- data/data/reap/build/rake/setup.rb +0 -1616
- data/data/reap/build/rake-lite/install.rb +0 -79
- data/data/reap/build/tasks/task/rdoc +0 -211
- data/data/reap/build/tasks/task/setup +0 -1616
- data/data/reap/build/tasks/task/test +0 -38
- data/lib/reap/manager.rb +0 -75
- data/lib/reap/utilities/netutils.rb +0 -221
- data/lib/reap/utilities/setuputils.rb +0 -124
- data/lib/reap/utilities/shellutils.rb +0 -175
- data/log/FIXME.txt +0 -25
- data/log/TODO.txt +0 -72
- data/task/man +0 -14
- data/task/rdoc +0 -20
- data/task/setup +0 -1616
@@ -1,21 +1,26 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
project : foo
|
3
|
+
contact : Your Name <yourmail@foomail.com>
|
4
|
+
license : GPLv3
|
5
|
+
created : 2005-08-09
|
6
|
+
homepage : http://orphans.rubyforge.org
|
7
|
+
repository : http://orphans.rubyforge.org/svn
|
6
8
|
|
7
|
-
project
|
8
|
-
|
9
|
-
created : "2005-08-09"
|
10
|
-
homepage : "http://reap.rubyforge.org"
|
11
|
-
repository : "http://reap.rubyforge.org/svn"
|
12
|
-
slogan : Reap Your Rewards
|
9
|
+
# Title. This defaults to project capitalized, if not given.
|
10
|
+
title : Project Title Here
|
13
11
|
|
14
|
-
|
12
|
+
# One line description.
|
13
|
+
brief : Foo Foo the Rabbit
|
15
14
|
|
16
|
-
|
17
|
-
|
15
|
+
# Detailed description.
|
16
|
+
description: >
|
17
|
+
Little rabbit Foo Foo was hoping through the forest.
|
18
|
+
Picking up field mice and bopping them on the head.
|
18
19
|
|
19
|
-
|
20
|
+
# Directories to exclude from package.
|
21
|
+
exclude : [ pkg, work, doc, ri ]
|
20
22
|
|
23
|
+
# List of dependenices with version constraints.
|
24
|
+
dependency :
|
25
|
+
- [facets, '>= 2.1.0']
|
21
26
|
|
data/lib/reap/default.yaml
CHANGED
@@ -12,66 +12,78 @@
|
|
12
12
|
secure: false # Uses TLS security, true or false?
|
13
13
|
login: plain # Login type: plain, cram_md5 or login.
|
14
14
|
cutoff: 30 # How many lines of changelog to provide.
|
15
|
+
|
15
16
|
check:
|
16
|
-
loadpath: #
|
17
|
-
exclude: []
|
17
|
+
loadpath: ~ # Defaults to metadata.loadpath.
|
18
|
+
exclude: [] # Files or directories to specifically exclude.
|
19
|
+
|
18
20
|
check-syntax:
|
19
|
-
loadpath: #
|
20
|
-
exclude: [ext]
|
21
|
+
loadpath: ~ # Defaults to metadata.loadpath.
|
22
|
+
exclude: [ext] # Files or directories to specifically exclude.
|
23
|
+
|
21
24
|
check-load:
|
22
|
-
loadpath: #
|
23
|
-
exclude: []
|
25
|
+
loadpath: ~ # Defaults to metadata.loadpath.
|
26
|
+
exclude: [] # Files or directories to specifically exclude.
|
27
|
+
|
24
28
|
clean:
|
25
|
-
remove: [**/*~, **/*.bak]
|
29
|
+
remove: [**/*~, **/*.bak] # Files globs to remove when cleaning.
|
30
|
+
|
26
31
|
log:
|
27
32
|
policy: [cap, ext] # How to save log files. (cap=capitialize, up=uppercase, low=lowercase, ext=extension)
|
28
|
-
output: log
|
33
|
+
output: log # Where to store log files. (This is to become convention!)
|
34
|
+
|
29
35
|
log-notes:
|
30
|
-
loadpath: #
|
31
|
-
labels: [TODO, FIXME, OPTIMIZE]
|
32
|
-
|
33
|
-
extensions: #{metadata.extensions} # Defaults to ext/**/extconf.rb (NOT USED YET)
|
36
|
+
loadpath: ~ # File paths to search for notes. Defaults to metadata.loadpath.
|
37
|
+
labels: [TODO, FIXME, OPTIMIZE] # Note labels to scan.
|
38
|
+
|
34
39
|
package:
|
35
|
-
formats: [zip, gem]
|
40
|
+
formats: [zip, gem] # Package formats to create (gem, zip, tgz)
|
41
|
+
|
36
42
|
publish:
|
37
|
-
source:
|
38
|
-
webdir: ~
|
39
|
-
username: #
|
43
|
+
source: site # Directory to publish.
|
44
|
+
webdir: ~ # Remote directory to copy to.
|
45
|
+
username: ~ # Account username. Deafults to ENV['RUBYFORGE_USERNAME'].
|
40
46
|
protect: [usage, statcvs, statsvn, robot.txt, wiki] # Used as defaults for creating .rsync-filter (after that edit .rsync-filter)
|
41
47
|
exclude: [.svn, scrap] # Used as defaults for creating .rsync-filter (after that edit .rsync-filter)
|
48
|
+
|
42
49
|
rdoc:
|
43
|
-
template: html
|
44
|
-
output: doc
|
45
|
-
main: 'README{,.txt}'
|
46
|
-
inline: true
|
47
|
-
merge: true
|
48
|
-
|
49
|
-
|
50
|
-
adfile:
|
51
|
-
targets: ~
|
50
|
+
template: html # Template to use.
|
51
|
+
output: doc # Where to save rdoc files.
|
52
|
+
main: 'README{,.txt}' # Main file (pattern).
|
53
|
+
inline: true # Inline source?
|
54
|
+
merge: true # Merge code?
|
55
|
+
include: [lib, '[A-Z]*'] # Which files to include (be careful of including a Rakefile).
|
56
|
+
exclude: [] # Paths to specifically exclude. (RDOC SUCKS --THIS DOESN'T WORK!!!)
|
57
|
+
adfile: site/ads/rdoc.html # Ad file html snippet to add te html rdocs.
|
58
|
+
targets: ~ # If you need more then one rdoc set, use targets.
|
59
|
+
|
52
60
|
ri:
|
53
|
-
output: ri
|
54
|
-
|
55
|
-
|
61
|
+
output: ri # Where to save ri files.
|
62
|
+
include: ~ # Defaults to metadata.loadpath.
|
63
|
+
exclude: [] # Paths to specifically exclude.
|
64
|
+
|
56
65
|
release:
|
57
|
-
username: #
|
58
|
-
changelog: 'CHANGES{,.txt}'
|
59
|
-
notelog: 'NOTES{,.txt}'
|
66
|
+
username: ~ # Account username. Deafults to ENV['RUBYFORGE_USERNAME'].
|
67
|
+
changelog: 'CHANGES{,.txt}' # File to send as changes.
|
68
|
+
notelog: 'NOTES{,.txt}' # File to send as notes.
|
69
|
+
|
60
70
|
spec:
|
61
|
-
specs: [spec/**/*_spec.rb, spec/**/spec_*.rb]
|
62
|
-
loadpath: #
|
63
|
-
require: []
|
64
|
-
warning: false
|
65
|
-
command: spec
|
66
|
-
live: false
|
71
|
+
specs: [spec/**/*_spec.rb, spec/**/spec_*.rb] # Pattern for rspec files.
|
72
|
+
loadpath: ~ # Defaults to metadata.loadpath.
|
73
|
+
require: [] # Any files to pre-require.
|
74
|
+
warning: false # Run specs with Ruby's warning turned-on.
|
75
|
+
command: spec # The spec command.
|
76
|
+
live: false # If true, will not use loadpath setting.
|
77
|
+
|
67
78
|
stats:
|
68
|
-
loadpath: #
|
69
|
-
exclude: ['ext']
|
79
|
+
loadpath: ~ # Defaults to metadata.loadpath.
|
80
|
+
exclude: ['ext'] # File to specifically exclude from stats.
|
81
|
+
|
70
82
|
test:
|
71
|
-
tests: test/**/{test,tc}_*.rb
|
72
|
-
loadpath: #
|
73
|
-
require: []
|
74
|
-
exclude: ext
|
75
|
-
command: testrb
|
76
|
-
live: false
|
83
|
+
tests: test/**/{test,tc}_*.rb # Pattern for unit test files.
|
84
|
+
loadpath: ~ # Defaults to metadata.loadpath.
|
85
|
+
require: [] # Any files to pre-require.
|
86
|
+
exclude: ext # ?
|
87
|
+
command: testrb # The test command.
|
88
|
+
live: false # If true, will not use loadpath setting.
|
77
89
|
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'net/smtp'
|
2
|
+
require 'timeout'
|
3
|
+
begin
|
4
|
+
require 'openssl'
|
5
|
+
rescue LoadError
|
6
|
+
end
|
7
|
+
|
8
|
+
module Net #:nodoc: all
|
9
|
+
class SMTP
|
10
|
+
module TLS
|
11
|
+
|
12
|
+
def self.included(base)
|
13
|
+
base.extend(ClassMethods)
|
14
|
+
|
15
|
+
@usetls = base.use_tls?
|
16
|
+
end
|
17
|
+
|
18
|
+
module ClassMethods
|
19
|
+
def self.extended(base)
|
20
|
+
base.disable_tls
|
21
|
+
end
|
22
|
+
|
23
|
+
def enable_tls()
|
24
|
+
@@usetls = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def disable_tls()
|
28
|
+
@@usetls = false
|
29
|
+
end
|
30
|
+
|
31
|
+
def use_tls?()
|
32
|
+
@@usetls
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def use_tls?()
|
37
|
+
@usetls
|
38
|
+
end
|
39
|
+
|
40
|
+
def enable_tls()
|
41
|
+
@usetls = true
|
42
|
+
end
|
43
|
+
|
44
|
+
def disable_tls()
|
45
|
+
@usetls = false
|
46
|
+
end
|
47
|
+
|
48
|
+
def use_tls?()
|
49
|
+
@usetls
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
def do_start(helodomain, user, secret, authtype)
|
54
|
+
raise IOError('SMTP session already started') if @started
|
55
|
+
check_auth_args user, secret, authtype if user or secret
|
56
|
+
|
57
|
+
sock = timeout(@open_timeout) {TCPSocket.open(@address, @port) }
|
58
|
+
@socket = Net::InternetMessageIO.new(sock)
|
59
|
+
@socket.read_timeout = @read_timeout
|
60
|
+
@socket.debug_output = STDERR
|
61
|
+
|
62
|
+
check_response(critical {recv_response() } )
|
63
|
+
do_helo(helodomain)
|
64
|
+
|
65
|
+
if @@usetls
|
66
|
+
raise 'openssl is not installed' unless defined?(OpenSSL)
|
67
|
+
ssl = OpenSSL::SSL::SSLSocket.new(sock)
|
68
|
+
starttls
|
69
|
+
ssl.sync_close = true
|
70
|
+
ssl.connect
|
71
|
+
|
72
|
+
@socket = Net::InternetMessageIO.new(ssl)
|
73
|
+
@socket.read_timeout = @read_timeout
|
74
|
+
@socket.debug_output = STDERR
|
75
|
+
do_helo(helodomain)
|
76
|
+
end
|
77
|
+
|
78
|
+
authenticate user, secret, authtype if user
|
79
|
+
@started = true
|
80
|
+
ensure
|
81
|
+
@socket.close if not @started and @socket and not @socket.closed?
|
82
|
+
end
|
83
|
+
|
84
|
+
def do_helo(helodomain)
|
85
|
+
begin
|
86
|
+
if @esmtp
|
87
|
+
ehlo helodomain
|
88
|
+
else
|
89
|
+
helo helodomain
|
90
|
+
end
|
91
|
+
rescue Net::ProtocolError
|
92
|
+
if @esmtp
|
93
|
+
@esmtp = false
|
94
|
+
@error_occured = false
|
95
|
+
retry
|
96
|
+
end
|
97
|
+
raise
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def starttls
|
102
|
+
getok('STARTTLS')
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
data/lib/reap/extensions.rb
CHANGED
data/lib/reap/metadata.rb
CHANGED
@@ -229,7 +229,7 @@ class Project
|
|
229
229
|
|
230
230
|
# Status of this release: alpha, beta, RC1, etc.
|
231
231
|
attr_accessor :status do
|
232
|
-
@
|
232
|
+
@status || 'alpha'
|
233
233
|
end
|
234
234
|
|
235
235
|
# Date of release.
|
@@ -558,7 +558,8 @@ class Project
|
|
558
558
|
files -= Dir.multiglob_r('pkg') #package_directory
|
559
559
|
end
|
560
560
|
|
561
|
-
|
561
|
+
# Do not include symlinks.
|
562
|
+
files.reject!{ |f| FileTest.symlink?(f) }
|
562
563
|
|
563
564
|
unless with_dirs
|
564
565
|
files = files.select{ |f| !File.directory?(f) }
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Reap
|
2
2
|
|
3
|
-
class
|
3
|
+
class Project
|
4
4
|
|
5
5
|
# Make a release announcement. Generates and can email release
|
6
6
|
# announcements. The announcement if built from the README file
|
@@ -57,13 +57,13 @@ module Reap
|
|
57
57
|
version = options.versoin || metadata.version
|
58
58
|
|
59
59
|
# defaults
|
60
|
-
subject ||= "%s, v%s
|
60
|
+
subject ||= "%s, v%s release"
|
61
61
|
account ||= mail_from
|
62
62
|
|
63
63
|
subject = subject % [title, version]
|
64
64
|
|
65
65
|
if dryrun?
|
66
|
-
puts "
|
66
|
+
puts "email '#{subject}'"
|
67
67
|
puts "\n#{message}\n\n" if verbose?
|
68
68
|
else
|
69
69
|
puts "\n#{message}\n\n"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Reap
|
2
2
|
|
3
|
-
class
|
3
|
+
class Project
|
4
4
|
|
5
5
|
# Remove gem package products.
|
6
6
|
|
@@ -26,8 +26,6 @@ module Reap
|
|
26
26
|
#raise LoadError, "RubyGems is not installed?"
|
27
27
|
end
|
28
28
|
|
29
|
-
status "Creating .gem package"
|
30
|
-
|
31
29
|
options = configure_options(options, 'package-gem', 'package')
|
32
30
|
|
33
31
|
prepare(options)
|
@@ -125,7 +123,7 @@ module Reap
|
|
125
123
|
# Platform: ruby, mswin32, i586-linux, powerpc-darwin, current
|
126
124
|
spec.platform = 'ruby' # TODO current support!
|
127
125
|
|
128
|
-
spec.require_paths = [package.
|
126
|
+
spec.require_paths = [package.loadpath].flatten
|
129
127
|
|
130
128
|
#if package.platform != 'ruby'
|
131
129
|
# spec.require_paths.concat(spec.require_paths.collect{ |d| File.join(d, platform) })
|
@@ -134,7 +132,9 @@ module Reap
|
|
134
132
|
spec.bindir = "bin"
|
135
133
|
spec.executables = package.executables
|
136
134
|
spec.requirements = package.requirements
|
137
|
-
|
135
|
+
|
136
|
+
# TODO: Looks like there is no choice but to auto-rdoc gem install.
|
137
|
+
spec.has_rdoc = !(FalseClass===package.document)
|
138
138
|
|
139
139
|
if package.dependencies
|
140
140
|
package.dependencies.each do |d,v|
|
@@ -1,10 +1,12 @@
|
|
1
1
|
module Reap
|
2
2
|
|
3
|
-
class
|
3
|
+
class Project
|
4
4
|
|
5
5
|
# Create web index.html from README. (Not yet used)
|
6
6
|
|
7
7
|
def html
|
8
|
+
status_title "Creating HTML documents"
|
9
|
+
|
8
10
|
require 'rdoc/markup/simple_markup'
|
9
11
|
require 'rdoc/markup/simple_markup/to_html'
|
10
12
|
|
@@ -38,32 +40,31 @@ module Reap
|
|
38
40
|
end
|
39
41
|
path = File.join(output, name + '.html')
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
puts "Created #{path}"
|
63
|
-
end
|
43
|
+
next unless out_of_date?(path, file)
|
44
|
+
|
45
|
+
title = "#{package.title} #{name.upcase}"
|
46
|
+
|
47
|
+
input = File.read(file)
|
48
|
+
output = s.convert(input, h) # FIX
|
49
|
+
|
50
|
+
text = ''
|
51
|
+
text << %{<html>}
|
52
|
+
text << %{<head>}
|
53
|
+
text << %{ <title>#{title}<title>}
|
54
|
+
text << %{ <link rel="stylesheet" TYPE="text/css" HREF="#{style}">} if style
|
55
|
+
text << %{</head>}
|
56
|
+
text << %{<body>}
|
57
|
+
text << output
|
58
|
+
text << %{</body>}
|
59
|
+
text << %{</html>}
|
60
|
+
|
61
|
+
write(path, text)
|
62
|
+
|
63
|
+
puts "Created #{path}"
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|
70
|
+
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'reap/
|
1
|
+
require 'reap/project/scm'
|
2
2
|
|
3
3
|
module Reap
|
4
4
|
|
5
|
-
class
|
5
|
+
class Project
|
6
6
|
|
7
7
|
# Update all logs.
|
8
8
|
|
@@ -40,6 +40,8 @@ module Reap
|
|
40
40
|
labels = options['labels'] || ['TODO', 'FIXME', 'OPTIMIZE']
|
41
41
|
output = options['output'] || 'log'
|
42
42
|
|
43
|
+
loadpath = list_option(loadpath)
|
44
|
+
|
43
45
|
labels = labels.split(',') if String === labels
|
44
46
|
labels = [labels].flatten.compact
|
45
47
|
|
@@ -62,7 +64,7 @@ module Reap
|
|
62
64
|
# Gather notes.
|
63
65
|
|
64
66
|
def log_notes_extract(labels, loadpath=nil)
|
65
|
-
files =
|
67
|
+
files = multiglob_r(*loadpath)
|
66
68
|
|
67
69
|
counts = Hash.new(0)
|
68
70
|
records = []
|
@@ -148,18 +150,26 @@ module Reap
|
|
148
150
|
def naming_policy
|
149
151
|
@naming_policy ||= (
|
150
152
|
logconfig = configuration['log'] || {}
|
151
|
-
logconfig['policy'] ||
|
153
|
+
policy = logconfig['policy'] || ['cap', 'ext']
|
154
|
+
list_option(policy)
|
152
155
|
)
|
153
156
|
end
|
154
157
|
|
155
158
|
# TODO: Naming policy needs to be apply to changelog too.
|
156
159
|
|
157
160
|
def apply_naming_policy(name, ext)
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
161
|
+
naming_policy.each do |policy|
|
162
|
+
case policy
|
163
|
+
when /^low/, /^down/
|
164
|
+
name = name.downcase
|
165
|
+
when /^up/
|
166
|
+
name = name.upcase
|
167
|
+
when /^cap/
|
168
|
+
name = name.capitalize
|
169
|
+
when /^ext/
|
170
|
+
name = name + ".#{ext}"
|
171
|
+
end
|
172
|
+
end
|
163
173
|
name
|
164
174
|
end
|
165
175
|
|
@@ -1,51 +1,44 @@
|
|
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.
|
1
|
+
#require 'reap/project/compile'
|
7
2
|
|
8
3
|
module Reap
|
9
4
|
|
10
|
-
class
|
5
|
+
class Project
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
# The Make tool routes to extension Makefile(s).
|
8
|
+
# Presently, it is designed to support only extconf.rb design.
|
9
|
+
#
|
10
|
+
# TODO: win32 cross-compile ?
|
15
11
|
|
16
|
-
|
12
|
+
MAKE_COMMAND = ENV['make'] || (RUBY_PLATFORM =~ /(win|w)32$/ ? 'nmake' : 'make')
|
17
13
|
|
18
|
-
def extension_scripts
|
19
|
-
[extensions].flatten.collect do |ext|
|
20
|
-
Dir.glob(ext)
|
21
|
-
end.flatten
|
22
|
-
end
|
23
14
|
|
24
|
-
#
|
15
|
+
# Check to see if this project has extensions that need to be compiled.
|
25
16
|
|
26
|
-
def
|
27
|
-
|
28
|
-
File.dirname(ext)
|
29
|
-
end
|
17
|
+
def compiles?
|
18
|
+
!extensions.empty?
|
30
19
|
end
|
31
20
|
|
32
|
-
#
|
21
|
+
# Extension directories. Often this will simply be 'ext'.
|
22
|
+
# but sometimes more then one extension is needed and are kept
|
23
|
+
# in separate directories. This works by looking for ext/**/*.c
|
24
|
+
# files, where ever they are is considered an extension directory.
|
33
25
|
|
34
|
-
def
|
35
|
-
|
26
|
+
def extensions
|
27
|
+
@extensions ||= Dir['ext/**/*.c'].collect{ |file| File.dirname(file) }.uniq
|
36
28
|
end
|
37
29
|
|
30
|
+
|
38
31
|
# Compile extensions.
|
39
32
|
|
40
33
|
def make
|
41
|
-
|
34
|
+
make_config
|
42
35
|
make_target
|
43
36
|
end
|
44
37
|
|
45
38
|
# Compile static.
|
46
39
|
|
47
40
|
def make_static
|
48
|
-
|
41
|
+
make_config
|
49
42
|
make_target 'static'
|
50
43
|
end
|
51
44
|
|
@@ -59,20 +52,21 @@ module Reap
|
|
59
52
|
|
60
53
|
def make_distclean
|
61
54
|
make_target 'distclean'
|
55
|
+
extensions.each do |directory|
|
56
|
+
makefile = File.join(directory, 'Makefile')
|
57
|
+
rm(makefile) if File.exist?(makefile)
|
58
|
+
end
|
62
59
|
end
|
63
60
|
|
64
|
-
|
65
|
-
|
66
|
-
#alias_method :clobber_make, :make_distclean
|
61
|
+
alias_method :clobber_make, :make_distclean
|
67
62
|
|
68
63
|
# Create Makefile(s).
|
69
64
|
|
70
|
-
def
|
71
|
-
extensions.each do |
|
72
|
-
directory = File.dirname(file)
|
65
|
+
def make_config
|
66
|
+
extensions.each do |directory|
|
73
67
|
next if File.exist?(File.join(directory, 'Makefile'))
|
74
68
|
cd(directory) do
|
75
|
-
sh "ruby
|
69
|
+
sh "ruby extconf.rb"
|
76
70
|
end
|
77
71
|
end
|
78
72
|
end
|
@@ -80,14 +74,13 @@ module Reap
|
|
80
74
|
private
|
81
75
|
|
82
76
|
def make_target(target='')
|
83
|
-
|
77
|
+
extensions.each do |directory|
|
84
78
|
cd(directory) do
|
85
|
-
sh "
|
79
|
+
sh "#{MAKE_COMMAND} #{target}"
|
86
80
|
end
|
87
81
|
end
|
88
82
|
end
|
89
83
|
|
90
|
-
|
91
84
|
# Eric Hodel said NOT to copy the compiled libs.
|
92
85
|
#
|
93
86
|
#task :copy_files do
|