Sha256: aea4df0350b35aa7ef62ff8e575ebf6d66df032ef5ddb7a0f5e060cc624a05be

Contents?: true

Size: 745 Bytes

Versions: 2

Compression:

Stored size: 745 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

      private

      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.1 lib/packer/binary/helpers.rb
packer-binary-0.2.0 lib/packer/binary/helpers.rb