Sha256: 12023268c3dd4434e551a37c1e4516651ed0a2e2e4bb229bd54ea079838115b0

Contents?: true

Size: 559 Bytes

Versions: 5

Compression:

Stored size: 559 Bytes

Contents

require 'rbconfig'

module Waddup

  module Extension::System

    # Runs given system command
    #
    # Options:
    #
    #   :quietly (supresses output)
    #
    def run(command, options = {})
      command << ' 2>&1' if options[:quietly]
      `#{command}`.chomp
    end

    # Retrieves operating system
    # See: https://github.com/celluloid/celluloid/blob/master/lib/celluloid/cpu_counter.rb
    def os
      @os ||= RbConfig::CONFIG['host_os'][/^[A-Za-z]+/]
    end

    # Whether running OSX
    def osx?
      os == 'darwin'
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
waddup-0.2.2 lib/waddup/extensions/system.rb
waddup-0.2.1 lib/waddup/extensions/system.rb
waddup-0.2.0 lib/waddup/extensions/system.rb
waddup-0.1.0 lib/waddup/extensions/system.rb
waddup-0.0.2 lib/waddup/extensions/system.rb