Sha256: 5afc2c174f3f375b672ef2bd07e6fee20c8602ea86524df67a3401e23250e4b3

Contents?: true

Size: 993 Bytes

Versions: 29

Compression:

Stored size: 993 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::Erb#run method generates the CloudFormation templates
  # and embeds user-data script into the template.
  class UserData < AbstractBase
    def initialize(options={})
      super
      @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".color(: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

29 entries across 29 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/user_data.rb
lono-7.5.1 lib/lono/user_data.rb
lono-7.5.0 lib/lono/user_data.rb
lono-7.4.11 lib/lono/user_data.rb
lono-7.4.10 lib/lono/user_data.rb
lono-7.4.9 lib/lono/user_data.rb
lono-7.4.8 lib/lono/user_data.rb
lono-7.4.7 lib/lono/user_data.rb
lono-7.4.6 lib/lono/user_data.rb
lono-7.4.5 lib/lono/user_data.rb
lono-7.4.4 lib/lono/user_data.rb
lono-7.4.3 lib/lono/user_data.rb
lono-7.4.2 lib/lono/user_data.rb
lono-7.4.1 lib/lono/user_data.rb
lono-7.4.0 lib/lono/user_data.rb
lono-7.3.2 lib/lono/user_data.rb
lono-7.3.1 lib/lono/user_data.rb
lono-7.3.0 lib/lono/user_data.rb
lono-7.2.3 lib/lono/user_data.rb
lono-7.2.2 lib/lono/user_data.rb