Sha256: 249adf883523db06ca38725b1257ab146e9902c0bc8bb9f4b631afcc85bd35a5

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require 'reap/task'

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

  section_required true

  def task_desc
    "Publish documents to the web."
  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', 'rubyforge.org'
      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..."
      sh(cmd) unless $PRETEND
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reap-4.0 lib/reap/task/publish.rb
reap-4.0.0 lib/reap/task/publish.rb
reap-5.10.10 lib/reap/task/publish.rb