Rakefile in ruby-vpi-16.0.1 vs Rakefile in ruby-vpi-17.0.0

- old
+ new

@@ -1,14 +1,12 @@ # = Environment variables # CFLAGS:: Arguments to the compiler. # LDFLAGS:: Arguments to the linker. #-- -# Copyright 2006-2007 Suraj N. Kurapati +# Copyright 2006 Suraj N. Kurapati # See the file named LICENSE for details. -CFLAGS, LDFLAGS = ENV['CFLAGS'], ENV['LDFLAGS'] - require 'rake/clean' require 'rake/rdoctask' require 'rake/gempackagetask' require 'tempfile' @@ -22,45 +20,46 @@ task :default => :build # load project information - include RubyVpi::Config - PROJECT_SSH_URL = "snk@rubyforge.org:/var/www/gforge-projects/#{PROJECT_ID}" + include RubyVPI + PROJECT_SSH_URL = "snk@rubyforge.org:/var/www/gforge-projects/#{PROJECT_ID}" load 'doc/history.rb' - head = @history.first - PROJECT_VERSION = head['Version'] + head = @history.first + PROJECT_VERSION = head['Version'] PROJECT_BIRTHDAY = head['Date'] # utility - # Returns a temporary, unique path ready for use. No file exists at the - # returned path. + # Returns a temporary, unique path ready for + # use. No file exists at the returned path. def generate_temp_path - rm_f path = Tempfile.new($$).path + path = Tempfile.new($$).path + rm_f path path end # uploads the given sources to the given destination URL def upload aDestUrl, *aSources sh 'rsync', '-avz', '--delete', aSources, aDestUrl end # propogate cleaning tasks recursively to lower levels - [:clean, :clobber].each do |t| + %w[clean clobber].each do |t| task t do files = FileList['**/Rakefile'].exclude('_darcs') files.shift # avoid infinite loop on _this_ file # allows propogation to lower levels when gem not installed ENV['RUBYLIB'] = PROJECT_LIBS files.each do |f| cd File.dirname(f) do - sh 'rake', t.to_s + sh 'rake', t end end end end @@ -71,22 +70,25 @@ task :build directory 'obj' CLOBBER.include 'obj' + ccFlags = ENV['CFLAGS'] + ldFlags = ENV['LDFLAGS'] + SIMULATORS.each_pair do |id, sim| taskName = "build_#{id}" desc "Builds object files for #{sim.name}." task taskName => ['obj', 'ext'] do src = PROJECT_ID + '.' + Config::CONFIG['DLEXT'] dst = File.expand_path(File.join('obj', id.to_s)) unless File.exist? dst cd 'ext' do - ENV['CFLAGS'] = "#{CFLAGS} #{sim.compiler_args}" - ENV['LDFLAGS'] = "#{LDFLAGS} #{sim.linker_args}" + ENV['CFLAGS'] = "#{ccFlags} #{sim.compiler_args}" + ENV['LDFLAGS'] = "#{ldFlags} #{sim.linker_args}" sh 'rake' mv src, dst sh 'rake clean' end @@ -118,11 +120,11 @@ CLOBBER.include 'ref/ruby' desc 'Generate reference for Ruby.' Rake::RDocTask.new 'ref/ruby' do |t| t.rdoc_dir = t.name - t.title = "#{PROJECT_NAME}: #{PROJECT_SUMMARY}" + t.title = "#{PROJECT_NAME}: #{PROJECT_SUMMARY}" t.options.concat %w(--charset utf-8 --line-numbers) t.rdoc_files.include '{bin,lib/**}/*.rb' end @@ -198,29 +200,30 @@ task :release => [:clobber, :dist] do sh 'rake package' end spec = Gem::Specification.new do |s| - s.name = s.rubyforge_project = PROJECT_ID - s.summary = PROJECT_SUMMARY - s.description = PROJECT_DETAIL - s.homepage = PROJECT_URL - s.version = PROJECT_VERSION + s.name = PROJECT_ID + s.rubyforge_project = PROJECT_ID + s.summary = PROJECT_SUMMARY + s.description = PROJECT_DETAIL + s.homepage = PROJECT_URL + s.version = PROJECT_VERSION - s.add_dependency 'rake', '>= 0.7.0' - s.add_dependency 'rspec', '>= 0.7.0' - s.add_dependency 'rcov', '>= 0.7.0' - s.add_dependency 'xx' # needed by rcov + s.add_dependency 'rake', '>= 0.7.0' + s.add_dependency 'rspec', '>= 1.0.0' + s.add_dependency 'rcov', '>= 0.7.0' + s.add_dependency 'xx' # needed by rcov s.add_dependency 'ruby-debug', '>= 0.5.2' s.requirements << "POSIX threads library" s.requirements << "C language compiler" - s.files = FileList['**/*'].exclude('_darcs') + s.files = FileList['**/*'].exclude('_darcs') s.autorequire = PROJECT_ID s.extensions << 'gem_extconf.rb' - s.executables = FileList['bin/*.rb'].map {|f| File.basename f} + s.executables = PROJECT_ID end Rake::GemPackageTask.new(spec) do |pkg| pkg.need_tar = true end @@ -229,13 +232,13 @@ # installation desc "Configures the gem during installation." task :gem_config_inst do |t| # make documentation available to gem_server - gemDir = File.dirname(__FILE__) + gemDir = File.dirname(__FILE__) gemName = File.basename(gemDir) - docDir = File.join('..', '..', 'doc', gemName) + docDir = File.join('..', '..', 'doc', gemName) mkdir_p docDir ln_s gemDir, File.join(docDir, 'rdoc') end @@ -245,11 +248,11 @@ desc "Ensure that examples work with $SIMULATOR" task :test => :build do # ensures that current sources are tested instead of the installed gem ENV['RUBYLIB'] = PROJECT_LIBS - FileList['samp/*/'].each do |s| - cd s do - sh 'rake', ENV['SIMULATOR'] || 'cver' + FileList['samp/**/*.rake'].each do |runner| + cd File.dirname(runner) do + sh 'rake', '-f', File.basename(runner), ENV['SIMULATOR'] || 'cver' end end end