Sha256: d036cbf20cdd85bf6e3d68a2e1a7aec65ae986e9098b748ee039985423cec890

Contents?: true

Size: 1.13 KB

Versions: 24

Compression:

Stored size: 1.13 KB

Contents

require 'rake/contrib/rubyforgepublisher'

desc 'Regenerates the contents of the website'
task :website do
  mkpath 'doc/output'
  Rake::Task[:spec_html].invoke
  Rake::Task[:rdoc].invoke
  Rake::Task[:rdoc_dev].invoke
  Rake::Task[:rcov].invoke
  WebsiteRakeHelpers.webgen
end

desc 'Removes generated documentation'
task :clobber do
  WebsiteRakeHelpers.clobber
end

task :verify_user do
  raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
end

desc "Uploads the website to RubyForge"
task :publish_website => [:verify_user, :website] do
  publisher = Rake::SshDirPublisher.new(
    "#{ENV['RUBYFORGE_USER']}@rubyforge.org",
    "/var/www/gforge-projects/gecoder",
    "doc/output"
  )
  publisher.upload
end

module WebsiteRakeHelpers
  module_function
  
  # Remove generated documentation.
  def clobber
    rm_rf 'doc/output'
    rm_rf 'doc/tmp'
  end
  
  # Generates the website with webgen.
  def webgen
    Dir.chdir 'doc' do
      output = nil
      IO.popen('webgen 2>&1') do |io|
        output = io.read
      end
      raise "ERROR while running webgen: #{output}" if output =~ /ERROR/n || $? != 0
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
gecoder-with-gecode-0.9.1-x86-mswin32-60 tasks/website.rake
gecoder-with-gecode-0.9.1 tasks/website.rake
gecoder-with-gecode-1.0.0-x86-mswin32-60 tasks/website.rake
gecoder-with-gecode-1.0.0 tasks/website.rake