Module: Totem
- Defined in:
- lib/totem.rb,
lib/totem/shell.rb,
lib/totem/version.rb,
lib/totem/shell_cmds/new.rb,
lib/totem/shell_cmds/base.rb,
lib/totem/shell_cmds/console.rb
Defined Under Namespace
Modules: ShellCmds
Classes: Shell
Constant Summary
collapse
- VERSION =
'0.0.7'
Class Method Summary
collapse
Class Method Details
.component ⇒ Object
41
42
43
|
# File 'lib/totem.rb', line 41
def self.component
return @component ||= ENV['TOTEM_COMPONENT']
end
|
.component=(val) ⇒ Object
45
46
47
48
|
# File 'lib/totem.rb', line 45
def self.component=(val)
raise 'component may only be set once and must be set before calling logger' if @logger || @component
@component = val
end
|
.env ⇒ Object
28
29
30
|
# File 'lib/totem.rb', line 28
def self.env
return (@env ||= (ENV['TOTEM_ENV'] || 'development'))
end
|
.env=(val) ⇒ Object
32
33
34
35
|
# File 'lib/totem.rb', line 32
def self.env=(val)
raise 'env may only be set once and must be set before calling logger' if @logger || @env
@env = val
end
|
.initialize(root) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/totem.rb', line 10
def self.initialize(root)
raise 'Already initialized.' if @setup
@setup = true
@root = root
Bundler.require(Totem.env.to_sym)
run_callbacks(:before_load_app)
$LOAD_PATH.unshift(root + '/app')
load_app
run_callbacks(:after_load_app)
return true
end
|
.instance ⇒ Object
50
51
52
|
# File 'lib/totem.rb', line 50
def self.instance
return @instance || ENV['TOTEM_INSTANCE']
end
|
.instance=(val) ⇒ Object
54
55
56
57
|
# File 'lib/totem.rb', line 54
def self.instance=(val)
raise 'instance may only be set once and must be set before calling logger' if @logger || @instance
@instance = val
end
|
.load_app ⇒ Object
37
38
39
|
# File 'lib/totem.rb', line 37
def self.load_app
require "#{Totem.root}/app/loader.rb"
end
|
.log_file_path ⇒ Object
86
87
88
|
# File 'lib/totem.rb', line 86
def self.log_file_path
return File.join(root, 'log', "#{process_name}.log")
end
|
.logger ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/totem.rb', line 63
def self.logger
return @logger if @logger
log_to_file
return @logger
end
|
.logger=(val) ⇒ Object
59
60
61
|
# File 'lib/totem.rb', line 59
def self.logger=(val)
return @logger = val
end
|
.process_name ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/totem.rb', line 78
def self.process_name
name = "#{env}"
name << "_#{component}" if component && component.length > 0
name << "_#{instance}" if instance && instance.length > 0
return name
end
|
.register_callback(type, callback = nil, &block) ⇒ Object
71
72
73
74
75
76
|
# File 'lib/totem.rb', line 71
def self.register_callback(type, callback=nil, &block)
@callbacks ||= {}
(@callbacks[type] ||= []) << (callback || block)
return true
end
|
.root ⇒ Object
24
25
26
|
# File 'lib/totem.rb', line 24
def self.root
return @root
end
|