hwid 0.1.1 → 0.1.3
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/Gemfile.lock +10 -8
- data/README.md +3 -3
- data/lib/hwid.rb +1 -1
- data/lib/hwid/base.rb +12 -3
- data/test/test_hwid.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 647fe03df69a6ee4aa5925fad2ba7538287f13cc
|
4
|
+
data.tar.gz: 5fe388fc26a5544a0d70e25599fa14e83d350130
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d56ff49b15441b9dac3ccda699bca7d80224f64c30e9bd8c13d2ae1db288915553d6f460096ada51ab23c21c5b51af2168cd914bed5732b459f61449e3a22d9
|
7
|
+
data.tar.gz: 9ea93d9c0682320d2ba5de7185f382b3d1c2f761b6fe19afee0d6511ef299da95c70db870312db948e6c6f49c3032c82f7187fe3bbff9d2cca72acc4fcb749b2
|
data/Gemfile.lock
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hwid (0.1.
|
4
|
+
hwid (0.1.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
codeclimate-test-reporter (0.
|
9
|
+
codeclimate-test-reporter (0.4.0)
|
10
10
|
simplecov (>= 0.7.1, < 1.0.0)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
docile (1.1.5)
|
12
|
+
minitest (5.4.0)
|
13
|
+
multi_json (1.10.1)
|
14
|
+
simplecov (0.9.0)
|
15
|
+
docile (~> 1.1.0)
|
16
|
+
multi_json
|
17
|
+
simplecov-html (~> 0.8.0)
|
18
|
+
simplecov-html (0.8.0)
|
17
19
|
|
18
20
|
PLATFORMS
|
19
21
|
ruby
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
[](https://codeclimate.com/github/semdinsp/hwid)
|
1
|
+
[](https://travis-ci.org/semdinsp/hwid)[](https://codeclimate.com/github/semdinsp/hwid)
|
3
2
|
[](http://badge.fury.io/rb/hwid)
|
4
3
|
|
5
4
|
hwid gem
|
@@ -17,4 +16,5 @@ It is a bit slow so perhaps only call it upon startup
|
|
17
16
|
Usage
|
18
17
|
=======
|
19
18
|
|
20
|
-
|
19
|
+
Hwid.systemid
|
20
|
+
|
data/lib/hwid.rb
CHANGED
@@ -2,6 +2,6 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
Dir[File.join(File.dirname(__FILE__), 'hwid/**/*.rb')].sort.each { |lib| require lib }
|
4
4
|
|
5
|
-
module
|
5
|
+
module Hwid
|
6
6
|
VERSION = '0.0.1'
|
7
7
|
end
|
data/lib/hwid/base.rb
CHANGED
@@ -24,16 +24,25 @@ module Hwid
|
|
24
24
|
return get_mac_id if mac
|
25
25
|
return get_linux_id if linux
|
26
26
|
end
|
27
|
+
def run_cmd(cmd)
|
28
|
+
res=""
|
29
|
+
begin
|
30
|
+
res=`#{cmd}`
|
31
|
+
rescue Exception => e
|
32
|
+
res="Serial: unknown"
|
33
|
+
end
|
34
|
+
res
|
35
|
+
end
|
27
36
|
def get_rasp_id
|
28
|
-
res
|
37
|
+
res=run_cmd('grep Serial /proc/cpuinfo')
|
29
38
|
self.parse(res)
|
30
39
|
end
|
31
40
|
def get_mac_id
|
32
|
-
res
|
41
|
+
res=run_cmd('/usr/sbin/system_profiler SPHardwareDataType -timeout 0 | grep Serial')
|
33
42
|
self.parse(res)
|
34
43
|
end
|
35
44
|
def get_linux_id
|
36
|
-
res
|
45
|
+
res=run_cmd('ifconfig | grep HWaddr').split.last
|
37
46
|
end
|
38
47
|
|
39
48
|
end # Class
|
data/test/test_hwid.rb
CHANGED
@@ -23,7 +23,14 @@ class HwidTest < Minitest::Test
|
|
23
23
|
assert @f.systemid!='unknown', "return id"
|
24
24
|
end
|
25
25
|
def test_class
|
26
|
-
assert Hwid.systemid!='unknown', "return id"
|
26
|
+
assert Hwid.systemid!='unknown', "return id is #{Hwid.systemid}"
|
27
|
+
|
28
|
+
end
|
29
|
+
def test_run_cmd
|
30
|
+
d =@f.run_cmd('date')
|
31
|
+
t=Time.now.day
|
32
|
+
puts d
|
33
|
+
assert d.include?(t.to_s), "date is #{d} day is #{t}"
|
27
34
|
|
28
35
|
end
|
29
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hwid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Sproule
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Get a rough hardware id of the system that the gem is running on
|
14
14
|
email: scott.sproule@ficonab.com
|