system 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -16,6 +16,8 @@ tmtags
16
16
  ## PROJECT::GENERAL
17
17
  coverage
18
18
  rdoc
19
+ doc
20
+ .yardoc
19
21
  pkg
20
22
 
21
23
  ## Netbeans
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create ruby@system
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ system (0.1.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ coderay (1.0.8)
10
+ diff-lcs (1.1.3)
11
+ fuubar (1.1.0)
12
+ rspec (~> 2.0)
13
+ rspec-instafail (~> 0.2.0)
14
+ ruby-progressbar (~> 1.0.0)
15
+ guard (1.5.4)
16
+ listen (>= 0.4.2)
17
+ lumberjack (>= 1.0.2)
18
+ pry (>= 0.9.10)
19
+ thor (>= 0.14.6)
20
+ guard-rspec (2.1.1)
21
+ guard (>= 1.1)
22
+ rspec (~> 2.11)
23
+ guard-yard (2.0.1)
24
+ guard (>= 1.1.0)
25
+ yard (>= 0.7.0)
26
+ kramdown (0.14.0)
27
+ listen (0.5.3)
28
+ lumberjack (1.0.2)
29
+ method_source (0.8.1)
30
+ pry (0.9.10)
31
+ coderay (~> 1.0.5)
32
+ method_source (~> 0.8)
33
+ slop (~> 3.3.1)
34
+ pry (0.9.10-java)
35
+ coderay (~> 1.0.5)
36
+ method_source (~> 0.8)
37
+ slop (~> 3.3.1)
38
+ spoon (~> 0.0)
39
+ rake (0.9.2.2)
40
+ rb-fsevent (0.9.2)
41
+ rspec (2.11.0)
42
+ rspec-core (~> 2.11.0)
43
+ rspec-expectations (~> 2.11.0)
44
+ rspec-mocks (~> 2.11.0)
45
+ rspec-core (2.11.1)
46
+ rspec-expectations (2.11.3)
47
+ diff-lcs (~> 1.1.3)
48
+ rspec-instafail (0.2.4)
49
+ rspec-mocks (2.11.3)
50
+ ruby-progressbar (1.0.2)
51
+ slop (3.3.3)
52
+ spoon (0.0.1)
53
+ thor (0.16.0)
54
+ version (1.0.0)
55
+ yard (0.8.3)
56
+
57
+ PLATFORMS
58
+ java
59
+ ruby
60
+
61
+ DEPENDENCIES
62
+ fuubar (~> 1.1)
63
+ guard-rspec (~> 2.1.1)
64
+ guard-yard (~> 2.0.1)
65
+ kramdown (~> 0.14.0)
66
+ rake (~> 0.9)
67
+ rb-fsevent (~> 0.9.1)
68
+ system!
69
+ version (~> 1.0.0)
data/Guardfile ADDED
@@ -0,0 +1,10 @@
1
+ guard 'yard' do
2
+ watch(%r{lib/.+\.rb})
3
+ end
4
+
5
+ guard 'rspec', cli: '-f Fuubar --color' do
6
+ watch(%r{^spec/.+_spec\.rb$})
7
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
8
+ watch('spec/spec_helper.rb') { "spec" }
9
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
10
+ end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Roja Buck
1
+ Copyright (c) 2009-2012 Roja Buck and Ryan Scott Lewis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/NOTES.md ADDED
@@ -0,0 +1,10 @@
1
+ # Developer Notes
2
+
3
+ * Must be a `Class` for cross-implementation because `System` exists within JRuby.
4
+ * Keep backwards compatibility until version 0.2.X.
5
+ * Documentation in [YARD](http://rubydoc.info/docs/yard/file/docs/GettingStarted.md).
6
+
7
+ ## Setup Development Environment
8
+
9
+ bundle install
10
+ bundle exec guard
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # System
2
+
3
+ System is a pure ruby interface to gather current systems information.
4
+
5
+ ## About
6
+
7
+ System is a cross-platform and cross-implementation interface to gather system information from the current host.
8
+
9
+ System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem, etc.
10
+
11
+ ## Install
12
+
13
+ ### Bundler: `gem 'system'`
14
+
15
+ ### RubyGems: `gem install system`
16
+
17
+ ## Usage
18
+
19
+ ```ruby
20
+ require 'system'
21
+
22
+ System::Ruby.java? # => Are we running on java?
23
+ System::Ruby.jruby? # => Are we running on jruby?
24
+ System::OS.name # => Current OS name as a Symbol i.e. :windows, :linux, :osx, :bsd, :darwin, :solaris
25
+ System::CPU.count # => Current number of CPUs, including individual cores
26
+ ```
27
+
28
+ ## TODO
29
+
30
+ ### List
31
+
32
+ * Separate OS and Implementation specific logic into loadable mixins
33
+
34
+ i.e. `require 'system/cpu'` would `require 'system/cpu/java'` if running JRuby.
35
+
36
+ * SPECS! Decide how to stub out system calls and replace with fixtures.
37
+
38
+ ### System::CPU
39
+
40
+ ```ruby
41
+ System::CPU[0].id # => The first CPU's physical ID as an integer
42
+ System::CPU[0].vendor # => The first CPU's vendor as a String
43
+ System::CPU[0].family # => The first CPU's family as an Integer
44
+ System::CPU[0].model # => The first CPU's model as an Integer
45
+ System::CPU[0].name # => The first CPU's model as a String
46
+ System::CPU[0].speed # => The first CPU's speed in MHz as a Float
47
+ System::CPU[0].cache # => The first CPU's cache size in KB as an Integer
48
+ System::CPU[0].multi_core? # => Does the first CPU contain multiple cores?
49
+ ```
50
+
51
+ ### System::CPU::Core
52
+
53
+ ```ruby
54
+ System::CPU[0].cores[0] # => The first CPU's first core as a System::CPU::Core
55
+ System::CPU[0].cores[0].id # => The ID of the first CPU's first core as an Integer
56
+ System::CPU[0].cores[0].flags # => An Array containing the Core's flags as Symbols
57
+ System::CPU[0].cores[0].siblings # => An Array containing the other Cores in the CPU
58
+ System::CPU[0].cores[0].siblings # => An Array containing the other Cores in the CPU
59
+ ```
60
+
61
+ ###### Build Status
62
+
63
+ [![Build Status](https://secure.travis-ci.org/roja/system.png)](http://travis-ci.org/roja/system)
64
+
65
+ ## Contributing
66
+
67
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
68
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
69
+ * Fork the project
70
+ * Start or switch to a testing/unstable/feature/bugfix branch
71
+ * Commit and push until you are happy with your contribution
72
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
73
+ * Please try not to mess with the Rakefile, VERSION or gemspec.
74
+
75
+ ## Copyright
76
+
77
+ Copyright © 2009-2012 Roja Buck and Ryan Scott Lewis.
78
+
79
+ The MIT License (MIT) - See LICENSE for further details.
data/Rakefile CHANGED
@@ -1,57 +1,39 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ require 'rake/version_task'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubygems/package_task'
4
+ require 'pathname'
3
5
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "system"
8
- gem.summary = %Q{System is a pure ruby interface to gather current systems information; OS, CPU, Filesystem etc...}
9
- gem.description = %Q{System is a pure ruby interface to gather systems information from the current host. System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem etc...}
10
- gem.email = "roja@arbia.co.uk"
11
- gem.homepage = "http://github.com/roja/system"
12
- gem.authors = ["Roja Buck"]
13
- gem.rubyforge_project = 'system'
14
- # gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
- end
17
- Jeweler::GemcutterTasks.new
18
- Jeweler::RubyforgeTasks.new do |rubyforge|
19
- rubyforge.doc_task = "rdoc"
20
- end
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
6
+ spec = Gem::Specification.new do |s|
7
+ s.name = 'system'
8
+ s.version = Pathname.new(__FILE__).dirname.join('VERSION').read.strip
9
+ s.author = ['Roja Buck', 'Ryan Scott Lewis']
10
+ s.email = ['roja@arbia.co.uk', 'ryan@rynet.us']
11
+ s.homepage = "http://github.com/roja/#{s.name}"
12
+ s.summary = 'System is a pure ruby interface to gather current systems information; OS, CPU, Filesystem etc...'
13
+ s.description = 'System is a pure ruby interface to gather systems information from the current host. System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem etc...'
14
+ s.require_path = 'lib'
15
+ s.files = `git ls-files`.lines.to_a.collect { |s| s.strip }
16
+ s.executables = `git ls-files -- bin/*`.lines.to_a.collect { |s| File.basename(s.strip) }
17
+
18
+ s.add_development_dependency 'version', '~> 1.0.0'
19
+ s.add_development_dependency 'rake', '~> 0.9'
20
+ s.add_development_dependency 'guard-rspec', '~> 2.1.1'
21
+ s.add_development_dependency 'guard-yard', '~> 2.0.1'
22
+ s.add_development_dependency 'rb-fsevent', '~> 0.9.1'
23
+ s.add_development_dependency 'fuubar', '~> 1.1'
24
+ s.add_development_dependency 'kramdown', '~> 0.14.0'
23
25
  end
24
26
 
25
- require 'rake/testtask'
26
- Rake::TestTask.new(:test) do |test|
27
- test.libs << 'lib' << 'test'
28
- test.pattern = 'test/**/test_*.rb'
29
- test.verbose = true
27
+ Rake::VersionTask.new do |t|
28
+ t.with_git_tag = true
29
+ t.with_gemspec = spec
30
30
  end
31
31
 
32
- begin
33
- require 'rcov/rcovtask'
34
- Rcov::RcovTask.new do |test|
35
- test.libs << 'test'
36
- test.pattern = 'test/**/test_*.rb'
37
- test.verbose = true
38
- end
39
- rescue LoadError
40
- task :rcov do
41
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
- end
43
- end
44
-
45
- task :test => :check_dependencies
46
-
47
- task :default => :test
32
+ RSpec::Core::RakeTask.new
48
33
 
49
- require 'rake/rdoctask'
50
- Rake::RDocTask.new do |rdoc|
51
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
-
53
- rdoc.rdoc_dir = 'rdoc'
54
- rdoc.title = "system #{version}"
55
- rdoc.rdoc_files.include('README*')
56
- rdoc.rdoc_files.include('lib/**/*.rb')
34
+ Gem::PackageTask.new(spec) do |t|
35
+ t.need_zip = false
36
+ t.need_tar = false
57
37
  end
38
+
39
+ task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
data/lib/system.rb CHANGED
@@ -1,43 +1,27 @@
1
- # system includes
2
- require 'singleton'
1
+ # System includes
3
2
  require 'rbconfig'
3
+ require 'pathname'
4
4
 
5
- # java includes
6
- if /java/.match(RUBY_PLATFORM)
5
+ # Java includes - Have to load this way to avoid overloading of our classes
6
+ if /java/.match(RUBY_PLATFORM) # TODO: For now, this is a good place for this but it will need abstracting..
7
7
  require 'java'
8
8
  import 'java.lang.System'
9
9
  end
10
10
 
11
- module HostSystem
11
+ # Prepare LOAD_PATH
12
+ __LIB__ ||= Pathname.new(__FILE__).dirname
13
+ $:.unshift(__LIB__.to_s) unless $:.include?(__LIB__.to_s)
12
14
 
13
- def self.os
14
- return @os if defined? @os # if we already know then pass it
15
- os_name = RUBY_PLATFORM
16
- os_name = RbConfig::CONFIG['host_os'] if defined? RbConfig::CONFIG
17
- os_name = System.getProperty('os.name').downcase if jruby?
18
- @os = case os_name
19
- when /linux/ then :linux
20
- when /win/ then :windows
21
- when /solaris/ then :solaris
22
- when /bsd/ then :bsd
23
- when /darwin/ then
24
- defined? RbConfig::CONFIG && RbConfig::CONFIG['build_vendor'] == 'apple' ? :osx : :darwin
25
- when /mac.*?os.*?x/ then :osx
26
- else
27
- :unknown
28
- end
29
- end
15
+ # Local includes
16
+ require 'system/version'
17
+ require 'system/ruby'
18
+ require 'system/os'
19
+ require 'system/cpu'
20
+ require 'system/backwards_compatibility'
30
21
 
31
- def self.java?
32
- !(/java/.match(RUBY_PLATFORM).nil?)
33
- end
34
-
35
- def self.jruby?
36
- if HostSystem::java?
37
- /jruby/.match(RUBY_ENGINE)
38
- else
39
- false
40
- end
41
- end
42
-
43
- end
22
+ # System is a cross-platform and cross-implementation interface to gather system information from the current host.
23
+ #
24
+ # System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem, etc..
25
+ #
26
+ # @since 0.1.0
27
+ class System; end
@@ -0,0 +1,42 @@
1
+ require 'system/version'
2
+
3
+ class System
4
+ class << self
5
+
6
+ # Get the name of the operating system running on the current host.
7
+ #
8
+ # Delegates to System::OS.name for backwards compatibility with 0.1.0.
9
+ #
10
+ # @return [Symbol] The name of the operating system.
11
+ # @since 0.1.0
12
+ def os
13
+ System::OS.name
14
+ end
15
+ alias_method :operating_system, :os
16
+
17
+ # Check if Ruby is using Java.
18
+ #
19
+ # Delegates to System::Ruby.java? for backwards compatibility with 0.1.0.
20
+ #
21
+ # @return [TrueClass, FalseClass] Is the current Ruby implementation using Java?
22
+ # @since 0.1.0
23
+ def java?
24
+ System::Ruby.java?
25
+ end
26
+
27
+ # Check if Ruby is JRuby.
28
+ #
29
+ # Delegates to System::Ruby.jruby? for backwards compatibility with 0.1.0.
30
+ #
31
+ # @return [TrueClass, FalseClass] Is the current Ruby implementation JRuby?
32
+ # @since 0.1.0
33
+ def jruby?
34
+ System::Ruby.jruby?
35
+ end
36
+
37
+ end
38
+ end
39
+
40
+ # Constant for backwards compatibility with 0.1.0.
41
+ # @since 0.1.0
42
+ HostSystem = System
data/lib/system/cpu.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'system/version'
2
+
3
+ class System
4
+
5
+ # Information about the current CPU(s) running on the current system.
6
+ #
7
+ # @since 0.1.1
8
+ class CPU
9
+ class << self
10
+
11
+ # The CPU count of the system, including individual CPU cores.
12
+ #
13
+ # @return [Integer] Count of CPU cores.
14
+ def count
15
+ return Java::Java.lang.Runtime.getRuntime.availableProcessors if System::Ruby.java? # defined? Java::Java
16
+ return File.read('/proc/cpuinfo').scan(/^processor\s*:/).size if File.exist?('/proc/cpuinfo')
17
+ require 'win32ole'
18
+ WIN32OLE.connect("winmgmts://").ExecQuery("select * from Win32_ComputerSystem").NumberOfProcessors
19
+ rescue LoadError
20
+ Integer `sysctl -n hw.ncpu 2>/dev/null` rescue 1
21
+ end
22
+
23
+ end
24
+ end
25
+ end
data/lib/system/os.rb ADDED
@@ -0,0 +1,71 @@
1
+ require 'system/version'
2
+
3
+ class System
4
+
5
+ # Information about the current Operating System (OS) running on the current system.
6
+ #
7
+ # @since 0.1.1
8
+ module OS
9
+
10
+ # Unknown OS
11
+ # @since 0.1.1
12
+ Unknown = :unknown
13
+
14
+ # Any OS running the Linux kernel
15
+ # @since 0.1.1
16
+ Linux = :linux
17
+
18
+ # Any Windows OS
19
+ # @since 0.1.1
20
+ Windows = :windows
21
+
22
+ # Any Solaris OS
23
+ # @since 0.1.1
24
+ Solaris = :solaris
25
+
26
+ # Any OS running the BSD kernel
27
+ # @since 0.1.1
28
+ BSD = :bsd
29
+
30
+ # Any OSX OS
31
+ # @since 0.1.1
32
+ OSX = :osx
33
+
34
+ # Any OS running the Darwin kernel
35
+ # @since 0.1.1
36
+ Darwin = :darwin
37
+
38
+ class << self
39
+
40
+ # Get the name of the operating system running on the current host.
41
+ #
42
+ # @return [Symbol] The name of the operating system.
43
+ # @example Return OS name
44
+ # System::OS.name # => :osx
45
+ # @example Assert current OS
46
+ # System::OS.name == System::OS::OSX # => true
47
+ # @since 0.1.1
48
+ def name
49
+ return @name if defined?(@name)
50
+
51
+ os_name = System::Ruby.platform
52
+ os_name = RbConfig::CONFIG['host_os'] if defined?(RbConfig::CONFIG)
53
+ os_name = System.getProperty('os.name').downcase if System::Ruby.jruby?
54
+
55
+ @name = case os_name
56
+ when /linux/ then Linux
57
+ when /solaris/ then Solaris
58
+ when /bsd/ then BSD
59
+ when /darwin/ then
60
+ defined?(RbConfig::CONFIG) && RbConfig::CONFIG['build_vendor'] == 'apple' ? OSX : Darwin
61
+ when /mac.*?os.*?x/ then OSX
62
+ when /win/ then Windows # TODO: "win" is in the word "darwin"... had to move down here but need better examples of Windows OS name results...
63
+ else
64
+ Unknown
65
+ end
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,102 @@
1
+ require 'system/version'
2
+
3
+ class System
4
+
5
+ # Information about the current Ruby implementation.
6
+ #
7
+ # @since 0.1.1
8
+ module Ruby
9
+ class << self
10
+
11
+ # @method copyright
12
+ # Return the current Ruby implementation's copyright.
13
+ #
14
+ # @since 0.1.1
15
+ # @return [String] The current Ruby implementation's copyright.
16
+ # @example
17
+ # System::Ruby.copyright # => "ruby - Copyright (C) 1993-2012 Yukihiro Matsumoto"
18
+
19
+ # @method description
20
+ # Return the current Ruby implementation's description which includes the engine, version,
21
+ # release date, revision, and platform.
22
+ #
23
+ # @since 0.1.1
24
+ # @return [String] The current Ruby implementation's engine.
25
+ # @example
26
+ # System::Ruby.copyright # => "ruby"
27
+
28
+ # @method engine
29
+ # Return the current Ruby implementation's engine.
30
+ #
31
+ # @since 0.1.1
32
+ # @return [String] The current Ruby implementation's engine.
33
+ # @example
34
+ # System::Ruby.copyright # => "ruby"
35
+
36
+ # @method patchlevel
37
+ # Return the current Ruby implementation's patch-level.
38
+ #
39
+ # @since 0.1.1
40
+ # @return [Integer] The current Ruby implementation's patch-level.
41
+ # @example
42
+ # System::Ruby.patchlevel # => 286
43
+
44
+ # @method platform
45
+ # Return the system platform the current Ruby implementation is running on.
46
+ #
47
+ # @since 0.1.1
48
+ # @return [String] The system platform the current Ruby implementation is running on.
49
+ # @example
50
+ # System::Ruby.platform # => "x86_64-darwin12.2.0"
51
+
52
+ # @method revision
53
+ # Return the current Ruby implementation's revision.
54
+ #
55
+ # @since 0.1.1
56
+ # @return [Integer] The current Ruby implementation's revision.
57
+ # @example
58
+ # System::Ruby.revision # => 37165
59
+
60
+ # @method release_date
61
+ # Return the current Ruby implementation's release date.
62
+ #
63
+ # @since 0.1.1
64
+ # @return [String] The current Ruby implementation's release date.
65
+ # @example
66
+ # System::Ruby.release_date # => "2012-10-12"
67
+
68
+ # @method version
69
+ # Return the current Ruby implementation's version.
70
+ #
71
+ # @since 0.1.1
72
+ # @return [String] The current Ruby implementation's version.
73
+ # @example
74
+ # System::Ruby.version # => "1.9.3"
75
+
76
+ Object.constants.grep(/^RUBY_/).each do |const_name|
77
+ method_name = const_name.to_s.gsub(/^RUBY_/, '').downcase.to_sym
78
+
79
+ define_method(method_name) { Object.const_get(const_name) }
80
+ end
81
+
82
+ # Check if Ruby is using Java.
83
+ # Delegates to System::Ruby.java? for backwards compatibility.
84
+ #
85
+ # @return [TrueClass, FalseClass] Is the current Ruby implementation using Java?
86
+ # @since 0.1.1
87
+ def java?
88
+ !(/java/.match(platform).nil?)
89
+ end
90
+
91
+ # Check if Ruby is JRuby.
92
+ # Delegates to System::Ruby.jruby? for backwards compatibility.
93
+ #
94
+ # @return [TrueClass, FalseClass] Is the current Ruby implementation JRuby?
95
+ # @since 0.1.1
96
+ def jruby?
97
+ java? ? !!(/jruby/.match(engine)) : false
98
+ end
99
+
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,5 @@
1
+ require 'version'
2
+
3
+ class System
4
+ is_versioned
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'pathname'
2
+
3
+ __LIB__ = Pathname.new(__FILE__).join('..', '..', 'lib').expand_path
4
+ $:.unshift(__LIB__.to_s) unless $:.include?(__LIB__.to_s)
5
+
6
+ require 'system'
7
+ require 'bundler/setup'
8
+
9
+ Bundler.require(:development)
10
+
11
+ Dir[ Pathname.new(__FILE__).join('..', 'support', '**', '*').expand_path ].each { |filename| require filename }
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe HostSystem do
4
+ subject { HostSystem } # Use the Class instead of an instance
5
+ it { should == System }
6
+ end
7
+
8
+ describe System do
9
+ subject { System } # Use the Class instead of an instance
10
+
11
+ describe '.os' do
12
+ it 'should delegate to System::OS.name' do
13
+ System::OS.should_receive(:name).and_return(:mock_response)
14
+
15
+ System.os.should == :mock_response
16
+ end
17
+ end
18
+
19
+ describe '.java?' do
20
+ it 'should delegate to System::Ruby.java?' do
21
+ System::Ruby.should_receive(:java?).and_return(:mock_response)
22
+
23
+ System.java?.should == :mock_response
24
+ end
25
+ end
26
+
27
+ describe '.jruby?' do
28
+ it 'should delegate to System::Ruby.jruby?' do
29
+ System::Ruby.should_receive(:jruby?).and_return(:mock_response)
30
+
31
+ System.jruby?.should == :mock_response
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe System do
4
+ subject { System::VERSION }
5
+
6
+ it { should == Pathname.new(__FILE__).join('..', '..', '..', 'VERSION').read.strip }
7
+ end
8
+
data/system.gemspec CHANGED
@@ -1,52 +1,47 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
3
  Gem::Specification.new do |s|
7
- s.name = %q{system}
8
- s.version = "0.1.0"
4
+ s.name = "system"
5
+ s.version = "0.1.1"
9
6
 
10
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Roja Buck"]
12
- s.date = %q{2010-01-23}
13
- s.description = %q{System is a pure ruby interface to gather systems information from the current host. System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem etc...}
14
- s.email = %q{roja@arbia.co.uk}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.markdown"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.markdown",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/system.rb",
27
- "system.gemspec",
28
- "test/helper.rb",
29
- "test/test_system.rb"
30
- ]
31
- s.homepage = %q{http://github.com/roja/system}
32
- s.rdoc_options = ["--charset=UTF-8"]
8
+ s.authors = ["Roja Buck", "Ryan Scott Lewis"]
9
+ s.date = "2012-11-10"
10
+ s.description = "System is a pure ruby interface to gather systems information from the current host. System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem etc..."
11
+ s.email = ["roja@arbia.co.uk", "ryan@rynet.us"]
12
+ s.files = [".gitignore", ".rvmrc", "Gemfile", "Gemfile.lock", "Guardfile", "LICENSE", "NOTES.md", "README.md", "Rakefile", "VERSION", "lib/system.rb", "lib/system/backwards_compatibility.rb", "lib/system/cpu.rb", "lib/system/os.rb", "lib/system/ruby.rb", "lib/system/version.rb", "spec/spec_helper.rb", "spec/system/backwards_compatibility_spec.rb", "spec/system/version_spec.rb", "system.gemspec"]
13
+ s.homepage = "http://github.com/roja/system"
33
14
  s.require_paths = ["lib"]
34
- s.rubyforge_project = %q{system}
35
- s.rubygems_version = %q{1.3.5}
36
- s.summary = %q{System is a pure ruby interface to gather current systems information; OS, CPU, Filesystem etc...}
37
- s.test_files = [
38
- "test/helper.rb",
39
- "test/test_system.rb"
40
- ]
15
+ s.rubygems_version = "1.8.24"
16
+ s.summary = "System is a pure ruby interface to gather current systems information; OS, CPU, Filesystem etc..."
41
17
 
42
18
  if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
19
  s.specification_version = 3
45
20
 
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
21
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
22
+ s.add_development_dependency(%q<version>, ["~> 1.0.0"])
23
+ s.add_development_dependency(%q<rake>, ["~> 0.9"])
24
+ s.add_development_dependency(%q<guard-rspec>, ["~> 2.1.1"])
25
+ s.add_development_dependency(%q<guard-yard>, ["~> 2.0.1"])
26
+ s.add_development_dependency(%q<rb-fsevent>, ["~> 0.9.1"])
27
+ s.add_development_dependency(%q<fuubar>, ["~> 1.1"])
28
+ s.add_development_dependency(%q<kramdown>, ["~> 0.14.0"])
47
29
  else
30
+ s.add_dependency(%q<version>, ["~> 1.0.0"])
31
+ s.add_dependency(%q<rake>, ["~> 0.9"])
32
+ s.add_dependency(%q<guard-rspec>, ["~> 2.1.1"])
33
+ s.add_dependency(%q<guard-yard>, ["~> 2.0.1"])
34
+ s.add_dependency(%q<rb-fsevent>, ["~> 0.9.1"])
35
+ s.add_dependency(%q<fuubar>, ["~> 1.1"])
36
+ s.add_dependency(%q<kramdown>, ["~> 0.14.0"])
48
37
  end
49
38
  else
39
+ s.add_dependency(%q<version>, ["~> 1.0.0"])
40
+ s.add_dependency(%q<rake>, ["~> 0.9"])
41
+ s.add_dependency(%q<guard-rspec>, ["~> 2.1.1"])
42
+ s.add_dependency(%q<guard-yard>, ["~> 2.0.1"])
43
+ s.add_dependency(%q<rb-fsevent>, ["~> 0.9.1"])
44
+ s.add_dependency(%q<fuubar>, ["~> 1.1"])
45
+ s.add_dependency(%q<kramdown>, ["~> 0.14.0"])
50
46
  end
51
47
  end
52
-
metadata CHANGED
@@ -1,66 +1,185 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: system
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Roja Buck
9
+ - Ryan Scott Lewis
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
-
12
- date: 2010-01-23 00:00:00 +00:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description: System is a pure ruby interface to gather systems information from the current host. System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem etc...
17
- email: roja@arbia.co.uk
13
+ date: 2012-11-10 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: version
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 1.0.0
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '0.9'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '0.9'
47
+ - !ruby/object:Gem::Dependency
48
+ name: guard-rspec
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 2.1.1
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 2.1.1
63
+ - !ruby/object:Gem::Dependency
64
+ name: guard-yard
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ version: 2.0.1
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: 2.0.1
79
+ - !ruby/object:Gem::Dependency
80
+ name: rb-fsevent
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ version: 0.9.1
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: 0.9.1
95
+ - !ruby/object:Gem::Dependency
96
+ name: fuubar
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: '1.1'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '1.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: kramdown
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ~>
117
+ - !ruby/object:Gem::Version
118
+ version: 0.14.0
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: 0.14.0
127
+ description: System is a pure ruby interface to gather systems information from the
128
+ current host. System offers a simple to use interface to gather an array of information
129
+ including; OS, CPU, Filesystem etc...
130
+ email:
131
+ - roja@arbia.co.uk
132
+ - ryan@rynet.us
18
133
  executables: []
19
-
20
134
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - LICENSE
24
- - README.markdown
25
- files:
26
- - .document
135
+ extra_rdoc_files: []
136
+ files:
27
137
  - .gitignore
138
+ - .rvmrc
139
+ - Gemfile
140
+ - Gemfile.lock
141
+ - Guardfile
28
142
  - LICENSE
29
- - README.markdown
143
+ - NOTES.md
144
+ - README.md
30
145
  - Rakefile
31
146
  - VERSION
32
147
  - lib/system.rb
148
+ - lib/system/backwards_compatibility.rb
149
+ - lib/system/cpu.rb
150
+ - lib/system/os.rb
151
+ - lib/system/ruby.rb
152
+ - lib/system/version.rb
153
+ - spec/spec_helper.rb
154
+ - spec/system/backwards_compatibility_spec.rb
155
+ - spec/system/version_spec.rb
33
156
  - system.gemspec
34
- - test/helper.rb
35
- - test/test_system.rb
36
- has_rdoc: true
37
157
  homepage: http://github.com/roja/system
38
158
  licenses: []
39
-
40
159
  post_install_message:
41
- rdoc_options:
42
- - --charset=UTF-8
43
- require_paths:
160
+ rdoc_options: []
161
+ require_paths:
44
162
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: "0"
50
- version:
51
- required_rubygems_version: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
56
- version:
163
+ required_ruby_version: !ruby/object:Gem::Requirement
164
+ none: false
165
+ requirements:
166
+ - - ! '>='
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ segments:
170
+ - 0
171
+ hash: -1923509668655408142
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ! '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
57
178
  requirements: []
58
-
59
- rubyforge_project: system
60
- rubygems_version: 1.3.5
179
+ rubyforge_project:
180
+ rubygems_version: 1.8.24
61
181
  signing_key:
62
182
  specification_version: 3
63
- summary: System is a pure ruby interface to gather current systems information; OS, CPU, Filesystem etc...
64
- test_files:
65
- - test/helper.rb
66
- - test/test_system.rb
183
+ summary: System is a pure ruby interface to gather current systems information; OS,
184
+ CPU, Filesystem etc...
185
+ test_files: []
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/README.markdown DELETED
@@ -1,45 +0,0 @@
1
- # System - System is a pure ruby interface to gather current systems information. #
2
-
3
- ## About ##
4
-
5
- System is a pure ruby interface to gather systems information from the current host. System offers a simple to use interface to gather an array of information including; OS, CPU, Filesystem etc.
6
-
7
- * Version 0.1.0 - Very basic information only
8
-
9
- ## GEM Installation ##
10
-
11
- After this it should be just a gem to install. For those of you with old rubygems versions first:
12
-
13
- gem install gemcutter # These two steps are only necessary if you haven't
14
- gem tumble # yet installed the gemcutter tools
15
-
16
- Otherwise and after it's simply:
17
-
18
- gem install system
19
-
20
- Then your ready to rock and roll. :)
21
-
22
- ## Usage ##
23
-
24
- Heres a few little examples of using system within your programs.
25
-
26
- require 'rubygems'
27
- require 'system'
28
-
29
- HostSystem::os # => Current OS as a symbol i.e. :windows, :linux, :osx, :bsd, :darwin, :solaris
30
- HostSystem::java? # => Are we running on java?
31
- HostSystem::jruby? # => Are we running on jruby?
32
-
33
- ## Note on Patches/Pull Requests ##
34
-
35
- * Fork the project.
36
- * Make your feature addition or bug fix.
37
- * Add tests for it. This is important so I don't break it in a
38
- future version unintentionally.
39
- * Commit, do not mess with rakefile, version, or history.
40
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
41
- * Send me a pull request. Bonus points for topic branches.
42
-
43
- ## Copyright ##
44
-
45
- Copyright (c) 2010 Roja Buck. See LICENSE for details.
data/test/helper.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'system'
8
-
9
- class Test::Unit::TestCase
10
- end
data/test/test_system.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestSystem < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end