Class: Gumdrop::Builder
- Inherits:
-
Object
- Object
- Gumdrop::Builder
- Includes:
- Util::SiteAccess
- Defined in:
- lib/gumdrop/builder.rb
Instance Attribute Summary collapse
-
#checksums ⇒ Object
readonly
Returns the value of attribute checksums.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#renderer ⇒ Object
readonly
Returns the value of attribute renderer.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(opts = {}) ⇒ Builder
constructor
A new instance of Builder.
Methods included from Util::SiteAccess
Methods included from Util::Loggable
Methods included from Util::Eventable
#clear_events, #event_block, #fire
Constructor Details
#initialize(opts = {}) ⇒ Builder
Returns a new instance of Builder.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gumdrop/builder.rb', line 11 def initialize(opts={}) site.active_builder= self opts= opts.to_symbolized_hash @renderer= opts[:renderer] || Renderer.new @copy_files=[] @write_files=[] @checksums={} @options= opts @use_checksum= if opts[:force] false else site.config.file_change_test == :checksum end end |
Instance Attribute Details
#checksums ⇒ Object (readonly)
Returns the value of attribute checksums.
9 10 11 |
# File 'lib/gumdrop/builder.rb', line 9 def checksums @checksums end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/gumdrop/builder.rb', line 9 def @options end |
#renderer ⇒ Object (readonly)
Returns the value of attribute renderer.
9 10 11 |
# File 'lib/gumdrop/builder.rb', line 9 def renderer @renderer end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/gumdrop/builder.rb', line 26 def execute fire :start event_block :build do log.debug "[Building Site]" log.debug "(Rendering)" event_block :render do if @options[:assets] _build_assets @options[:assets], true else _build_assets site.contents.keys.sort end end # All files rendered without exception, write them to disc log.info "(Writing to #{ site.output_path })" event_block :write do @write_files.each {|files| _write files } @copy_files.each {|files| _copy files } end end fire :end rescue => ex log.error ex $stderr.puts ex, true exit 1 unless site.[:resume] end |