Module: Ore::Config
- Defined in:
- lib/ore/config.rb
Constant Summary collapse
- HOME =
The users home directory
Gem.user_home
- PATH =
Ore config directory
File.join(HOME,'.ore')
- OPTIONS_FILE =
Default options file.
File.join(PATH,'options.yml')
- TEMPLATES_DIR =
Custom Ore Templates directory
File.join(PATH,'templates')
- DATA_DIR =
The
data/ore
directory for Ore File.(File.join('..','..','data','ore'),File.dirname(__FILE__))
- BUILTIN_TEMPLATES_DIR =
The
data/ore/templates
directory for Ore File.join(DATA_DIR,'templates')
Class Method Summary collapse
-
.builtin_templates {|path| ... } ⇒ Object
The builtin templates.
-
.disable! ⇒ Object
private
Disables access to user config.
-
.enable! ⇒ Object
private
Enables access to user config.
-
.installed_templates {|path| ... } ⇒ Object
The installed templates.
-
.options ⇒ Options
Loads the default options from
~/.ore/options.yml
.
Class Method Details
.builtin_templates {|path| ... } ⇒ Object
The builtin templates.
75 76 77 78 79 80 81 |
# 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! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Disables access to user config.
43 44 45 |
# File 'lib/ore/config.rb', line 43 def self.disable! @enabled = false end |
.enable! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Enables access to user config.
32 33 34 |
# File 'lib/ore/config.rb', line 32 def self.enable! @enabled = true end |
.installed_templates {|path| ... } ⇒ Object
The installed templates.
92 93 94 95 96 97 98 99 100 |
# 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 ⇒ Options
Loads the default options from ~/.ore/options.yml
.
58 59 60 61 62 63 64 |
# File 'lib/ore/config.rb', line 58 def self. @options ||= if @enabled && File.file?(OPTIONS_FILE) Options.load(OPTIONS_FILE) else Options.new end end |