Class: Soundwave::Site
- Inherits:
-
Object
- Object
- Soundwave::Site
- Defined in:
- lib/soundwave.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #data_trail ⇒ Object
- #generate(destination) ⇒ Object
-
#initialize(source = "./", destination = "./_site") ⇒ Site
constructor
A new instance of Site.
Constructor Details
#initialize(source = "./", destination = "./_site") ⇒ Site
Returns a new instance of Site.
45 46 47 |
# File 'lib/soundwave.rb', line 45 def initialize(source="./", destination="./_site") @source = Pathname(source). end |
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
43 44 45 |
# File 'lib/soundwave.rb', line 43 def destination @destination end |
#source ⇒ Object
Returns the value of attribute source.
43 44 45 |
# File 'lib/soundwave.rb', line 43 def source @source end |
Instance Method Details
#data_trail ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/soundwave.rb', line 58 def data_trail @_data_path ||= Hike::Trail.new(source.join("_data")).tap do |t| t.append_path "." t.append_extension ".json" t.append_extension ".yml", ".yaml" end end |
#generate(destination) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/soundwave.rb', line 49 def generate(destination) destination = Pathname(destination) Dir[source.join("**","*.mustache")].each do |path| next if File.basename(path).to_s =~ /^_/ page = Page.new(self, path) page.write(destination.join(page.output_path)) end end |