sproc 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sproc.rb +1 -1
- data/lib/sproc/osinfo.rb +55 -0
- data/lib/sproc/version.rb +1 -1
- metadata +2 -2
- data/lib/sproc/utils.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a736ea3eebf9855455803021aa1dd57589e1784f92f841f63984d64c1bb5cce2
|
4
|
+
data.tar.gz: 0ead0dc9e4609cb8adc976dd743f427bbe9d8ee9be39d78b6ab743804b0c13d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee15b0602c7b22c813a47aca5c0c3a824624ad0794145aaa9382763e6f6ce54eaf5418fe0df9b2974c7c1945609c74d8f6f32630bc987e10eaa5bed137a8fffb
|
7
|
+
data.tar.gz: ac59da1176212f4d34b9100ba6353bb81923a059fbd7229c91622386e320e1a96514319deacf920ad3b0347796e6adf15f856422d987fb63bdd29935e2fb9dc3
|
data/lib/sproc.rb
CHANGED
data/lib/sproc/osinfo.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
# helper methods to find out os and execution environment
|
4
|
+
module SProc
|
5
|
+
module OSInfo
|
6
|
+
# the supported exec environments
|
7
|
+
module OS
|
8
|
+
WINDOWS = 0
|
9
|
+
LINUX = 1
|
10
|
+
MINGW = 2
|
11
|
+
CYGWIN = 3
|
12
|
+
OSX = 4
|
13
|
+
BSD = 5
|
14
|
+
UNKNOWN = 100
|
15
|
+
end
|
16
|
+
|
17
|
+
# returns the current execution environment
|
18
|
+
def self.os_context
|
19
|
+
case RbConfig::CONFIG['host_os']
|
20
|
+
when /mswin/ then OS::WINDOWS
|
21
|
+
when /mingw/ then OS::MINGW
|
22
|
+
when /cygwin/ then OS::CYGWIN
|
23
|
+
when /darwin/ then OS::OSX
|
24
|
+
when /linux/ then OS::LINUX
|
25
|
+
when /bsd/ then OS::BSD
|
26
|
+
else OS::UNKNOWN
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# return the current underlying operating system
|
31
|
+
def self.host_os
|
32
|
+
if [OS::WINDOWS, OS::MINGW, OS::CYGWIN].include?(os_context)
|
33
|
+
OS::WINDOWS
|
34
|
+
else
|
35
|
+
os_context
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def on_windows?
|
40
|
+
host_os == OS::WINDOWS
|
41
|
+
end
|
42
|
+
|
43
|
+
def on_linux?
|
44
|
+
os_context == OS::LINUX
|
45
|
+
end
|
46
|
+
|
47
|
+
def on_bsd?
|
48
|
+
os_context == OS::BSD
|
49
|
+
end
|
50
|
+
|
51
|
+
def on_osx?
|
52
|
+
os_context == OS::OSX
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/sproc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sproc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anders Rillbert
|
@@ -43,8 +43,8 @@ files:
|
|
43
43
|
- bin/setup
|
44
44
|
- lib/sproc.rb
|
45
45
|
- lib/sproc/core.rb
|
46
|
+
- lib/sproc/osinfo.rb
|
46
47
|
- lib/sproc/reporting.rb
|
47
|
-
- lib/sproc/utils.rb
|
48
48
|
- lib/sproc/version.rb
|
49
49
|
- sproc.gemspec
|
50
50
|
homepage: https://github.com/rillbert/sproc
|
data/lib/sproc/utils.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
# utility to find out info about our execution environment
|
4
|
-
module OSInfo
|
5
|
-
# the supported exec environments
|
6
|
-
module OS
|
7
|
-
WINDOWS = 0
|
8
|
-
LINUX = 1
|
9
|
-
MINGW = 2
|
10
|
-
CYGWIN = 3
|
11
|
-
OSX = 4
|
12
|
-
BSD = 5
|
13
|
-
UNKNOWN = 100
|
14
|
-
end
|
15
|
-
|
16
|
-
# returns the current execution environment
|
17
|
-
def self.os_context
|
18
|
-
case RbConfig::CONFIG['host_os']
|
19
|
-
when /mswin/ then OS::WINDOWS
|
20
|
-
when /mingw/ then OS::MINGW
|
21
|
-
when /cygwin/ then OS::CYGWIN
|
22
|
-
when /darwin/ then OS::OSX
|
23
|
-
when /linux/ then OS::LINUX
|
24
|
-
when /bsd/ then OS::BSD
|
25
|
-
else OS::UNKNOWN
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# return the current underlying operating system
|
30
|
-
def self.host_os
|
31
|
-
if [OS::WINDOWS, OS::MINGW, OS::CYGWIN].include?(os_context)
|
32
|
-
OS::WINDOWS
|
33
|
-
else
|
34
|
-
os_context
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def on_windows?
|
39
|
-
host_os == OS::WINDOWS
|
40
|
-
end
|
41
|
-
|
42
|
-
def on_linux?
|
43
|
-
os_context == OS::LINUX
|
44
|
-
end
|
45
|
-
|
46
|
-
def on_bsd?
|
47
|
-
os_context == OS::BSD
|
48
|
-
end
|
49
|
-
|
50
|
-
def on_osx?
|
51
|
-
os_context == OS::OSX
|
52
|
-
end
|
53
|
-
end
|