Sha256: f1b51715150ffbc24595f8b28b5459dc38a17c7f23301b79ac7c299a3a9e9829

Contents?: true

Size: 573 Bytes

Versions: 9

Compression:

Stored size: 573 Bytes

Contents

class Kubes::Compiler
  class Strategy
    def initialize(options={})
      @options = options
      @path = options[:path]
    end

    def compile
      klass = strategy_class
      return false unless klass

      strategy = klass.new(@options.merge(path: @path)) # Dsl or Erb
      result = strategy.run
      result.decorate!(:pre) # compile pre phase decoration
      result
    end

    def strategy_class
      ext = File.extname(@path).sub('.','').to_sym
      map = {
        rb: Dsl,
        yaml: Erb,
        yml: Erb,
      }
      map[ext]
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kubes-0.6.8 lib/kubes/compiler/strategy.rb
kubes-0.6.7 lib/kubes/compiler/strategy.rb
kubes-0.6.6 lib/kubes/compiler/strategy.rb
kubes-0.6.5 lib/kubes/compiler/strategy.rb
kubes-0.6.4 lib/kubes/compiler/strategy.rb
kubes-0.6.3 lib/kubes/compiler/strategy.rb
kubes-0.6.2 lib/kubes/compiler/strategy.rb
kubes-0.6.1 lib/kubes/compiler/strategy.rb
kubes-0.6.0 lib/kubes/compiler/strategy.rb