Permalink
Browse files

updated docs and comments. getting ready for 0.3.0

git-svn-id: svn+ssh://rubyforge.org/var/svn/rake/trunk@103 5af023f1-ac1a-0410-98d6-829a145c37ef
  • Loading branch information...
1 parent 2d6c1bf commit 0a5d4accd69edb554ebb57868495fba6fabdf94e jimweirich committed Nov 22, 2003
View
@@ -1,5 +1,13 @@
= Rake Changelog
+== Version 0.2.9
+
+This version contains numerous changes as the RubyConf.new(2003)
+presentation was being prepared. The changes include:
+
+* The monolithic rubyapp task library is in the process of being
+ dropped in favor of lighter weight task libraries.
+
== Version 0.2.7
* Added "desc" for task descriptions.
View
@@ -150,7 +150,7 @@ Options are:
[<tt>--require</tt> _name_ (-r)]
Require _name_ before executing the Rakefile.
-[<tt>--tasks</tt> (-h)]
+[<tt>--tasks</tt> (-T)]
Display a list of the major tasks and their comments. Comments
are defined using the "desc" command.
View
@@ -57,6 +57,7 @@ end
Rake::RDocTask.new { |rdoc|
rdoc.rdoc_dir = 'html'
rdoc.template = 'kilmer'
+# rdoc.template = 'css2'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.add('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
rdoc.rdoc_files.add('lib/**/*.rb', 'doc/**/*.rdoc', 'test/*.rb')
@@ -85,13 +86,17 @@ spec = Gem::Specification.new do |s|
s.require_path = 'lib'
s.autorequire = 'rake'
s.files = PKG_FILES
+ s.description = <<EOF
+Rake is a Make-like program implemented in Ruby. Tasks
+and dependencies are specified in standard Ruby syntax.
+EOF
end
-Rake::PackageTask.new { |pkg|
+Rake::PackageTask.new do |pkg|
pkg.gem_spec = spec
pkg.need_zip = true
pkg.need_tar = true
-}
+end
# Misc tasks =========================================================
View
@@ -84,7 +84,7 @@ given two object files name <tt>a.o</tt> and <tt>b.o</tt>. The tasks
for creating <tt>a.o</tt> and <tt>b.o</tt> are not shown.
file "prog" => ["a.o", "b.o"] do |t|
- Sys.run "cc -o #{t.name} #{t.prerequisites.join(' ')}"
+ sh "cc -o #{t.name} #{t.prerequisites.join(' ')}"
end
== Directory Tasks
@@ -98,17 +98,17 @@ that creates the directory. For example, the following declaration
is equivalent to ...
- file "testdata" do |t| Sys.makedirs(t.name) end
- file "testdata/examples" do |t| Sys.makedirs(t.name) end
- file "testdata/examples/doc" do |t| Sys.makedirs(t.name) end
+ file "testdata" do |t| mkdir t.name end
+ file "testdata/examples" do |t| mkdir t.name end
+ file "testdata/examples/doc" do |t| mkdir t.name end
The +directory+ method does not accept prerequisites or actions, but
both prerequisites and actions can be added later. For example ...
directory "testdata"
file "testdata" => ["otherdata"]
file "testdata" do
- Sys.copy_files "standard_data/*.data", testdata
+ cp Dir["standard_data/*.data"], "testdata"
end
== Rules
View
@@ -75,13 +75,15 @@ Some quick examples ...
A simple task to delete backup files ...
task :clean do
- Dir['*~'].each {|fn| File.delete(fn) rescue nil }
+ Dir['*~'].each {|fn| rm fn rescue nil}
end
-Note that task names are symbols (they are slightly easier to type than
-quoted strings ... but you may use quoted string if you would rather).
-Note also the use of "rescue nil" to trap and ignore errors in the
-File.delete command.
+Note that task names are symbols (they are slightly easier to type
+than quoted strings ... but you may use quoted string if you would
+rather). Rake makes the methods of the FileUtils module directly
+available, so we take advantage of the <tt>rm</tt> command. Also note
+the use of "rescue nil" to trap and ignore errors in the <tt>rm</tt>
+command.
To run it, just type "rake clean". Rake will automatically find a
Rakefile in the current directory (or above!) and will invoke the
@@ -91,12 +93,11 @@ named, rake will invoke the task "default".
Here's another task with dependencies ...
task :clobber => [:clean] do
- sys %{rm -r tempdir}
+ rm_r "tempdir"
end
Task :clobber depends upon task :clean, so :clean will be run before
-:clobber is executed. "sys" is short for the "system" command (with an
-echo to standard out).
+:clobber is executed.
Files are specified by using the "file" command. It is similar to the
task command, except that the task name represents a file, and the task
@@ -109,14 +110,12 @@ Here is a file based dependency that will compile "hello.cc" to
file "hello.cc"
file "hello.o" => ["hello.cc"] do |t|
srcfile = t.name.sub(/\.o$/, ".cc")
- sys %{g++ #{srcfile} -c -o #{t.name}}
+ sh %{g++ #{srcfile} -c -o #{t.name}}
end
I normally specify file tasks with string (rather than symbols). Some
file names can't be represented by symbols. Plus it makes the
-distinction between them more clear to the casual reader. And yes,
-currently the "hello.cc" task with no prerequisites and no actions is
-required.
+distinction between them more clear to the casual reader.
Currently writing a task for each and every file in the project would be
tedious at best. I envision a set of libraries to make this job
@@ -136,7 +135,7 @@ message). Does this sound interesting to anyone? If so, I'll continue
to clean it up and write it up and publish it on RAA. Otherwise, I'll
leave it as an interesting excerise and a tribute to the power of Ruby.
-Why /might/ rake be intersting to Ruby programmers. I don't know,
+Why /might/ rake be interesting to Ruby programmers. I don't know,
perhaps ...
* No weird make syntax (only weird Ruby syntax :-)
@@ -150,4 +149,3 @@ perhaps ...
So ... Sorry for the long rambling message. Like I said, I never
intended to write this code at all.
-
Oops, something went wrong.

0 comments on commit 0a5d4ac

Please sign in to comment.