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
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/foreman_debian/command/install.rb', line 47 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
43 44 45 |
# File 'lib/foreman_debian/command/install.rb', line 43 def dir_root Pathname.new(working_dir) end |
#execute ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/foreman_debian/command/install.rb', line 15 def execute jobs = {} procfile.entries do |name, command| jobs[name] = (command) end concurrency = decode_concurrency(concurrency_encoded) get_engine.install(jobs, concurrency) end |
#expand_procfile_command(command) ⇒ Object
24 25 26 27 28 |
# File 'lib/foreman_debian/command/install.rb', line 24 def (command) args = Shellwords.split(command) args[0] = Pathname.new(args[0]).(dir_root).to_s Shellwords.join(args) end |
#procfile ⇒ Foreman::Procfile
37 38 39 40 |
# File 'lib/foreman_debian/command/install.rb', line 37 def procfile raise "Procfile `#{procfile_path.to_s}` does not exist" unless procfile_path.file? Foreman::Procfile.new(procfile_path) end |
#procfile_path ⇒ Pathname
31 32 33 34 |
# File 'lib/foreman_debian/command/install.rb', line 31 def procfile_path path_relative = procfile_path_relative || "#{working_dir}/Procfile" Pathname.new(path_relative).(Dir.getwd) end |