Class: Gumdrop::Site
- Inherits:
-
Object
- Object
- Gumdrop::Site
- Includes:
- Util::Configurable, Util::Eventable, Util::Loggable
- Defined in:
- lib/gumdrop/site.rb
Instance Attribute Summary collapse
-
#active_builder ⇒ Object
hmmm…
-
#active_renderer ⇒ Object
hmmm…
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#generators ⇒ Object
readonly
Returns the value of attribute generators.
-
#last_run ⇒ Object
readonly
Returns the value of attribute last_run.
-
#layouts ⇒ Object
readonly
Returns the value of attribute layouts.
-
#options ⇒ Object
Returns the value of attribute options.
-
#partials ⇒ Object
readonly
Returns the value of attribute partials.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#sitefile ⇒ Object
readonly
Returns the value of attribute sitefile.
Instance Method Summary collapse
- #clear ⇒ Object
- #config_did_change ⇒ Object
- #data_path ⇒ Object
- #generate ⇒ Object
- #ignore_path?(path) ⇒ Boolean
- #in_blacklist?(path) ⇒ Boolean
-
#initialize(sitefile, opts = {}) ⇒ Site
constructor
You shouldn’t call this yourself! Access it via Gumdrop.site.
- #output_path ⇒ Object
-
#parent ⇒ Object
Events stop bubbling here.
- #resolve(path = nil, opts = {}) ⇒ Object
- #scan(force = false) ⇒ Object
-
#scan_only ⇒ Object
For testing…
- #source_path ⇒ Object
Methods included from Util::Loggable
Methods included from Util::Eventable
#clear_events, #event_block, #fire
Methods included from Util::Configurable
Constructor Details
#initialize(sitefile, opts = {}) ⇒ Site
You shouldn’t call this yourself! Access it via Gumdrop.site
40 41 42 43 44 45 46 47 48 |
# File 'lib/gumdrop/site.rb', line 40 def initialize(sitefile, opts={}) Gumdrop.send :set_current_site, self @sitefile= sitefile. @options= Util::HashObject.from opts @root= File.dirname @sitefile @last_run= 0 clear end |
Instance Attribute Details
#active_builder ⇒ Object
hmmm…
37 38 39 |
# File 'lib/gumdrop/site.rb', line 37 def active_builder @active_builder end |
#active_renderer ⇒ Object
hmmm…
37 38 39 |
# File 'lib/gumdrop/site.rb', line 37 def active_renderer @active_renderer end |
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def contents @contents end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def data @data end |
#generators ⇒ Object (readonly)
Returns the value of attribute generators.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def generators @generators end |
#last_run ⇒ Object (readonly)
Returns the value of attribute last_run.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def last_run @last_run end |
#layouts ⇒ Object (readonly)
Returns the value of attribute layouts.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def layouts @layouts end |
#options ⇒ Object
Returns the value of attribute options.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def @options end |
#partials ⇒ Object (readonly)
Returns the value of attribute partials.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def partials @partials end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def root @root end |
#sitefile ⇒ Object (readonly)
Returns the value of attribute sitefile.
33 34 35 |
# File 'lib/gumdrop/site.rb', line 33 def sitefile @sitefile end |
Instance Method Details
#clear ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/gumdrop/site.rb', line 56 def clear() @contents= ContentList.new @layouts= SpecialContentList.new ".layout" @partials= SpecialContentList.new @generators= [] @data= DataManager.new @is_scanned= false _reset_config! _load_sitefile self end |
#config_did_change ⇒ Object
139 140 141 |
# File 'lib/gumdrop/site.rb', line 139 def config_did_change Gumdrop.init_logging end |
#data_path ⇒ Object
111 112 113 |
# File 'lib/gumdrop/site.rb', line 111 def data_path @data_path ||= data_dir.(root) end |
#generate ⇒ Object
86 87 88 89 |
# File 'lib/gumdrop/site.rb', line 86 def generate _execute_generators self end |
#ignore_path?(path) ⇒ Boolean
97 98 99 100 101 |
# File 'lib/gumdrop/site.rb', line 97 def ignore_path?(path) config.ignore.any? do |pattern| path.path_match? pattern end end |
#in_blacklist?(path) ⇒ Boolean
91 92 93 94 95 |
# File 'lib/gumdrop/site.rb', line 91 def in_blacklist?(path) blacklist.any? do |pattern| path.path_match? pattern end end |
#output_path ⇒ Object
107 108 109 |
# File 'lib/gumdrop/site.rb', line 107 def output_path @output_path ||= output_dir.(root) end |
#parent ⇒ Object
Events stop bubbling here.
135 136 137 |
# File 'lib/gumdrop/site.rb', line 135 def parent nil end |
#resolve(path = nil, opts = {}) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/gumdrop/site.rb', line 115 def resolve(path=nil, opts={}) case when path.is_a?(Content) path when !path.nil? contents.first(path) || partials.first(path) when opts[:page] contents.first opts[:page] when opts[:partial] partials.first opts[:partial] when opts[:layout] layouts.first opts[:layout] when opts[:generator] generators.first opts[:generator] else nil end end |
#scan(force = false) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/gumdrop/site.rb', line 68 def scan(force=false) if !@is_scanned or force clear if @is_scanned # ???? _content_scanner @is_scanned= true generate end self end |
#scan_only ⇒ Object
For testing…
78 79 80 81 82 83 84 |
# File 'lib/gumdrop/site.rb', line 78 def scan_only # For testing... if !@is_scanned or force clear if @is_scanned # ???? _content_scanner end self end |
#source_path ⇒ Object
103 104 105 |
# File 'lib/gumdrop/site.rb', line 103 def source_path @source_path ||= source_dir.(root) end |