computer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/computer.rb +55 -1
- data/lib/computer/shell.rb +1 -1
- data/lib/computer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57382b24b0fe32c098bf2e3b617dc26c6d51e424
|
4
|
+
data.tar.gz: a394aea3fa4170f7319d7f453ba9bda63e0f3c54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dda398b269b5de60b36a0edc1aa5bf16fbd686f1770640bd40da017447b872633672b54bd0067fe14a5fac6812db90108cf7cde18db12b8d8aa128d4551a6e4
|
7
|
+
data.tar.gz: fa573d8190cbb015bb37ec1d7a30413e3244a0b3ec231ede8a761db36ff1967784a1c32a1b02290eed53b2ba29bbd1257f72d2418eb3b538fea54df1993904fc
|
data/lib/computer.rb
CHANGED
@@ -12,7 +12,7 @@ require 'fileutils' ## e.g. FileUtils.mkdir_p etc.
|
|
12
12
|
##########################
|
13
13
|
# more defaults ("prolog/prelude") always pre-loaded
|
14
14
|
require 'optparse'
|
15
|
-
|
15
|
+
require 'rbconfig'
|
16
16
|
|
17
17
|
#####################
|
18
18
|
# our own code
|
@@ -21,6 +21,60 @@ require 'computer/shell'
|
|
21
21
|
|
22
22
|
|
23
23
|
|
24
|
+
|
25
|
+
## add some system info from/via rbconfig - why? why not?
|
26
|
+
module Computer
|
27
|
+
|
28
|
+
OS = case RbConfig::CONFIG['host_os'].downcase
|
29
|
+
when /linux/
|
30
|
+
"linux"
|
31
|
+
when /darwin/
|
32
|
+
"darwin"
|
33
|
+
when /freebsd/
|
34
|
+
"freebsd"
|
35
|
+
when /netbsd/
|
36
|
+
"netbsd"
|
37
|
+
when /openbsd/
|
38
|
+
"openbsd"
|
39
|
+
when /dragonfly/
|
40
|
+
"dragonflybsd"
|
41
|
+
when /sunos|solaris/
|
42
|
+
"solaris"
|
43
|
+
when /mingw|mswin/
|
44
|
+
"windows"
|
45
|
+
else
|
46
|
+
RbConfig::CONFIG['host_os'].downcase
|
47
|
+
end
|
48
|
+
|
49
|
+
CPU = RbConfig::CONFIG['host_cpu'] ## todo/check: always use downcase - why? why not?
|
50
|
+
|
51
|
+
ARCH = case CPU.downcase
|
52
|
+
when /amd64|x86_64|x64/
|
53
|
+
"x86_64"
|
54
|
+
when /i?86|x86|i86pc/
|
55
|
+
"i386"
|
56
|
+
when /ppc64|powerpc64/
|
57
|
+
"powerpc64"
|
58
|
+
when /ppc|powerpc/
|
59
|
+
"powerpc"
|
60
|
+
when /sparcv9|sparc64/
|
61
|
+
"sparcv9"
|
62
|
+
when /arm64|aarch64/ # MacOS calls it "arm64", other operating systems "aarch64"
|
63
|
+
"aarch64"
|
64
|
+
when /^arm/
|
65
|
+
"arm"
|
66
|
+
else
|
67
|
+
RbConfig::CONFIG['host_cpu'] ## todo/check: always use downcase - why? why not?
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.os() OS; end
|
71
|
+
def self.cpu() CPU; end
|
72
|
+
def self.arch() ARCH; end
|
73
|
+
|
74
|
+
|
75
|
+
end # module Computer
|
76
|
+
|
77
|
+
|
24
78
|
######################
|
25
79
|
# add convenience shortcuts - why? why not?
|
26
80
|
Compu = Computer
|
data/lib/computer/shell.rb
CHANGED
data/lib/computer/version.rb
CHANGED