Class: Kia::Commands::Build

Inherits:
Thor::Group
  • Object
show all
Defined in:
lib/kia/commands/build.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#templatesObject

Returns the value of attribute templates.



8
9
10
# File 'lib/kia/commands/build.rb', line 8

def templates
  @templates
end

Instance Method Details

#compileObject



10
11
12
13
14
15
16
17
18
# File 'lib/kia/commands/build.rb', line 10

def compile
  @templates = []

  files = Dir.glob(["**/source/*.erb"])

  files.each do |file|
    @templates << Tilt.new(file)
  end
end

#outputObject



20
21
22
23
24
25
26
27
28
# File 'lib/kia/commands/build.rb', line 20

def output
  @templates.each do |template|
    template.file.gsub!("source", "public").gsub!(".erb", "")

    File.open(template.file, "w") do |file|
      file.write(template.render)
    end
  end
end