Class: Jeweler::RubyforgeTasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Jeweler::RubyforgeTasks
- Defined in:
- lib/jeweler/rubyforge_tasks.rb
Overview
Rake tasks for putting a Jeweler gem on Rubyforge.
Jeweler::Tasks.new needs to be used before this.
Basic usage:
Jeweler::RubyforgeTasks.new
Easy enough, right?
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}/
Instance Attribute Summary collapse
-
#doc_task ⇒ Object
Task to be used for generating documentation, before they are uploaded.
-
#jeweler ⇒ Object
Returns the value of attribute jeweler.
-
#project ⇒ Object
The RubyForge project to interact with.
-
#remote_doc_path ⇒ Object
The path to upload docs to.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize {|_self| ... } ⇒ RubyforgeTasks
constructor
A new instance of RubyforgeTasks.
Constructor Details
#initialize {|_self| ... } ⇒ RubyforgeTasks
Returns a new instance of RubyforgeTasks.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jeweler/rubyforge_tasks.rb', line 32 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 self.doc_task ||= :rdoc define end |
Instance Attribute Details
#doc_task ⇒ Object
Task to be used for generating documentation, before they are uploaded. Defaults to rdoc.
28 29 30 |
# File 'lib/jeweler/rubyforge_tasks.rb', line 28 def doc_task @doc_task end |
#jeweler ⇒ Object
Returns the value of attribute jeweler.
30 31 32 |
# File 'lib/jeweler/rubyforge_tasks.rb', line 30 def jeweler @jeweler end |
#project ⇒ Object
The RubyForge project to interact with. Defaults to whatever is in your jeweler gemspec.
24 25 26 |
# File 'lib/jeweler/rubyforge_tasks.rb', line 24 def project @project end |
#remote_doc_path ⇒ Object
The path to upload docs to. It is relative to /var/www/gforge-projects/##project/, and defaults to your gemspec’s name
26 27 28 |
# File 'lib/jeweler/rubyforge_tasks.rb', line 26 def remote_doc_path @remote_doc_path end |
Instance Method Details
#define ⇒ Object
44 45 46 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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/jeweler/rubyforge_tasks.rb', line 44 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 "Release the current gem version to RubyForge." task :gem => [:gemspec, :build] do begin jeweler.release_gem_to_rubyforge rescue NoRubyForgeProjectInGemspecError => e abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration" rescue MissingRubyForgePackageError => e abort "Rubyforge reported that the #{e.} package isn't setup. Run rake rubyforge:setup to do so." rescue RubyForgeProjectNotConfiguredError => e abort "RubyForge reported that #{e.} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge" end end desc "Publish docs to RubyForge." task :docs => doc_task do config = YAML.load( File.read(File.('~/.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 -av --delete #{local_dir}/ #{host}:#{remote_dir}} end end desc "Setup a rubyforge project for this gem" task :setup do begin jeweler.setup_rubyforge rescue NoRubyForgeProjectInGemspecError => e abort "Setting up RubyForge requires that you specify a 'rubyforge_project' in your Jeweler::Tasks declaration" rescue RubyForgeProjectNotConfiguredError => e abort "The RubyForge reported that #{e.} wasn't configured. This means you need to run 'rubyforge setup', 'rubyforge login', and 'rubyforge configure', or maybe the project doesn't exist on RubyForge" end end end end |