Module: Application::Defaults
- Included in:
- Application
- Defined in:
- lib/ruby-app/application_defaults.rb
Instance Method Summary collapse
- #bundler_group ⇒ Object
- #config ⇒ Object
- #env ⇒ Object (also: #environment)
- #error_mailer ⇒ Object
- #hostname ⇒ Object
- #identifier ⇒ Object
- #initializer_paths ⇒ Object
- #logger ⇒ Object
- #logger_dir ⇒ Object
- #rake_paths ⇒ Object
- #revision ⇒ Object
- #started_at ⇒ Object
- #tmp_dir ⇒ Object
Instance Method Details
#bundler_group ⇒ Object
62 63 |
# File 'lib/ruby-app/application_defaults.rb', line 62 def bundler_group end |
#config ⇒ Object
46 47 48 |
# File 'lib/ruby-app/application_defaults.rb', line 46 def config CommonConfig end |
#env ⇒ Object Also known as: environment
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ruby-app/application_defaults.rb', line 15 def env @gem_env ||= begin env = ENV['APP_ENV'] || ENV['RAILS_ENV'] # if not specify env, try find file with env config/environment.current # which created this file by a capistrano, by example unless env path = File.join(root, %w{ config environment.current }) if File.exists?(path) env = File.read(path) env.strip! end end env = 'development' unless env env end end |
#error_mailer ⇒ Object
69 70 71 |
# File 'lib/ruby-app/application_defaults.rb', line 69 def error_mailer ErrorMailer end |
#hostname ⇒ Object
77 78 79 |
# File 'lib/ruby-app/application_defaults.rb', line 77 def hostname @_hostname ||= `hostname`.chop end |
#identifier ⇒ Object
50 51 52 |
# File 'lib/ruby-app/application_defaults.rb', line 50 def identifier "ruby-app" end |
#initializer_paths ⇒ Object
58 59 60 |
# File 'lib/ruby-app/application_defaults.rb', line 58 def initializer_paths @gem_initializer_paths ||= [] end |
#logger ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/ruby-app/application_defaults.rb', line 37 def logger @gem_logger ||= begin file = env.to_s['test'] ? File.open(File.join(logger_dir, "#{name rescue 'ruby-app'}.log"), "a") : STDERR LocalLogger.new(file).tap do |l| l.level = App.config.log_level end end end |
#logger_dir ⇒ Object
11 12 13 |
# File 'lib/ruby-app/application_defaults.rb', line 11 def logger_dir @gem_logger_dir ||= File.join(root, %w{log}) end |
#rake_paths ⇒ Object
54 55 56 |
# File 'lib/ruby-app/application_defaults.rb', line 54 def rake_paths @gem_rake_paths ||= [] end |
#revision ⇒ Object
73 74 75 |
# File 'lib/ruby-app/application_defaults.rb', line 73 def revision @_revision ||= File.read(File.join(root, %w[REVISION]))[0..5] rescue nil end |
#started_at ⇒ Object
65 66 67 |
# File 'lib/ruby-app/application_defaults.rb', line 65 def started_at $app_started_at end |
#tmp_dir ⇒ Object
7 8 9 |
# File 'lib/ruby-app/application_defaults.rb', line 7 def tmp_dir @gem_tmp_dir ||= File.join(root, %w{tmp}) end |