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.
- #prepare(&block) ⇒ Object
- #resolve(path = nil, opts = {}) ⇒ Object
- #scan(force = false) ⇒ Object
-
#scan_only ⇒ Object
For testing…
- #source_path ⇒ Object
- #unrenderable?(path) ⇒ Boolean
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
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/gumdrop/site.rb', line 41 def initialize(sitefile, opts={}) Gumdrop.send :set_current_site, self @sitefile= sitefile. @options= Util::HashObject.from opts @root= File.dirname @sitefile @last_run= 0 @_preparations= [] @contents= ContentList.new @layouts= SpecialContentList.new ".layout" @partials= SpecialContentList.new @generators= [] @data= DataManager.new clear end |
Instance Attribute Details
#active_builder ⇒ Object
hmmm…
38 39 40 |
# File 'lib/gumdrop/site.rb', line 38 def active_builder @active_builder end |
#active_renderer ⇒ Object
hmmm…
38 39 40 |
# File 'lib/gumdrop/site.rb', line 38 def active_renderer @active_renderer end |
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def contents @contents end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def data @data end |
#generators ⇒ Object (readonly)
Returns the value of attribute generators.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def generators @generators end |
#last_run ⇒ Object (readonly)
Returns the value of attribute last_run.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def last_run @last_run end |
#layouts ⇒ Object (readonly)
Returns the value of attribute layouts.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def layouts @layouts end |
#options ⇒ Object
Returns the value of attribute options.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def @options end |
#partials ⇒ Object (readonly)
Returns the value of attribute partials.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def partials @partials end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def root @root end |
#sitefile ⇒ Object (readonly)
Returns the value of attribute sitefile.
34 35 36 |
# File 'lib/gumdrop/site.rb', line 34 def sitefile @sitefile end |
Instance Method Details
#clear ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/gumdrop/site.rb', line 65 def clear() @contents.clear() @layouts.clear() @partials.clear() @generators.clear() @data.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
166 167 168 |
# File 'lib/gumdrop/site.rb', line 166 def config_did_change Gumdrop.init_logging end |
#data_path ⇒ Object
134 135 136 |
# File 'lib/gumdrop/site.rb', line 134 def data_path @data_path ||= data_dir.(root) end |
#generate ⇒ Object
102 103 104 105 106 |
# File 'lib/gumdrop/site.rb', line 102 def generate _execute_preparations _execute_generators self end |
#ignore_path?(path) ⇒ Boolean
114 115 116 117 118 |
# File 'lib/gumdrop/site.rb', line 114 def ignore_path?(path) config.ignore.any? do |pattern| path.path_match? pattern end end |
#in_blacklist?(path) ⇒ Boolean
108 109 110 111 112 |
# File 'lib/gumdrop/site.rb', line 108 def in_blacklist?(path) blacklist.any? do |pattern| path.path_match? pattern end end |
#output_path ⇒ Object
130 131 132 |
# File 'lib/gumdrop/site.rb', line 130 def output_path @output_path ||= output_dir.(root) end |
#parent ⇒ Object
Events stop bubbling here.
162 163 164 |
# File 'lib/gumdrop/site.rb', line 162 def parent nil end |
#prepare(&block) ⇒ Object
157 158 159 |
# File 'lib/gumdrop/site.rb', line 157 def prepare(&block) @_preparations << block end |
#resolve(path = nil, opts = {}) ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/gumdrop/site.rb', line 138 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
84 85 86 87 88 89 90 91 92 |
# File 'lib/gumdrop/site.rb', line 84 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…
94 95 96 97 98 99 100 |
# File 'lib/gumdrop/site.rb', line 94 def scan_only # For testing... if !@is_scanned or force clear if @is_scanned # ???? _content_scanner end self end |
#source_path ⇒ Object
126 127 128 |
# File 'lib/gumdrop/site.rb', line 126 def source_path @source_path ||= source_dir.(root) end |
#unrenderable?(path) ⇒ Boolean
120 121 122 123 124 |
# File 'lib/gumdrop/site.rb', line 120 def unrenderable?(path) config.no_render.any? do |pattern| path.path_match? pattern end end |