Class: RhetButler::Configuration
- Inherits:
-
Object
- Object
- RhetButler::Configuration
- Defined in:
- lib/rhet-butler/configuration.rb
Overview
This class is used to manage application config throughout. Basically it wraps a hash loaded from the base fileset. Since the file search path can be configured from there, it would be overly complex to allow config.yaml files in a configured source path.
Also, n.b. all access to configuration is through methods on this class, so it’s easy to see what values are allowed
Instance Method Summary collapse
- #arrangement_blueprint ⇒ Object
- #author ⇒ Object
- #default_content_filters ⇒ Object
- #default_note_filters ⇒ Object
- #description ⇒ Object
- #impress_config ⇒ Object
-
#initialize(files, overrides = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #named_filter_lists ⇒ Object
- #password ⇒ Object
- #root_arrangement ⇒ Object
- #root_slide ⇒ Object
- #root_slide_template ⇒ Object
- #search_paths ⇒ Object
- #serve_port ⇒ Object
- #static_target ⇒ Object
- #template_cache ⇒ Object
- #title ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(files, overrides = nil) ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rhet-butler/configuration.rb', line 12 def initialize(files, overrides=nil) @base_hash = begin files.find("config.yaml").contents rescue Valise::Errors::NotFound warn "No config.yaml found in #{files.inspect} - using defaults" {} end @base_hash.merge!(overrides) unless overrides.nil? end |
Instance Method Details
#arrangement_blueprint ⇒ Object
67 68 69 |
# File 'lib/rhet-butler/configuration.rb', line 67 def arrangement_blueprint @base_hash["blueprint"] || [] end |
#author ⇒ Object
35 36 37 |
# File 'lib/rhet-butler/configuration.rb', line 35 def @base_hash['author_name'] || "Judson Lester" end |
#default_content_filters ⇒ Object
83 84 85 |
# File 'lib/rhet-butler/configuration.rb', line 83 def default_content_filters @default_content_filters ||= @base_hash["default-content-filters"] || "textile" end |
#default_note_filters ⇒ Object
87 88 89 |
# File 'lib/rhet-butler/configuration.rb', line 87 def default_note_filters @default_note_filters ||= @base_hash["default-note-filters"] || "textile" end |
#description ⇒ Object
43 44 45 |
# File 'lib/rhet-butler/configuration.rb', line 43 def description @base_hash['presentation_description'] || "A nifty presentation made with Rhet Butler" end |
#impress_config ⇒ Object
59 60 61 |
# File 'lib/rhet-butler/configuration.rb', line 59 def impress_config @base_hash['impress-config'] || {} end |
#named_filter_lists ⇒ Object
79 80 81 |
# File 'lib/rhet-butler/configuration.rb', line 79 def named_filter_lists @base_hash["named-filters"] || {"textile" => [SlideRenderers::Textile.new]} end |
#password ⇒ Object
31 32 33 |
# File 'lib/rhet-butler/configuration.rb', line 31 def password @base_hash['password'] || 'judsonr00tzme' end |
#root_arrangement ⇒ Object
63 64 65 |
# File 'lib/rhet-butler/configuration.rb', line 63 def root_arrangement @base_hash["arrangement"] || "horizontal" end |
#root_slide ⇒ Object
75 76 77 |
# File 'lib/rhet-butler/configuration.rb', line 75 def @base_hash["root_slide"] || "slides.yaml" end |
#root_slide_template ⇒ Object
23 24 25 |
# File 'lib/rhet-butler/configuration.rb', line 23 def @base_hash['root_slide_template'] || 'presentation.html' end |
#search_paths ⇒ Object
47 48 49 |
# File 'lib/rhet-butler/configuration.rb', line 47 def search_paths @base_hash["sources"] || [] end |
#serve_port ⇒ Object
71 72 73 |
# File 'lib/rhet-butler/configuration.rb', line 71 def serve_port @base_hash["serve_port"] || 8081 end |
#static_target ⇒ Object
55 56 57 |
# File 'lib/rhet-butler/configuration.rb', line 55 def static_target @base_hash["static_target"] || "static" end |
#template_cache ⇒ Object
51 52 53 |
# File 'lib/rhet-butler/configuration.rb', line 51 def template_cache @base_hash["template-cache"] || ".template-cache" end |
#title ⇒ Object
39 40 41 |
# File 'lib/rhet-butler/configuration.rb', line 39 def title @base_hash['presentation_title'] || 'Presentation' end |
#username ⇒ Object
27 28 29 |
# File 'lib/rhet-butler/configuration.rb', line 27 def username @base_hash['username'] || 'judson' end |