Sha256: 7857f952074eea20ba829c833d0f9b625165d7e61481b098b5cbe2c1ef057c1d

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

require 'rake/contrib/rubyforgepublisher'

desc 'Regenerates the contents of the website'
task :website do
  Rake::Task[:clobber].invoke
  mkdir 'doc/output'
  begin
    Rake::Task[:spec_html].invoke
  rescue
    # The task will fail unless all specs pass, we want it to continue.
  end
  Rake::Task[:rdoc].invoke
  begin
    Rake::Task[:rcov].invoke
  rescue
    # The task will fail unless all specs pass, we want it to continue.
  end
  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'
  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

5 entries across 5 versions & 1 rubygems

Version Path
gecoder-0.4.0 tasks/website.rake
gecoder-0.5.0 tasks/website.rake
gecoder-0.6.0 tasks/website.rake
gecoder-0.6.1 tasks/website.rake
gecoder-0.7.0 tasks/website.rake