--
thanks,
-pate
-------------------------
We are often unable to tell people what they need to know, because
they want to know something else, and would therefore only
misunderstand what we said
- the Raven (George MacDonald, Lilith)
>I'm wrapping up a tutorial on Rake for IBM (but probably won't be published
>for 2-3 months), and I wanted to make a request to the community. Does
>anyone have an interesting, useful rake task or rule they'd be interested in
>sharing? I'd like to include a short cookbook at the end of the article with
>some example code and explanations. You'll get credit in the text if I end up
>using your code (or build something based on it). You can respond to me off
>list if you like, but it might make for an interesting discussion here.
>
>
>
>
Hey bud,
How's the new job going ?
Where did you get positioned ??? Still in Seattle?
Anyways, just shoutin' to my homie.
Ciao for now.
j.
> I'm wrapping up a tutorial on Rake for IBM (but probably won't be published
> for 2-3 months), and I wanted to make a request to the community. Does
> anyone have an interesting, useful rake task or rule they'd be interested in
> sharing? I'd like to include a short cookbook at the end of the article with
> some example code and explanations. You'll get credit in the text if I end up
> using your code (or build something based on it). You can respond to me off
> list if you like, but it might make for an interesting discussion here.
I made Rake package my software with help from darcs:
PROJECT = "mycoolapp"
desc "Do predistribution stuff"
task :predist => [:chmod, :changelog, :doc]
desc "Make an archive as .tar.gz"
task :dist => :test do
system "export DARCS_REPO=#{File.expand_path "."}; " +
"darcs dist -d #{PROJECT}#{get_darcs_tree_version}"
end
desc "Make binaries executable"
task :chmod do
Dir["bin/*"].each { |binary| File.chmod(0775, binary) }
end
desc "Generate a ChangeLog"
task :changelog do
system "darcs changes --repo=#{ENV["DARCS_REPO"] || "."} >ChangeLog"
end
# Helper to retrieve the "revision number" of the darcs tree.
def get_darcs_tree_version
return "" unless File.directory? "_darcs"
changes = `darcs changes`
count = 0
tag = "0.0"
changes.each("\n\n") { |change|
head, title, desc = change.split("\n", 3)
if title =~ /^ \*/
# Normal change.
count += 1
elsif title =~ /tagged (.*)/
# Tag. We look for these.
tag = $1
break
else
warn "Unparsable change: #{change}"
end
}
"-#{tag}.#{count}"
end
I set the darcs preferences to call "rake predist" after checking out,
so I can just run "rake dist" and quickly get a packaged version of my
project, named after the last tag (I use version numbers for those,
0.1, 0.2 etc.) and the number of patches following it; it includes
rdoc HTML, a Changelog and has permissions set right.
Nothing revolutionary, but very useful.
> thanks,
> -pate
--
Christian Neukirchen <chneuk...@gmail.com> http://chneukirchen.org