Sha256: 47f4c374a13c00f31648c1c0be0ffca92eac37ffc8dc2e3321c2578e001cf6d5
Contents?: true
Size: 908 Bytes
Versions: 5
Compression:
Stored size: 908 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 class SubApp attr_reader :parts def initialize(line) @parts = line.split end def name parts.first.gsub(':', '') end def port if index = parts.find_index('-p') parts[index + 1] && parts[index + 1].to_i end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
cumuli-0.3.2 | lib/cumuli/app/procs.rb |
cumuli-0.3.1 | lib/cumuli/app/procs.rb |
cumuli-0.3.0 | lib/cumuli/app/procs.rb |
cumuli-0.2.1 | lib/cumuli/app/procs.rb |
cumuli-0.2.0 | lib/cumuli/app/procs.rb |