Sha256: c2f20140c3f098697bf7a2abfbc32630b312e0e8fac408bfa3ca446fafd6fd2b

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

module Cumuli
  class App
    class Procs
      attr_reader :port_map, :path, :apps

      def initialize(path=nil)
        @path = (path || Dir.pwd) + "/Procfile"
        parse_procfile
      end

      def map
        @map ||= apps.inject({}) do |hash, app|
          hash[app.name] = app.port
          hash
        end
      end

      def file
        @file ||= File.read(path)
      end

      def parse_procfile
        @apps = file.lines.map do |line|
          SubApp.new(line)
        end
      end

      def names
        map.keys
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cumuli-0.3.4 lib/cumuli/app/procs.rb