linux_stat 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +209 -77
- data/bin/console +2 -12
- data/{run_all_methods.rb → bin/linuxstat.rb} +28 -12
- data/ext/fs_stat/extconf.rb +4 -0
- data/ext/fs_stat/fs_stat.c +28 -0
- data/lib/linux_stat.rb +3 -6
- data/lib/linux_stat/battery.rb +24 -1
- data/lib/linux_stat/bios.rb +12 -2
- data/lib/linux_stat/cpu.rb +40 -10
- data/lib/linux_stat/filesystem.rb +97 -0
- data/lib/linux_stat/kernel.rb +124 -14
- data/lib/linux_stat/memory.rb +23 -5
- data/lib/linux_stat/mounts.rb +64 -0
- data/lib/linux_stat/net.rb +3 -1
- data/lib/linux_stat/os.rb +33 -2
- data/lib/linux_stat/process.rb +14 -0
- data/lib/linux_stat/swap.rb +37 -4
- data/lib/linux_stat/version.rb +1 -1
- metadata +12 -15
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -6
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -34
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -6
- data/linux_stat.gemspec +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e2c68de7353a60dbdff528a65e721cc0f7632e95c5d8db2e0e1dc1b7242deb1
|
4
|
+
data.tar.gz: ada661cb896983bddf8f831b55822bfb006f6167c1ea2bbbd2319bf38028bd79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1399f3b227442243558ae76d4cdbc4679f21984b8d7e2aacd7ed25c471d5588e9901877c943d4a2220583f3eb4094b00e81016e6e573ef1038052574e8306fd0
|
7
|
+
data.tar.gz: 79c25491f4517ef2370b375d19177ca01b6589c6e0931e40dc0aa7c92269b605c97cab4cfe42cde51895ebe9b21d418fd301daf44dfdc496ff0b8bd24788dac6
|
data/README.md
CHANGED
@@ -1,9 +1,31 @@
|
|
1
1
|
# LinuxStat
|
2
|
+

