Class: Lucie::App
- Inherits:
-
Object
- Object
- Lucie::App
- Defined in:
- lib/lucie/app.rb
Overview
App responsible for configuring and launch the application based on Lucie application framework.
Class Attribute Summary collapse
-
.log_level ⇒ Object
Returns the value of attribute log_level.
-
.raise_exception ⇒ Object
Returns the value of attribute raise_exception.
-
.root ⇒ Object
Returns the value of attribute root.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#pwd ⇒ Object
readonly
Returns the value of attribute pwd.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Class Method Summary collapse
- .init(command = ARGV, root = nil, pwd = nil) ⇒ Object
- .run(command = ARGV, root = nil, pwd = nil) ⇒ Object
- .start(instance) ⇒ Object
Instance Method Summary collapse
- #env ⇒ Object
- #exit_value ⇒ Object
-
#initialize(command, root, pwd = nil) ⇒ App
constructor
A new instance of App.
- #start ⇒ Object
Constructor Details
#initialize(command, root, pwd = nil) ⇒ App
Returns a new instance of App.
37 38 39 40 41 42 43 44 |
# File 'lib/lucie/app.rb', line 37 def initialize(command, root, pwd = nil) @root = root @command = CommandLineParser.new(command) @exit_value ||= 0 @task = nil @pwd = pwd || ENV["PWD"] Dir.chdir(@pwd) end |
Class Attribute Details
.log_level ⇒ Object
Returns the value of attribute log_level.
11 12 13 |
# File 'lib/lucie/app.rb', line 11 def log_level @log_level end |
.raise_exception ⇒ Object
Returns the value of attribute raise_exception.
10 11 12 |
# File 'lib/lucie/app.rb', line 10 def raise_exception @raise_exception end |
.root ⇒ Object
Returns the value of attribute root.
12 13 14 |
# File 'lib/lucie/app.rb', line 12 def root @root end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
17 18 19 |
# File 'lib/lucie/app.rb', line 17 def command @command end |
#pwd ⇒ Object (readonly)
Returns the value of attribute pwd.
19 20 21 |
# File 'lib/lucie/app.rb', line 19 def pwd @pwd end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
18 19 20 |
# File 'lib/lucie/app.rb', line 18 def root @root end |
Class Method Details
.init(command = ARGV, root = nil, pwd = nil) ⇒ Object
27 28 29 30 |
# File 'lib/lucie/app.rb', line 27 def self.init(command = ARGV, root = nil, pwd = nil) root ||= File.("..", File.dirname(Kernel.caller[0])) self.new(command, root, pwd) end |
.run(command = ARGV, root = nil, pwd = nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/lucie/app.rb', line 21 def self.run(command = ARGV, root = nil, pwd = nil) root ||= File.("..", File.dirname(Kernel.caller[0])) instance = self.init(command, root, pwd) self.start(instance) end |
.start(instance) ⇒ Object
32 33 34 35 |
# File 'lib/lucie/app.rb', line 32 def self.start(instance) instance.start instance.exit_value end |
Instance Method Details
#env ⇒ Object
54 55 56 |
# File 'lib/lucie/app.rb', line 54 def env ENV end |
#exit_value ⇒ Object
50 51 52 |
# File 'lib/lucie/app.rb', line 50 def exit_value @exit_value end |
#start ⇒ Object
46 47 48 |
# File 'lib/lucie/app.rb', line 46 def start help? ? call_help : call_method_invoking_process end |