Sha256: 8ea144296a61401d168ff283a2a838276892059b67341481bdb06cb5e51b3a50

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'reap/task'

module ReapTask
  def publish_task(*args,&blk)
    ::Reap::PublishTask.new(*args,&blk)
  end
end

#
# Publish Task
#
class Reap::PublishTask < Reap::Task

  #register 'publish'

  def default_name ; 'publish' ; end
  def default_desc
    "publish documents to the web [reap]"
  end

  attr_accessor :host, :type, :dir, :project, :username
  attr_accessor :exclude  # not using yet

  def init
    @type     ||= 'www'
    @host     ||= 'rubyforge.org'
    @project  ||= master['rubyforge']['project'] || master['name']
    @username ||= master['rubyforge']['username']
    @exclude  ||= []
  end

  def run
    cmd = ''; skip = false

    case @host
    when 'rubyforge'
      case @type
      when 'www', 'web'
        cmd = %{scp -r #{@dir}/* #{@username}@rubyforge.org:/var/www/gforge-projects/#{@project}/}
      else
        puts %{Unrecognized publishing kind '#{@type}' for host '#{@host}'. Skipped.}
        skip = true
      end
    else
      puts %{Unrecognized publishing host '#{@host}'. Skipped.}
      skip = true
    end

    unless skip
      puts "Reap is shelling out publishing work..."
      puts cmd
      sh(cmd) unless $PRETEND
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reap-03.01 lib/reap/publish_task.rb
reap-3.01 lib/reap/publish_task.rb