Method: Deplate::Core.set_theme

Defined in:
lib/deplate/core.rb

.set_theme(options, name) ⇒ Object



642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/deplate/core.rb', line 642

def set_theme(options, name)
    theme_dir = @@themes[name]
    if theme_dir
        EtcDirs.unshift(theme_dir)
        collect_theme(@@css, theme_dir, 'css', '.css')
        collect_theme(@@templates, theme_dir, 'templates', '')
        for resource in Dir[File.join(theme_dir, 'resources', '*')]
            options.resources << [resource, false]
        end
        prelude = File.join(theme_dir, 'prelude.txt')
        if File.exist?(prelude)
            options.prelude.concat(File.readlines(prelude).map {|l| l.chomp})
        end
        if is_allowed?(options, 's')
            read_ini_file(options, File.join(theme_dir, 'theme.ini'))
            unless options.ini_command_line_arguments.empty?
                options.opts.parse!(options.ini_command_line_arguments)
            end
        end
    else
        log(['Unknown theme', name], :error)
    end
end