Sha256: 89d9bbf74a414aeb7b2252c23b9afdc68bbadb612d50e7c3fcf37b3e4a04e624

Contents?: true

Size: 558 Bytes

Versions: 13

Compression:

Stored size: 558 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.compile_decorate! # compile phase decoration
      result
    end

    def strategy_class
      ext = File.extname(@path)
      case ext
      when '.rb'   then Dsl
      when '.yaml' then Erb
      else Pass
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kubes-0.3.5 lib/kubes/compiler/strategy.rb
kubes-0.3.4 lib/kubes/compiler/strategy.rb
kubes-0.3.3 lib/kubes/compiler/strategy.rb
kubes-0.3.2 lib/kubes/compiler/strategy.rb
kubes-0.3.1 lib/kubes/compiler/strategy.rb
kubes-0.3.0 lib/kubes/compiler/strategy.rb
kubes-0.2.6 lib/kubes/compiler/strategy.rb
kubes-0.2.5 lib/kubes/compiler/strategy.rb
kubes-0.2.4 lib/kubes/compiler/strategy.rb
kubes-0.2.3 lib/kubes/compiler/strategy.rb
kubes-0.2.2 lib/kubes/compiler/strategy.rb
kubes-0.2.1 lib/kubes/compiler/strategy.rb
kubes-0.2.0 lib/kubes/compiler/strategy.rb