Cutting RubyForge and supporting ERB

4 views
Skip to first unread message

Luke Bayes

unread,
Oct 28, 2009, 10:12:11 PM10/28/09
to project...@googlegroups.com
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

jerry.vos

unread,
Oct 29, 2009, 1:20:29 PM10/29/09
to ProjectSprouts
On Oct 28, 9:12 pm, Luke Bayes <lba...@patternpark.com> wrote:
> Hey Folks,
>
> In an effort to simplify my own publishing process, I have migrated all
> Sprout gems over tohttp://gemcutter.org
>
> You can see all of the available sprouts (mixed in with some name-stealers)
> here:
>
> http://gemcutter.org/search?query=sprout
>
> 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

Gemcutter's pretty neat, I used it for the first time and was
surprised at how incredibly easy to use it is.

Do you have plans for removing the gems from rubyforge? I feel like
it'd be easy for a non-ruby person to run through the instructions and
do:
gem install sprout

and have it install and not realize they got an old version (since
they didn't add gemcutter as a source).

As another note on gems and "make gem dependencies not suck", I
earlier mentioned wycat's bundler, and have finally got it up and
running on a rails project of mine, and will say it's pretty sweet.
Again, not sure how easy it'd be to leverage that for sprouts, but
it's pretty useful. You should take a look at it if you haven't.

http://github.com/wycats/bundler

Luke Bayes

unread,
Oct 29, 2009, 1:26:36 PM10/29/09
to project...@googlegroups.com
You're right about the instructions.

I just pushed the latest sprout gem to Rubyforge for the time being while we work toward updating the docs.

I'll be sure to look into wycats bundler too.

Thanks for the info!


Luke

viatropos

unread,
Oct 29, 2009, 2:19:17 PM10/29/09
to ProjectSprouts
That ERBResolver is very very cool, I can't wait to try it out.
Reply all
Reply to author
Forward
0 new messages