Class: Dimples::Site
- Inherits:
-
Object
- Object
- Dimples::Site
- Defined in:
- lib/dimples/site.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#posts ⇒ Object
Returns the value of attribute posts.
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(output_path) ⇒ Site
constructor
A new instance of Site.
Constructor Details
#initialize(output_path) ⇒ Site
Returns a new instance of Site.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dimples/site.rb', line 17 def initialize(output_path) @paths = { source: File.(Dir.pwd), destination: File.(output_path) } @config = read_config %w[pages posts static templates].each { |type| @paths[type.to_sym] = File.join(@paths[:source], type) } scan_posts scan_pages scan_templates end |
Instance Attribute Details
#categories ⇒ Object
Returns the value of attribute categories.
15 16 17 |
# File 'lib/dimples/site.rb', line 15 def categories @categories end |
#posts ⇒ Object
Returns the value of attribute posts.
15 16 17 |
# File 'lib/dimples/site.rb', line 15 def posts @posts end |
Class Method Details
.generate(output_path) ⇒ Object
11 12 13 |
# File 'lib/dimples/site.rb', line 11 def self.generate(output_path) new(output_path).generate end |
Instance Method Details
#generate ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/dimples/site.rb', line 32 def generate if Dir.exist?(@paths[:destination]) puts "Error: The output directory (#{@paths[:destination]}) already exists." return end Dir.mkdir(@paths[:destination]) generate_posts generate_pages generate_categories copy_assets end |