class RedmineInstaller::Command
Attributes
cmd[R]
formatter[R]
title[R]
Public Class Methods
new(cmd, title: nil)
click to toggle source
# File lib/redmine-installer/command.rb, line 9 def initialize(cmd, title: nil) @cmd = cmd @title = title || cmd @formatter = $SILENT_MODE ? SilentFormatter.new : FullFormatter.new end
Public Instance Methods
run()
click to toggle source
# File lib/redmine-installer/command.rb, line 15 def run Bundler.with_clean_env do run! end end
run!()
click to toggle source
# File lib/redmine-installer/command.rb, line 21 def run! success = false logger.std("--> #{cmd}") formatter.print_title(title) status = Open3.popen2e(cmd) do |input, output, wait_thr| input.close output.each_line do |line| logger.std(line) formatter.print_line(line) end wait_thr.value end success = status.success? rescue => e success = false ensure formatter.print_end(success) end