Class: Reflekt::Renderer

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

Instance Method Summary collapse

Constructor Details

#initialize(package_path, output_path) ⇒ Renderer

Returns a new instance of Renderer.



4
5
6
7
# File 'lib/renderer.rb', line 4

def initialize(package_path, output_path)
  @package_path = package_path
  @output_path = output_path
end

Instance Method Details

#renderObject

Place files in output path.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/renderer.rb', line 12

def render()

  filenames = [
    "bundle.js",
    "index.html",
    "package-lock.json",
    "package.json",
    "README.md",
    "server.js"
  ]

  filenames.each do |filename|
    file = File.read(File.join(@package_path, "web", filename))
    File.open(File.join(@output_path, filename), 'w+') do |f|
      f.write file
    end
  end

  file = File.read(File.join(@package_path, "web", "gitignore.txt"))
  File.open(File.join(@output_path, ".gitignore"), 'w+') do |f|
    f.write file
  end

end