Sha256: ba8b9a9cb9588e4a52e59cec7c2a6061cba958342991df4ee7dec544c5a82127

Contents?: true

Size: 1.08 KB

Versions: 34

Compression:

Stored size: 1.08 KB

Contents

module Bake

  module Blocks

    module HasExecuteCommand
      attr_reader :config

      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
          cmd_result, output = ProcessHelper.run([commandLine], true, true, nil, exitCodeArray, @projectDir)
        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

34 entries across 34 versions & 1 rubygems

Version Path
bake-toolkit-2.72.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.71.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.70.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.70.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.69.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.68.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.68.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.67.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.66.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.65.2 lib/blocks/has_execute_command.rb
bake-toolkit-2.65.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.65.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.64.4 lib/blocks/has_execute_command.rb
bake-toolkit-2.64.3 lib/blocks/has_execute_command.rb
bake-toolkit-2.64.2 lib/blocks/has_execute_command.rb
bake-toolkit-2.64.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.64.0 lib/blocks/has_execute_command.rb
bake-toolkit-2.63.2 lib/blocks/has_execute_command.rb
bake-toolkit-2.63.1 lib/blocks/has_execute_command.rb
bake-toolkit-2.63.0 lib/blocks/has_execute_command.rb