module Ore::Config

Constants

BUILTIN_TEMPLATES_DIR

The ‘data/ore/templates` directory for Ore

DATA_DIR

The ‘data/ore` directory for Ore

HOME

The users home directory

OPTIONS_FILE

Default options file.

PATH

Ore config directory

TEMPLATES_DIR

Custom Ore Templates directory

Public Class Methods

builtin_templates() { |template| ... } click to toggle source

The builtin templates.

@yield [path]

The given block will be passed every builtin template.

@yieldparam [String] path

The path of a Ore template directory.
# File lib/ore/config.rb, line 75
def self.builtin_templates
  if File.directory?(BUILTIN_TEMPLATES_DIR)
    Dir.glob("#{BUILTIN_TEMPLATES_DIR}/*") do |template|
      yield template if File.directory?(template)
    end
  end
end
disable!() click to toggle source

Disables access to user config.

@api private

@since 0.5.0

# File lib/ore/config.rb, line 43
def self.disable!
  @enabled = false
end
enable!() click to toggle source

Enables access to user config.

@api private

@since 0.5.0

# File lib/ore/config.rb, line 32
def self.enable!
  @enabled = true
end
installed_templates() { |template| ... } click to toggle source

The installed templates.

@yield [path]

The given block will be passed every installed template.

@yieldparam [String] path

The path of a Ore template directory.
# File lib/ore/config.rb, line 92
def self.installed_templates
  return unless @enabled

  if File.directory?(TEMPLATES_DIR)
    Dir.glob("#{TEMPLATES_DIR}/*") do |template|
      yield template if File.directory?(template)
    end
  end
end
options() click to toggle source

Loads the default options from ‘~/.ore/options.yml`.

@return [Options]

The loaded default options.

@raise [RuntimeError]

The `~/.ore/options.yml` did not contain a YAML encoded Hash.

@since 0.9.0

# File lib/ore/config.rb, line 58
def self.options
  @options ||= if @enabled && File.file?(OPTIONS_FILE)
                 Options.load(OPTIONS_FILE)
               else
                 Options.new
               end
end