colinsurprenant / raad

Ruby as a Daemon
Other
48 stars 7 forks source link

bootstrap-less option #8

Open bporterfield opened 12 years ago

bporterfield commented 12 years ago

Hello! Thanks for this gem!

I have an existing Thor-based command-line interface that I want to have start|stop to daemonize, but also needs a variety of other CLI options. The way the Raad gem is currently set up with bootstrapping, it appears to assume that the only command-line options are start/stop. It also seems to makes assumptions based on the current filename for service initiation that, in my case, would not make sense.

I can hack what I need together with some ideas from this gem, but this is what I would have loved to see:

in bin/my_app:

require 'raad'
require 'thor'

class MyApp < Thor

  default_task :start

  desc "Start My App", "Starts App Server"
  def start

    daemonize = true

    if daemonize
      Raad::Runner.new('ruby path_to_my_service_starter.rb').daemonize
    else
      MyServiceStarter.run
    end
  end

  desc "Some other option I need"
  def my_option
  end

end

Or something to this effect. Not really an issue, just a suggestion. Thanks again.

colinsurprenant commented 12 years ago

Hi Ben,

Thanks for your interest and you suggestion.

You are right that using Raad in an existing project which already handle command line options is a pain, and frankly, I did not really pay much attention to this as my primary goal was to make it work for my own usage pattern.

I will definitely give some thoughts on how to facilitate integration into existing projects. In particular, I am starting to play with Thor in another project (RedStorm). I'll see if it make sense to integrate Thor into Raad too and see if it can help with this issue.

Keep the suggestions comin' :)

Colin