Module: Hoe::Website
- Defined in:
- lib/hoe/website.rb
Overview
Website plugin for hoe.
Tasks Provided:
- website
-
Generate and upload website to remote server via rsync
- website_generate
-
Generate website files
- website_upload
-
Upload website files via rsync
Instance Method Summary collapse
Instance Method Details
#define_website_tasks ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/hoe/website.rb', line 33 def define_website_tasks desc 'Generate website files' task :website_generate => :ruby_env do (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt| sh %{ #{$ruby_app || 'ruby'} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} } end end desc 'Upload website files via rsync' task :website_upload do local_dir = 'website' host = website_config["host"] host = host ? "#{host}:" : "" remote_dir = website_config["remote_dir"] sh %{rsync -aCv #{local_dir}/ #{host}#{remote_dir}} end remove_task :publish_docs # recreate hoe's rubyforge specific version desc 'Publish RDoc to RubyForge.' task :publish_docs => [:clean, :docs] do local_dir = 'doc' host = website_config["host"] host = host ? "#{host}:" : "" remote_dir = File.join(website_config["remote_dir"], "rdoc") sh %{rsync -aCv #{local_dir}/ #{host}#{remote_dir}} end desc 'Generate and upload website files' task :website => [:website_generate, :website_upload, :publish_docs] end |
#initialize_website ⇒ Object
29 30 31 |
# File 'lib/hoe/website.rb', line 29 def initialize_website require File.dirname(__FILE__) + '/../newgem/tasks' end |
#website_config ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hoe/website.rb', line 12 def website_config unless @website_config require 'yaml' begin @website_config = YAML.load(File.read("config/website.yml")) rescue puts <<-EOS.gsub(/^ /, '') To upload your website to a host, you need to configure config/website.yml. See config/website.yml.sample for an example. EOS exit end end @website_config end |