Sha256: b92eb2889822121dab4e835d6f7148195b637b55ee1c4c3b36f26ae4783a6b40
Contents?: true
Size: 1.38 KB
Versions: 6
Compression:
Stored size: 1.38 KB
Contents
module App def self.rails? defined?(RAILS_ROOT) end def self.revision @revision ||= begin "r#{File.read("#{root}/REVISION")}" rescue Errno::ENOENT "" end end def self.env if rails? RAILS_ENV elsif defined?(APP_ENV) APP_ENV else "production" end end def self.development? env == "development" end def self.production? env == "production" end def self.test? env == "test" end def self.root if defined?(RAILS_ROOT) RAILS_ROOT elsif defined?(APP_ROOT) APP_ROOT else raise "Cannot determine application root" end end 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 def self.tmpdir @tmpdir ||= begin tmpdir = if rails? "#{root}/tmp" else ENV["TMPDIR"] end tmpdir = tmpdir.gsub(/\/$/, "") raise "Cannot determine tmpdir setting" if tmpdir.blank? tmpdir end end def self.local_conf @local_conf = nil if App.env == "development" @local_conf ||= LocalConf.new("local.yml") end end module App::Etest def test_app assert_not_nil(App.root) end def test_app assert_equal("", App.revision) end end if VEX_TEST == "base"
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
vex-0.3.3 | lib/vex/base/app.rb |
vex-0.2.9 | lib/vex/base/app.rb |
vex-0.2.8 | lib/vex/base/app.rb |
vex-0.2.7 | lib/vex/base/app.rb |
vex-0.2.6 | lib/vex/base/app.rb |
vex-0.2.5 | lib/vex/base/app.rb |