Module: Application::Defaults

Included in:
Application
Defined in:
lib/ruby-app/application_defaults.rb

Instance Method Summary collapse

Instance Method Details

#bundler_groupObject



60
61
# File 'lib/ruby-app/application_defaults.rb', line 60

def bundler_group
end

#configObject



44
45
46
# File 'lib/ruby-app/application_defaults.rb', line 44

def config
  CommonConfig
end

#envObject Also known as: environment



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ruby-app/application_defaults.rb', line 13

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_mailerObject



63
64
65
# File 'lib/ruby-app/application_defaults.rb', line 63

def error_mailer
  ErrorMailer
end

#identifierObject



48
49
50
# File 'lib/ruby-app/application_defaults.rb', line 48

def identifier
  "ruby-app"
end

#initializer_pathsObject



56
57
58
# File 'lib/ruby-app/application_defaults.rb', line 56

def initializer_paths
  @gem_initializer_paths ||= []
end

#loggerObject



35
36
37
38
39
40
41
42
# File 'lib/ruby-app/application_defaults.rb', line 35

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_dirObject



9
10
11
# File 'lib/ruby-app/application_defaults.rb', line 9

def logger_dir
  @gem_logger_dir ||= File.join(root, %w{log})
end

#rake_pathsObject



52
53
54
# File 'lib/ruby-app/application_defaults.rb', line 52

def rake_paths
  @gem_rake_paths ||= []
end

#tmp_dirObject



5
6
7
# File 'lib/ruby-app/application_defaults.rb', line 5

def tmp_dir
  @gem_tmp_dir ||= File.join(root, %w{tmp})
end