Sha256: d6ad4391c0220638be7fb741331d65b362653be5cff7180b209ad16c9e3e85a1

Contents?: true

Size: 1.06 KB

Versions: 11

Compression:

Stored size: 1.06 KB

Contents

module Bake

  module Blocks

    module HasExecuteCommand

      def executeCommand(commandLine, ignoreStr=nil, exitCodeArray = [0], echo = "on")
        if Bake.options.dry
          puts commandLine
          return true
        end

        puts commandLine if (Bake.options.verbose >= 1 && echo != "off") || Bake.options.verbose >= 3
        puts "(executed in '#{@projectDir}')" if Bake.options.verbose >= 3
        cmd_result = false
        output = ""
        begin
          Dir.chdir(@projectDir) do
            cmd_result, output = ProcessHelper.run([commandLine], true, true, nil, exitCodeArray)
          end
        rescue Exception=>e
          puts e.message
          puts e.backtrace if Bake.options.debug
        end

        if (cmd_result == false and (not ignoreStr or not output.include?ignoreStr))
          Bake.formatter.printError("Command \"#{commandLine}\" failed", @config)
          puts "(executed in '#{@projectDir}')" if Bake.options.verbose >= 3
          raise SystemCommandFailed.new
        end
        return cmd_result
      end

    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
bake-toolkit-2.34.3 lib/blocks/has_execute_command.rb
bake-toolkit-2.34.2 lib/blocks/has_execute_command.rb
bake-toolkit-2.34.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.34.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.33.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.32.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.31.7 lib/blocks/has_execute_command.rb
bake-toolkit-2.31.5 lib/blocks/has_execute_command.rb
bake-toolkit-2.31.4 lib/blocks/has_execute_command.rb
bake-toolkit-2.31.2 lib/blocks/has_execute_command.rb
bake-toolkit-2.31.0 lib/blocks/has_execute_command.rb