hwid 0.1.1 → 0.1.3

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: f69681e361e230ec455dc72893c443abcd7ff74e
4
- data.tar.gz: ab9a1c87884d550e68651c5cfc041435402e06c2
3
+ metadata.gz: 647fe03df69a6ee4aa5925fad2ba7538287f13cc
4
+ data.tar.gz: 5fe388fc26a5544a0d70e25599fa14e83d350130
5
5
  SHA512:
6
- metadata.gz: 81b388f088c9d551266fac3da3c24a69020efc339f5b4a5f3e05ad9930c53bc0d06893af42e77d9ff919e07ec663165677d72f37dfa7a53a4ec353f7d47d7d2a
7
- data.tar.gz: c8aa3d6852c51bde42dac3170d656b5dd416f51001296cb14ef99b61f69908931708559c8d6322157a35fe28faa18473c7d3b850cce5c9a66b724e35d70da895
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.0)
4
+ hwid (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- codeclimate-test-reporter (0.1.1)
9
+ codeclimate-test-reporter (0.4.0)
10
10
  simplecov (>= 0.7.1, < 1.0.0)
11
- minitest (5.0.8)
12
- multi_json (1.8.0)
13
- simplecov (0.7.1)
14
- multi_json (~> 1.0)
15
- simplecov-html (~> 0.7.1)
16
- simplecov-html (0.7.1)
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
- [![Build Status](https://travis-ci.org/semdinsp/hwid.png)](https://travis-ci.org/semdinsp/hwid)
2
- [![Code Climate](https://codeclimate.com/github/semdinsp/hwid/badges/gpa.svg)](https://codeclimate.com/github/semdinsp/hwid)
1
+ [![Build Status](https://travis-ci.org/semdinsp/hwid.svg?branch=master)](https://travis-ci.org/semdinsp/hwid)[![Code Climate](https://codeclimate.com/github/semdinsp/hwid/badges/gpa.svg)](https://codeclimate.com/github/semdinsp/hwid)
3
2
  [![Gem Version](https://badge.fury.io/rb/hwid.png)](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
- @hwid.systemid
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 Randprize
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=`grep Serial /proc/cpuinfo`
37
+ res=run_cmd('grep Serial /proc/cpuinfo')
29
38
  self.parse(res)
30
39
  end
31
40
  def get_mac_id
32
- res=`system_profiler SPHardwareDataType -timeout 0 | grep Serial`
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=`ifconfig |grep HWaddr`.split.last
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.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-16 00:00:00.000000000 Z
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