Class: Bueller::RubyforgeTasks

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/bueller/rubyforge_tasks.rb

Overview

(Mostly deprecated) Rake tasks for putting a Bueller gem on Rubyforge.

Bueller::Tasks.new needs to be used before this.

Basic usage:

Bueller::RubyforgeTasks.new

There are a few options you can tweak:

* project: the rubyforge project to operate on. This defaults to whatever you specified in your gemspec. Defaults to your gem name.
* remote_doc_path: the place to upload docs to on Rubyforge under /var/www/gforge-projects/#{project}/

See also wiki.github.com/technicalpickles/bueller/rubyforge

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ RubyforgeTasks

Returns a new instance of RubyforgeTasks.

Yields:

  • (_self)

Yield Parameters:



29
30
31
32
33
# File 'lib/bueller/rubyforge_tasks.rb', line 29

def initialize
  yield self if block_given?

  define
end

Instance Attribute Details

#buellerObject

Returns the value of attribute bueller.



27
28
29
# File 'lib/bueller/rubyforge_tasks.rb', line 27

def bueller
  @bueller
end

#doc_taskObject

Task to be used for generating documentation, before they are uploaded. Defaults to rdoc.



25
26
27
# File 'lib/bueller/rubyforge_tasks.rb', line 25

def doc_task
  @doc_task
end

#projectObject

The RubyForge project to interact with. Defaults to whatever is in your bueller gemspec.



21
22
23
# File 'lib/bueller/rubyforge_tasks.rb', line 21

def project
  @project
end

#remote_doc_pathObject

The path to upload docs to. It is relative to /var/www/gforge-projects/##project/, and defaults to your gemspec’s name



23
24
25
# File 'lib/bueller/rubyforge_tasks.rb', line 23

def remote_doc_path
  @remote_doc_path
end

Instance Method Details

#defineObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/bueller/rubyforge_tasks.rb', line 47

def define
  namespace :rubyforge do
    namespace :release do
      desc "Pretend to release the current gem version to RubyForge, but actually release to Gemcutter."
      task :gem => 'gemcutter:release'

      if publish_documentation?
        desc "Publish docs to RubyForge."
        task :docs => doc_task do
          config = YAML.load(
            File.read(File.expand_path('~/.rubyforge/user-config.yml'))
          )

          host = "#{config['username']}@rubyforge.org"
          remote_dir = "/var/www/gforge-projects/#{project}/#{remote_doc_path}"

          local_dir = case self.doc_task.to_sym
                      when :rdoc then 'rdoc'
                      when :yardoc then 'doc'
                      else
                        raise "Unsure what to run to generate documentation. Please set doc_task and re-run."
                      end

          sh %{rsync --archive --verbose --delete #{local_dir}/ #{host}:#{remote_dir}}
        end
      end
    end

    if publish_documentation?
      desc "Release RDoc documentation to RubyForge"
      task :release => "rubyforge:release:docs"
    end
  end

  task :release => 'rubyforge:release'
end

#publish_documentation?Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/bueller/rubyforge_tasks.rb', line 84

def publish_documentation?
  ! (doc_task == false || doc_task == :none)
end