Module: MnoEnterprise::Frontend::AssetsUtil

Defined in:
lib/mno_enterprise/frontend/assets_util.rb

Class Method Summary collapse

Class Method Details

.assets_urlObject



6
7
8
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 6

def self.assets_url
  self.config["environments"][Rails.env]["assets"]
end

.configObject



14
15
16
17
18
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 14

def self.config
  @@config ||= YAML.load_file(File.join(Rails.root, 'config', 'assets.yml'))

  @@config
end

.engine_root_pathObject

Return the engine root path



26
27
28
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 26

def self.engine_root_path
  MnoEnterprise::Frontend::Engine.root
end

.imagesObject



30
31
32
33
34
35
36
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 30

def self.images
  [self.root_path, self.engine_root_path].map do |base_path|
    Dir.glob(base_path.join("app/assets/images/**/*.*")).map do |path|
      path.gsub(base_path.join("app/assets/images/").to_s, "")
    end
  end.flatten.uniq
end

.root_pathObject

Return the application root path



21
22
23
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 21

def self.root_path
  Rails.root
end

.server_hostObject



10
11
12
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 10

def self.server_host
  self.config["environments"][Rails.env]["host"]
end

.templatesObject



38
39
40
41
42
43
44
# File 'lib/mno_enterprise/frontend/assets_util.rb', line 38

def self.templates
  [self.root_path, self.engine_root_path].map do |base_path|
    Dir.glob(base_path.join("app/assets/templates/**/*.*")).map do |path|
      path.gsub(base_path.join("app/assets/templates/").to_s, "")
    end
  end.flatten.uniq
end