Sha256: 0865966323b1e81522906d0cc9038776016a38be175d63e0eae6fd65eb93abf3

Contents?: true

Size: 567 Bytes

Versions: 10

Compression:

Stored size: 567 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)
      case ext
      when '.rb'   then Dsl
      when '.yaml','.yml' then Erb
      else Pass
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kubes-0.5.1 lib/kubes/compiler/strategy.rb
kubes-0.5.0 lib/kubes/compiler/strategy.rb
kubes-0.4.7 lib/kubes/compiler/strategy.rb
kubes-0.4.6 lib/kubes/compiler/strategy.rb
kubes-0.4.5 lib/kubes/compiler/strategy.rb
kubes-0.4.4 lib/kubes/compiler/strategy.rb
kubes-0.4.3 lib/kubes/compiler/strategy.rb
kubes-0.4.2 lib/kubes/compiler/strategy.rb
kubes-0.4.1 lib/kubes/compiler/strategy.rb
kubes-0.4.0 lib/kubes/compiler/strategy.rb