Sha256: 2c6353c77ae97affb9299368d15d39a61143b4d07d16c58995f23ce08bb8c1d1
Contents?: true
Size: 949 Bytes
Versions: 4
Compression:
Stored size: 949 Bytes
Contents
require "foreman" require "foreman/procfile_entry" # A valid Procfile entry is captured by this regex. # All other lines are ignored. # # /^([A-Za-z0-9_]+):\s*(.+)$/ # # $1 = name # $2 = command # class Foreman::Procfile attr_reader :entries def initialize(filename=nil) @entries = [] load(filename) if filename end def [](name) entries.detect { |entry| entry.name == name } end def process_names entries.map(&:name) end def load(filename) entries.clear parse_procfile(filename) end def write(filename) File.open(filename, 'w') do |io| entries.each do |ent| io.puts(ent) end end end def <<(entry) entries << Foreman::ProcfileEntry.new(*entry) self end protected def parse_procfile(filename) File.read(filename).split("\n").map do |line| if line =~ /^([A-Za-z0-9_]+):\s*(.+)$/ self << [ $1, $2 ] end end.compact end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
foreman-0.47.0 | lib/foreman/procfile.rb |
foreman-0.46.0-mingw32 | lib/foreman/procfile.rb |
foreman-0.46.0-java | lib/foreman/procfile.rb |
foreman-0.46.0 | lib/foreman/procfile.rb |