19 |
19 |
20 $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s ) |
20 $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s ) |
21 $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s ) |
21 $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s ) |
22 } |
22 } |
23 |
23 |
|
24 require 'rubygems' |
|
25 gem 'rake', '>= 0.8.3' |
24 |
26 |
25 require 'rbconfig' |
27 require 'rbconfig' |
26 require 'rubygems' |
|
27 require 'rake' |
28 require 'rake' |
28 require 'rake/rdoctask' |
29 require 'rake/rdoctask' |
29 require 'rake/testtask' |
30 require 'rake/testtask' |
30 require 'rake/packagetask' |
31 require 'rake/packagetask' |
31 require 'rake/clean' |
32 require 'rake/clean' |
32 |
33 |
33 $dryrun = false |
34 $dryrun = false |
34 |
35 |
35 ### Config constants |
36 ### Config constants |
36 BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd ) |
37 BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd ) |
|
38 BINDIR = BASEDIR + 'bin' |
37 LIBDIR = BASEDIR + 'lib' |
39 LIBDIR = BASEDIR + 'lib' |
38 EXTDIR = BASEDIR + 'ext' |
40 EXTDIR = BASEDIR + 'ext' |
39 DOCSDIR = BASEDIR + 'docs' |
41 DOCSDIR = BASEDIR + 'docs' |
40 PKGDIR = BASEDIR + 'pkg' |
42 PKGDIR = BASEDIR + 'pkg' |
41 |
43 DATADIR = BASEDIR + 'data' |
42 PKG_NAME = 'jparallel' |
44 |
|
45 PROJECT_NAME = 'jparallel' |
|
46 PKG_NAME = PROJECT_NAME.downcase |
43 PKG_SUMMARY = 'A "parallel jail shell" written in Ruby' |
47 PKG_SUMMARY = 'A "parallel jail shell" written in Ruby' |
44 VERSION_FILE = LIBDIR + 'jparallel.rb' |
48 VERSION_FILE = LIBDIR + 'jparallel.rb' |
45 PKG_VERSION = VERSION_FILE.read[ /VERSION = '(\d+\.\d+\.\d+)'/, 1 ] |
49 PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*'(\d+\.\d+\.\d+)'/, 1 ] |
46 PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}" |
50 PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}" |
47 GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem" |
51 GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem" |
48 |
52 |
49 ARTIFACTS_DIR = Pathname.new( ENV['CC_BUILD_ARTIFACTS'] || 'artifacts' ) |
53 ARTIFACTS_DIR = Pathname.new( ENV['CC_BUILD_ARTIFACTS'] || 'artifacts' ) |
50 |
54 |
51 TEXT_FILES = %w( Rakefile ChangeLog README LICENSE ).collect {|filename| BASEDIR + filename } |
55 TEXT_FILES = %w( Rakefile ChangeLog README LICENSE ).collect {|filename| BASEDIR + filename } |
|
56 BIN_FILES = Pathname.glob( BINDIR + '*' ).delete_if {|item| item =~ /\.svn/ } |
52 LIB_FILES = Pathname.glob( LIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ } |
57 LIB_FILES = Pathname.glob( LIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ } |
53 EXT_FILES = Pathname.glob( EXTDIR + '**/*.{c,h,rb}' ).delete_if {|item| item =~ /\.svn/ } |
58 EXT_FILES = Pathname.glob( EXTDIR + '**/*.{c,h,rb}' ).delete_if {|item| item =~ /\.svn/ } |
|
59 DATA_FILES = Pathname.glob( DATADIR + '**/*' ).delete_if {|item| item =~ /\.svn/ } |
54 |
60 |
55 SPECDIR = BASEDIR + 'spec' |
61 SPECDIR = BASEDIR + 'spec' |
56 SPEC_FILES = Pathname.glob( SPECDIR + '**/*_spec.rb' ).delete_if {|item| item =~ /\.svn/ } |
62 SPECLIBDIR = SPECDIR + 'lib' |
|
63 SPEC_FILES = Pathname.glob( SPECDIR + '**/*_spec.rb' ).delete_if {|item| item =~ /\.svn/ } + |
|
64 Pathname.glob( SPECLIBDIR + '**/*.rb' ).delete_if {|item| item =~ /\.svn/ } |
57 |
65 |
58 TESTDIR = BASEDIR + 'tests' |
66 TESTDIR = BASEDIR + 'tests' |
59 TEST_FILES = Pathname.glob( TESTDIR + '**/*.tests.rb' ).delete_if {|item| item =~ /\.svn/ } |
67 TEST_FILES = Pathname.glob( TESTDIR + '**/*.tests.rb' ).delete_if {|item| item =~ /\.svn/ } |
60 |
68 |
61 RAKE_TASKDIR = BASEDIR + 'rake' |
69 RAKE_TASKDIR = BASEDIR + 'rake' |
62 RAKE_TASKLIBS = Pathname.glob( RAKE_TASKDIR + '*.rb' ) |
70 RAKE_TASKLIBS = Pathname.glob( RAKE_TASKDIR + '*.rb' ) |
63 |
71 |
64 LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local' |
72 LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local' |
65 |
73 |
66 EXTRA_PKGFILES = [] |
74 EXTRA_PKGFILES = [] |
67 EXTRA_PKGFILES += Pathname.glob( BASEDIR + 'examples/*.{c,rb}' ).delete_if {|item| item =~ /\.svn/ } |
75 EXTRA_PKGFILES.concat Pathname.glob( BASEDIR + 'examples/*.{c,rb}' ).delete_if {|item| item =~ /\.svn/ } |
68 |
76 |
69 RELEASE_FILES = TEXT_FILES + |
77 RELEASE_FILES = TEXT_FILES + |
70 SPEC_FILES + |
78 SPEC_FILES + |
71 TEST_FILES + |
79 TEST_FILES + |
|
80 BIN_FILES + |
72 LIB_FILES + |
81 LIB_FILES + |
73 EXT_FILES + |
82 EXT_FILES + |
|
83 DATA_FILES + |
74 RAKE_TASKLIBS + |
84 RAKE_TASKLIBS + |
75 EXTRA_PKGFILES |
85 EXTRA_PKGFILES |
76 |
86 |
77 RELEASE_FILES << LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist? |
87 RELEASE_FILES << LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist? |
78 |
88 |
122 |
133 |
123 # Project constants |
134 # Project constants |
124 PROJECT_HOST = 'deveiate.org' |
135 PROJECT_HOST = 'deveiate.org' |
125 PROJECT_PUBDIR = "/usr/local/www/public/code" |
136 PROJECT_PUBDIR = "/usr/local/www/public/code" |
126 PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}" |
137 PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}" |
127 PROJECT_SCPURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}" |
138 PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}" |
|
139 PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}" |
128 |
140 |
129 # Rubyforge stuff |
141 # Rubyforge stuff |
130 RUBYFORGE_GROUP = 'deveiate' |
142 RUBYFORGE_GROUP = 'deveiate' |
131 RUBYFORGE_PROJECT = 'jparallel' |
143 RUBYFORGE_PROJECT = 'jparallel' |
132 |
144 |
133 # Gem dependencies: gemname => version |
145 # Gem dependencies: gemname => version |
134 DEPENDENCIES = { |
146 DEPENDENCIES = { |
135 } |
147 } |
136 |
148 |
|
149 # Developer Gem dependencies: gemname => version |
|
150 DEVELOPMENT_DEPENDENCIES = { |
|
151 'amatch' => '>= 0.2.3', |
|
152 'rake' => '>= 0.8.1', |
|
153 'rcodetools' => '>= 0.7.0.0', |
|
154 'rcov' => '>= 0', |
|
155 'RedCloth' => '>= 4.0.3', |
|
156 'rspec' => '>= 0', |
|
157 'rubyforge' => '>= 0', |
|
158 'termios' => '>= 0', |
|
159 'text-format' => '>= 1.0.0', |
|
160 'tmail' => '>= 1.2.3.1', |
|
161 'ultraviolet' => '>= 0.10.2', |
|
162 'libxml-ruby' => '>= 0.8.3', |
|
163 } |
|
164 |
137 # Non-gem requirements: packagename => version |
165 # Non-gem requirements: packagename => version |
138 REQUIREMENTS = { |
166 REQUIREMENTS = { |
139 'FreeBSD' => '>= 7.0', |
167 'FreeBSD' => '>= 5.0', |
140 } |
168 } |
141 |
169 |
142 # RubyGem specification |
170 # RubyGem specification |
143 GEMSPEC = Gem::Specification.new do |gem| |
171 GEMSPEC = Gem::Specification.new do |gem| |
144 gem.name = PKG_NAME.downcase |
172 gem.name = PKG_NAME.downcase |
145 gem.version = PKG_VERSION |
173 gem.version = PKG_VERSION |
146 |
174 |
147 gem.summary = PKG_SUMMARY |
175 gem.summary = PKG_SUMMARY |
148 gem.description = <<-EOD |
176 gem.description = <<-EOD |
149 This is shell that can be used to interact with multiple FreeBSD jail instances |
177 This is shell that can be used to interact with multiple FreeBSD jail instances |
150 |
|
151 simultaneously. It includes a Ruby binding to the FreeBSD jail(2) functions. |
178 simultaneously. It includes a Ruby binding to the FreeBSD jail(2) functions. |
152 EOD |
179 EOD |
153 |
180 |
154 gem.authors = 'Michae Granger and Mahlon Smith' |
181 gem.authors = 'Michael Granger and Mahlon Smith' |
155 gem.email = 'ged@FaerieMUD.org, mahlon@martini.nu' |
182 gem.email = 'ged@FaerieMUD.org, mahlon@martini.nu' |
156 gem.homepage = 'http://deveiate.org/projects/Jparallel/' |
183 gem.homepage = 'http://deveiate.org/projects/Jparallel/' |
157 gem.rubyforge_project = RUBYFORGE_PROJECT |
184 gem.rubyforge_project = RUBYFORGE_PROJECT |
158 |
185 |
159 gem.has_rdoc = true |
186 gem.has_rdoc = true |
160 gem.rdoc_options = RDOC_OPTIONS |
187 gem.rdoc_options = RDOC_OPTIONS |
|
188 |
|
189 gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s |
|
190 |
161 |
191 |
162 gem.files = RELEASE_FILES. |
192 gem.files = RELEASE_FILES. |
163 collect {|f| f.relative_path_from(BASEDIR).to_s } |
193 collect {|f| f.relative_path_from(BASEDIR).to_s } |
164 gem.test_files = SPEC_FILES. |
194 gem.test_files = SPEC_FILES. |
165 collect {|f| f.relative_path_from(BASEDIR).to_s } |
195 collect {|f| f.relative_path_from(BASEDIR).to_s } |
166 |
196 |
167 DEPENDENCIES.each do |name, version| |
197 DEPENDENCIES.each do |name, version| |
168 version = '>= 0' if version.length.zero? |
198 version = '>= 0' if version.length.zero? |
169 gem.add_dependency( name, version ) |
199 gem.add_runtime_dependency( name, version ) |
|
200 end |
|
201 |
|
202 # Developmental dependencies don't work as of RubyGems 1.2.0 |
|
203 unless Gem::Version.new( Gem::RubyGemsVersion ) <= Gem::Version.new( "1.2.0" ) |
|
204 DEVELOPMENT_DEPENDENCIES.each do |name, version| |
|
205 version = '>= 0' if version.length.zero? |
|
206 gem.add_development_dependency( name, version ) |
|
207 end |
170 end |
208 end |
171 |
209 |
172 REQUIREMENTS.each do |name, version| |
210 REQUIREMENTS.each do |name, version| |
173 gem.requirements << [ name, version ].compact.join(' ') |
211 gem.requirements << [ name, version ].compact.join(' ') |
174 end |
212 end |
175 end |
213 end |
|
214 |
|
215 # Manual-generation config |
|
216 MANUALDIR = DOCSDIR + 'manual' |
176 |
217 |
177 $trace = Rake.application.options.trace ? true : false |
218 $trace = Rake.application.options.trace ? true : false |
178 $dryrun = Rake.application.options.dryrun ? true : false |
219 $dryrun = Rake.application.options.dryrun ? true : false |
179 |
220 |
180 |
221 |
224 end |
268 end |
225 |
269 |
226 |
270 |
227 ### Task: cruise (Cruisecontrol task) |
271 ### Task: cruise (Cruisecontrol task) |
228 desc "Cruisecontrol build" |
272 desc "Cruisecontrol build" |
229 task :cruise => [:clean, :spec, :package] do |task| |
273 task :cruise => [:clean, 'spec:quiet', :package] do |task| |
230 raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty? |
274 raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty? |
231 artifact_dir = ARTIFACTS_DIR.cleanpath |
275 artifact_dir = ARTIFACTS_DIR.cleanpath |
232 artifact_dir.mkpath |
276 artifact_dir.mkpath |
233 |
277 |
234 $stderr.puts "Copying coverage stats..." |
278 coverage = BASEDIR + 'coverage' |
235 FileUtils.cp_r( 'coverage', artifact_dir ) |
279 if coverage.exist? && coverage.directory? |
|
280 $stderr.puts "Copying coverage stats..." |
|
281 FileUtils.cp_r( 'coverage', artifact_dir ) |
|
282 end |
236 |
283 |
237 $stderr.puts "Copying packages..." |
284 $stderr.puts "Copying packages..." |
238 FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir ) |
285 FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir ) |
239 end |
286 end |
240 |
287 |