Class Picnic::Cli
In: lib/picnic/cli.rb
Parent: Object

Provides a command-line interface for your app. This is useful for creating a ‘bin’ file for launching your application.

Usage example (put this in a file called ‘foo’):

  #!/usr/bin/env ruby

  require 'rubygems'
  require 'picnic'

  require 'picnic/cli'

  cli = Picnic::Cli.new(
    'foo',
    :app_file => "/path/to/foo.br"
  )

  cli.handle_cli_input

Also see the ServiceControl class for info on how to use your cli script as a service.

Methods

Attributes

app  [RW] 
options  [RW] 

Public Class methods

Creates a new command-line interface handler.

app:The name of the application. This should match the name of the binary, which by default is expected to be in the same directory as the service control script.
options:A hash overriding default options. The options are:
app_file:The path to your application‘s main Ruby file. By default this is expected to be ../lib/<app>.rb
pid_file:Where the app‘s PID file (containing the app‘s process ID) should be placed. By default this is /etc/<app>/<app>.pid

Public Instance methods

Parses command line options given to the script.

[Validate]