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
33
34
35
|
# File 'lib/ufo/core.rb', line 13
def app
return ENV['UFO_APP'] if ENV['UFO_APP']
if @@config_loaded
config.app
else
call_line = caller.find {|l| l.include?('.ufo') }
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.
Called from:
#{call_line}
EOL
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
71
72
73
74
75
|
# File 'lib/ufo/core.rb', line 71
def config
Config.instance.load_project_config
@@config_loaded = true
Config.instance.config
end
|
60
61
62
|
# File 'lib/ufo/core.rb', line 60
def configure(&block)
Config.instance.configure(&block)
end
|
#env ⇒ Object
v5: development is default v6: dev is default
39
40
41
|
# File 'lib/ufo/core.rb', line 39
def env
ENV['UFO_ENV'] || 'dev'
end
|
44
45
46
47
48
|
# File 'lib/ufo/core.rb', line 44
def
= ENV['UFO_EXTRA'] if ENV['UFO_EXTRA'] return if &.empty?
end
|
#log_root ⇒ Object
56
57
58
|
# File 'lib/ufo/core.rb', line 56
def log_root
"#{root}/log"
end
|
#logger ⇒ Object
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/ufo/core.rb', line 80
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
51
52
53
54
|
# File 'lib/ufo/core.rb', line 51
def root
path = ENV['UFO_ROOT'] || '.'
Pathname.new(path)
end
|