test/daemon.rb in rexec-1.4.1 vs test/daemon.rb in rexec-1.5.0
- old
+ new
@@ -18,12 +18,13 @@
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-require 'rubygems'
+$LOAD_PATH.unshift File.expand_path("../../lib/", __FILE__)
+require 'rubygems'
require 'pathname'
require 'rexec'
require 'rexec/daemon'
@@ -31,43 +32,41 @@
require 'webrick/https'
require 'xmlrpc/server'
# Very simple XMLRPC daemon
class TestDaemon < RExec::Daemon::Base
- @@var_directory = "/tmp/ruby-test/var"
+ @@var_directory = "/tmp/ruby-test/var"
- def self.run
- puts "Starting server..."
+ def self.run
+ puts "Starting server..."
- @@rpc_server = WEBrick::HTTPServer.new(
- :Port => 11235,
- :BindAddress => "0.0.0.0",
- :SSLEnable => true,
- :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
- :SSLCertName => [["CN", WEBrick::Utils::getservername]])
-
- @@listener = XMLRPC::WEBrickServlet.new
-
- @@listener.add_handler("add") do |amount|
- @@count ||= 0
- @@count += amount
- end
-
- @@listener.add_handler("total") do
- @@count
- end
-
- @@rpc_server.mount("/RPC2", @@listener)
-
- $stdout.flush
- $stderr.flush
-
- @@rpc_server.start
- end
-
- def self.shutdown
+ @@rpc_server = WEBrick::HTTPServer.new(
+ :Port => 31337,
+ :BindAddress => "0.0.0.0"
+ )
+
+ @@listener = XMLRPC::WEBrickServlet.new
+
+ @@listener.add_handler("add") do |amount|
+ @@count ||= 0
+ @@count += amount
+ end
+
+ @@listener.add_handler("total") do
+ @@count
+ end
+
+ @@rpc_server.mount("/RPC2", @@listener)
+
+ $stdout.flush
+ $stderr.flush
+
+ @@rpc_server.start
+ end
+
+ def self.shutdown
puts "Shutting down server..."
- @@rpc_server.shutdown
- end
+ @@rpc_server.shutdown
+ end
end
TestDaemon.daemonize