Permalink
Browse files

Updated README

  • Loading branch information...
1 parent c95384d commit 97f0bc682d139f51369c32ef0fc1e18235485c26 @delano committed May 7, 2009
Showing with 77 additions and 5 deletions.
  1. +60 −1 README.rdoc
  2. +1 −1 Rakefile
  3. +16 −3 bin/sysinfo
View
@@ -2,6 +2,65 @@
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:
+
+* <tt>$ sysinfo os</tt>
+* <tt>$ sysinfo impl</tt>
+* <tt>$ sysinfo arch</tt>
+
+== 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:
@@ -12,7 +71,7 @@ Via Rubygems, one of:
or via download:
* sysinfo-latest.tar.gz[http://github.com/delano/sysinfo/tarball/latest]
* sysinfo-latest.zip[http://github.com/delano/sysinfo/zipball/latest]
-
+
== Prerequisites
* Ruby 1.8, Ruby 1.9, or JRuby 1.2
View
@@ -74,7 +74,7 @@ Rake::RDocTask.new do |t|
t.rdoc_files.include(LICENSE)
t.rdoc_files.include(README)
t.rdoc_files.include(CHANGES)
- #t.rdoc_files.include('bin/*')
+ t.rdoc_files.include('bin/*')
t.rdoc_files.include('lib/**/*.rb')
end
View
@@ -14,7 +14,7 @@ require 'rubygems'
require 'drydock'
require 'sysinfo'
-module SysInfoCLI
+module SysInfoCLI #:nodoc:
extend Drydock
debug :off
@@ -50,15 +50,28 @@ module SysInfoCLI
reorg = {}
SysInfo::IMPLEMENTATIONS.each do |arch|
next if arch[0].nil?
- reorg.store(arch[1,2].join('_'), arch[0])
+ reorg.store(arch[2].to_s, arch[0])
end
impl = reorg.keys.sort.collect do |key|
obj.global.verbose == true ? "%-15s -> %s" % [key, reorg[key].source] : key
end
- puts impl
+ puts impl.compact.uniq
end
command_alias :impl, :implementations
+ about "Display list of known operating systems (OS)"
+ command :os do |obj|
+ reorg = {}
+ SysInfo::IMPLEMENTATIONS.each do |arch|
+ next if arch[0].nil?
+ reorg.store(arch[1].to_s, arch[0])
+ end
+ impl = reorg.keys.sort.collect do |key|
+ obj.global.verbose == true ? "%-15s -> %s" % [key, reorg[key].source] : key
+ end
+ puts impl.compact.uniq
+ end
+
end

0 comments on commit 97f0bc6

Please sign in to comment.