Module: Ufo::Core
- Extended by:
- Memoist
- Includes:
- Utils::Pretty
- Included in:
- Ufo
- Defined in:
- lib/ufo/core.rb
Instance Method Summary
collapse
#pretty_home, #pretty_path, #pretty_time
Instance Method Details
#app ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/ufo/core.rb', line 13
def app
return ENV['UFO_APP'] if ENV['UFO_APP']
if @@config_loaded
config.app
else
puts "ERROR: Using Ufo.app or :APP expansion very early in the UFO boot process".color(:red)
puts <<~EOL.color(:red)
The Ufo.app or :APP expansions are not yet available at this point
You can either:
1. Use the UFO_APP env var to set it, which allows it to be used.
2. Hard code your actual app name.
EOL
call_line = caller.find {|l| l.include?('.ufo') }
DslEvaluator.print_code(call_line)
exit 1
end
end
|
#config ⇒ Object
In general, use the Ufo.config instead of Config.instance.config since it guarantees the load_project_config call
68
69
70
71
72
|
# File 'lib/ufo/core.rb', line 68
def config
Config.instance.load_project_config
@@config_loaded = true
Config.instance.config
end
|
57
58
59
|
# File 'lib/ufo/core.rb', line 57
def configure(&block)
Config.instance.configure(&block)
end
|
#env ⇒ Object
v5: development is default v6: dev is default
36
37
38
|
# File 'lib/ufo/core.rb', line 36
def env
ENV['UFO_ENV'] || 'dev'
end
|
41
42
43
44
45
|
# File 'lib/ufo/core.rb', line 41
def
= ENV['UFO_EXTRA'] if ENV['UFO_EXTRA'] return if &.empty?
end
|
#log_root ⇒ Object
53
54
55
|
# File 'lib/ufo/core.rb', line 53
def log_root
"#{root}/log"
end
|
#logger ⇒ Object
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/ufo/core.rb', line 77
def logger
if @@config_loaded
@@logger = config.logger
else
@@logger ||= Logger.new(ENV['UFO_LOG_PATH'] || $stderr)
end
end
|
#role ⇒ Object
9
10
11
|
# File 'lib/ufo/core.rb', line 9
def role
ENV['UFO_ROLE'] || 'web'
end
|
#root ⇒ Object
48
49
50
51
|
# File 'lib/ufo/core.rb', line 48
def root
path = ENV['UFO_ROOT'] || '.'
Pathname.new(path)
end
|