module Lono::Template::Strategy::Dsl::Builder::Helpers::FileHelper

Public Instance Methods

content(path) click to toggle source
# 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) click to toggle source
# 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
    message = "WARNING: path #{path} not found"
    puts message.color(:yellow)
    puts "Called from:"
    puts caller[2]
    message
  end
end
render_path(path) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# 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
        message = "WARN: #{@user_data_script} not found"
        puts message.color(:yellow)
        "# #{message}"
      end
    end