Class: Torba::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/torba/rails.rb

Class Method Summary collapse

Class Method Details

.precompile_assets?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/torba/rails.rb', line 15

def self.precompile_assets?
  defined?(Rake.application) && Rake.application.top_level_tasks.include?("assets:precompile")
end

.serve_static_files?(config = Rails.application.config) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'lib/torba/rails.rb', line 8

def self.serve_static_files?(config = Rails.application.config)
  (config.respond_to?(:public_file_server) && config.public_file_server.enabled) ||
    (config.respond_to?(:serve_static_files) && config.serve_static_files) || # Rails 4
    (config.respond_to?(:serve_static_assets) && config.serve_static_assets) || # Rails 3
    ENV["RAILS_GROUPS"] == "assets" # Rails 3
end

.setup(config = Rails.application.config) ⇒ Object



3
4
5
6
# File 'lib/torba/rails.rb', line 3

def self.setup(config = Rails.application.config)
  config.assets.paths.concat(Torba.load_path)
  config.assets.precompile.concat(Torba.non_js_css_logical_paths)
end