Sha256: 593e0fd08857b23424f8a8cb9d070c397550758d7868f3524f34e18e494fc943

Contents?: true

Size: 483 Bytes

Versions: 56

Compression:

Stored size: 483 Bytes

Contents

module Kubes::Compiler::Dsl::Core
  module Helpers
    def dockerfile_port
      path = "#{Kubes.root}/Dockerfile"
      File.exist?(path) ? parse_for_dockerfile_port(path) : 80
    end

  private
    def parse_for_dockerfile_port(path)
      lines = IO.read(path).split("\n")
      expose_line = lines.find { |l| l =~ /^EXPOSE / }
      if expose_line
        md = expose_line.match(/EXPOSE (\d+)/)
        port = md[1] if md
      end
      port ? port.to_i : 80
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

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