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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47eaa7f5789df49ff5c40d32073b6e5d6ea5f285de49848393e7affc9ebd2d74
4
- data.tar.gz: e91addb8e1c9efd46e2ea9ceab92234a0bab9ccb3372999ddeee05b8342e31e1
3
+ metadata.gz: a736ea3eebf9855455803021aa1dd57589e1784f92f841f63984d64c1bb5cce2
4
+ data.tar.gz: 0ead0dc9e4609cb8adc976dd743f427bbe9d8ee9be39d78b6ab743804b0c13d8
5
5
  SHA512:
6
- metadata.gz: c29e5cc9b78ad913fc4c5e7a6c25839d8f3f1ad95d67b1771ef09802f11600a38dd935eb610f4a1a1f4617d0f3a5929b0ea884787105bdd47c23206530c9bcd5
7
- data.tar.gz: 642daecedfcce8350c22b484a7618a2b547f66b38bceb6f39b722cc30f1cdc1237cd3d748d4c6e65bfa19dced8b316e018878e3ef5a8666266a7f7bb0b2de7a7
6
+ metadata.gz: ee15b0602c7b22c813a47aca5c0c3a824624ad0794145aaa9382763e6f6ce54eaf5418fe0df9b2974c7c1945609c74d8f6f32630bc987e10eaa5bed137a8fffb
7
+ data.tar.gz: ac59da1176212f4d34b9100ba6353bb81923a059fbd7229c91622386e320e1a96514319deacf920ad3b0347796e6adf15f856422d987fb63bdd29935e2fb9dc3
data/lib/sproc.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "sproc/version"
4
4
  require_relative "sproc/core"
5
- require_relative "sproc/reporting"
5
+ require_relative "sproc/osinfo"
6
6
 
7
7
  module SProc
8
8
  class Error < StandardError; end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SProc
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
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.5.1
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