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.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dimples/site.rb', line 16 def initialize(output_path) @paths = { source: File.(Dir.pwd), destination: File.(output_path) } @config = read_config %w[pages posts static templates].each do |type| @paths[type.to_sym] = File.join(@paths[:source], type) end scan_posts scan_pages scan_templates end |
Instance Attribute Details
#categories ⇒ Object
Returns the value of attribute categories.
14 15 16 |
# File 'lib/dimples/site.rb', line 14 def categories @categories end |
#posts ⇒ Object
Returns the value of attribute posts.
14 15 16 |
# File 'lib/dimples/site.rb', line 14 def posts @posts end |
Class Method Details
.generate(output_path) ⇒ Object
10 11 12 |
# File 'lib/dimples/site.rb', line 10 def self.generate(output_path) new(output_path).generate end |
Instance Method Details
#generate ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dimples/site.rb', line 33 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 |