Sha256: 74f99b2019ea6552e48f6b470a88cf71ef73e6f79eb78055d905c112cb7509a0

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'reap/task'

module ReapTask
  def webpublish_task(*args,&blk)
    ::Reap::WebPublishTask.new(*args,&blk)
  end
end

#
# Web Publish Task
#
class Reap::WebPublishTask < Reap::Task

  #register 'webpublish'

  def default_name ; 'webpublish' ; end
  def default_desc
    "publish project website to your internet host [reap]"
  end

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

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

  def run
    cmd = ''; skip = false

    case @host
    when 'rubyforge'
      cmd = %{scp -r #{@dir}/* #{@username}@rubyforge.org:/var/www/gforge-projects/#{@project}/}
    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/web_publish_task.rb
reap-3.01 lib/reap/web_publish_task.rb