To edit pages or tickets please login with username/password: aaf/aaf

Changeset 294

Show
Ignore:
Timestamp:
12/16/07 20:44:21 (10 months ago)
Author:
jk
Message:

apply patch from #184 - add run option to ferret_server script making it block

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plugin/acts_as_ferret/lib/ferret_server.rb

    r259 r294  
    7070 
    7171      ################################################################################ 
    72       # start the server 
     72      # start the server as a daemon process 
    7373      def start 
    7474        raise "ferret_server not configured for #{RAILS_ENV}" unless (@cfg.uri rescue nil) 
     75        platform_daemon { run_drb_service } 
     76      end 
     77 
     78      ################################################################################ 
     79      # run the server and block until it exits 
     80      def run 
     81        raise "ferret_server not configured for #{RAILS_ENV}" unless (@cfg.uri rescue nil) 
     82        run_drb_service 
     83      end 
     84 
     85      def run_drb_service 
    7586        $stdout.puts("starting ferret server...") 
    76  
    77         platform_daemon do  
    78           self.class.running = true 
    79           DRb.start_service(@cfg.uri, self) 
    80           DRb.thread.join 
    81         end 
     87        self.class.running = true 
     88        DRb.start_service(@cfg.uri, self) 
     89        DRb.thread.join 
    8290      rescue Exception => e 
    8391        @logger.error(e.to_s) 
  • trunk/plugin/acts_as_ferret/lib/server_manager.rb

    r292 r294  
    1111################################################################################ 
    1212OptionParser.new do |optparser| 
    13   optparser.banner = "Usage: #{File.basename($0)} [options] {start|stop}" 
     13  optparser.banner = "Usage: #{File.basename($0)} [options] {start|stop|run}" 
    1414 
    1515  optparser.on('-h', '--help', "This message") do 
     
    3434 
    3535  $ferret_server_action = $ferret_server_action.first 
    36   (puts optparser; exit(1)) unless %w(start stop).include?($ferret_server_action) 
     36  (puts optparser; exit(1)) unless %w(start stop run).include?($ferret_server_action) 
    3737end 
    3838 

To edit pages or tickets please login with username/password: aaf/aaf