Module: App
- Defined in:
- lib/vex/base/app.rb
Defined Under Namespace
Modules: Etest
Class Method Summary collapse
- .development? ⇒ Boolean
- .env ⇒ Object
- .local_conf ⇒ Object
- .logger ⇒ Object
- .production? ⇒ Boolean
- .rails? ⇒ Boolean
- .revision ⇒ Object
- .root ⇒ Object
- .test? ⇒ Boolean
- .tmpdir ⇒ Object
Class Method Details
.development? ⇒ Boolean
24 25 26 |
# File 'lib/vex/base/app.rb', line 24 def self.development? env == "development" end |
.env ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/vex/base/app.rb', line 14 def self.env if rails? RAILS_ENV elsif defined?(APP_ENV) APP_ENV else "production" end end |
.local_conf ⇒ Object
73 74 75 76 |
# File 'lib/vex/base/app.rb', line 73 def self.local_conf @local_conf = nil if App.env == "development" @local_conf ||= LocalConf.new("local.yml") end |
.logger ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vex/base/app.rb', line 46 def self.logger if rails? RAILS_DEFAULT_LOGGER else require "logger" logdir = "#{root}/log" FileUtils.mkdir_p logdir Logger.new "#{logdir}/#{env}.log" end end |
.production? ⇒ Boolean
28 29 30 |
# File 'lib/vex/base/app.rb', line 28 def self.production? env == "production" end |
.rails? ⇒ Boolean
2 3 4 |
# File 'lib/vex/base/app.rb', line 2 def self.rails? defined?(RAILS_ROOT) end |
.revision ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/vex/base/app.rb', line 6 def self.revision @revision ||= begin "r#{File.read("#{root}/REVISION")}" rescue Errno::ENOENT "" end end |
.root ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/vex/base/app.rb', line 36 def self.root if defined?(RAILS_ROOT) RAILS_ROOT elsif defined?(APP_ROOT) APP_ROOT else raise "Cannot determine application root" end end |
.test? ⇒ Boolean
32 33 34 |
# File 'lib/vex/base/app.rb', line 32 def self.test? env == "test" end |