From 79c986c77eb134d83d46e9267a388ec48d26d630 Mon Sep 17 00:00:00 2001 From: quix Date: Sat, 13 Sep 2008 15:50:05 -0400 Subject: [PATCH] allow --rand to take a string. Make full name --randomize. --- README | 8 +++++--- lib/rake.rb | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README b/README index b63890ddc..e72dfd095 100644 --- a/README +++ b/README @@ -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 -srand(SEED) to produce the same permutation each time. The -randomize option also disables +multitask+. +When given the optional SEED string, it will call +srand(SEED.hash) 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 diff --git a/lib/rake.rb b/lib/rake.rb index 041d486fb..5aa9b71c5 100755 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -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 } ],