Class: Dimples::Site
- Inherits:
-
Object
- Object
- Dimples::Site
- Defined in:
- lib/dimples/site.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#latest_post ⇒ Object
readonly
Returns the value of attribute latest_post.
-
#pages ⇒ Object
readonly
Returns the value of attribute pages.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#posts ⇒ Object
readonly
Returns the value of attribute posts.
-
#templates ⇒ Object
readonly
Returns the value of attribute templates.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(config = {}) ⇒ Site
constructor
A new instance of Site.
- #inspect ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Site
Returns a new instance of Site.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dimples/site.rb', line 14 def initialize(config = {}) @config = Hashie::Mash.new(Configuration.defaults).deep_merge(config) @paths = {}.tap do |paths| paths[:base] = Dir.pwd paths[:output] = File.join(paths[:base], @config.paths.output) paths[:sources] = {}.tap do |sources| %w[pages posts public templates].each do |type| sources[type.to_sym] = File.join(paths[:base], type) end end end prepare end |
Instance Attribute Details
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
6 7 8 |
# File 'lib/dimples/site.rb', line 6 def categories @categories end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/dimples/site.rb', line 5 def config @config end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/dimples/site.rb', line 7 def errors @errors end |
#latest_post ⇒ Object (readonly)
Returns the value of attribute latest_post.
12 13 14 |
# File 'lib/dimples/site.rb', line 12 def latest_post @latest_post end |
#pages ⇒ Object (readonly)
Returns the value of attribute pages.
10 11 12 |
# File 'lib/dimples/site.rb', line 10 def pages @pages end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
8 9 10 |
# File 'lib/dimples/site.rb', line 8 def paths @paths end |
#posts ⇒ Object (readonly)
Returns the value of attribute posts.
9 10 11 |
# File 'lib/dimples/site.rb', line 9 def posts @posts end |
#templates ⇒ Object (readonly)
Returns the value of attribute templates.
11 12 13 |
# File 'lib/dimples/site.rb', line 11 def templates @templates end |
Instance Method Details
#generate ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dimples/site.rb', line 30 def generate prepare read_templates read_posts read_pages create_output_directory copy_assets publish_posts publish_pages publish_archives publish_categories if @config.generation.categories rescue PublishingError, RenderingError, GenerationError => error @errors << error end |
#inspect ⇒ Object
48 49 50 |
# File 'lib/dimples/site.rb', line 48 def inspect "#<#{self.class} @paths=#{paths}>" end |