macserialrb 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -11
- data/Rakefile +2 -2
- data/exe/macserialrb +46 -0
- data/ext/macserialrb/extconf.rb +2 -3
- data/lib/macserialrb.rb +3 -5
- data/lib/macserialrb/version.rb +1 -1
- data/macserialrb.gemspec +13 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8780b9bdda73058568972404cf21cd4ef6c6991596907b9081c5fa642ce4c1a
|
4
|
+
data.tar.gz: a784b50fb23247bb3eb1ec15ce2dc85976339cae77cbfc0969107eb20d2bda94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4d47aefa7c0630636bec39ec7388e1965a93da17a1e2927ac5db8fa3c01267e3d1356fec1ff37512cce34c6ff39fe0f660b47218e649d4201267cc684143c1
|
7
|
+
data.tar.gz: f5141abe678c644738316e3cb437f63ac194a635c6cd5f4d6131d4723ddec5f40047ab90500b63b5862e114f4580707364ccda439b75fd1f400a0e59dbd24521
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Macserialrb
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/csrutil/macserialrb.svg?branch=main)](https://travis-ci.org/csrutil/macserialrb)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/macserialrb.svg)](https://badge.fury.io/rb/macserialrb)
|
5
|
+
![](https://ruby-gem-downloads-badge.herokuapp.com/macserialrb)
|
6
|
+
|
3
7
|
This is the Ruby version of the macserial, you can check the [source](https://github.com/acidanthera/OpenCorePkg/tree/master/Utilities/macserial) here
|
4
8
|
|
5
9
|
## Usage
|
@@ -7,24 +11,26 @@ This is the Ruby version of the macserial, you can check the [source](https://gi
|
|
7
11
|
List all the models
|
8
12
|
|
9
13
|
```ruby
|
10
|
-
|
14
|
+
$ macserialrb -l
|
15
|
+
MacBook1,1
|
16
|
+
MacBook10,1
|
17
|
+
MacBook2,1
|
18
|
+
...
|
11
19
|
```
|
12
20
|
|
13
21
|
Generate SystemSerialNumber and MLB
|
14
22
|
|
15
23
|
```ruby
|
16
|
-
|
17
|
-
|
18
|
-
{
|
19
|
-
productName: "iMac19,1",
|
20
|
-
SystemSerialNumber: "C02YRRYRJV3Q",
|
21
|
-
MLB: "C02921306QXLNV9A8"
|
22
|
-
}
|
23
|
-
```
|
24
|
+
$ macserialrb -m iMac19,1
|
24
25
|
|
25
|
-
|
26
|
+
iMac19,1 macserial info
|
26
27
|
|
27
|
-
|
28
|
+
productName: iMac19,1
|
29
|
+
SystemSerialNumber: C02CV0XNJV3Q
|
30
|
+
MLB: C02024101GULNV9FB
|
31
|
+
SystemUUID: 5DD65CCD-61DC-40C3-8667-00E75ED6E9A0
|
32
|
+
ROM: 28201A05BECA
|
33
|
+
```
|
28
34
|
|
29
35
|
## Installation
|
30
36
|
|
@@ -61,3 +67,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
61
67
|
## Code of Conduct
|
62
68
|
|
63
69
|
Everyone interacting in the Macserialrb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/csrutil/macserialrb/blob/master/CODE_OF_CONDUCT.md).
|
70
|
+
|
71
|
+
## Credits
|
72
|
+
|
73
|
+
- https://github.com/acidanthera/OpenCorePkg
|
data/Rakefile
CHANGED
@@ -5,10 +5,10 @@ RSpec::Core::RakeTask.new(:spec)
|
|
5
5
|
|
6
6
|
require "rake/extensiontask"
|
7
7
|
|
8
|
-
task :
|
8
|
+
task build: :compile
|
9
9
|
|
10
10
|
Rake::ExtensionTask.new("macserialrb") do |ext|
|
11
11
|
ext.lib_dir = "lib/macserialrb"
|
12
12
|
end
|
13
13
|
|
14
|
-
task :
|
14
|
+
task default: [:clobber, :compile, :spec]
|
data/exe/macserialrb
CHANGED
@@ -1,3 +1,49 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
require "optparse"
|
3
4
|
require "macserialrb"
|
5
|
+
require "securerandom"
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
op = OptionParser.new do |parser|
|
10
|
+
parser.banner = "Usage: macserialrb [options]"
|
11
|
+
parser.on("-v", "--version", "macserialrb version") do |v|
|
12
|
+
options[:version] = v
|
13
|
+
end
|
14
|
+
|
15
|
+
parser.on("-l", "--list", "list all mac models") do |v|
|
16
|
+
options[:list] = v
|
17
|
+
end
|
18
|
+
|
19
|
+
parser.on("-m", "--model [iMac19,1]", String, "mac model") do |v|
|
20
|
+
options[:model] = v
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
if ARGV.length == 0
|
25
|
+
op.parse! %w[--help]
|
26
|
+
exit 0
|
27
|
+
else
|
28
|
+
op.parse!
|
29
|
+
end
|
30
|
+
|
31
|
+
if options[:version]
|
32
|
+
puts ["Macserialrb", Macserialrb::VERSION].join " "
|
33
|
+
exit 0
|
34
|
+
end
|
35
|
+
|
36
|
+
if options[:list]
|
37
|
+
puts Macserialrb.models
|
38
|
+
exit 0
|
39
|
+
end
|
40
|
+
|
41
|
+
info = Macserialrb.generate options.slice(:model)
|
42
|
+
|
43
|
+
info[:SystemUUID] = SecureRandom.uuid.upcase
|
44
|
+
info[:ROM] = SecureRandom.hex(6).upcase
|
45
|
+
|
46
|
+
puts "#{options[:model]} macserial info \n\n"
|
47
|
+
info.each do |k, v|
|
48
|
+
puts [k, v].join(": ")
|
49
|
+
end
|
data/ext/macserialrb/extconf.rb
CHANGED
@@ -2,10 +2,9 @@ require "mkmf"
|
|
2
2
|
|
3
3
|
case RUBY_PLATFORM
|
4
4
|
when /linux/i
|
5
|
-
$CPPFLAGS +=
|
5
|
+
$CPPFLAGS += " -std=c11 -Werror -Wall"
|
6
6
|
when /darwin/i
|
7
|
-
$CPPFLAGS +=
|
7
|
+
$CPPFLAGS += " -std=c11 -Werror -Wall"
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
10
|
create_makefile("macserialrb/macserialrb")
|
data/lib/macserialrb.rb
CHANGED
data/lib/macserialrb/version.rb
CHANGED
data/macserialrb.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
require_relative
|
1
|
+
require_relative "lib/macserialrb/version"
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name
|
5
|
-
spec.version
|
6
|
-
spec.authors
|
7
|
-
spec.email
|
4
|
+
spec.name = "macserialrb"
|
5
|
+
spec.version = Macserialrb::VERSION
|
6
|
+
spec.authors = ["csrutil"]
|
7
|
+
spec.email = ["csrutil@protonmail.com"]
|
8
8
|
|
9
|
-
spec.summary
|
10
|
-
spec.description
|
11
|
-
spec.homepage
|
12
|
-
spec.license
|
9
|
+
spec.summary = "macserialrb is a tool that obtains and decodes Mac serial number and board identifier to provide more information about the production of your hardware. "
|
10
|
+
spec.description = "macserialrb is a tool that obtains and decodes Mac serial number and board identifier to provide more information about the production of your hardware. "
|
11
|
+
spec.homepage = "https://github.com/csrutil/macserialrb"
|
12
|
+
spec.license = "MIT"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
14
|
|
15
15
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
-
spec.files
|
23
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
24
24
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
25
|
end
|
26
|
-
spec.bindir
|
27
|
-
spec.executables
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ["lib"]
|
29
|
-
spec.extensions
|
29
|
+
spec.extensions = ["ext/macserialrb/extconf.rb"]
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macserialrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- csrutil
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'macserialrb is a tool that obtains and decodes Mac serial number and
|
14
14
|
board identifier to provide more information about the production of your hardware. '
|