Class: Guides::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/guides/generator.rb

Constant Summary collapse

GUIDES_RE =
/\.(?:textile|html\.erb)$/
LOCAL_ASSETS =
File.expand_path("../templates/assets", __FILE__)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Generator

Returns a new instance of Generator.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/guides/generator.rb', line 67

def initialize(options)
  @options = options

  @guides_dir = File.expand_path(Dir.pwd)
  @source_dir = File.join(@guides_dir, "source")
  @output_dir = File.join(@guides_dir, "output")

  FileUtils.mkdir_p(@output_dir)

  @edge     = options[:edge]
  @warnings = options[:warnings]
  @all      = options[:all]

  @meta = Guides.meta
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.



62
63
64
# File 'lib/guides/generator.rb', line 62

def all
  @all
end

#edgeObject (readonly)

Returns the value of attribute edge.



62
63
64
# File 'lib/guides/generator.rb', line 62

def edge
  @edge
end

#guides_dirObject (readonly)

Returns the value of attribute guides_dir.



62
63
64
# File 'lib/guides/generator.rb', line 62

def guides_dir
  @guides_dir
end

#output_dirObject (readonly)

Returns the value of attribute output_dir.



62
63
64
# File 'lib/guides/generator.rb', line 62

def output_dir
  @output_dir
end

#source_dirObject (readonly)

Returns the value of attribute source_dir.



62
63
64
# File 'lib/guides/generator.rb', line 62

def source_dir
  @source_dir
end

#warningsObject (readonly)

Returns the value of attribute warnings.



62
63
64
# File 'lib/guides/generator.rb', line 62

def warnings
  @warnings
end

Instance Method Details

#generateObject



83
84
85
86
# File 'lib/guides/generator.rb', line 83

def generate
  generate_guides
  copy_assets
end