pluginfactory 1.0.5 → 1.0.6
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/ChangeLog +286 -70
- data/Rakefile +35 -20
- data/lib/pluginfactory.rb +2 -1
- data/rake/documentation.rb +71 -0
- data/rake/helpers.rb +318 -311
- data/rake/hg.rb +15 -1
- data/rake/manual.rb +5 -5
- data/rake/packaging.rb +14 -35
- data/rake/publishing.rb +18 -62
- metadata +14 -8
- data/rake/rdoc.rb +0 -30
- data/rake/win32.rb +0 -190
data/rake/hg.rb
CHANGED
@@ -22,6 +22,8 @@ unless defined?( HG_DOTDIR )
|
|
22
22
|
###
|
23
23
|
|
24
24
|
module MercurialHelpers
|
25
|
+
require './helpers.rb' unless defined?( RakefileHelpers )
|
26
|
+
include RakefileHelpers
|
25
27
|
|
26
28
|
###############
|
27
29
|
module_function
|
@@ -208,8 +210,20 @@ unless defined?( HG_DOTDIR )
|
|
208
210
|
task :add => :newfiles
|
209
211
|
|
210
212
|
|
213
|
+
desc "Pull and update from the default repo"
|
214
|
+
task :pull do
|
215
|
+
paths = get_repo_paths()
|
216
|
+
if origin_url = paths['default']
|
217
|
+
ask_for_confirmation( "Pull and update from '#{origin_url}'?", false ) do
|
218
|
+
run 'hg', 'pull', '-u'
|
219
|
+
end
|
220
|
+
else
|
221
|
+
trace "Skipping pull: No 'default' path."
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
211
225
|
desc "Check the current code in if tests pass"
|
212
|
-
task :checkin => ['hg:newfiles', 'test', COMMIT_MSG_FILE] do
|
226
|
+
task :checkin => ['hg:pull', 'hg:newfiles', 'test', COMMIT_MSG_FILE] do
|
213
227
|
targets = get_target_args()
|
214
228
|
$stderr.puts '---', File.read( COMMIT_MSG_FILE ), '---'
|
215
229
|
ask_for_confirmation( "Continue with checkin?" ) do
|
data/rake/manual.rb
CHANGED
@@ -147,7 +147,7 @@ module Manual
|
|
147
147
|
|
148
148
|
layout = self.config['layout'].sub( /\.page$/, '' )
|
149
149
|
templatepath = @layouts_dir + "#{layout}.page"
|
150
|
-
template = ERB.new( templatepath.read )
|
150
|
+
template = ERB.new( templatepath.read(:encoding => 'UTF-8') )
|
151
151
|
page = self
|
152
152
|
|
153
153
|
html = template.result( binding() )
|
@@ -565,7 +565,7 @@ module Manual
|
|
565
565
|
manual_pages = setup_page_conversion_tasks( sourcedir, outputdir, catalog )
|
566
566
|
|
567
567
|
desc "Build the manual"
|
568
|
-
task :build => [ :
|
568
|
+
task :build => [ :apidocs, :copy_resources, :copy_apidocs, :generate_pages ]
|
569
569
|
|
570
570
|
task :clobber do
|
571
571
|
RakeFileUtils.verbose( $verbose ) do
|
@@ -686,8 +686,8 @@ module Manual
|
|
686
686
|
end
|
687
687
|
|
688
688
|
desc "Copy API documentation to the manual output directory"
|
689
|
-
task :copy_apidocs => :
|
690
|
-
cp_r(
|
689
|
+
task :copy_apidocs => :apidocs do
|
690
|
+
cp_r( API_DOCSDIR, outputdir )
|
691
691
|
end
|
692
692
|
|
693
693
|
# Now group all the resource file tasks into a containing task
|
@@ -713,7 +713,7 @@ if MANUALDIR.exist?
|
|
713
713
|
|
714
714
|
Manual::GenTask.new do |manual|
|
715
715
|
manual.metadata.version = PKG_VERSION
|
716
|
-
manual.metadata.api_dir =
|
716
|
+
manual.metadata.api_dir = API_DOCSDIR
|
717
717
|
manual.output_dir = MANUALOUTPUTDIR
|
718
718
|
manual.base_dir = MANUALDIR
|
719
719
|
manual.source_dir = 'src'
|
data/rake/packaging.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
#
|
1
|
+
#####################################################################
|
2
|
+
### P A C K A G I N G T A S K S
|
3
|
+
#####################################################################
|
5
4
|
|
6
5
|
require 'rbconfig'
|
7
6
|
require 'pathname'
|
8
|
-
require '
|
9
|
-
require 'rake/gempackagetask'
|
7
|
+
require 'rubygems/package_task'
|
10
8
|
|
11
|
-
require Pathname( __FILE__ ).dirname.expand_path + 'hg.rb'
|
12
9
|
|
13
10
|
include Config
|
14
11
|
|
12
|
+
### Task: prerelease
|
13
|
+
desc "Append the package build number to package versions"
|
14
|
+
task :prerelease do
|
15
|
+
GEMSPEC.version.version += ".#{PKG_BUILD}"
|
16
|
+
end
|
17
|
+
|
18
|
+
|
15
19
|
### Task: gem
|
16
20
|
### Task: package
|
17
21
|
Rake::PackageTask.new( PKG_NAME, PKG_VERSION ) do |task|
|
@@ -24,34 +28,9 @@ end
|
|
24
28
|
task :package => [:gem]
|
25
29
|
|
26
30
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
desc "Build a RubyGem package (#{GEM_FILE_NAME})"
|
31
|
-
task :gem => gempath.to_s
|
32
|
-
file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
|
33
|
-
when_writing( "Creating GEM" ) do
|
34
|
-
Gem::Builder.new( GEMSPEC ).build
|
35
|
-
verbose( true ) do
|
36
|
-
mv GEM_FILE_NAME, gempath
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
prerelease_gempath = PKGDIR + SNAPSHOT_GEM_NAME
|
43
|
-
|
44
|
-
desc "Build a pre-release RubyGem package"
|
45
|
-
task :prerelease_gem => prerelease_gempath.to_s
|
46
|
-
file prerelease_gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
|
47
|
-
when_writing( "Creating prerelease GEM" ) do
|
48
|
-
gemspec = GEMSPEC.clone
|
49
|
-
gemspec.version = Gem::Version.create( "%s.%s" % [GEMSPEC.version, PKG_BUILD] )
|
50
|
-
Gem::Builder.new( gemspec ).build
|
51
|
-
verbose( true ) do
|
52
|
-
mv SNAPSHOT_GEM_NAME, prerelease_gempath
|
53
|
-
end
|
54
|
-
end
|
31
|
+
Gem::PackageTask.new( GEMSPEC ) do |pkg|
|
32
|
+
pkg.need_zip = true
|
33
|
+
pkg.need_tar = true
|
55
34
|
end
|
56
35
|
|
57
36
|
|
data/rake/publishing.rb
CHANGED
@@ -34,7 +34,13 @@ class Net::SMTP
|
|
34
34
|
|
35
35
|
def do_ssl_start( helodomain, user, secret, authtype )
|
36
36
|
raise IOError, 'SMTP session already started' if @started
|
37
|
-
|
37
|
+
if user or secret
|
38
|
+
if self.method( :check_auth_args ).arity == 3
|
39
|
+
check_auth_args( user, secret, authtype )
|
40
|
+
else
|
41
|
+
check_auth_args( user, secret )
|
42
|
+
end
|
43
|
+
end
|
38
44
|
|
39
45
|
# Open the connection
|
40
46
|
@debug_output << "opening connection to #{@address}...\n" if @debug_output
|
@@ -85,7 +91,6 @@ begin
|
|
85
91
|
require 'tmail'
|
86
92
|
require 'net/smtp'
|
87
93
|
require 'etc'
|
88
|
-
require 'rubyforge'
|
89
94
|
require 'socket'
|
90
95
|
require 'text/format'
|
91
96
|
|
@@ -134,11 +139,11 @@ begin
|
|
134
139
|
task :project => :upload # the old name
|
135
140
|
|
136
141
|
desc "Publish the project docs to #{PROJECT_HOST}"
|
137
|
-
task :upload_docs => [ :
|
142
|
+
task :upload_docs => [ :apidocs ] do
|
138
143
|
when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
|
139
144
|
log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
|
140
145
|
run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
|
141
|
-
run 'scp', '-qCr',
|
146
|
+
run 'scp', '-qCr', API_DOCSDIR, PROJECT_SCPDOCURL
|
142
147
|
end
|
143
148
|
end
|
144
149
|
|
@@ -195,15 +200,16 @@ begin
|
|
195
200
|
desc 'Send out a release announcement'
|
196
201
|
task :announce => [RELEASE_ANNOUNCE_FILE] do
|
197
202
|
email = TMail::Mail.new
|
198
|
-
|
203
|
+
|
204
|
+
if $publish_privately || RELEASE_ANNOUNCE_ADDRESSES.empty?
|
199
205
|
trace "Sending private announce mail"
|
200
206
|
email.to = 'rubymage@gmail.com'
|
201
207
|
else
|
202
208
|
trace "Sending public announce mail"
|
203
|
-
email.to =
|
209
|
+
email.to = RELEASE_ANNOUNCE_ADDRESSES
|
204
210
|
email.bcc = 'rubymage@gmail.com'
|
205
211
|
end
|
206
|
-
email.from =
|
212
|
+
email.from = 'Michael Granger <mgranger@laika.com>'
|
207
213
|
email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
|
208
214
|
email.body = File.read( RELEASE_ANNOUNCE_FILE )
|
209
215
|
email.date = Time.new
|
@@ -236,61 +242,11 @@ begin
|
|
236
242
|
end
|
237
243
|
|
238
244
|
|
239
|
-
desc 'Publish the new release to
|
240
|
-
task :publish => [:clean, :
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
log "Skipping push of release files to RubyForge"
|
245
|
-
else
|
246
|
-
rf = RubyForge.new
|
247
|
-
log "Loading RubyForge config"
|
248
|
-
rf.configure
|
249
|
-
|
250
|
-
group_id = rf.autoconfig['group_ids'][RUBYFORGE_GROUP] or
|
251
|
-
fail "Your configuration doesn't have a group id for '#{RUBYFORGE_GROUP}'"
|
252
|
-
|
253
|
-
# If this project doesn't yet exist, create it
|
254
|
-
unless rf.autoconfig['package_ids'].key?( project )
|
255
|
-
ask_for_confirmation( "Package '#{project}' doesn't exist on RubyForge. Create it?" ) do
|
256
|
-
log "Creating new package '#{project}'"
|
257
|
-
rf.create_package( group_id, project )
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
package_id = rf.autoconfig['package_ids'][ project ]
|
262
|
-
|
263
|
-
# Make sure this release doesn't already exist
|
264
|
-
releases = rf.autoconfig['release_ids']
|
265
|
-
if releases.key?( GEMSPEC.name ) && releases[ GEMSPEC.name ].key?( PKG_VERSION )
|
266
|
-
log "Rubyforge seems to already have #{ PKG_FILE_NAME }"
|
267
|
-
else
|
268
|
-
config = rf.userconfig or
|
269
|
-
fail "You apparently haven't set up your RubyForge credentials on this machine."
|
270
|
-
config['release_notes'] = GEMSPEC.description
|
271
|
-
config['release_changes'] = File.read( RELEASE_NOTES_FILE )
|
272
|
-
|
273
|
-
files = FileList[ PKGDIR + GEM_FILE_NAME ]
|
274
|
-
files.include PKGDIR + "#{PKG_FILE_NAME}.tar.gz"
|
275
|
-
files.include PKGDIR + "#{PKG_FILE_NAME}.tar.bz2"
|
276
|
-
files.include PKGDIR + "#{PKG_FILE_NAME}.zip"
|
277
|
-
|
278
|
-
log "Releasing #{PKG_FILE_NAME}"
|
279
|
-
when_writing do
|
280
|
-
log "Publishing to RubyForge: \n",
|
281
|
-
"\tproject: #{RUBYFORGE_GROUP}\n",
|
282
|
-
"\tpackage: #{PKG_NAME.downcase}\n",
|
283
|
-
"\tpackage version: #{PKG_VERSION}\n",
|
284
|
-
"\tfiles: " + files.collect {|f| f.to_s }.join(', ') + "\n"
|
285
|
-
|
286
|
-
ask_for_confirmation( "Publish to RubyForge?" ) do
|
287
|
-
log 'Logging in...'
|
288
|
-
rf.login
|
289
|
-
log "Adding the new release to the '#{project}' project"
|
290
|
-
rf.add_release( group_id, package_id, PKG_VERSION, *files )
|
291
|
-
end
|
292
|
-
end
|
293
|
-
end
|
245
|
+
desc 'Publish the new release to Gemcutter'
|
246
|
+
task :publish => [:clean, :gem, :notes] do |task|
|
247
|
+
ask_for_confirmation( "Publish #{GEM_FILE_NAME} to Gemcutter?", false ) do
|
248
|
+
gempath = PKGDIR + GEM_FILE_NAME
|
249
|
+
sh 'gem', 'push', gempath
|
294
250
|
end
|
295
251
|
end
|
296
252
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluginfactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
version: 1.0.6
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Martin Chase, Michael Granger
|
@@ -9,7 +14,7 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-03-23 00:00:00 -07:00
|
13
18
|
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
@@ -40,17 +45,16 @@ files:
|
|
40
45
|
- lib/pluginfactory.rb
|
41
46
|
- rake/191_compat.rb
|
42
47
|
- rake/dependencies.rb
|
48
|
+
- rake/documentation.rb
|
43
49
|
- rake/helpers.rb
|
44
50
|
- rake/hg.rb
|
45
51
|
- rake/manual.rb
|
46
52
|
- rake/packaging.rb
|
47
53
|
- rake/publishing.rb
|
48
|
-
- rake/rdoc.rb
|
49
54
|
- rake/style.rb
|
50
55
|
- rake/svn.rb
|
51
56
|
- rake/testing.rb
|
52
57
|
- rake/verifytask.rb
|
53
|
-
- rake/win32.rb
|
54
58
|
has_rdoc: true
|
55
59
|
homepage: http://deveiate.org/projects/PluginFactory/
|
56
60
|
licenses: []
|
@@ -74,18 +78,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
78
|
requirements:
|
75
79
|
- - ">="
|
76
80
|
- !ruby/object:Gem::Version
|
81
|
+
segments:
|
82
|
+
- 0
|
77
83
|
version: "0"
|
78
|
-
version:
|
79
84
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
85
|
requirements:
|
81
86
|
- - ">="
|
82
87
|
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 0
|
83
90
|
version: "0"
|
84
|
-
version:
|
85
91
|
requirements: []
|
86
92
|
|
87
|
-
rubyforge_project:
|
88
|
-
rubygems_version: 1.3.
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 1.3.6
|
89
95
|
signing_key:
|
90
96
|
specification_version: 3
|
91
97
|
summary: A mixin for making plugin classes
|
data/rake/rdoc.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# RDoc Rake tasks
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
gem 'rdoc', '>= 2.4.3'
|
7
|
-
|
8
|
-
require 'rubygems'
|
9
|
-
require 'rdoc/rdoc'
|
10
|
-
require 'rake/clean'
|
11
|
-
require 'rdoc/task'
|
12
|
-
|
13
|
-
# Append docs/lib to the load path if it exists for a locally-installed Darkfish
|
14
|
-
DOCSLIB = DOCSDIR + 'lib'
|
15
|
-
$LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
|
16
|
-
|
17
|
-
# Make relative string paths of all the stuff we need to generate docs for
|
18
|
-
DOCFILES = Rake::FileList[ LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files ]
|
19
|
-
|
20
|
-
|
21
|
-
directory RDOCDIR.to_s
|
22
|
-
CLOBBER.include( RDOCDIR )
|
23
|
-
|
24
|
-
desc "Build API documentation in #{RDOCDIR}"
|
25
|
-
RDoc::Task.new do |task|
|
26
|
-
task.main = "README"
|
27
|
-
task.rdoc_files.include( DOCFILES )
|
28
|
-
task.rdoc_dir = RDOCDIR.to_s
|
29
|
-
task.options = RDOC_OPTIONS
|
30
|
-
end
|
data/rake/win32.rb
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Win32-specific tasks (cross-compiling, etc.)
|
3
|
-
#
|
4
|
-
# Thanks to some people that understand this stuff better than me for
|
5
|
-
# posting helpful blog posts. This stuff is an amalgam of stuff they did:
|
6
|
-
#
|
7
|
-
# * Mauricio Fernandez
|
8
|
-
# http://eigenclass.org/hiki/cross+compiling+rcovrt
|
9
|
-
#
|
10
|
-
# * Jeremy Hinegardner
|
11
|
-
# http://www.copiousfreetime.org/articles/2008/10/12/building-gems-for-windows.html
|
12
|
-
#
|
13
|
-
# * Aaron Patterson
|
14
|
-
# http://tenderlovemaking.com/2008/11/21/cross-compiling-ruby-gems-for-win32/
|
15
|
-
|
16
|
-
require 'rubygems'
|
17
|
-
require 'rake'
|
18
|
-
require 'pathname'
|
19
|
-
require 'rubygems/platform'
|
20
|
-
require 'rbconfig'
|
21
|
-
require 'uri'
|
22
|
-
require 'net/ftp'
|
23
|
-
|
24
|
-
HOMEDIR = Pathname( '~' ).expand_path
|
25
|
-
RUBYVERSION = '1.8.6-p287'
|
26
|
-
RUBYVERSION_MAJORMINOR = RUBYVERSION[/^\d+\.\d+/]
|
27
|
-
|
28
|
-
RUBY_DL_BASE = "ftp://ftp.ruby-lang.org/pub/ruby/#{RUBYVERSION_MAJORMINOR}/"
|
29
|
-
RUBY_DL_URI = URI( RUBY_DL_BASE + "ruby-#{RUBYVERSION}.tar.gz" )
|
30
|
-
|
31
|
-
XCOMPILER_DIR = HOMEDIR + '.ruby_mingw32'
|
32
|
-
|
33
|
-
XCOMPILER_DL = XCOMPILER_DIR + "ruby-#{RUBYVERSION}.tar.gz"
|
34
|
-
XCOMPILER_SRC = XCOMPILER_DIR + "ruby-#{RUBYVERSION}"
|
35
|
-
|
36
|
-
XCOMPILER_BIN = XCOMPILER_DIR + 'bin'
|
37
|
-
XCOMPILER_LIB = XCOMPILER_DIR + 'lib'
|
38
|
-
XCOMPILER_RUBY = XCOMPILER_BIN + 'ruby.exe'
|
39
|
-
|
40
|
-
XCOMPILER_LOAD_PATH = XCOMPILER_LIB + "ruby/#{RUBYVERSION_MAJORMINOR}/i386-mingw32"
|
41
|
-
|
42
|
-
TAR_OPTS = { :compression => :gzip }
|
43
|
-
|
44
|
-
WIN32_GEMSPEC = GEMSPEC.dup
|
45
|
-
WIN32_GEMSPEC.files += FileList[ EXTDIR + '**.{dll,so}' ]
|
46
|
-
WIN32_GEMSPEC.platform = Gem::Platform.new( 'i386-mingw32' )
|
47
|
-
WIN32_GEMSPEC.extensions = []
|
48
|
-
|
49
|
-
|
50
|
-
CONFIGURE_CMD = %W[
|
51
|
-
env
|
52
|
-
ac_cv_func_getpgrp_void=no
|
53
|
-
ac_cv_func_setpgrp_void=yes
|
54
|
-
rb_cv_negative_time_t=no
|
55
|
-
ac_cv_func_memcmp_working=yes
|
56
|
-
rb_cv_binary_elf=no
|
57
|
-
./configure
|
58
|
-
--host=i386-mingw32
|
59
|
-
--target=i386-mingw32
|
60
|
-
--build=#{Config::CONFIG['build']}
|
61
|
-
--prefix=#{XCOMPILER_DIR}
|
62
|
-
]
|
63
|
-
|
64
|
-
### Archive::Tar::Reader#extract (as of 0.9.0) is broken w.r.t.
|
65
|
-
### permissions, so we have to do this ourselves.
|
66
|
-
def untar( tarfile, targetdir )
|
67
|
-
targetdir = Pathname( targetdir )
|
68
|
-
raise "No such directory: #{targetdir}" unless targetdir.directory?
|
69
|
-
|
70
|
-
reader = Archive::Tar::Reader.new( tarfile.to_s, TAR_OPTS )
|
71
|
-
|
72
|
-
mkdir_p( targetdir )
|
73
|
-
reader.each( true ) do |header, body|
|
74
|
-
path = targetdir + header[:path]
|
75
|
-
# trace "Header is: %p" % [ header ]
|
76
|
-
|
77
|
-
case header[:type]
|
78
|
-
when :file
|
79
|
-
trace " #{path}"
|
80
|
-
path.open( File::WRONLY|File::EXCL|File::CREAT|File::TRUNC, header[:mode] ) do |fio|
|
81
|
-
bytesize = header[:size]
|
82
|
-
fio.write( body[0,bytesize] )
|
83
|
-
end
|
84
|
-
|
85
|
-
when :directory
|
86
|
-
trace " #{path}"
|
87
|
-
path.mkpath
|
88
|
-
|
89
|
-
when :link
|
90
|
-
linktarget = targetdir + header[:dest]
|
91
|
-
trace " #{path} => #{linktarget}"
|
92
|
-
path.make_link( linktarget.to_s )
|
93
|
-
|
94
|
-
when :symlink
|
95
|
-
linktarget = targetdir + header[:dest]
|
96
|
-
trace " #{path} -> #{linktarget}"
|
97
|
-
path.make_symlink( linktarget )
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
102
|
-
|
103
|
-
|
104
|
-
begin
|
105
|
-
require 'archive/tar'
|
106
|
-
|
107
|
-
namespace :win32 do
|
108
|
-
directory XCOMPILER_DIR.to_s
|
109
|
-
|
110
|
-
file XCOMPILER_DL => XCOMPILER_DIR do
|
111
|
-
# openuri can't handle this -- passive ftp required?
|
112
|
-
# run 'wget', '-O', XCOMPILER_DL, RUBY_DL_URI
|
113
|
-
log "Downloading ruby distro from %s" % [ RUBY_DL_URI ]
|
114
|
-
ftp = Net::FTP.new( RUBY_DL_URI.host )
|
115
|
-
ftp.login
|
116
|
-
ftp.getbinaryfile( RUBY_DL_URI.path, XCOMPILER_DL, 4096 )
|
117
|
-
ftp.close
|
118
|
-
end
|
119
|
-
|
120
|
-
directory XCOMPILER_SRC.to_s
|
121
|
-
task XCOMPILER_SRC => [ XCOMPILER_DIR, XCOMPILER_DL ] do
|
122
|
-
if XCOMPILER_SRC.exist?
|
123
|
-
trace "Rake fails. #{XCOMPILER_SRC} already exists."
|
124
|
-
else
|
125
|
-
untar( XCOMPILER_DL, XCOMPILER_DIR )
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
file XCOMPILER_RUBY => XCOMPILER_SRC do
|
130
|
-
Dir.chdir( XCOMPILER_SRC ) do
|
131
|
-
unless File.exist?( 'Makefile.in.orig' )
|
132
|
-
File.open( 'Makefile.in.new', IO::CREAT|IO::WRONLY|IO::EXCL ) do |ofh|
|
133
|
-
IO.readlines( 'Makefile.in' ).each do |line|
|
134
|
-
next if line.include?( 0.chr )
|
135
|
-
trace " copying line: %p" % [ line ]
|
136
|
-
line.sub!( /ALT_SEPARATOR = ".*?"/, "ALT_SEPARATOR = 92.chr" )
|
137
|
-
ofh.write( line )
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
mv 'Makefile.in', 'Makefile.in.orig'
|
142
|
-
mv 'Makefile.in.new', 'Makefile.in'
|
143
|
-
end
|
144
|
-
|
145
|
-
run *CONFIGURE_CMD
|
146
|
-
run 'make', 'ruby'
|
147
|
-
run 'make', 'rubyw.exe'
|
148
|
-
run 'make', 'install'
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
file XCOMPILER_LOAD_PATH => XCOMPILER_RUBY
|
153
|
-
|
154
|
-
desc "Cross-compile the library for Win32 systems, installing a cross-" +
|
155
|
-
"compiled Ruby if necessary"
|
156
|
-
task :build => [ EXTDIR, XCOMPILER_LOAD_PATH.to_s ] do
|
157
|
-
in_subdirectory( EXTDIR ) do
|
158
|
-
ruby "-I#{XCOMPILER_LOAD_PATH}", 'extconf.rb'
|
159
|
-
sh 'make'
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
desc "Build a binary gem for win32 systems"
|
164
|
-
task :gem => ['win32:build', PKGDIR.to_s] + WIN32_GEMSPEC.files do
|
165
|
-
when_writing( "Creating win32 GEM" ) do
|
166
|
-
pkgname = WIN32_GEMSPEC.file_name
|
167
|
-
builder = Gem::Builder.new( WIN32_GEMSPEC )
|
168
|
-
builder.build
|
169
|
-
mv pkgname, PKGDIR + pkgname, :verbose => $trace
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
rescue LoadError => err
|
175
|
-
trace "Couldn't load the win32 tasks: %s: %s" % [ err.class.name, err.message ]
|
176
|
-
|
177
|
-
task :no_win32_build do
|
178
|
-
abort "No win32 build: %s: %s" % [ err.class.name, err.message ]
|
179
|
-
end
|
180
|
-
|
181
|
-
namespace :win32 do
|
182
|
-
desc "Build a binary Gem for Win32 systems, installing a cross " +
|
183
|
-
"compiled Ruby if necessary"
|
184
|
-
task :gem => :no_win32_build
|
185
|
-
task :build => :no_win32_build
|
186
|
-
end
|
187
|
-
|
188
|
-
end
|
189
|
-
|
190
|
-
|