Skip to content

Instantly share code, notes, and snippets.

@fredjean
Forked from matthewmccullough/Rakefile
Created February 1, 2011 19:16
Show Gist options
  • Save fredjean/806422 to your computer and use it in GitHub Desktop.
Save fredjean/806422 to your computer and use it in GitHub Desktop.
dirs = ["output/test/deepdir", "testdir", "another"]
task :default => dirs
dirs.each do |dir|
directory dir
end
# fjean@Prometheus ~/dev/gist-806422
# master* $ rake -t -v [13:22:23]
# (in /Users/fjean/dev/gist-806422)
# ** Invoke default (first_time)
# ** Invoke output/test/deepdir (first_time)
# ** Execute output/test/deepdir
# mkdir -p output/test/deepdir
# ** Invoke testdir (first_time)
# ** Execute testdir
# mkdir -p testdir
# ** Invoke another (first_time)
# ** Execute another
# mkdir -p another
# ** Execute default
@fredjean
Copy link
Author

fredjean commented Feb 1, 2011

The dirs are only created as needed. A second run yields:

fjean@Prometheus ~/dev/gist-806422
master $ rake -t -v                                                                 [13:23:12]
(in /Users/fjean/dev/gist-806422)
** Invoke default (first_time)
** Invoke output/test/deepdir (first_time, not_needed)
** Invoke testdir (first_time, not_needed)
** Invoke another (first_time, not_needed)
** Execute default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment