"Do the Simplest Thing That Could Possibly Work" applies to more than code

| | Comments (2)

Wilson and I just sat down and stripped a lot of nonsense out of gitjour, making it a plain hoe-based project. Here is the gist of it in one command

% rake check_manifest                                                                                               
--- Manifest.txt    2008-06-01 09:31:16.000000000 -0700
+++ Manifest.tmp    2008-08-23 18:34:54.000000000 -0700
@@ -1,25 +1,8 @@
 History.txt
-License.txt
 Manifest.txt
 README.txt
 Rakefile
-config/hoe.rb
-config/requirements.rb
 bin/gitjour
 lib/gitjour.rb
-lib/gitjour/application.rb
-lib/gitjour/version.rb
-script/destroy
-script/generate
-script/txt2html
-setup.rb
-tasks/deployment.rake
-tasks/environment.rake
-tasks/website.rake
 test/test_gitjour.rb
 test/test_helper.rb
-website/index.html
-website/index.txt
-website/javascripts/rounded_corners_lite.inc.js
-website/stylesheets/screen.css
-website/template.rhtml

% rake check_manifest | patch -p0                                                                                     
  patching file Manifest.txt

Now, the rakefile is a plain hoe-based Rakefile and you can read it and understand it. There are no extraneous files in lib. There are no script files, setup.rb, extra tasks that don't do anything that hoe doesn't already do... I just don't get why anyone needs all that. I don't quite think the above list really conveys how much simpler the setup is:

History.txt
Manifest.txt
README.txt
Rakefile
bin/gitjour
lib/gitjour.rb
test/test_gitjour.rb
test/test_helper.rb

2 Comments

The "cruft" you've removed comes with the newgem generator.

The script folder holds the rails-like generator to run rubygem-based generators. This uses the rubigen project, an extraction of the rails generator. Its awesome. The rubyconf presentation is at http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html and project page is at http://rubigen.rubyforge.org/ (now with less evil red background)

The task folder was an idea that I had to allow ppl to hack the tasks within each project. I don't know anyone that has ever modified these tasks, so I'll be refactoring them back into newgem, just as hoe has them within hoe; so the tasks folder will go from future newgem versions.

setup.rb was something I added because some one once told me I should for all those masses of people who want to install packages without rubygems. I've never used it, and I think chris2 is the only bloke who has publically said he doesn't have rubygems installed.

The website folder is an optional (though turned on by default) static html generator that automatically uploads to a project's rubyforge site. Having rdoc output as a project's homepage does it no marketing justice. The website folder, and the associated "rake website" task encourages projects to create aesthetically pleasing front pages for their project that automatically posts to the http://projectname.rubyforge.org page, such as the http://rubigen.rubyforge.org/ page.

The config/requirements.rb file enforces development dependencies. Until rubygems 1.2 there was no way to specify "you need gem X + Y for development/testing, but not for general use" Gems created with newgem disabled hoe's self-allocation as a dependency, and only enforced and educated gem developers about dependencies when a rake task was called. Now, with rubygems 1.2, these dependencies can be added as development dependencies; making this file redundant which is great.

The config/hoe.rb file was to make the Rakefile clean. As for the tasks/*.rake folder, all this code should be extracted back into the newgem gem, and then hopefully a much smaller amount of config code can be returned to the Rakefile; just like a vanilla hoe gem.

Yes, newgem can generate less files; but more than you've included above. I appreciate the reminder.

Leave a comment

About this Entry

This page contains a single entry by zenspider published on August 23, 2008 3:24 PM.

Writing Extensions using Hoe was the previous entry in this blog.

[ANN/PIMP] Ruby Certificate Program @ University of Washington This Fall is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.32-en