Sha256: 4a3dd02e199180e07601801654441b1188378978e57f77c89276cfe5dedceae4

Contents?: true

Size: 722 Bytes

Versions: 58

Compression:

Stored size: 722 Bytes

Contents

module Kubes::Compiler::Dsl::Core
  module Files
    def files(*list)
      dir = current_dir
      list.each do |file|
        path = "#{dir}/#{file}"
        load_data_from_file(path)
      end
    end

    def load_data_from_file(path)
      parser = Kubes::Compiler::Dsl::Core::Parser.new(path)
      items = parser.parse
      items.transform_values! { |v| base64(v) } if secret_class?
      data(items)
    end

    def secret_class?
      self.class == Kubes::Compiler::Dsl::Syntax::Secret
    end

    def current_dir
      resources_line = caller.find { |l| l.include?('.kubes/resources') }
      path = resources_line.split(':').first
      File.dirname(path) # IE: /full/path/.kubes/resources
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
kubes-0.9.3 lib/kubes/compiler/dsl/core/files.rb
kubes-0.9.2 lib/kubes/compiler/dsl/core/files.rb
kubes-0.9.1 lib/kubes/compiler/dsl/core/files.rb
kubes-0.9.0 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.10 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.9 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.8 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.7 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.6 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.5 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.4 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.3 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.2 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.1 lib/kubes/compiler/dsl/core/files.rb
kubes-0.8.0 lib/kubes/compiler/dsl/core/files.rb
kubes-0.7.10 lib/kubes/compiler/dsl/core/files.rb
kubes-0.7.9 lib/kubes/compiler/dsl/core/files.rb
kubes-0.7.8 lib/kubes/compiler/dsl/core/files.rb
kubes-0.7.7 lib/kubes/compiler/dsl/core/files.rb
kubes-0.7.6 lib/kubes/compiler/dsl/core/files.rb