Class: Joggle::CLI::Runner
- Inherits:
-
Object
- Object
- Joggle::CLI::Runner
- Defined in:
- lib/joggle/cli/runner.rb
Overview
Basic command-line interface for Joggle.
Class Method Summary collapse
-
.run(app, args) ⇒ Object
Create and run a CLI object.
Instance Method Summary collapse
-
#initialize(app, args) ⇒ Runner
constructor
Create CLI object.
-
#run ⇒ Object
Run command-line interface.
Constructor Details
#initialize(app, args) ⇒ Runner
Create CLI object.
20 21 22 |
# File 'lib/joggle/cli/runner.rb', line 20 def initialize(app, args) @opt = OptionParser.run(app, args) end |
Class Method Details
.run(app, args) ⇒ Object
Create and run a CLI object.
13 14 15 |
# File 'lib/joggle/cli/runner.rb', line 13 def self.run(app, args) new(app, args).run end |
Instance Method Details
#run ⇒ Object
Run command-line interface.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/joggle/cli/runner.rb', line 27 def run if @opt['cli.daemon'] pid = Process.fork { $stderr.reopen('/dev/null', 'w') Joggle::Runner::PStore.run(@opt) exit 0; } # detach from background process Process.detach(pid) # print process id and exit $stderr.puts "Detached from pid #{pid}" else Joggle::Runner::PStore.run(@opt) end exit 0; end |