Skip to content

Commit

Permalink
allow --rand to take a string. Make full name --randomize.
Browse files Browse the repository at this point in the history
  • Loading branch information
quix committed Sep 13, 2008
1 parent c8de9d3 commit 79c986c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ closer to saying what you mean.
% drake --rand[=SEED]

This will randomize the order of sibling prerequisites for each task.
When given the optional SEED integer, it will call
<tt>srand(SEED)</tt> to produce the same permutation each time. The
randomize option also disables +multitask+.
When given the optional SEED string, it will call
<tt>srand(SEED.hash)</tt> to produce the same permutation each time
(String#hash produces the integer which is the seed). The randomize
option also disables +multitask+, making it a regular unthreaded
+task+.

Though this option may produce an error due to an unspecified
dependency, at least it will be an error which is exactly the same on
Expand Down
4 changes: 2 additions & 2 deletions lib/rake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2282,12 +2282,12 @@ def standard_rake_options
['--threads', '-j N', "Specifies the number of threads to run simultaneously.",
lambda { |value| self.num_threads = value.to_i }
],
['--rand[=SEED]', "Randomize task prerequisite orders",
['--randomize[=SEED]', "Randomize task prerequisite orders",
lambda { |value|
MultiTask.class_eval { remove_method(:invoke_prerequisites) }
options.randomize = true
if value
srand(value.to_i)
srand(value.hash)
end
}
],
Expand Down

0 comments on commit 79c986c

Please sign in to comment.