Sha256: 0f19d6ca61ae628e4fd5791c34f3195e0ab2a7c59e06b189cedbf4a4a7e54d7e

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

#!/usr/bin/env ratch

# Publish website to rubyforge
#
# This task publishes the source dir (deafult 'doc')
# to a rubyforge website.

main :publish do
  config = configuration['publish']

  project     = config['project']
  subdir      = config['subdir']
  source      = config['source'] || "doc"
  username    = config['username'] || ENV['RUBYFORGE_USERNAME']
  clear       = config['clear']

  if clear
    protect   = config['protect'].to_a
    exclude   = config['exclude'].to_a
  else
    protect   = %w{usage statcvs statsvn robot.txt wiki} + config['protect'].to_a
    exclude   = %w{.svn} + config['exclude'].to_a
  end

  abort "no project"  unless project
  abort "no username" unless username

  if subdir
    destination = File.join(project, subdir)
  else
    destination = project
  end

  dir = source.chomp('/') + '/'
  url = "#{username}@rubyforge.org:/var/www/gforge-projects/#{destination}"

  rsync_file = File.join(source,'.rsync-filter')

  op = ['-rLvz', '--delete-after']  # maybe -p ?

  unless protect.empty? && exclude.empty?

    unless file?(rsync_file)
      File.open(rsync_file, 'w') do |f|
        exclude.each{|e| f << "- #{e}\n"}
        protect.each{|e| f << "P #{e}\n"}
      end
    end

    op << "--filter='dir-merge #{rsync_file}'"
  end

  args = op + [dir, url]

  rsync(*args.to_params)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
stick-1.3.3 task/publish
stick-1.3.2 task/publish
stick-1.2.0 task/publish
stick-1.3.1 task/publish
stick-1.3.0 task/publish