80: def post
81: options = []
82: if bad?(input.service_name) or bad?(input.root) or bad?(input.environment) or bad?(input.address) or bad?(input.port)
83: @result = "ERROR: You must fill out all mandatory (*) fields."
84: render :install_result
85: else
86: options << ["-n", input.service_name]
87: options << ["-r", '"' + input.root + '"']
88: options << ["-e", input.environment]
89: options << ["-b", input.address]
90: options << ["-p", input.port]
91: options << ["-d", input.display_name] if good? input.display_name
92: options << ["-m", '"' + input.mime + '"'] if good? input.mime
93: options << ["-P", input.num_procs] if good? input.num_procs
94: options << ["-t", input.timeout] if good? input.timeout
95: options << ["-c", input.cpu] if good? input.cpu
96:
97: begin
98: @result = `ruby #$mongrel_rails_service install #{options.join(' ')}`
99: $service_logs << @result
100: rescue
101: @result = "Failed to start #{input.service_name}: #$!"
102: $service_logs << @result
103: end
104:
105: render :install_result
106: end
107: end