sys-uname 1.2.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +11 -0
- data/Gemfile +2 -7
- data/README.md +9 -8
- data/Rakefile +4 -2
- data/doc/uname.rdoc +3 -35
- data/examples/uname_test.rb +1 -13
- data/lib/sys/platform.rb +15 -18
- data/lib/sys/uname.rb +3 -1
- data/lib/sys/unix/uname.rb +23 -84
- data/lib/sys/windows/uname.rb +222 -238
- data/lib/sys-uname.rb +2 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/sys_platform_spec.rb +32 -43
- data/spec/sys_uname_spec.rb +186 -232
- data/sys-uname.gemspec +11 -7
- data.tar.gz.sig +0 -0
- metadata +36 -5
- metadata.gz.sig +0 -0
data/lib/sys-uname.rb
CHANGED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspec'
|
4
|
+
require 'sys/uname'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.filter_run_excluding(:bsd) unless RbConfig::CONFIG['host_os'] =~ /powerpc|darwin|macos|bsd|dragonfly/i
|
8
|
+
config.filter_run_excluding(:hpux) unless RbConfig::CONFIG['host_os'] =~ /hpux/i
|
9
|
+
config.filter_run_excluding(:linux) unless RbConfig::CONFIG['host_os'] =~ /linux/i
|
10
|
+
config.filter_run_excluding(:windows) unless Gem.win_platform?
|
11
|
+
end
|
data/spec/sys_platform_spec.rb
CHANGED
@@ -1,75 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
##############################################################################
|
2
4
|
# sys_platform_spec.rb
|
3
5
|
#
|
4
6
|
# Test suite for the Sys::Platform class.
|
5
7
|
##############################################################################
|
6
|
-
require '
|
7
|
-
require 'sys/uname'
|
8
|
-
require 'rbconfig'
|
8
|
+
require 'spec_helper'
|
9
9
|
|
10
10
|
RSpec.describe Sys::Platform do
|
11
|
-
|
12
|
-
|
13
|
-
@host_os = RbConfig::CONFIG['host_os']
|
14
|
-
@windows = @host_os =~ /mingw|mswin|windows/i ? true : false
|
15
|
-
end
|
16
|
-
|
17
|
-
example "the VERSION constant is set to the expected value" do
|
18
|
-
expect(Sys::Platform::VERSION).to eql('1.2.2')
|
11
|
+
example 'the VERSION constant is set to the expected value' do
|
12
|
+
expect(Sys::Platform::VERSION).to eql('1.3.0')
|
19
13
|
expect(Sys::Platform::VERSION).to be_frozen
|
20
14
|
end
|
21
15
|
|
22
|
-
example
|
23
|
-
expect(Sys::Platform::ARCH).to
|
24
|
-
end
|
25
|
-
|
26
|
-
example "the OS constant is defined" do
|
27
|
-
expect(Sys::Platform::OS).to be_kind_of(Symbol)
|
16
|
+
example 'the ARCH constant is defined' do
|
17
|
+
expect(Sys::Platform::ARCH).to be_a(Symbol)
|
28
18
|
end
|
29
19
|
|
30
|
-
example
|
31
|
-
expect(Sys::Platform::
|
20
|
+
example 'the OS constant is defined' do
|
21
|
+
expect(Sys::Platform::OS).to be_a(Symbol)
|
32
22
|
end
|
33
23
|
|
34
|
-
example
|
35
|
-
expect(Sys::Platform::IMPL).to
|
24
|
+
example 'the IMPL constant is defined' do
|
25
|
+
expect(Sys::Platform::IMPL).to be_a(Symbol)
|
36
26
|
end
|
37
27
|
|
38
|
-
example
|
39
|
-
expect(
|
40
|
-
expect(Sys::Platform.mac?).to eql(true).or eql(false)
|
28
|
+
example 'the IMPL returns an expected value on windows', :windows do
|
29
|
+
expect(%i[mingw mswin]).to include(Sys::Platform::IMPL)
|
41
30
|
end
|
42
31
|
|
43
|
-
example
|
44
|
-
expect(
|
45
|
-
expect(
|
32
|
+
example 'the mac? method is defined and returns a boolean' do
|
33
|
+
expect(described_class).to respond_to(:mac?)
|
34
|
+
expect(described_class.mac?).to eql(true).or eql(false)
|
46
35
|
end
|
47
36
|
|
48
|
-
example
|
49
|
-
expect(
|
37
|
+
example 'the windows? method is defined and returns a boolean' do
|
38
|
+
expect(described_class).to respond_to(:windows?)
|
39
|
+
expect(described_class.windows?).to eql(true).or eql(false)
|
50
40
|
end
|
51
41
|
|
52
|
-
example
|
53
|
-
expect(
|
54
|
-
expect(Sys::Platform.unix?).to eql(true).or eql(false)
|
42
|
+
example 'the windows? method returns the expected value' do
|
43
|
+
expect(described_class.windows?).to eql(Gem.win_platform?)
|
55
44
|
end
|
56
45
|
|
57
|
-
example
|
58
|
-
expect(
|
46
|
+
example 'the unix? method is defined and returns a boolean' do
|
47
|
+
expect(described_class).to respond_to(:unix?)
|
48
|
+
expect(described_class.unix?).to eql(true).or eql(false)
|
59
49
|
end
|
60
50
|
|
61
|
-
example
|
62
|
-
expect(
|
63
|
-
expect(Sys::Platform.solaris?).to eql(true).or eql(false)
|
51
|
+
example 'the unix? method returns the expected value' do
|
52
|
+
expect(described_class.unix?).not_to eql(Gem.win_platform?)
|
64
53
|
end
|
65
54
|
|
66
|
-
example
|
67
|
-
expect(
|
68
|
-
expect(
|
55
|
+
example 'the linux? method is defined and returns a boolean' do
|
56
|
+
expect(described_class).to respond_to(:linux?)
|
57
|
+
expect(described_class.linux?).to eql(true).or eql(false)
|
69
58
|
end
|
70
59
|
|
71
|
-
example
|
72
|
-
expect(
|
73
|
-
expect(
|
60
|
+
example 'the bsd? method is defined and returns a boolean' do
|
61
|
+
expect(described_class).to respond_to(:bsd?)
|
62
|
+
expect(described_class.bsd?).to eql(true).or eql(false)
|
74
63
|
end
|
75
64
|
end
|