Class: Lucie::App

Inherits:
Object
  • Object
show all
Defined in:
lib/lucie/app.rb

Overview

App responsible for configuring and launch the application based on Lucie application framework.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, root) ⇒ App

Returns a new instance of App.



37
38
39
40
41
42
43
# File 'lib/lucie/app.rb', line 37

def initialize(command, root)
  @root = root
  @command = CommandLineParser.new(command)
  @exit_value ||= 0
  @task = nil
  @pwd = ENV["PWD"]
end

Class Attribute Details

.log_levelObject

Returns the value of attribute log_level.



11
12
13
# File 'lib/lucie/app.rb', line 11

def log_level
  @log_level
end

.raise_exceptionObject

Returns the value of attribute raise_exception.



10
11
12
# File 'lib/lucie/app.rb', line 10

def raise_exception
  @raise_exception
end

.rootObject

Returns the value of attribute root.



12
13
14
# File 'lib/lucie/app.rb', line 12

def root
  @root
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



17
18
19
# File 'lib/lucie/app.rb', line 17

def command
  @command
end

#pwdObject (readonly)

Returns the value of attribute pwd.



19
20
21
# File 'lib/lucie/app.rb', line 19

def pwd
  @pwd
end

#rootObject (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) ⇒ Object



27
28
29
30
# File 'lib/lucie/app.rb', line 27

def self.init(command = ARGV, root = nil)
  root ||= File.expand_path("..", File.dirname(Kernel.caller[0]))
  self.new(command, root)
end

.run(command = ARGV, root = nil) ⇒ Object



21
22
23
24
25
# File 'lib/lucie/app.rb', line 21

def self.run(command = ARGV, root = nil)
  root ||= File.expand_path("..", File.dirname(Kernel.caller[0]))
  instance = self.init(command, root)
  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

#envObject



53
54
55
# File 'lib/lucie/app.rb', line 53

def env
  ENV
end

#exit_valueObject



49
50
51
# File 'lib/lucie/app.rb', line 49

def exit_value
  @exit_value
end

#startObject



45
46
47
# File 'lib/lucie/app.rb', line 45

def start
  help? ? call_help : call_method_invoking_process
end