Module: Lono::Template::Strategy::Dsl::Builder::Helpers::FileHelper
- Extended by:
- Memoist
- Defined in:
- lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb
Instance Method Summary collapse
- #content(path) ⇒ Object
- #render_file(folder, path) ⇒ Object
- #render_path(path) ⇒ Object
- #user_data(path) ⇒ Object
- #user_data_script ⇒ Object
Instance Method Details
#content(path) ⇒ Object
5 6 7 |
# File 'lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb', line 5 def content(path) render_file(Lono.config.content_path, path) end |
#render_file(folder, path) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb', line 30 def render_file(folder, path) path = "#{folder}/#{path}" if File.exist?(path) render_path(path) else = "WARNING: path #{path} not found" puts .color(:yellow) puts "Called from:" puts caller[2] end end |
#render_path(path) ⇒ Object
44 45 46 |
# File 'lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb', line 44 def render_path(path) RenderMePretty.result(path, context: self) end |
#user_data(path) ⇒ Object
9 10 11 |
# File 'lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb', line 9 def user_data(path) render_file(Lono.config.user_data_path, path) end |
#user_data_script ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb', line 13 def user_data_script unless @user_data_script return <<~EOL # @user_data_script variable not set. IE: @user_data_script = "configs/#{@blueprint}/user_data/boostrap.sh" # Also, make sure that "configs/#{@blueprint}/user_data/boostrap.sh" path you're using exists. EOL end if File.exist?(@user_data_script) render_path(@user_data_script) else = "WARN: #{@user_data_script} not found" puts .color(:yellow) "# #{}" end end |