Hey Folks,
In an effort to simplify my own publishing process, I have migrated all Sprout gems over to
http://gemcutter.org
You can see all of the available sprouts (mixed in with some name-stealers) here:
Gem Cutter has already added support for all gems that are on RubyForge, and is becoming the primary source that new versions of RubyGems will point at.
To update your installation of RubyGems so that it points at gemcutter do the following:
sudo gem install gemcutter # Install the gemcutter gem
gem tumble # Make gemcutter your primary gem source
------------------------------------------------
I also added a fantastic new feature to the Sprout gem.
ERBResolver
With this feature, you can easily add a new task to any rakefile that requires 'sprout'.
This new task is based on the standard Rake::FileTask and allows us to instantly render arbitrary ERB templates on disk.
Here's an example:
erb_resolver 'bin/SomeProject.html' do |t|
t.title = "Some Fantastic Project"
t.header = "SomeProject-debug.swf"
end
desc "Create the HTML document"
task :html => 'bin/SomeProject.html'
This task expects you to have a template file on disk at [taskname].erb like:
bin/SomeProject.html.erb
And the contents of that file have access to a 'title' and a 'header' variable.
The erb template could look something like:
<html>
<title><%= title %></title>
<body>
<h1><%= header %></h1>
</body>
</html>
For this example, I have aliased the task with a 'desc' block so that you could run:
rake html
Which will only generate the html document IF the document doesn't yet exist, OR the erb template has been updated more recently than the rendered document.
If you're concerned about putting the erb into your bin and would rather put it somewhere like 'config', you could update the task as follows:
erb_resolver 'config/SomeProject.html' do |t|
t.title = "Some Fantastic Project"
t.header = "SomeProject-debug.swf"
end
file 'bin/SomeProject.html' => 'config/SomeProject.html' do
FileUtils.mv 'config/SomeProject.html', 'bin/SomeProject.html'
end
As always, please let me know if anyone has any questions or concerns.
Thanks!
Luke