Method: Bake::Blocks::BlockBase#printCmd

Defined in:
lib/blocks/blockBase.rb

#printCmd(cmd, alternate, reason, forceVerbose) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/blocks/blockBase.rb', line 90

def printCmd(cmd, alternate, reason, forceVerbose)
  if (cmd == Thread.current[:lastCommand])
    if (Bake.options.verbose >= 2 or (Thread.current[:printedCmdAlternate] and not forceVerbose))
      return
    end
  end

  Thread.current[:lastCommand] = cmd

  return if Bake.options.verbose == 0 and not forceVerbose

  if forceVerbose or Bake.options.verbose >= 2 or not alternate
    Thread.current[:printedCmdAlternate] = false
    puts "" if Bake.options.verbose >= 2 # for A.K. :-)

    if Bake.options.verbose >= 3
      exedIn = "\n(executed in '#{@projectDir}')"
      because = reason ? "\n(#{reason})" : ""
    else
      exedIn = ""
      because = ""
    end

    if cmd.is_a?(Array)
      puts cmd.join(' ') + exedIn + because
    else
      puts cmd + exedIn + because
    end
  else
    Thread.current[:printedCmdAlternate] = true
    puts alternate
  end

end