|
2
3
|
|
3
|
-
|
4
|
+
For reading the HTML version, visit [linux_stat](https://souravgoswami.github.io/linux_stat/).
|
5
|
+
|
6
|
+
LinuxStat lets you read status of a Linux system. It can show you cpu stats and usages, memory stats and usages, swap stats and usages, battery usage, bios info, kernel details, local ip, os details and parse os-release + lsb-release, etc.
|
4
7
|
|
5
8
|
It only works for Linux, and detecting the OS is upto the user of this gem.
|
6
9
|
|
10
|
+
## Dependencies:
|
11
|
+
+ You need to have the C compile to be able to compile the C extension.
|
12
|
+
On Arch Linux:
|
13
|
+
```
|
14
|
+
# pacman -S gcc
|
15
|
+
```
|
16
|
+
|
17
|
+
On Debian based systems:
|
18
|
+
```
|
19
|
+
# apt install gcc
|
20
|
+
```
|
21
|
+
|
22
|
+
+ You might also require ruby-dev in Debian based systems which provides support for ruby.h header file:
|
23
|
+
```
|
24
|
+
# apt install ruby-dev
|
25
|
+
```
|
26
|
+
|
27
|
+
+ Once your are done, and you can compile the C file, you can follow the installation!
|
28
|
+
|
7
29
|
## Installation
|
8
30
|
|
9
31
|
Add this line to your application's Gemfile:
|
@@ -22,23 +44,27 @@ Or install it yourself as:
|
|
22
44
|
|
23
45
|
## Usage
|
24
46
|
### LinuxStat::BIOS
|
47
|
+
### LinuxStat::BIOS
|
25
48
|
```
|
49
|
+
LinuxStat::BIOS.date
|
50
|
+
=> "04/10/2017"
|
51
|
+
|
26
52
|
LinuxStat::BIOS.model
|
27
|
-
=> Inspiron 5567
|
53
|
+
=> "Inspiron 5567"
|
28
54
|
|
29
55
|
LinuxStat::BIOS.vendor
|
30
|
-
=> Dell Inc.
|
31
|
-
|
32
|
-
LinuxStat::BIOS.date
|
33
|
-
=> 04/10/2017
|
56
|
+
=> "Dell Inc."
|
34
57
|
|
35
58
|
LinuxStat::BIOS.version
|
36
|
-
=> 1.1.2
|
59
|
+
=> "1.1.2"
|
37
60
|
|
38
61
|
```
|
39
62
|
|
40
63
|
### LinuxStat::Battery
|
41
64
|
```
|
65
|
+
LinuxStat::Battery.charge
|
66
|
+
=> 100.0
|
67
|
+
|
42
68
|
LinuxStat::Battery.charging?
|
43
69
|
=> true
|
44
70
|
|
@@ -48,8 +74,11 @@ LinuxStat::Battery.discharging?
|
|
48
74
|
LinuxStat::Battery.full?
|
49
75
|
=> true
|
50
76
|
|
51
|
-
LinuxStat::Battery.
|
52
|
-
=>
|
77
|
+
LinuxStat::Battery.manufacturer
|
78
|
+
=> "Samsung SDI"
|
79
|
+
|
80
|
+
LinuxStat::Battery.model
|
81
|
+
=> "DELL CYMGM77"
|
53
82
|
|
54
83
|
LinuxStat::Battery.present?
|
55
84
|
=> true
|
@@ -57,17 +86,11 @@ LinuxStat::Battery.present?
|
|
57
86
|
LinuxStat::Battery.stat
|
58
87
|
=> {:model=>"DELL CYMGM77", :manufacturer=>"Samsung SDI", :technology=>"Li-ion", :status=>"Full", :charge=>100.0, :charging=>true, :discharging=>false, :full=>true}
|
59
88
|
|
60
|
-
LinuxStat::Battery.
|
61
|
-
=>
|
62
|
-
|
63
|
-
LinuxStat::Battery.manufacturer
|
64
|
-
=> Samsung SDI
|
89
|
+
LinuxStat::Battery.status
|
90
|
+
=> "Full"
|
65
91
|
|
66
92
|
LinuxStat::Battery.technology
|
67
|
-
=> Li-ion
|
68
|
-
|
69
|
-
LinuxStat::Battery.charge
|
70
|
-
=> 100.0
|
93
|
+
=> "Li-ion"
|
71
94
|
|
72
95
|
```
|
73
96
|
|
@@ -76,62 +99,121 @@ LinuxStat::Battery.charge
|
|
76
99
|
LinuxStat::CPU.count
|
77
100
|
=> 4
|
78
101
|
|
79
|
-
LinuxStat::CPU.stat
|
80
|
-
=> {0=>3.33, 1=>0.0, 2=>0.0, 3=>0.0, 4=>12.5}
|
81
|
-
|
82
|
-
LinuxStat::CPU.model
|
83
|
-
=> Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz
|
84
|
-
|
85
102
|
LinuxStat::CPU.cur_freq
|
86
|
-
=> [
|
103
|
+
=> [1998722, 1998401, 1974377, 1875264]
|
87
104
|
|
88
105
|
LinuxStat::CPU.max_freq
|
89
106
|
=> [2000000, 2000000, 2000000, 2000000]
|
90
107
|
|
108
|
+
LinuxStat::CPU.model
|
109
|
+
=> "Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz"
|
110
|
+
|
111
|
+
LinuxStat::CPU.stat
|
112
|
+
=> {0=>6.45, 1=>0.0, 2=>0.0, 3=>12.5, 4=>0.0}
|
113
|
+
|
114
|
+
LinuxStat::CPU.total_usage
|
115
|
+
=> 3.45
|
116
|
+
|
117
|
+
LinuxStat::CPU.usage
|
118
|
+
=> 6.45
|
119
|
+
|
120
|
+
LinuxStat::CPU.usages
|
121
|
+
=> {0=>9.68, 1=>11.11, 2=>12.5, 3=>14.29, 4=>12.5}
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
### LinuxStat::Filesystem
|
126
|
+
```
|
127
|
+
LinuxStat::Filesystem.available
|
128
|
+
=> 43155402752
|
129
|
+
|
130
|
+
LinuxStat::Filesystem.free
|
131
|
+
=> 43155402752
|
132
|
+
|
133
|
+
LinuxStat::Filesystem.stat
|
134
|
+
=> {:total=>119981191168, :free=>43155402752, :used=>76825788416}
|
135
|
+
|
136
|
+
LinuxStat::Filesystem.stat_raw
|
137
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>10535987, :block_avail_unpriv=>10535987, :inodes=>58612160, :free_inodes=>56718515, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
138
|
+
|
139
|
+
LinuxStat::Filesystem.total
|
140
|
+
=> 119981191168
|
141
|
+
|
142
|
+
LinuxStat::Filesystem.used
|
143
|
+
=> 76825788416
|
144
|
+
|
91
145
|
```
|
92
146
|
|
93
147
|
### LinuxStat::Kernel
|
94
148
|
```
|
149
|
+
LinuxStat::Kernel.build_date
|
150
|
+
=> 2020-10-21 01:11:20 +0000
|
151
|
+
|
152
|
+
LinuxStat::Kernel.build_date_string
|
153
|
+
=> "21 Oct 2020 01:11:20 +0000"
|
154
|
+
|
155
|
+
LinuxStat::Kernel.build_user
|
156
|
+
=> "souravgoswami@archlinux"
|
157
|
+
|
95
158
|
LinuxStat::Kernel.compiler
|
96
159
|
=> [:gcc, "10.2.0"]
|
97
160
|
|
98
|
-
LinuxStat::Kernel.
|
99
|
-
=>
|
161
|
+
LinuxStat::Kernel.compiler_version
|
162
|
+
=> "10.2.0"
|
100
163
|
|
101
|
-
LinuxStat::Kernel.
|
102
|
-
=>
|
164
|
+
LinuxStat::Kernel.string
|
165
|
+
=> "Linux version 5.9.1-xanmod1-1 (souravgoswami@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP PREEMPT Wed, 21 Oct 2020 01:11:20 +0000"
|
103
166
|
|
104
167
|
LinuxStat::Kernel.version
|
105
|
-
=> 5.9.1-xanmod1-1
|
168
|
+
=> "5.9.1-xanmod1-1"
|
106
169
|
|
107
170
|
```
|
108
171
|
|
109
172
|
### LinuxStat::Memory
|
110
173
|
```
|
174
|
+
LinuxStat::Memory.available
|
175
|
+
=> 403724
|
176
|
+
|
111
177
|
LinuxStat::Memory.percent_available
|
112
|
-
=>
|
178
|
+
=> 10.52
|
179
|
+
|
180
|
+
LinuxStat::Memory.percent_used
|
181
|
+
=> 89.48
|
113
182
|
|
114
183
|
LinuxStat::Memory.stat
|
115
|
-
=> {:total=>
|
184
|
+
=> {:total=>3836264, :used=>3432540, :available=>403724, :percent_used=>89.48, :percent_available=>10.52}
|
116
185
|
|
117
186
|
LinuxStat::Memory.total
|
118
|
-
=>
|
119
|
-
|
120
|
-
LinuxStat::Memory.available
|
121
|
-
=> 595444
|
187
|
+
=> 3836264
|
122
188
|
|
123
189
|
LinuxStat::Memory.used
|
124
|
-
=>
|
190
|
+
=> 3432540
|
125
191
|
|
126
|
-
|
127
|
-
|
192
|
+
```
|
193
|
+
|
194
|
+
### LinuxStat::Mounts
|
195
|
+
```
|
196
|
+
LinuxStat::Mounts.list
|
197
|
+
=> ["proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0", "sys /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0", "dev /dev devtmpfs rw,nosuid,relatime,size=1891796k,nr_inodes=472949,mode=755 0 0", "run /run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0", "...
|
198
|
+
|
199
|
+
LinuxStat::Mounts.root
|
200
|
+
=> "/dev/sda2"
|
201
|
+
|
202
|
+
LinuxStat::Mounts.root_fs
|
203
|
+
=> "xfs"
|
204
|
+
|
205
|
+
LinuxStat::Mounts.root_mount_options
|
206
|
+
=> "rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota"
|
207
|
+
|
208
|
+
LinuxStat::Mounts.tmpfs
|
209
|
+
=> {"/dev/shm"=>"tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0", "/sys/fs/cgroup"=>"tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755 0 0", "/ramdisk"=>"tmpfs /ramdisk tmpfs rw,nosuid,nodev,relatime,size=6291456k 0 0", "/tmp...
|
128
210
|
|
129
211
|
```
|
130
212
|
|
131
213
|
### LinuxStat::Net
|
132
214
|
```
|
133
215
|
LinuxStat::Net.ipv4_private
|
134
|
-
=> 192.168.0.106
|
216
|
+
=> "192.168.0.106"
|
135
217
|
|
136
218
|
```
|
137
219
|
|
@@ -140,91 +222,141 @@ LinuxStat::Net.ipv4_private
|
|
140
222
|
LinuxStat::OS.bits
|
141
223
|
=> 64
|
142
224
|
|
143
|
-
LinuxStat::OS.
|
144
|
-
=>
|
225
|
+
LinuxStat::OS.distribution
|
226
|
+
=> "Arch Linux"
|
145
227
|
|
146
|
-
LinuxStat::OS.
|
147
|
-
=>
|
228
|
+
LinuxStat::OS.hostname
|
229
|
+
=> "archlinux"
|
148
230
|
|
149
231
|
LinuxStat::OS.lsb_release
|
150
232
|
=> {:LSB_VERSION=>"1.4", :DISTRIB_ID=>"Arch", :DISTRIB_RELEASE=>"rolling", :DISTRIB_DESCRIPTION=>"Arch Linux"}
|
151
233
|
|
152
|
-
LinuxStat::OS.
|
153
|
-
=> archlinux
|
234
|
+
LinuxStat::OS.os_release
|
235
|
+
=> {:NAME=>"Arch Linux", :PRETTY_NAME=>"Arch Linux", :ID=>"arch", :BUILD_ID=>"rolling", :ANSI_COLOR=>"38;2;23;147;209", :HOME_URL=>"https://www.archlinux.org/", :DOCUMENTATION_URL=>"https://wiki.archlinux.org/", :SUPPORT_URL=>"https://bbs.archlinux.org/"...
|
154
236
|
|
155
|
-
LinuxStat::OS.
|
156
|
-
=>
|
237
|
+
LinuxStat::OS.uptime
|
238
|
+
=> {:hour=>10, :minute=>54, :second=>22.45}
|
157
239
|
|
158
240
|
```
|
159
241
|
|
160
242
|
### LinuxStat::Process
|
161
243
|
```
|
162
244
|
LinuxStat::Process.count
|
163
|
-
=>
|
164
|
-
|
165
|
-
LinuxStat::Process.types
|
166
|
-
=> {1=>:sleeping, 2=>:sleeping, 3=>:idle, 4=>:idle, 6=>:idle, 9=>:idle, 10=>:sleeping, 11=>:sleeping, 12=>:idle, 13=>:sleeping, 14=>:sleeping, 15=>:sleeping, 16=>:sleeping, 17=>:sleeping, 18=>:sleeping, 19=>:sleeping, 20=>:sleeping, 21=>:sleeping, 23=>:i...
|
167
|
-
|
168
|
-
LinuxStat::Process.names
|
169
|
-
=> {1=>"systemd", 2=>"kthreadd", 3=>"rcu_gp", 4=>"rcu_par_gp", 6=>"kworker/0:0H-kblockd", 9=>"mm_percpu_wq", 10=>"ksoftirqd/0", 11=>"rcuc/0", 12=>"rcu_preempt", 13=>"rcub/0", 14=>"migration/0", 15=>"idle_inject/0", 16=>"cpuhp/0", 17=>"cpuhp/1", 18=>"idle...
|
245
|
+
=> 210
|
170
246
|
|
171
247
|
LinuxStat::Process.idle
|
172
|
-
=> [3, 4, 6, 9, 12, 23, 30, 37, 39, 49, 102, 103, 104, 106, 107, 108, 109, 110, 117, 118, 119,
|
248
|
+
=> [3, 4, 6, 9, 12, 23, 30, 37, 39, 49, 102, 103, 104, 106, 107, 108, 109, 110, 117, 118, 119, 122, 131, 134, 140, 152, 153, 179, 181, 183, 184, 191, 192, 193, 194, 195, 196, 198, 236, 286, 314, 324, 346, 385, 3540, 3541, 3542, 3543, 3544, 3545, 30463, 3...
|
173
249
|
|
174
250
|
LinuxStat::Process.list
|
175
|
-
=> [1, 2, 3, 4, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 102, 103, 104, 106, 107, 108, 109, 110, 112, 114, 115, 117, 118, 119,
|
251
|
+
=> [1, 2, 3, 4, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 102, 103, 104, 106, 107, 108, 109, 110, 112, 114, 115, 117, 118, 119, 122, 131, 134,...
|
252
|
+
|
253
|
+
LinuxStat::Process.names
|
254
|
+
=> {1=>"systemd", 2=>"kthreadd", 3=>"rcu_gp", 4=>"rcu_par_gp", 6=>"kworker/0:0H-events_highpri", 9=>"mm_percpu_wq", 10=>"ksoftirqd/0", 11=>"rcuc/0", 12=>"rcu_preempt", 13=>"rcub/0", 14=>"migration/0", 15=>"idle_inject/0", 16=>"cpuhp/0", 17=>"cpuhp/1", 18...
|
255
|
+
|
256
|
+
LinuxStat::Process.running
|
257
|
+
=> [33736]
|
176
258
|
|
177
259
|
LinuxStat::Process.sleeping
|
178
|
-
=> [1, 2, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 40, 41, 42, 46, 47, 48, 50, 51, 52, 112, 114, 115,
|
260
|
+
=> [1, 2, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 40, 41, 42, 46, 47, 48, 50, 51, 52, 112, 114, 115, 178, 180, 197, 225, 239, 309, 317, 329, 332, 333, 334, 338, 367, 368, 369, 370, 378, 381, 383, 384, 402,...
|
261
|
+
|
262
|
+
LinuxStat::Process.types
|
263
|
+
=> {1=>:sleeping, 2=>:sleeping, 3=>:idle, 4=>:idle, 6=>:idle, 9=>:idle, 10=>:sleeping, 11=>:sleeping, 12=>:idle, 13=>:sleeping, 14=>:sleeping, 15=>:sleeping, 16=>:sleeping, 17=>:sleeping, 18=>:sleeping, 19=>:sleeping, 20=>:sleeping, 21=>:sleeping, 23=>:i...
|
179
264
|
|
180
265
|
LinuxStat::Process.zombie
|
181
266
|
=> []
|
182
267
|
|
183
|
-
LinuxStat::Process.running
|
184
|
-
=> [32117]
|
185
|
-
|
186
268
|
```
|
187
269
|
|
188
270
|
### LinuxStat::Swap
|
189
271
|
```
|
272
|
+
LinuxStat::Swap.any?
|
273
|
+
=> true
|
274
|
+
|
275
|
+
LinuxStat::Swap.available
|
276
|
+
=> 1913936
|
277
|
+
|
278
|
+
LinuxStat::Swap.list
|
279
|
+
=> {"/dev/zram0"=>[:partition, 4194300, 2280364, -2]}
|
280
|
+
|
190
281
|
LinuxStat::Swap.percent_available
|
191
|
-
=>
|
282
|
+
=> 45.63
|
283
|
+
|
284
|
+
LinuxStat::Swap.percent_used
|
285
|
+
=> 54.37
|
192
286
|
|
193
287
|
LinuxStat::Swap.stat
|
194
|
-
=> {:total=>4194300, :used=>
|
288
|
+
=> {:total=>4194300, :used=>2280364, :available=>1913936, :percent_used=>54.37, :percent_available=>45.63}
|
195
289
|
|
196
290
|
LinuxStat::Swap.total
|
197
291
|
=> 4194300
|
198
292
|
|
199
|
-
LinuxStat::Swap.
|
200
|
-
=>
|
293
|
+
LinuxStat::Swap.used
|
294
|
+
=> 2280364
|
201
295
|
|
202
|
-
|
203
|
-
=> 2854972
|
296
|
+
```
|
204
297
|
|
205
|
-
|
206
|
-
|
298
|
+
## Return Types
|
299
|
+
+ In general, if a method returns either a Float or a Integer or a Time, it will return a Float or Integer or Time in all cases. But if the status isn't available, it will return nil.
|
207
300
|
|
208
|
-
|
209
|
-
|
301
|
+
+ If the method returns a Hash / Array, it will return return Hash / Array in all cases. If the status isn't available, it will return an empty Hash / Array.
|
302
|
+
|
303
|
+
+ If the method returns a String, it will return return String in all cases. If the status isn't available, it will return an empty *frozen* String.
|
304
|
+
|
305
|
+
+ It doesn't have implementation of any Error that gets raised in runtime for the ease of use.
|
306
|
+
|
307
|
+
+ If you need to check some stat that returns an integer or float, and you get nil, you know it's not available, so you can work accordingly. But if you need the integer or float value in 0 to whatever format, you can use the .to_i or .to_f method on the object, nil will get converted to number then.
|
308
|
+
|
309
|
+
If some error is *raised* it should be reported as a bug.
|
310
|
+
|
311
|
+
## Ruby on Rails
|
312
|
+
|
313
|
+
1. Just add `gem linux_stat`:
|
210
314
|
|
211
315
|
```
|
316
|
+
bundle add linux_stat
|
317
|
+
```
|
318
|
+
|
319
|
+
You can use LinuxStat directly in rails.
|
212
320
|
|
321
|
+

|
322
|
+
|
323
|
+
Don't need to worry about versions if you are using anything > 0.2.1.
|
324
|
+
|
325
|
+
Newer versions will have bug fixes, performance improvements and new features but the return types of old methods will always be the same across upgrades > 0.2.1.
|
326
|
+
|
327
|
+
Even if we remove something, there will be always a deprecation warning for some months or for even a year before we actually remove it.
|
213
328
|
|
214
329
|
## Development
|
215
330
|
|
216
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
331
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
217
332
|
|
218
333
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
219
334
|
|
335
|
+
## Testing
|
336
|
+
Like other gems, this doesn't have a test like RSpec. We suggest using the bin/linuxstat.rb file on various systems.
|
337
|
+
If you need to test a specific module, say the CPU, just run it like this:
|
338
|
+
|
339
|
+
```
|
340
|
+
$ ruby bin/linuxstat.rb CPU
|
341
|
+
```
|
342
|
+
|
343
|
+
Or:
|
344
|
+
```
|
345
|
+
$ ruby bin/linuxstat.rb cpu
|
346
|
+
```
|
347
|
+
|
348
|
+
That is, the argument passed is not case-sensitive.
|
349
|
+
But if the argument passed isn't available and outright wrong, it will run all the module methods. For example, you can't do:
|
350
|
+
|
351
|
+
```
|
352
|
+
$ ruby bin/linuxstat.rb upc
|
353
|
+
```
|
354
|
+
This is not a valid module and can't be run.
|
355
|
+
|
220
356
|
## Contributing
|
221
357
|
|
222
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
358
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Souravgoswami/linux_stat.
|
223
359
|
|
224
360
|
## License
|
225
361
|
|
226
362
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
227
|
-
|
228
|
-
## Code of Conduct
|
229
|
-
|
230
|
-
Everyone interacting in the LinuxStat project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/linux_stat/blob/master/CODE_OF_CONDUCT.md).
|
data/bin/console
CHANGED
@@ -1,14 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
require "linux_stat"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
2
|
+
$-v = true
|
3
|
+
%w(bundler/setup linux_stat irb).each(&method(:require))
|
14
4
|
IRB.start(__FILE__)
|