require 'rake' require 'rake/clean' require 'rake/packagetask' require 'rake/gempackagetask' #require 'rubygems' #require 'rbconfig' #require 'find' #require 'ftools' #require 'fileutils' #include Config PROJECT = "rockit" VERSION_FILE = "VERSION" MANIFEST_FILE = "Manifest" README_FILE = "README" TODO_FILE = "TODO" RAKE_FILE = "rakefile" CHANGELOG = "Changelog" task :default => :ptest ############################################################################# # Version related ############################################################################# # Read the version from the version file def Version() File.open(VERSION_FILE) {|fh| fh.read.strip} end # Update the version num on disc def update_version v = Version().split(".").map {|vp| vp.to_i} new_v = yield(v) File.open(VERSION_FILE, "w") {|fh| fh.write(new_v)} puts Version() end def inc_tiny; update_version {|v| "#{v[0]}.#{v[1]}.#{v[2]+1}\n"}; end def inc_minor; update_version {|v| "#{v[0]}.#{v[1]+1}.0\n"}; end def inc_major; update_version {|v| "#{v[0]+1}.0.0\n"}; end task :version do puts Version() end task :inc_tiny do inc_tiny() end task :inc_minor do inc_minor() end task :inc_major do inc_major() end ############################################################################# # Test related ############################################################################# PackratTestFiles = FileList["tests/unit/packrat/test*.rb"] PackratAcceptanceTestFiles = FileList["tests/acceptance/packrat/**/atest*.rb"] task :setup_for_test do $: << "lib" end def load_files(list) list.each {|f| puts "Loading #{f}"; require f} end task :ptest => [:setup_for_test] do load_files PackratTestFiles end task :patest => [:setup_for_test] do load_files PackratAcceptanceTestFiles end task :unit_tests => [:setup_for_test] do load_files FileList["tests/unit/**/test*.rb"] end task :acceptance_tests do load_files FileList["tests/acceptance/**/test*.rb"] end task :utest => :unit_tests task :ut => :unit_tests task :atest => :acceptance_tests task :at => :acceptance_tests ############################################################################# # Gem and package related ############################################################################# BaseFileToIncludeGlobs = [ "README", "TODO", "BUGS", "LICENSE", "VERSION", "rakefile", "Manifest", "lib/packrat/**/*", "lib/rockit/prettyprint/**/*", "lib/rockit/tree/**/*", "lib/util/**/*", ] TestFilesToIncludeGlobs = [ "tests/acceptance/**/*", "tests/unit/**/*", ] PkgFileGlobs = BaseFileToIncludeGlobs + TestFilesToIncludeGlobs GemSpec = Gem::Specification.new do |s| s.name = PROJECT s.version = Version() s.platform = Gem::Platform::RUBY s.summary = "Rockit is the Ruby Object-oriented Compiler construction toolKIT" s.author = "Robert Feldt" s.email = "Robert.Feldt@gmail.com" s.homepage = "http://www.pronovomundo.com/projects/ruby/rockit" s.description = < with a given in the given . def release_file(file, release_name, package = PROJECT) group_id = PROJECT system "rubyforge add_release #{group_id} #{package} #{release_name} #{file}" end # Delete a package (and all its files) def delete_package(packageName) system "rubyforge create_package rockit #{ARGV.last}" end # We use a temporary package name for now, should be PROJECT later... PACKAGE_NAME = "1799" # if of the test package in rockit group desc "Create package and release to rubyforge" task :rubyforge_release => [:package] do system "rubyforge login" release_name = "#{PROJECT}-#{Version()}" files_to_release = FileList["pkg/#{release_name}.*"] files_to_release.each do |file| puts "Releasing #{file} to Rubyforge" release_file(file, release_name, PACKAGE_NAME) end end