Sha256: 53edf69af45fd92525c9060770ef614c7af0aea4104e7e7e48792df7e41f2536

Contents?: true

Size: 1.92 KB

Versions: 30

Compression:

Stored size: 1.92 KB

Contents

require 'mattock/tasklib'

#Big XXX: this totally isn't done.  It's some notes against ever wanting to
#publish announcements to rubyforge ever again

module Corundum
  class Publishing < Mattock::TaskLib
    default_namespace :rubyforge

    setting(:rubyforge,  nested(:package_id => nil, :group_id => nil, :release_name => nil))
    setting(:package_dir,  nil)
    setting(:gemspec,  nil)

    def define
      desc "Publish the gem and its documentation to Rubyforge and Gemcutter"
      task root_task => in_namespace(:docs, :rubyforge)

      in_namespace do
        desc 'Publish RDoc to RubyForge'
        task :docs do
          config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
          host = "#{config["username"]}@rubyforge.org"
          remote_dir = "/var/www/gforge-projects/#{@rubyforge[:group_id]}"
          local_dir = 'rubydoc'
          sh %{rsync -av --delete #{local_dir}/ #{host}:#{remote_dir}}
        end

        task :scrape_rubyforge do
          require 'rubyforge'
          forge = RubyForge.new
          forge.configure
          forge.scrape_project(@rubyforge[:package_id])
        end

        desc "Publishes to RubyForge"
        task :rubyforge => [:docs, :scrape_rubyforge] do |t|
          require 'rubyforge'
          forge = RubyForge.new
          forge.configure
          files = [".gem", ".tar.gz", ".tar.bz2"].map do |extension|
            File::join(@package_dir, @gemspec.full_name) + extension
          end
          release = forge.lookup("release", @rubyforge[:package_id])[@rubyforge[:release_name]] rescue nil
          if release.nil?
            forge.add_release(@rubyforge[:group_id], @rubyforge[:package_id], @rubyforge[:release_name], *files)
          else
            files.each do |file|
              forge.add_file(@rubyforge[:group_id], @rubyforge[:package_id], @rubyforge[:release_name], file)
            end
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
corundum-0.3.8 lib/corundum/rubyforge.rb
corundum-0.3.7 lib/corundum/rubyforge.rb
corundum-0.3.6 lib/corundum/rubyforge.rb
corundum-0.3.5 lib/corundum/rubyforge.rb
corundum-0.3.4 lib/corundum/rubyforge.rb
corundum-0.3.3 lib/corundum/rubyforge.rb
corundum-0.3.2 lib/corundum/rubyforge.rb
corundum-0.3.1 lib/corundum/rubyforge.rb
corundum-0.3 lib/corundum/rubyforge.rb
corundum-0.2 lib/corundum/rubyforge.rb
corundum-0.1.4 lib/corundum/rubyforge.rb
corundum-0.1.3 lib/corundum/rubyforge.rb
corundum-0.1.2 lib/corundum/rubyforge.rb
corundum-0.1.0 lib/corundum/rubyforge.rb
corundum-0.0.31 lib/corundum/rubyforge.rb
corundum-0.0.30 lib/corundum/rubyforge.rb
corundum-0.0.29 lib/corundum/rubyforge.rb
corundum-0.0.28 lib/corundum/rubyforge.rb
corundum-0.0.27 lib/corundum/rubyforge.rb
corundum-0.0.26 lib/corundum/rubyforge.rb