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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5607ed6cb5688ad020b7c5f3908e12f88a828084
4
- data.tar.gz: 2746b122b2e927f729b26d28af7b27bc7729a13b
3
+ metadata.gz: 57382b24b0fe32c098bf2e3b617dc26c6d51e424
4
+ data.tar.gz: a394aea3fa4170f7319d7f453ba9bda63e0f3c54
5
5
  SHA512:
6
- metadata.gz: 53be4c3d03aaf38bda90fbb482c4862be247e037503a3ef35e72ed8b767d43de52cd605831fb161a8374d22eaa41c66057814a99142aa7f0ab2ed470d46191b1
7
- data.tar.gz: 8ea309ab1de096aafb509f6722031dd87172f572ba491cf64f7424cb99e08dc6abf33f27e8366fced3a18271a6e71347631dda408a7f06c00e351a3521c0ea97
6
+ metadata.gz: 5dda398b269b5de60b36a0edc1aa5bf16fbd686f1770640bd40da017447b872633672b54bd0067fe14a5fac6812db90108cf7cde18db12b8d8aa128d4551a6e4
7
+ data.tar.gz: fa573d8190cbb015bb37ec1d7a30413e3244a0b3ec231ede8a761db36ff1967784a1c32a1b02290eed53b2ba29bbd1257f72d2418eb3b538fea54df1993904fc
@@ -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
@@ -53,5 +53,5 @@ class Shell
53
53
  raise ShellError, "Shell.run >#{cmd}< failed with exit status #{status.exitstatus}<: #{stderr}"
54
54
  end
55
55
  end
56
- end # class Shell
56
+ end # class Shell
57
57
  end # module Computer
@@ -2,7 +2,7 @@ module Computer
2
2
 
3
3
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  VERSION = [MAJOR,MINOR,PATCH].join('.')
7
7
 
8
8
  def self.version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: computer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer