Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 213 lines (171 sloc) 5.676 kB
3f232bc Minor updates to website and benchmark script.
transami authored
1 #!/usr/bin/env ruby
2
3 # Be sure to set ENV['RUBYFORGE_USERNAME'] to use publish.
4
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
5 require 'rubygems'
6 require 'date'
7 require 'rake/gempackagetask'
4443c99 Update rake files to include rdoc.
cfis authored
8 require 'rake/rdoctask'
abb5992 Add rake test patch from Aaron Patterson.
seanc authored
9 require 'rake/testtask'
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
10 require 'date'
11
12
13 # ------- Default Package ----------
14 FILES = FileList[
00266e6 Add top level rakefile to distribution.
cfis authored
15 'RAKEFILE',
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
16 'README',
17 'LICENSE',
18 'CHANGES',
d836a77 Added setup.rb to gem and tgz archives.
cfis authored
19 'setup.rb',
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
20 'doc/**/*',
0c4baad Messed up .inc for c files. Add back in and a fix to the readme file.
cfis authored
21 'ext/libxml/*',
00d1ebd Update builds scripts after moving files around.
cfis authored
22 'ext/mingw/Rakefile',
23 'vc/*.sln',
24 'vc/*.vcproj',
a6078b9 Fix up gem build script.
cfis authored
25 'lib/**/*',
1389db2 Fix benchmark include.
cfis authored
26 'benchmark/**/*',
00d1ebd Update builds scripts after moving files around.
cfis authored
27 'test/**/*'
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
28 ]
29
30 # Default GEM Specification
31 default_spec = Gem::Specification.new do |spec|
32 spec.name = "libxml-ruby"
33
34 spec.homepage = "http://libxml.rubyforge.org/"
35 spec.summary = "Ruby libxml bindings"
36 spec.description = <<-EOF
37 The Libxml-Ruby project provides Ruby language bindings for the GNOME
38 Libxml2 XML toolkit. It is free software, released under the MIT License.
39 Libxml-ruby's primary advantage over REXML is performance - if speed
40 is your need, these are good libraries to consider, as demonstrated
41 by the informal benchmark below.
42 EOF
43
44 # Determine the current version of the software
45 spec.version =
606f47d Add vc project to built gem.
cfis authored
46 if File.read('ext/libxml/version.h') =~ /\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
47 CURRENT_VERSION = $1
48 else
49 CURRENT_VERSION = "0.0.0"
50 end
51
52 spec.author = "Charlie Savage"
0f6aa2e Minor cleanup of tests and readme files.
cfis authored
53 spec.email = "libxml-devel@rubyforge.org"
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
54 spec.platform = Gem::Platform::RUBY
9e4551c Fix broken gem spec requires.
cfis authored
55 spec.require_paths = ["lib", "ext/libxml"]
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
56 spec.bindir = "bin"
57 spec.extensions = ["ext/libxml/extconf.rb"]
58 spec.files = FILES.to_a
59 spec.test_files = Dir.glob("test/tc_*.rb")
60
61 spec.required_ruby_version = '>= 1.8.4'
62 spec.date = DateTime.now
30ab65e Updated Rakefile.
transami authored
63 spec.rubyforge_project = 'libxml'
c4ff578 Added rdoc support to package Rakefile.
cfis authored
64
65 spec.has_rdoc = true
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
66 end
67
68 # Rake task to build the default package
69 Rake::GemPackageTask.new(default_spec) do |pkg|
30ab65e Updated Rakefile.
transami authored
70 pkg.package_dir = 'admin/pkg'
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
71 pkg.need_tar = true
72 pkg.need_zip = true
73 end
74
75
76 # ------- Windows Package ----------
a6078b9 Fix up gem build script.
cfis authored
77
ef24025 Update Rakefile so:
cfis authored
78 # Use *.dll* to get import libraries
00d1ebd Update builds scripts after moving files around.
cfis authored
79 binaries = (FileList['ext/mingw/*.so',
80 'ext/mingw/*.dll*'])
a6078b9 Fix up gem build script.
cfis authored
81
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
82 # Windows specification
83 win_spec = default_spec.clone
84 win_spec.extensions = []
85 win_spec.platform = Gem::Platform::CURRENT
00d1ebd Update builds scripts after moving files around.
cfis authored
86 win_spec.files += binaries.map {|binaryname| "lib/#{File.basename(binaryname)}"}
ef24025 Update Rakefile so:
cfis authored
87
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
88
89 desc "Create Windows Gem"
90 task :create_win32_gem do
91 # Copy the win32 extension built by MingW - easier to install
92 # since there are no dependencies of msvcr80.dll
93 current_dir = File.expand_path(File.dirname(__FILE__))
94
00d1ebd Update builds scripts after moving files around.
cfis authored
95 binaries.each do |binaryname|
96 target = File.join(current_dir, 'lib', File.basename(binaryname))
97 cp(binaryname, target)
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
98 end
99
30ab65e Updated Rakefile.
transami authored
100 # Create the gem, then move it to admin/pkg
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
101 Gem::Builder.new(win_spec).build
102 gem_file = "#{win_spec.name}-#{win_spec.version}-#{win_spec.platform}.gem"
30ab65e Updated Rakefile.
transami authored
103 mv(gem_file, "admin/pkg/#{gem_file}")
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
104
105 # Remove win extension from top level directory
00d1ebd Update builds scripts after moving files around.
cfis authored
106 binaries.each do |binaryname|
ce22281 Fix rakefile to not delete checed-in binaries.
cfis authored
107 target = File.join(current_dir, 'lib', File.basename(binaryname))
108 rm(target)
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
109 end
110 end
111
a8b897d Update to gem file.
cfis authored
112
3f232bc Minor updates to website and benchmark script.
transami authored
113 # --------- RDoc Documentation ---------
a8b897d Update to gem file.
cfis authored
114 desc "Generate rdoc documentation"
115 Rake::RDocTask.new("rdoc") do |rdoc|
3f232bc Minor updates to website and benchmark script.
transami authored
116 rdoc.rdoc_dir = 'doc/rdoc'
117 rdoc.title = "LibXML"
a8b897d Update to gem file.
cfis authored
118 # Show source inline with line numbers
119 rdoc.options << "--inline-source" << "--line-numbers"
4443c99 Update rake files to include rdoc.
cfis authored
120 # Make the readme file the start page for the generated html
121 rdoc.options << '--main' << 'README'
122 rdoc.rdoc_files.include('doc/*.rdoc',
123 'ext/**/*.c',
124 'lib/**/*.rb',
125 'CHANGES',
126 'README',
127 'LICENSE',
128 'VERSION')
a8b897d Update to gem file.
cfis authored
129 end
130
24c0213 Update for building gems, precompiles binaries for Windows.
cfis authored
131 task :default => :package
e8f3887 Removed rdoc dependency for package task since it didn't actually see…
cfis authored
132 task :package => :create_win32_gem
abb5992 Add rake test patch from Aaron Patterson.
seanc authored
133
134 Rake::TestTask.new do |t|
135 t.libs << "test"
8c0ae89 Fixe Rakefile's test task.
transami authored
136 t.libs << "lib"
137 t.libs << "ext/libxml"
abb5992 Add rake test patch from Aaron Patterson.
seanc authored
138 end
139
0ba6cd8 Apply patch http://rubyforge.org/tracker/index.php?func=detail&aid=21…
cfis authored
140 if not RUBY_PLATFORM.match(/mswin32/i)
141 Rake::Task[:test].prerequisites << :extensions
142 end
143
abb5992 Add rake test patch from Aaron Patterson.
seanc authored
144 task :build => :extensions
145 task :extension => :build
146
ef24025 Update Rakefile so:
cfis authored
147 ext = Config::CONFIG["DLEXT"]
abb5992 Add rake test patch from Aaron Patterson.
seanc authored
148 task :extensions => ["ext/libxml/libxml_ruby.#{ext}"]
149 file "ext/libxml/libxml_ruby.#{ext}" =>
150 ["ext/libxml/Makefile"] + FileList["ext/libxml/*.{c,h}"].to_a do |t|
151 Dir.chdir("ext/libxml") { sh "make" }
152 end
153
154 namespace :extensions do
155 task :clean do
156 Dir.chdir("ext/libxml") do
157 sh "rm -f Makefile"
158 sh "rm -f *.{o,so,bundle,log}"
159 end
160 end
161 end
162
163 file "ext/libxml/Makefile" => ["ext/libxml/extconf.rb"] do
164
165 command = ["ruby"] + $:.map{|dir| "-I#{File.expand_path dir}"} + ["extconf.rb"]
166 Dir.chdir("ext/libxml") { sh *command }
167 end
3f232bc Minor updates to website and benchmark script.
transami authored
168
169 # --------- Publish Website to Rubyforge ---------
170 desc "publish website (uses rsync)"
171 task :publish => [:publish_website, :publish_rdoc]
172
173 task :publish_website do
174 unixname = 'libxml'
175 username = ENV['RUBYFORGE_USERNAME']
176
177 dir = 'admin/web'
178 url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{unixname}"
179
180 dir = dir.chomp('/') + '/'
181
182 # Using commandline filter options didn't seem to work, so
183 # I opted for creating an .rsync_filter file for all cases.
184
185 protect = %w{usage statcvs statsvn robot.txt wiki}
186 exclude = %w{.svn}
187
188 rsync_file = File.join(dir,'.rsync-filter')
189 unless File.file?(rsync_file)
190 File.open(rsync_file, 'w') do |f|
191 exclude.each{|e| f << "- #{e}\n"}
192 protect.each{|e| f << "P #{e}\n"}
193 end
194 end
195
196 # maybe -p ?
197 cmd = "rsync -rLvz --delete-after --filter='dir-merge #{rsync_file}' #{dir} #{url}"
198 sh cmd
199 end
200
201 task :publish_rdoc do
202 unixname = 'libxml'
203 username = ENV['RUBYFORGE_USERNAME']
204
205 dir = 'doc/rdoc'
206 url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{unixname}/rdoc"
207
208 dir = dir.chomp('/') + '/'
209
210 # maybe -p ?
211 cmd = "rsync -rLvz --delete-after #{dir} #{url}"
212 sh cmd
ef24025 Update Rakefile so:
cfis authored
213 end
Something went wrong with that request. Please try again.