Class: Jeweler::RubyforgeTasks

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of RubyforgeTasks.

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
15
16
17
18
19
20
# File 'lib/jeweler/rubyforge_tasks.rb', line 11

def initialize
  yield self if block_given?

  self.jeweler = Rake.application.jeweler

  self.remote_doc_path ||= jeweler.gemspec.name
  self.project ||= jeweler.gemspec.rubyforge_project

  define
end

Instance Attribute Details

#jewelerObject

Returns the value of attribute jeweler.



9
10
11
# File 'lib/jeweler/rubyforge_tasks.rb', line 9

def jeweler
  @jeweler
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/jeweler/rubyforge_tasks.rb', line 8

def project
  @project
end

#remote_doc_pathObject

Returns the value of attribute remote_doc_path.



8
9
10
# File 'lib/jeweler/rubyforge_tasks.rb', line 8

def remote_doc_path
  @remote_doc_path
end

Instance Method Details

#defineObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/jeweler/rubyforge_tasks.rb', line 22

def define
  namespace :rubyforge do

    desc "Release gem and RDoc documentation to RubyForge"
    task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]

    namespace :release do
      desc "Publish RDoc to RubyForge."
      task :docs => [:rdoc] 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 = 'rdoc'

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