RAKEFILE

Path: RAKEFILE
Last Update: Sat Jul 21 11:12:18 -0400 2007

require ‘rubygems’ require ‘rake’ require ‘rake/clean’ require ‘rake/packagetask’ require ‘rake/gempackagetask’ require ‘rake/rdoctask’ require ‘rake/testtask‘

require ‘rake/contrib/rubyforgepublisher‘

require ‘pscp’ require ‘rote’ require ‘rote/filters’ require ‘rote/filters/redcloth’ require ‘rote/filters/tidy’ require ‘rote/format/html’ require ‘rote/extratasks‘

require ‘spec/rake/spectask’ require ‘spec/rake/verify_rcov‘

include Rote

load ‘lib/rools/version.rb‘

PACKAGE_VERSION = Rools::ROOLS_VERSION CURRENT_COVERAGE = Rools::ROOLS_COVERAGE

CLEAN.include("pkg", "html", "rdoc", "engine.log")

PACKAGE_FILES = FileList[

  'README',
  'CHANGELOG',
  'RAKEFILE',
  'lib/rools.rb',
  'lib/**/*.rb'

].to_a

PROJECT = ‘rools‘

ENV[‘RUBYFORGE_USER’] = "cappelaere@rubyforge.org" ENV[‘RUBYFORGE_PROJECT’] = "/var/www/gforge-projects/#{PROJECT}"

desc ‘Release Files’ task :default => [:rcov, :rdoc, :doc, :gem, :package]

# Generate the RDoc documentation rd = Rake::RDocTask.new do |rdoc|

  rdoc.rdoc_dir = 'html/doc'
  rdoc.title = 'Rools -- A Pure Ruby Rules Engine'
  rdoc.rdoc_files.include(PACKAGE_FILES)
  rdoc.options << '-N'
  rdoc.options << '-S'

end

# Create a task to build the static docs (html) ws = Rote::DocTask.new(:doc) do |site|

    site.output_dir = 'html'
    site.layout_dir = 'doc/layouts'
    site.pages.dir  = 'doc/pages'
    site.pages.include('**/*')

    site.ext_mapping(/thtml|textile/, 'html') do |page|
        page.extend Format::HTML
        page.page_filter Filters::RedCloth.new
        page.page_filter Filters::Syntax.new
    end

    site.res.dir = 'doc/res'
    site.res.include('**/*.png')
    site.res.include('**/*.gif')
    site.res.include('**/*.jpg')
    site.res.include('**/*.css')

end

# Add rdoc deps to doc task task :doc => [:rdoc]

gem_spec = Gem::Specification.new do |s|

  s.platform = Gem::Platform::RUBY
  s.name = PROJECT
  s.summary = "A Rules Engine written in Ruby"
  s.description = "Can be used for program-flow, ideally suited to processing applications"
  s.version = PACKAGE_VERSION

  s.authors = 'Sam Smoot', 'Scott Bauer', 'Pat Cappelaere'
  s.email = 'ssmoot@gmail.com; bauer.mail@gmail.com cappelaere@gmail.com'
  s.rubyforge_project = PROJECT
  s.homepage = 'http://rools.rubyforge.org/'

  s.files = PACKAGE_FILES

  s.require_path = 'lib'
  s.requirements << 'none'
  s.autorequire = 'rools'

  s.has_rdoc = true
  s.rdoc_options << '--line-numbers' << '--inline-source' << '--main' << 'README'
  s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a

end

# # Create a task for creating a ruby gem # Rake::GemPackageTask.new(gem_spec) do |p|

  p.gem_spec = gem_spec
  p.need_tar = true
  p.need_zip = true

end

# # Packaging the source # Rake::PackageTask.new("rools", Rools::ROOLS_VERSION) do |pkg|

    pkg.need_zip = true
    pkg.package_files = FileList[
        "RAKEFILE",
        "CHANGELOG",
        "README",
        "*.txt",
        "doc/**/*",
        "examples/**/*",
        "lib/**/*",
        "test/**/*",
        "specs/**/*",
        "html/**/*"
    ].to_a
    pkg.package_files.delete("rc.txt")
    pkg.package_files.delete("MISC.txt")
    class << pkg
        def package_name
            "#{@name}-#{@version}-src"
        end
    end

end

desc "Publish RDOC to RubyForge" task :rubyforge => [:rdoc, :gem] do

  Rake::SshDirPublisher.new(ENV['RUBYFORGE_USER'], ENV['RUBYFORGE_PROJECT'], 'html').upload
  #Rake::SshFilePublisher.new(ENV['RUBYFORGE_USER'], ENV['RUBYFORGE_PROJECT'], 'pkg', "#{PROJECT}-#{PACKAGE_VERSION}.gem").upload

end

# Builds the website and uploads it to Rubyforge.org task :upload_website => [:doc] do

    sh """

rsync -azv -e ssh \

[Validate]