Sha256: 038435a8f6979e206f24552f3ff29ea082fabc946fa7ee37ea1c940397b4948b

Contents?: true

Size: 999 Bytes

Versions: 7

Compression:

Stored size: 999 Bytes

Contents

module Bake

  module Blocks

    module HasExecuteCommand

      def executeCommand(commandLine, ignoreStr=nil, exitCodeArray = [0], echo = "on")
        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

7 entries across 7 versions & 1 rubygems

Version Path
bake-toolkit-2.30.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.29.4 lib/blocks/has_execute_command.rb
bake-toolkit-2.29.3 lib/blocks/has_execute_command.rb
bake-toolkit-2.29.2 lib/blocks/has_execute_command.rb
bake-toolkit-2.29.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.28.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.28.0 lib/blocks/has_execute_command.rb