Sha256: e4d30d14198b57fa7362de83cb6da2df8552a9c498a7d0cc28dc74fa09b60a73

Contents?: true

Size: 657 Bytes

Versions: 3

Compression:

Stored size: 657 Bytes

Contents


module Dockdev
  class Workspace

    def initialize(root = Dir.getwd)
      @root = root
    end

    def name
      File.dirname(@root)
    end

    def has_dockerfile?
      found_dockerfile_count > 0
    end

    def found_dockerfile_count
      dockerfiles.length 
    end

    def has_multiple_dockerfiles?
      found_dockerfile_count > 1
    end

    def dockerfiles
      Dir.glob(File.join(@root,"Dockerfile*"))
    end

    def dockerfile
      if has_dockerfile?
        dockerfiles.first
      else
        nil
      end
    end

    def has_docker_compose?
      Dir.glob(File.join(@root,"docker-compose.yml")).length > 0
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dockdev-0.4.2 lib/dockdev/workspace.rb
dockdev-0.4.1 lib/dockdev/workspace.rb
dockdev-0.4.0 lib/dockdev/workspace.rb