Class: Hayde::Generator

Inherits:
Object
  • Object
show all
Includes:
Utils::Files
Defined in:
lib/hayde/generator.rb

Constant Summary collapse

GUIDES_RE =
/\.(?:textile|html\.erb)$/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Files

included

Constructor Details

#initialize {|_self| ... } ⇒ Generator

Returns a new instance of Generator.

Yields:

  • (_self)

Yield Parameters:



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_dirObject

Returns the value of attribute assets_dir.



52
53
54
# File 'lib/hayde/generator.rb', line 52

def assets_dir
  @assets_dir
end

#edgeObject

Returns the value of attribute edge.



52
53
54
# File 'lib/hayde/generator.rb', line 52

def edge
  @edge
end

#forceObject

Returns the value of attribute force.



52
53
54
# File 'lib/hayde/generator.rb', line 52

def force
  @force
end

#layoutObject

Returns the value of attribute layout.



52
53
54
# File 'lib/hayde/generator.rb', line 52

def layout
  @layout
end

#output_dirObject

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_prefixObject

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

#warningsObject

Returns the value of attribute warnings.



52
53
54
# File 'lib/hayde/generator.rb', line 52

def warnings
  @warnings
end

Instance Method Details

#cleanObject



71
72
73
# File 'lib/hayde/generator.rb', line 71

def clean
  FileUtils.rm_r Dir.glob(File.join(output_dir, '*'))
end

#generateObject



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