Monday, December 10, 2007

Ruby Calnder plugin

New day new problem.

I installed a ruby on rails calendar plugin. Install worked fine. One of the install steps was to run

rake rdoc

This gave me the following problem
rake aborted!
no such file to load -- hoe
C:/dev/ruby/timesheet/vendor/plugins/calendar_helper/rakefile:4
(See full trace by running task with --trace)

Hoe it turns out is a simple ruby project for helping with rakefiles. To install Hoe

gem install hoe
(no need for sudo since I'm on windows)

Now rake rdoc gives me
rake aborted!
couldn't find HOME environment -- expanding `~/.hoerc'
C:/dev/ruby/timesheet/vendor/plugins/calendar_helper/rakefile:7:in `new'
(See full trace by running task with --trace)

This was because I was running on Windows not unix. Setting HOME environment helps this

set HOME=%HOMEPATH%

Now the problem is
rake aborted!
Don't know how to build task 'README'

This as it turns out was a problem with the rakefile. It referred to a non-existant file 'README ' in the plugin. There was however a Readme.txt file. Updating the Rakefile to refer to this finally fixed the issues.


require 'rubygems'
require 'rake'
require 'rake/rdoctask'
require 'hoe'
require './lib/calendar_helper.rb'

Hoe.new('calendar_helper', CalendarHelper::VERSION) do |p|
p.rubyforge_name = 'seattlerb'
p.author = 'Geoffrey Grosenbach'
p.email = 'boss AT topfunky.com'
p.summary = 'Generates a configurable, CSS-tagged HTML calendar.'
p.description = "A simple method to create an HTML calendar for a single month. Can be styled with CSS. Usable with Ruby on Rails."
p.url = "http://rubyforge.org/projects/seattlerb"
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
p.clean_globs = ['test/output']
end

# desc "Test task (actually runs specs)"
# task "test" do
# system "spec --format specdoc --color spec/*_spec.rb"
# end

# -- Rails-specific --

desc 'Generate documentation for the calendar_helper plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'CalendarHelper'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('Readme.txt')
rdoc.rdoc_files.include('lib/**/*.rb')
end

3 comments:

台灣社區培力學會 said...

soryy, i do not have idea how do I set Home environment, which file should I insert the variable ?

k said...

Hi,

For windows, in the dos window where you are running ruby you just need to run

set HOME=%HOMEPATH%

It should be set automatically if you are using unix

Jim Pickrell said...

On that last step, suggest to simply rename readme.txt to README. Simpler than editing the rakefile and gets the same results.