fix subtle newref decode bug
[fuzed.git] / bin / fuzed
blob59b5fae352607953694cad28a60f924adfaa92fe
1 #!/usr/bin/env ruby
3 # require 'fuzed'
4 require File.join(File.dirname(__FILE__), *%w[.. lib fuzed])
6 require 'optparse'
7 require 'pp'
9 options = {}
10 OptionParser.new do |opts|
11 opts.banner = "Usage: fuzed command [options]"
13 opts.on("-c CONFIG", "--config CONFIG", "Path to Yaws config file") do |n|
14 options[:config] = n
15 end
17 opts.on("-n NAME", "--name NAME", "Node name") do |n|
18 options[:name] = n
19 end
21 opts.on("-m NAME", "--master NAME", "Master node name") do |n|
22 options[:master_name] = n
23 end
25 opts.on("-r RAILS_ROOT", "--rails RAILS_ROOT", "Path to Rails root") do |a|
26 options[:rails] = a
27 end
28 end.parse!
30 command = ARGV[0]
32 case command
33 when 'start'
34 config = options[:config]
35 nodename = options[:name]
37 puts "Starting yaws server with name: #{nodename}"
38 system %Q{yaws --conf #{config} --pa #{Fuzed.relative 'elibs'} -name "#{nodename}" --runmod rails_connection_pool}
39 when 'join'
40 nodename = options[:name]
41 master = options[:master_name]
42 rails = options[:rails]
44 puts "Starting a client named #{nodename} offering service to #{master}"
45 puts "Each node will run: 'fuzed-adapter #{rails}'"
46 system %Q{cd #{Fuzed.root}; erl -noshell -name #{nodename} -eval "join_cluster:start('#{master}','fuzed-adapter #{rails}')."}
47 else
48 puts 'Invalid command'
49 end
51 __END__
53 ruby-prof -p graph_html -f graph.html