Coder Social home page Coder Social logo

mic75 / sysinfo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from delano/sysinfo

0.0 1.0 0.0 269 KB

All your system-independent infoz in one handy (Ruby) class

Home Page: http://delano.github.com/sysinfo

License: MIT License

Ruby 97.02% Shell 2.98%

sysinfo's Introduction

SysInfo - v0.6

All your system-independent infoz in one handy class.

SysInfo does a takes a very quick glance at the system it’s running on and exposes the results as YAML, JSON, CSV, or TSV. It also determines a platform identifier for the system that takes the form: VM-OS-IMPLEMENTATION-ARCHITECTURE.

Platform Identifier Examples

ruby-unix-osx-i386
ruby-unix-osx-powerpc
ruby-unix-linux-x86_64
java-win32-windows-i386
java-win32-mingw-i386

For the complete list of operating systems, implementations and architectures that SysInfo is aware of, see:

  • $ sysinfo os

  • $ sysinfo impl

  • $ sysinfo arch

Usage – Library

sysinfo = SysInfo.new
p sysinfo.vm                    # => ruby
p sysinfo.os                    # => unix
p sysinfo.impl                  # => osx
p sysinfo.arch                  # => i386
p sysinfo.platform              # => ruby-unix
p sysinfo.to_s                  # => ruby-unix-osx-i386

p sysinfo.user                  # => delano
p sysinfo.home                  # => /Users/delano
p sysinfo.uptime                # => 290.429              (hours)
p sysinfo.shell                 # => /bin/bash
p sysinfo.paths                 # => [/sbin, /bin, /usr/bin, ...]

p sysinfo.hostname              # => walter
p sysinfo.ipaddress_internal    # => 10.0.1.2
p sysinfo.uptime                # => 290.573655656974
p sysinfo.ruby                  # => [1,9,1]

Usage – Executable

$ sysinfo 
ruby-unix-osx-i386

$ /usr/jruby/bin/sysinfo
java-unix-osx-x86_64

$ sysinfo -f yaml
:vm: :ruby
:os: :unix
:impl: :osx
...
:shell: :"/bin/bash"
:user: delano

$ sysinfo -f json
{"vm":"ruby","os":"unix","impl":"osx", ..., "shell":"\/bin\/bash","user":"delano"}

$ sysinfo -f csv
ruby,unix,osx, ... /bin/bash,delano

Installation

Via Rubygems, one of:

$ sudo gem install sysinfo
$ sudo gem install delano-sysinfo --source http://gems.github.com/

or via download:

Prerequisites

  • Ruby 1.8, Ruby 1.9, or JRuby 1.2

  • Storable

Credits

  • Delano Mandelbaum ([email protected])

  • Portions of this code were originally from Amazon’s EC2 AMI tools, specifically lib/platform.rb.

License

See: LICENSE.txt

sysinfo's People

Contributors

delano avatar jperville avatar flameeyes avatar mic75 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.