Sha256: 8cf8b89d2423e516cbf801fad4a9827b5f2da72e5a552e9d0eade2adc95ecbc4

Contents?: true

Size: 730 Bytes

Versions: 2

Compression:

Stored size: 730 Bytes

Contents

module Packer
  module Binary
    # Generic helper methods
    module Helpers
      module_function

      # Runs given commands using mixlib-shellout
      def system_command(*command_args)
        cmd = Mixlib::ShellOut.new(*command_args)
        cmd.run_command
        cmd
      end

      # prints to `stderr`
      def err(message)
        stderr.print("#{message}\n")
      end

      # prints to `stdout`
      def msg(message)
        stdout.print("#{message}\n")
      end

      # prints to `stfout` if `ENV['DEBUG']` is set
      def debug(message)
        stdout.print("#{message}\n") if ENV['DEBUG']
      end

      def stdout
        $stdout
      end

      def stderr
        $stderr
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
packer-binary-0.2.3 lib/packer/binary/helpers.rb
packer-binary-0.2.2 lib/packer/binary/helpers.rb