Class: Wagn::Application

Inherits:
Rails::Application
  • Object
show all
Defined in:
lib/wagn/application.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.inherited(base) ⇒ Object



41
42
43
44
45
# File 'lib/wagn/application.rb', line 41

def inherited(base)
  Rails.application = base.instance
  Rails.application.add_lib_to_load_path!
  ActiveSupport.run_load_hooks(:before_configuration, base.instance)
end

Instance Method Details

#add_path(paths, path, options = {}) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/wagn/application.rb', line 48

def add_path paths, path, options={}
  root = options.delete(:root) || Wagn.gem_root
  gem_path = File.join( root, path )
  with = options.delete(:with)
  with = with ? File.join(root, with) : gem_path
  #warn "add gem path #{path}, #{with}, #{gem_path}, #{options.inspect}"
  paths[path] = Rails::Paths::Path.new(paths, gem_path, with, options)
end

#configObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/wagn/application.rb', line 58

def config
  @config ||= begin
    config = super

    Cardio.set_config config

    config.i18n.enforce_available_locales = true


    config.assets.enabled = false
    config.assets.version = '1.0'

    config.encoding              = "utf-8"
    config.filter_parameters    += [:password]
    config.no_authentication     = false
    config.files_web_path        = 'files'

    config.email_defaults        = nil

    config.token_expiry          = 2.days
    config.revisions_per_page    = 10
    config.request_logger        = false
    config.performance_logger    = false
    config
  end
end

#pathsObject



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/wagn/application.rb', line 85

def paths
  @paths ||= begin
    paths = super
    Cardio.set_paths paths

    paths.add 'files'

    paths['mod'] << 'mod'
    paths['app/models'] = []
    paths['app/mailers'] = []

    add_path paths, 'config/routes', :with => 'rails/application-routes.rb'

    paths
  end
end