lib/mina/commands.rb in mina-1.2.4 vs lib/mina/commands.rb in mina-1.2.5

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Mina class Commands extend Forwardable include Helpers::Internal include Configuration::DSL @@ -17,28 +19,28 @@ code = indent(indent, code) if indent queue[stage] << (quiet ? code : echo_cmd(code)) end def comment(code, indent: nil) - if indent - queue[stage] << indent(indent, %{echo "-----> #{code}"}) - else - queue[stage] << %{echo "-----> #{code}"} - end + queue[stage] << if indent + indent(indent, %(echo "-----> #{code}")) + else + %(echo "-----> #{code}") + end end def delete(stage) queue.delete(stage) || [] end def empty(stage = :default) queue[stage] = [] end - def process(path = nil) + def process(path = nil) # rubocop:disable Metrics/AbcSize if path && !queue[stage].empty? - queue[stage].unshift(%{echo "$ cd #{path}"}) if fetch(:verbose) + queue[stage].unshift(%(echo "$ cd #{path}")) if fetch(:verbose) %{(cd #{path} && #{queue[stage].join(' && ')} && cd -)} else queue[stage].join("\n") end end @@ -47,9 +49,10 @@ !queue.empty? && stage == :default end def run(backend) return if queue.empty? + report_time do status = Mina::Runner.new(process, backend).run error! 'Run Error' unless status end end