Sha256: 561cac3d71d9ffe2a71bc1a9f7eacb12617b3c32c637730605d824a9ae21853b

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require 'trinidad'
require 'trinidad/jars'
require 'trinidad/extensions'

require 'trinidad_daemon_extension/jars'
require 'trinidad_daemon_extension/tomcat_wrapper'
require 'trinidad_daemon_extension/version'

module Trinidad
  module Extensions
    class DaemonServerExtension < ServerExtension
      def configure(tomcat)
        Trinidad::Extensions::Daemon::TomcatWrapper.new(tomcat, pid_file, jvm_args)
      end

      def override_tomcat?; true; end

      def pid_file
        @options[:pid_file]
      end
      
      def jvm_args
        @options[:jvm_args] ? @options[:jvm_args].split : []
      end
    end

    class DaemonOptionsExtension < OptionsExtension
      def configure(parser, default_options)
        message = 'run Trinidad as a daemon, PID_FILE defaults to ENV[TMPDIR]/trinidad.pid'
        parser.on('--daemonize', '--daemonize [PID_FILE]', message) do |pid|
          extensions = default_options[:extensions] || {}
          extensions[:daemon] = { :pid_file => pid }
          default_options[:extensions] = extensions
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trinidad_daemon_extension-0.3.1 lib/trinidad_daemon_extension.rb