tasks/distribution.rake in gecoder-0.9.0 vs tasks/distribution.rake in gecoder-0.9.1

- old
+ new

@@ -6,19 +6,23 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" PKG_FILE_NAME_WITH_GECODE = "#{PKG_NAME_WITH_GECODE}-#{PKG_VERSION}" # The location where the precompiled DLL should be placed. DLL_LOCATION = 'lib/gecode.dll' EXT_DIR = 'ext' +GECODE_DIR = 'vendor/gecode' +GECODE_NAME = 'gecode-2.2.0' +GECODE_ARCHIVE_NAME = "#{GECODE_NAME}.tar.gz" + desc 'Generate RDoc' rd = Rake::RDocTask.new do |rdoc| rdoc.rdoc_dir = 'doc/output/rdoc' rdoc.title = 'Gecode/R' rdoc.template = 'doc/rdoc/jamis.rb' rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'delegate' << '--main' << 'README' - rdoc.rdoc_files.include('README', 'CHANGES', 'LGPL-LICENSE', 'lib/**/*.rb') + rdoc.rdoc_files.include('README', 'CHANGES', 'THANKS', 'LGPL-LICENSE', 'lib/**/*.rb') end TMP_DIR = 'doc/tmp/rdoc_dev' desc 'Generate RDoc, ignoring nodoc' Rake::RDocTask.new(:rdoc_dev => :prepare_rdoc_dev) do |rdoc| @@ -41,10 +45,22 @@ end destination.close end end +desc 'Extracts the source of Gecode before it is packaged into a gem' +task :extract_gecode do + next if File.exist? "#{EXT_DIR}/#{GECODE_NAME}" + cd(EXT_DIR) do + cp "../#{GECODE_DIR}/#{GECODE_ARCHIVE_NAME}", GECODE_ARCHIVE_NAME + system("tar -xvf #{GECODE_ARCHIVE_NAME}") + rm GECODE_ARCHIVE_NAME + end +end +# To ensure that the Gecode files exist for the gem spec. +Rake::Task['extract_gecode'].invoke + spec = Gem::Specification.new do |s| s.name = PKG_NAME s.version = GecodeR::VERSION s.summary = 'Ruby interface to Gecode, an environment for constraint programming.' s.description = <<-end_description @@ -65,11 +81,11 @@ 'ext/*.h', 'ext/extconf.rb' ].to_a s.require_path = 'lib' s.extensions << 'ext/extconf.rb' - s.requirements << 'Gecode 2.1.1' + s.requirements << 'Gecode 2.2.0' s.has_rdoc = true s.rdoc_options = rd.options s.extra_rdoc_files = rd.rdoc_files s.test_files = FileList['specs/**/*.rb'] @@ -101,17 +117,17 @@ spec_windows_binary_with_gecode.requirements = [] # Add the precompiled Gecode DLLs and precompiled bindings. spec_windows_binary_with_gecode.files = spec.files.dup - FileList['ext/**/*'].to_a + FileList['vendor/gecode/win32/lib/*'].to_a << 'lib/gecode.dll' -spec_windows_binary_with_gecode.platform = 'mswin32' #Gem::Platform::WIN32 +spec_windows_binary_with_gecode.platform = 'x86-mswin32-60' #Gem::Platform::WIN32 # Create a clone of the gem spec that includes Gecode. spec_with_gecode = spec.dup spec_with_gecode.name = PKG_NAME_WITH_GECODE spec_with_gecode.extensions = - spec_with_gecode.extensions.dup.unshift 'ext/gecode-2.1.1/configure' + spec_with_gecode.extensions.dup.unshift 'ext/gecode-2.2.0/configure' spec_with_gecode.requirements = [] spec_with_gecode.files = spec.files.dup + FileList['ext/gecode-*/**/*'].to_a desc 'Generate Gecode/R Gem' Rake::GemPackageTask.new(spec) do |pkg| @@ -139,10 +155,12 @@ end desc 'Removes generated distribution files' task :clobber do rm DLL_LOCATION if File.exists? DLL_LOCATION + extracted_gecode = "#{EXT_DIR}/#{GECODE_NAME}" + rm_r extracted_gecode if File.exists? extracted_gecode FileList[ "#{EXT_DIR}/*.o", "#{EXT_DIR}/gecode.{cc,hh}", "#{EXT_DIR}/Makefile", "#{EXT_DIR}/mkmf.log" @@ -177,9 +195,12 @@ "pkg/#{PKG_FILE_NAME_WITH_GECODE}.gem", #"pkg/#{PKG_FILE_NAME_WITH_GECODE}.tgz", #"pkg/#{PKG_FILE_NAME_WITH_GECODE}.zip", "pkg/#{PKG_FILE_NAME_WITH_GECODE}-x86-mswin32.gem" ] +gecode_release_files.each do |pkg| + file pkg => :extract_gecode +end desc 'Publish Gecode/R with Gecode packages on RubyForge' task :publish_gecoder_with_gecode_packages => [:verify_user] + gecode_release_files do require 'meta_project' require 'rake/contrib/xforge'