Class: ForemanDebian::Command::Install
- Inherits:
-
ForemanDebian::Command
- Object
- Clamp::Command
- ForemanDebian::Command
- ForemanDebian::Command::Install
- Defined in:
- lib/foreman_debian/command/install.rb
Instance Method Summary collapse
- #decode_concurrency(concurrency_encoded) ⇒ Object
- #dir_root ⇒ Pathname
- #execute ⇒ Object
- #expand_procfile_command(command) ⇒ Object
- #procfile ⇒ Foreman::Procfile
- #procfile_path ⇒ Pathname
Methods inherited from ForemanDebian::Command
Instance Method Details
#decode_concurrency(concurrency_encoded) ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/foreman_debian/command/install.rb', line 51 def decode_concurrency(concurrency_encoded) concurrency_hash = {} concurrency_encoded.split(',').each do |entry| parts = entry.split('=') raise 'Invalid concurrency option' unless parts.size == 2 name, concurrency = parts concurrency_hash[name] = concurrency.to_i end concurrency_hash end |
#dir_root ⇒ Pathname
47 48 49 |
# File 'lib/foreman_debian/command/install.rb', line 47 def dir_root Pathname.new(working_dir) end |
#execute ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/foreman_debian/command/install.rb', line 19 def execute jobs = {} procfile.entries do |name, command| jobs[name] = (command) end concurrency = decode_concurrency(concurrency_encoded) get_engine.install(jobs, concurrency, user) end |
#expand_procfile_command(command) ⇒ Object
28 29 30 31 32 |
# File 'lib/foreman_debian/command/install.rb', line 28 def (command) args = Shellwords.split(command) args[0] = Pathname.new(args[0]).(dir_root).to_s Shellwords.join(args) end |
#procfile ⇒ Foreman::Procfile
41 42 43 44 |
# File 'lib/foreman_debian/command/install.rb', line 41 def procfile raise "Procfile `#{procfile_path.to_s}` does not exist" unless procfile_path.file? Foreman::Procfile.new(procfile_path) end |
#procfile_path ⇒ Pathname
35 36 37 38 |
# File 'lib/foreman_debian/command/install.rb', line 35 def procfile_path path_relative = procfile_path_relative || "#{working_dir}/Procfile" Pathname.new(path_relative).(Dir.getwd) end |