Class: Hayde::Generator
- Inherits:
-
Object
- Object
- Hayde::Generator
- Includes:
- Utils::Files
- Defined in:
- lib/hayde/generator.rb
Constant Summary collapse
- GUIDES_RE =
/\.(?:textile|html\.erb)$/
Instance Attribute Summary collapse
-
#assets_dir ⇒ Object
Returns the value of attribute assets_dir.
-
#edge ⇒ Object
Returns the value of attribute edge.
-
#force ⇒ Object
Returns the value of attribute force.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
-
#page_title_prefix ⇒ Object
Returns the value of attribute page_title_prefix.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Instance Method Summary collapse
- #clean ⇒ Object
- #generate ⇒ Object
-
#initialize {|_self| ... } ⇒ Generator
constructor
A new instance of Generator.
Methods included from Utils::Files
Constructor Details
#initialize {|_self| ... } ⇒ Generator
Returns a new instance of Generator.
57 58 59 60 61 |
# File 'lib/hayde/generator.rb', line 57 def initialize set_defaults yield self if block_given? FileUtils.mkdir_p(@output_dir) end |
Instance Attribute Details
#assets_dir ⇒ Object
Returns the value of attribute assets_dir.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def assets_dir @assets_dir end |
#edge ⇒ Object
Returns the value of attribute edge.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def edge @edge end |
#force ⇒ Object
Returns the value of attribute force.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def force @force end |
#layout ⇒ Object
Returns the value of attribute layout.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def layout @layout end |
#output_dir ⇒ Object
Returns the value of attribute output_dir.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def output_dir @output_dir end |
#page_title_prefix ⇒ Object
Returns the value of attribute page_title_prefix.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def page_title_prefix @page_title_prefix end |
#warnings ⇒ Object
Returns the value of attribute warnings.
52 53 54 |
# File 'lib/hayde/generator.rb', line 52 def warnings @warnings end |
Instance Method Details
#clean ⇒ Object
71 72 73 |
# File 'lib/hayde/generator.rb', line 71 def clean FileUtils.rm_r Dir.glob(File.join(output_dir, '*')) end |
#generate ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/hayde/generator.rb', line 63 def generate puts "Generating guides has been started." generate_guides puts "Copying assets ..." copy_assets puts "Generating guides has been finished." end |