Class: ProcfileSplit::Procfile

Inherits:
Object
  • Object
show all
Defined in:
lib/procfile_split/procfile.rb

Class Method Summary collapse

Class Method Details

.create_procfile(file, process, command) ⇒ Object



14
15
16
17
18
19
# File 'lib/procfile_split/procfile.rb', line 14

def self.create_procfile(file, process, command)
  procfile_line = "#{process}: #{command}"
  File.open(file, 'w') do |f| 
    f.write(procfile_line)
  end
end

.processes(procfile) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/procfile_split/procfile.rb', line 3

def self.processes(procfile)
  lines = procfile.split("\n")
  lines.inject({}) do |map, line|
    name, command = line.split(":")
    if name && command
      map[name] = command.strip
    end
    map
  end
end