Module: Card::Mod::Loader

Defined in:
lib/card/mod/loader.rb

Class Method Summary collapse

Class Method Details

.load_chunksObject



27
28
29
30
31
# File 'lib/card/mod/loader.rb', line 27

def load_chunks
  mod_dirs.each(:chunk) do |dir|
    load_dir dir
  end
end

.load_layoutsObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/card/mod/loader.rb', line 33

def load_layouts
  hash = {}
  mod_dirs.each(:layout) do |dirname|
    Dir.foreach(dirname) do |filename|
      next if filename =~ /^\./
      layout_name = filename.gsub(/\.html$/, "")
      hash[layout_name] = File.read File.join(dirname, filename)
    end
  end
  hash
end

.load_modsObject



20
21
22
23
24
25
# File 'lib/card/mod/loader.rb', line 20

def load_mods
  load_initializers
  load_set_patterns
  load_formats
  load_sets
end

.mod_dirsObject



45
46
47
# File 'lib/card/mod/loader.rb', line 45

def mod_dirs
  @mod_dirs ||= Mod::Dirs.new(Card.paths["mod"].existent)
end

.refresh_script_and_styleObject



49
50
51
52
# File 'lib/card/mod/loader.rb', line 49

def refresh_script_and_style
  update_if_source_file_changed Card[:all, :script]
  update_if_source_file_changed Card[:all, :style]
end