Sha256: 6eec4d1042ed6c6b7fe99d5cd418e2264c64dc3a8ced71f039b0401aefdc696f

Contents?: true

Size: 991 Bytes

Versions: 13

Compression:

Stored size: 991 Bytes

Contents

module Lono
  # This class is not use by lono internally. It is really only meant to be
  # exposed to the lono userdata command so users can debug their generated
  # app/user_data scripts. It is useful for debugging.
  #
  # Normally, the Lono::DSL#run method generates the CloudFormation templates
  # and embeds user-data script into the template.
  class UserData
    def initialize(options)
      @options = options
      @name = options[:name]
      @path = "#{Lono.root}/app/user_data/#{@name}.sh"
    end

    def generate
      puts "Generating user_data for '#{@name}' at #{@path}"
      if File.exist?(@path)
        puts RenderMePretty.result(@path, context: context)
      else
        puts "ERROR: #{@path} does not exist".colorize(:red)
        exit 1
      end
    end

    # Context for ERB rendering.
    # This is where we control what references get passed to the ERB rendering.
    def context
      @context ||= Lono::Template::Context.new(@options)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
lono-4.2.4 lib/lono/user_data.rb
lono-4.2.3 lib/lono/user_data.rb
lono-4.2.2 lib/lono/user_data.rb
lono-4.2.1 lib/lono/user_data.rb
lono-4.2.0 lib/lono/user_data.rb
lono-4.1.0 lib/lono/user_data.rb
lono-4.0.6 lib/lono/user_data.rb
lono-4.0.5 lib/lono/user_data.rb
lono-4.0.4 lib/lono/user_data.rb
lono-4.0.3 lib/lono/user_data.rb
lono-4.0.2 lib/lono/user_data.rb
lono-4.0.1 lib/lono/user_data.rb
lono-4.0.0 lib/lono/user_data.rb