bin/marvin in Sutto-marvin-0.2.1 vs bin/marvin in Sutto-marvin-0.2.2
- old
+ new
@@ -73,11 +73,12 @@
@dest = File.expand_path(path)
start_script(:ring_server)
end
desc "distributed_client [PATH]", "starts a distributed client from the given location"
- method_options :verbose => :boolean, :daemon => :boolean, :level => :optional, :kill => :boolean
+ method_options :verbose => :boolean, :daemon => :boolean, :level => :optional,
+ :kill => :boolean, :nodes => :numeric
def distributed_client(path = ".")
@dest = File.expand_path(path)
start_script(:distributed_client)
end
@@ -122,10 +123,24 @@
extra_args = []
extra_args << "-k" if options[:kill]
extra_args << "-v" if options[:verbose]
extra_args << "-d" if options[:daemon]
extra_args << "--level=#{options[:level]}" if options[:level]
- Dir.chdir(@dest) { exec("script/#{name}", *extra_args) }
+ if options[:daemon] && options[:nodes]
+ nodes = options[:nodes]
+ else
+ nodes = 1
+ end
+ Dir.chdir(@dest) do
+ # Lets you start a number of different processes.
+ # uses system if there are more than 1 nodes, exec
+ # otherwise.
+ if nodes > 1
+ nodes.times { system("script/#{name}", *extra_args) }
+ else
+ exec("script/#{name}", *extra_args)
+ end
+ end
else
STDOUT.puts "Woop! #{@dest.gsub(" ", "\\ ")} isn't a marvin app."
end
end
\ No newline at end of file