Changeset 231

Show
Ignore:
Timestamp:
05/03/07 13:07:50 (2 years ago)
Author:
e.@brainspl.at
Message:

commiting rogelio's patch for a merb script/runner alike, closes #43 , thanks rogelio

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/merb_server.rb

    r198 r231  
    9292          end 
    9393           
     94          opts.on("-r", "--script-runner ['RUBY CODE'| FULL_SCRIPT_PATH]", "Command-line option to run scripts and/or code in the merb app") do |stuff_to_run| 
     95            options[:runner] = stuff_to_run 
     96          end 
     97           
    9498          opts.on("-g", "--generate-app PATH", "Generate a fresh merb app at PATH") do |path| 
    9599            options[:generate] = path || Dir.pwd 
     
    103107            options[:merb_config] = config 
    104108          end 
    105            
    106           opts.on("-X", "--mutex on/off", "This flag is for turnhing on and off the mutex lock.") do |mutex| 
     109          
     110          opts.on("-X", "--mutex on/off", "This flag is for turning the mutex lock on and off.") do |mutex| 
    107111            if mutex == 'off' 
    108112              options[:use_mutex] = false 
     
    204208          exit! 
    205209        end 
     210 
     211        if @@merb_opts[:runner] 
     212          initialize_merb 
     213          code_or_file = @@merb_opts[:runner]  
     214          if File.exists?(code_or_file) 
     215            eval(File.read(code_or_file)) 
     216          else 
     217            eval(code_or_file) 
     218          end 
     219          exit! 
     220        end 
    206221         
    207222        if @@merb_opts[:start_drb]