Class: Reflekt::Renderer
- Inherits:
-
Object
- Object
- Reflekt::Renderer
- Defined in:
- lib/renderer.rb
Instance Method Summary collapse
-
#initialize(package_path, output_path) ⇒ Renderer
constructor
A new instance of Renderer.
-
#render ⇒ Object
Place files in output path.
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
#render ⇒ Object
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 |