Class: Forger::Script::Compile
- Includes:
- Template
- Defined in:
- lib/forger/script/compile.rb
Constant Summary
Constants inherited from Base
Base::BUILD_ROOT, Base::SCRIPTS_INFO_PATH
Instance Method Summary collapse
- #clean ⇒ Object
-
#compile_all ⇒ Object
use in compile cli command.
- #compile_folder(folder, layout_path = false) ⇒ Object
-
#compile_scripts ⇒ Object
used in upload.
Methods included from Template
Methods inherited from Base
#derandomize, #initialize, #randomize
Constructor Details
This class inherits a constructor from Forger::Base
Instance Method Details
#clean ⇒ Object
36 37 38 |
# File 'lib/forger/script/compile.rb', line 36 def clean FileUtils.rm_rf("#{BUILD_ROOT}/app") end |
#compile_all ⇒ Object
use in compile cli command
15 16 17 18 19 20 |
# File 'lib/forger/script/compile.rb', line 15 def compile_all clean compile_folder("scripts") layout_path = context.layout_path(@options[:layout]) compile_folder("user-data", layout_path) end |
#compile_folder(folder, layout_path = false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/forger/script/compile.rb', line 22 def compile_folder(folder, layout_path=false) puts "Compiling app/#{folder} to tmp/app/#{folder}.".color(:green) Dir.glob("#{Forger.root}/app/#{folder}/**/*").each do |path| next if File.directory?(path) next if path.include?("layouts") result = RenderMePretty.result(path, layout: layout_path, context: context) tmp_path = path.sub(%r{.*/app/}, "#{BUILD_ROOT}/app/") puts " #{tmp_path}" if @options[:verbose] FileUtils.mkdir_p(File.dirname(tmp_path)) IO.write(tmp_path, result) end end |
#compile_scripts ⇒ Object
used in upload
9 10 11 12 |
# File 'lib/forger/script/compile.rb', line 9 def compile_scripts clean compile_folder("scripts") end |