Module: Usmu

Defined in:
lib/usmu.rb,
lib/usmu/ui.rb,
lib/usmu/plugin.rb,
lib/usmu/version.rb,
lib/usmu/deployment.rb,
lib/usmu/ui/console.rb,
lib/usmu/collections.rb,
lib/usmu/plugin/core.rb,
lib/usmu/configuration.rb,
lib/usmu/template/page.rb,
lib/usmu/site_generator.rb,
lib/usmu/ui/rack_server.rb,
lib/usmu/helpers/indexer.rb,
lib/usmu/template/layout.rb,
lib/usmu/metadata_service.rb,
lib/usmu/template/helpers.rb,
lib/usmu/template/include.rb,
lib/usmu/plugin/core_hooks.rb,
lib/usmu/template/static_file.rb,
lib/usmu/template/generated_file.rb,
lib/usmu/deployment/directory_diff.rb,
lib/usmu/deployment/remote_file_interface.rb

Overview

This module contains all the code for the Usmu site generator

Defined Under Namespace

Modules: Deployment, Helpers, Template, Ui Classes: Collections, Configuration, MetadataService, Plugin, SiteGenerator

Constant Summary collapse

VERSION =

The current version string for the gem

'1.4.3'

Class Method Summary collapse

Class Method Details

.add_file_logger(filename) ⇒ void

This method returns an undefined value.

Adds a file-based logger

Parameters:

  • filename (String)

    Filename of the file to log to.



48
49
50
51
# File 'lib/usmu.rb', line 48

def self.add_file_logger(filename)
  @log.add_appenders(Logging.appenders.file(filename, :filename => filename, :level => :all))
  nil
end

.disable_stdout_loggingvoid

This method returns an undefined value.

Disables stdout logging across the application. This is used to hide stack traces but still log them to the file log if it is in use.



60
61
62
63
# File 'lib/usmu.rb', line 60

def self.disable_stdout_logging
  @log.remove_appenders('usmu-stdout')
  nil
end

.load_lazy_tilt_modulesvoid



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/usmu.rb', line 71

def self.load_lazy_tilt_modules
  # There be magic here. Not nice, but gets the job done. Tilt's data structure here is a little unusual.
  Tilt.default_mapping.lazy_map.map {|pair| pair[1]}.map {|i| i.map {|j| j[1]}}.flatten.uniq.each do |f|
    begin
      require f
      @log.debug("Loaded #{f}")
    rescue LoadError => e
      @log.debug("Failed to load #{f}: #{e.inspect}")
    end
  end
end

.pluginsUsmu::Plugin

Returns a handler to the plugin interface.

Returns:



67
68
69
# File 'lib/usmu.rb', line 67

def self.plugins
  @plugins ||= Usmu::Plugin.new
end

.quiet_loggingvoid

This method returns an undefined value.

Disable all log messages other than errors. Warnings will be suppressed.



39
40
41
42
# File 'lib/usmu.rb', line 39

def self.quiet_logging
  Logging.appenders['usmu-stdout'].level = :error
  nil
end

.verbose_loggingvoid

This method returns an undefined value.

Enable logging of all events to the console



31
32
33
34
# File 'lib/usmu.rb', line 31

def self.verbose_logging
  Logging.appenders['usmu-stdout'].level = :all
  nil
end