macos.rb 0.50.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.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +572 -0
  3. data/Gemfile +3 -0
  4. data/LICENSE +21 -0
  5. data/README.md +129 -0
  6. data/Rakefile +9 -0
  7. data/lib/Array/all_but_last.rb +7 -0
  8. data/lib/MacOS/Apple80211.rb +68 -0
  9. data/lib/MacOS/Applications.rb +73 -0
  10. data/lib/MacOS/Defaults/ComAppleDock.rb +153 -0
  11. data/lib/MacOS/Defaults/NSGlobalDomain/NSUserKeyEquivalents.rb +109 -0
  12. data/lib/MacOS/Defaults.rb +126 -0
  13. data/lib/MacOS/DiskUtil.rb +63 -0
  14. data/lib/MacOS/Dmg.rb +99 -0
  15. data/lib/MacOS/HardwarePort.rb +79 -0
  16. data/lib/MacOS/IfConfig.rb +183 -0
  17. data/lib/MacOS/Keychain.rb +26 -0
  18. data/lib/MacOS/LaunchControl.rb +36 -0
  19. data/lib/MacOS/SystemProfiler.rb +119 -0
  20. data/lib/MacOS/USBFlashDrive.rb +26 -0
  21. data/lib/MacOS/Users.rb +16 -0
  22. data/lib/MacOS/VERSION.rb +6 -0
  23. data/lib/MacOS/VPN.rb +13 -0
  24. data/lib/MacOS/Voice.rb +40 -0
  25. data/lib/MacOS.rb +27 -0
  26. data/lib/Module/alias_methods.rb +7 -0
  27. data/lib/Ordinal/Array.rb +8 -0
  28. data/lib/Ordinal.rb +157 -0
  29. data/lib/Thoran/Array/AllButLast/all_but_last.rb +28 -0
  30. data/lib/Thoran/Array/LastX/lastX.rb +33 -0
  31. data/lib/Thoran/Module/AliasMethods/alias_methods.rb +23 -0
  32. data/lib/Thoran/String/Capture/capture.rb +28 -0
  33. data/lib/Version.rb +381 -0
  34. data/macos.rb.gemspec +59 -0
  35. data/test/MacOS/Apple80211_test.rb +80 -0
  36. data/test/MacOS/Applications_test.rb +82 -0
  37. data/test/MacOS/Defaults/ComAppleDock_test.rb +66 -0
  38. data/test/MacOS/Defaults/NSGlobalDomain/NSUserKeyEquivalents_test.rb +67 -0
  39. data/test/MacOS/Defaults_test.rb +144 -0
  40. data/test/MacOS/DiskUtil_test.rb +48 -0
  41. data/test/MacOS/Dmg_test.rb +69 -0
  42. data/test/MacOS/HardwarePort_test.rb +46 -0
  43. data/test/MacOS/IfConfig_test.rb +144 -0
  44. data/test/MacOS/Keychain_test.rb +22 -0
  45. data/test/MacOS/LaunchControl_test.rb +40 -0
  46. data/test/MacOS/SystemProfiler_test.rb +69 -0
  47. data/test/MacOS/USBFlashDrive_test.rb +20 -0
  48. data/test/MacOS/Users_test.rb +10 -0
  49. data/test/MacOS/VPN_test.rb +18 -0
  50. data/test/MacOS/Voice_test.rb +46 -0
  51. data/test/MacOS_test.rb +17 -0
  52. data/test/VERSION_test.rb +19 -0
  53. data/test/commands_test.rb +50 -0
  54. data/test/fixtures/airport-I-deprecated.txt +2 -0
  55. data/test/fixtures/airport-I.txt +17 -0
  56. data/test/fixtures/defaults-domains.txt +1 -0
  57. data/test/fixtures/defaults-export-com.apple.dock.xml +47 -0
  58. data/test/fixtures/defaults-read-NSUserKeyEquivalents.txt +4 -0
  59. data/test/fixtures/df-k.txt +6 -0
  60. data/test/fixtures/diskutil-list-plist.xml +104 -0
  61. data/test/fixtures/dscl-list-users.txt +8 -0
  62. data/test/fixtures/ifconfig-a.txt +53 -0
  63. data/test/fixtures/networksetup-listallhardwareports.txt +39 -0
  64. data/test/fixtures/say-v.txt +8 -0
  65. data/test/fixtures/system_profiler-SPAirPortDataType.txt +44 -0
  66. data/test/fixtures/system_profiler-SPSoftwareDataType.txt +14 -0
  67. data/test/fixtures/system_profiler-SPUSBDataType.txt +58 -0
  68. data/test/gemspec_test.rb +50 -0
  69. data/test/helper.rb +18 -0
  70. metadata +183 -0
@@ -0,0 +1,10 @@
1
+ require_relative '../helper'
2
+ require 'MacOS/Users'
3
+
4
+ describe MacOS::Users do
5
+ it "lists the real users, without the system and service accounts" do
6
+ MacOS::Users.stub(:`, fixture('dscl-list-users.txt')) do
7
+ _(MacOS::Users.all).must_equal(%w{another example})
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../helper'
2
+ require 'MacOS/IfConfig'
3
+ require 'MacOS/VPN'
4
+
5
+ describe MacOS::VPN do
6
+ it "is up where a tunnel interface is up" do
7
+ MacOS::IfConfig.stub(:output, fixture('ifconfig-a.txt')) do
8
+ _(MacOS::VPN.up?.interface).must_equal('utun4')
9
+ end
10
+ end
11
+
12
+ it "isn't where no tunnel interface has an address" do
13
+ without_tunnel = fixture('ifconfig-a.txt').sub(/^\tinet 198\.51\.100\.250 .+\n/, '')
14
+ MacOS::IfConfig.stub(:output, without_tunnel) do
15
+ _(MacOS::VPN.up?).must_be_nil
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,46 @@
1
+ require_relative '../helper'
2
+ require 'MacOS/Voice'
3
+
4
+ describe MacOS::Voice do
5
+ def with_voices(&block)
6
+ MacOS::Voice.stub(:`, fixture('say-v.txt'), &block)
7
+ end
8
+
9
+ def voice(name)
10
+ MacOS::Voice.list.find{|voice| voice.name == name}
11
+ end
12
+
13
+ it "makes one for each voice say knows" do
14
+ with_voices do
15
+ _(MacOS::Voice.all.size).must_equal(8)
16
+ _(MacOS::Voice.list.map(&:name)).must_include('Albert')
17
+ end
18
+ end
19
+
20
+ it "reads a voice's name, localisation and description" do
21
+ with_voices do
22
+ albert = voice('Albert')
23
+ _(albert.localization).must_equal('en_US')
24
+ _(albert.description).must_equal('Hello! My name is Albert.')
25
+ end
26
+ end
27
+
28
+ it "reads a name with spaces in it whole" do
29
+ with_voices do
30
+ _(voice('Bad News').localization).must_equal('en_US')
31
+ _(voice('Eddy (English (UK))').localization).must_equal('en_GB')
32
+ end
33
+ end
34
+
35
+ it "gives a description without its newline" do
36
+ with_voices do
37
+ _(MacOS::Voice.list.none?{|voice| voice.description.end_with?("\n")}).must_equal(true)
38
+ end
39
+ end
40
+
41
+ it "picks a voice at random from those say knows" do
42
+ with_voices do
43
+ _(MacOS::Voice.list.map(&:name)).must_include(MacOS::Voice.random_voice.name)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,17 @@
1
+ require_relative './helper'
2
+ require 'MacOS'
3
+
4
+ describe MacOS do
5
+ it "loads every library" do
6
+ %w{
7
+ Apple80211 Applications Defaults Defaults::ComAppleDock Defaults::NSGlobalDomain::NSUserKeyEquivalents DiskUtil Dmg
8
+ HardwarePort IfConfig Keychain LaunchControl SystemProfiler USBFlashDrive Users VERSION VPN Voice
9
+ }.each{|name| _(MacOS.const_get(name)).wont_be_nil}
10
+ end
11
+
12
+ it "gives the system's version" do
13
+ MacOS::SystemProfiler.stub(:system_profiler_output, fixture('system_profiler-SPSoftwareDataType.txt')) do
14
+ _(MacOS.version.to_s).must_equal('15.8.1')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require_relative './helper'
2
+ require 'MacOS/VERSION'
3
+
4
+ describe MacOS do
5
+ describe "VERSION" do
6
+ it "is a string" do
7
+ _(MacOS::VERSION).must_be_instance_of String
8
+ end
9
+
10
+ it "is three numbers separated by dots" do
11
+ _(MacOS::VERSION).must_match(/\A\d+\.\d+\.\d+\z/)
12
+ end
13
+
14
+ it "matches the newest entry in the CHANGELOG" do
15
+ changelog = File.read(File.expand_path('../CHANGELOG', __dir__))
16
+ _(changelog[/^(\d+\.\d+\.\d+):/, 1]).must_equal(MacOS::VERSION)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,50 @@
1
+ require_relative './helper'
2
+ require 'open3'
3
+ require 'MacOS'
4
+
5
+ # The command each library sends, caught before it reaches the shell, so as none runs.
6
+ describe "the commands" do
7
+ def sent_by(receiver, method, *args)
8
+ sent = []
9
+ receiver.stub(:`, ->(command){sent << command; ''}){receiver.send(method, *args)}
10
+ sent
11
+ end
12
+
13
+ def captured_by(receiver, method, *args)
14
+ sent = []
15
+ Open3.stub(:capture3, ->(command){sent << command; ['', '', nil]}){receiver.send(method, *args)}
16
+ sent
17
+ end
18
+
19
+ it "lists the hardware ports with networksetup" do
20
+ _(sent_by(MacOS::HardwarePort, :output)).must_equal(['networksetup -listallhardwareports'])
21
+ end
22
+
23
+ it "lists the interfaces with ifconfig" do
24
+ _(sent_by(MacOS::IfConfig, :output)).must_equal(['ifconfig -a'])
25
+ end
26
+
27
+ it "reads the software overview with system_profiler" do
28
+ _(sent_by(MacOS::SystemProfiler, :system_profiler_output)).must_equal(['system_profiler SPSoftwareDataType'])
29
+ end
30
+
31
+ it "reads the Wi-Fi connection with system_profiler" do
32
+ _(sent_by(MacOS::Apple80211, :system_profiler_airport)).must_equal(['system_profiler SPAirPortDataType'])
33
+ end
34
+
35
+ it "reads the Wi-Fi connection with airport, where it's there" do
36
+ _(sent_by(MacOS::Apple80211, :airport_i)).must_equal(['/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I'])
37
+ end
38
+
39
+ it "lists the disks with diskutil" do
40
+ _(sent_by(MacOS::DiskUtil, :xml_volume_plist)).must_equal(['diskutil list -plist'])
41
+ end
42
+
43
+ it "asks security for a generic password" do
44
+ _(captured_by(MacOS::Keychain, :find_generic_password, 'ExampleNet')).must_equal(['security find-generic-password -ga ExampleNet'])
45
+ end
46
+
47
+ it "asks system_profiler for the USB devices" do
48
+ _(captured_by(MacOS::USBFlashDrive, :raw_system_profiler_output)).must_equal(['system_profiler SPUSBDataType'])
49
+ end
50
+ end
@@ -0,0 +1,2 @@
1
+ WARNING: The airport command line tool is deprecated and will be removed in a future release.
2
+ For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
@@ -0,0 +1,17 @@
1
+ agrCtlRSSI: -52
2
+ agrExtRSSI: 0
3
+ agrCtlNoise: -94
4
+ agrExtNoise: 0
5
+ state: running
6
+ op mode: station
7
+ lastTxRate: 573
8
+ maxRate: 1201
9
+ lastAssocStatus: 0
10
+ 802.11 auth: open
11
+ link auth: wpa2-psk
12
+ BSSID: 00:00:5e:00:53:20
13
+ SSID: ExampleNet
14
+ MCS: 9
15
+ guardInterval: 800
16
+ NSS: 2
17
+ channel: 36,80
@@ -0,0 +1 @@
1
+ com.apple.dock, com.apple.finder, com.apple.Safari
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>autohide</key>
6
+ <true/>
7
+ <key>magnification</key>
8
+ <false/>
9
+ <key>mineffect</key>
10
+ <string>scale</string>
11
+ <key>orientation</key>
12
+ <string>bottom</string>
13
+ <key>persistent-apps</key>
14
+ <array>
15
+ <dict>
16
+ <key>tile-data</key>
17
+ <dict>
18
+ <key>file-data</key>
19
+ <dict>
20
+ <key>_CFURLString</key>
21
+ <string>file:///System/Applications/Mail.app/</string>
22
+ <key>_CFURLStringType</key>
23
+ <integer>15</integer>
24
+ </dict>
25
+ </dict>
26
+ </dict>
27
+ <dict>
28
+ <key>tile-data</key>
29
+ <dict>
30
+ <key>file-data</key>
31
+ <dict>
32
+ <key>_CFURLString</key>
33
+ <string>file:///Users/example/Applications/Example%20App.app/</string>
34
+ <key>_CFURLStringType</key>
35
+ <integer>15</integer>
36
+ </dict>
37
+ </dict>
38
+ </dict>
39
+ </array>
40
+ <key>persistent-others</key>
41
+ <array/>
42
+ <key>recent-apps</key>
43
+ <array/>
44
+ <key>tilesize</key>
45
+ <integer>48</integer>
46
+ </dict>
47
+ </plist>
@@ -0,0 +1,4 @@
1
+ {
2
+ "Find Previous" = "@$d";
3
+ "Previous Tab" = "@~\\UF702";
4
+ }
@@ -0,0 +1,6 @@
1
+ Filesystem 1024-blocks Used Available Capacity iused ifree %iused Mounted on
2
+ /dev/disk3s1s1 971350180 11000992 512000000 3% 425829 4291815364 0% /
3
+ devfs 211 211 0 100% 730 0 100% /dev
4
+ /dev/disk3s5 971350180 400000000 512000000 44% 1200000 5120000000 0% /System/Volumes/Data
5
+ /dev/disk4s1 31256576 15552 31241024 1% 1 0 100% /Volumes/EXAMPLE
6
+ map auto_home 0 0 0 100% 0 0 - /System/Volumes/Data/home
@@ -0,0 +1,104 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AllDisks</key>
6
+ <array>
7
+ <string>disk0</string>
8
+ <string>disk0s1</string>
9
+ <string>disk0s2</string>
10
+ <string>disk3</string>
11
+ <string>disk4</string>
12
+ <string>disk4s1</string>
13
+ </array>
14
+ <key>AllDisksAndPartitions</key>
15
+ <array>
16
+ <dict>
17
+ <key>Content</key>
18
+ <string>GUID_partition_scheme</string>
19
+ <key>DeviceIdentifier</key>
20
+ <string>disk0</string>
21
+ <key>OSInternal</key>
22
+ <true/>
23
+ <key>Partitions</key>
24
+ <array>
25
+ <dict>
26
+ <key>Content</key>
27
+ <string>Apple_APFS_ISC</string>
28
+ <key>DeviceIdentifier</key>
29
+ <string>disk0s1</string>
30
+ <key>Size</key>
31
+ <integer>524288000</integer>
32
+ </dict>
33
+ <dict>
34
+ <key>Content</key>
35
+ <string>Apple_APFS</string>
36
+ <key>DeviceIdentifier</key>
37
+ <string>disk0s2</string>
38
+ <key>Size</key>
39
+ <integer>994662584320</integer>
40
+ </dict>
41
+ </array>
42
+ <key>Size</key>
43
+ <integer>1000555581440</integer>
44
+ </dict>
45
+ <dict>
46
+ <key>APFSVolumes</key>
47
+ <array>
48
+ <dict>
49
+ <key>DeviceIdentifier</key>
50
+ <string>disk3s1</string>
51
+ <key>MountPoint</key>
52
+ <string>/</string>
53
+ <key>VolumeName</key>
54
+ <string>Macintosh HD</string>
55
+ </dict>
56
+ </array>
57
+ <key>Content</key>
58
+ <string></string>
59
+ <key>DeviceIdentifier</key>
60
+ <string>disk3</string>
61
+ <key>Partitions</key>
62
+ <array/>
63
+ <key>Size</key>
64
+ <integer>994662584320</integer>
65
+ </dict>
66
+ <dict>
67
+ <key>Content</key>
68
+ <string>FDisk_partition_scheme</string>
69
+ <key>DeviceIdentifier</key>
70
+ <string>disk4</string>
71
+ <key>OSInternal</key>
72
+ <false/>
73
+ <key>Partitions</key>
74
+ <array>
75
+ <dict>
76
+ <key>Content</key>
77
+ <string>Windows_FAT_32</string>
78
+ <key>DeviceIdentifier</key>
79
+ <string>disk4s1</string>
80
+ <key>MountPoint</key>
81
+ <string>/Volumes/EXAMPLE</string>
82
+ <key>Size</key>
83
+ <integer>32006733824</integer>
84
+ <key>VolumeName</key>
85
+ <string>EXAMPLE</string>
86
+ </dict>
87
+ </array>
88
+ <key>Size</key>
89
+ <integer>32010928128</integer>
90
+ </dict>
91
+ </array>
92
+ <key>VolumesFromDisks</key>
93
+ <array>
94
+ <string>Macintosh HD</string>
95
+ <string>EXAMPLE</string>
96
+ </array>
97
+ <key>WholeDisks</key>
98
+ <array>
99
+ <string>disk0</string>
100
+ <string>disk3</string>
101
+ <string>disk4</string>
102
+ </array>
103
+ </dict>
104
+ </plist>
@@ -0,0 +1,8 @@
1
+ _amavisd
2
+ _appleevents
3
+ _www
4
+ another
5
+ daemon
6
+ example
7
+ nobody
8
+ root
@@ -0,0 +1,53 @@
1
+ lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
2
+ options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
3
+ inet 127.0.0.1 netmask 0xff000000
4
+ inet6 ::1 prefixlen 128
5
+ inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
6
+ nd6 options=201<PERFORMNUD,DAD>
7
+ gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
8
+ stf0: flags=0<> mtu 1280
9
+ en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
10
+ options=460<TSO4,TSO6,CHANNEL_IO>
11
+ ether 00:00:5e:00:53:01
12
+ media: autoselect <full-duplex>
13
+ status: inactive
14
+ en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
15
+ options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
16
+ ether 00:00:5e:00:53:02
17
+ inet6 fe80::2%en0 prefixlen 64 secured scopeid 0xf
18
+ inet 192.0.2.114 netmask 0xffffff00 broadcast 192.0.2.255
19
+ nd6 options=201<PERFORMNUD,DAD>
20
+ media: autoselect
21
+ status: active
22
+ awdl0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
23
+ options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
24
+ ether 00:00:5e:00:53:03
25
+ inet6 fe80::3%awdl0 prefixlen 64 scopeid 0x10
26
+ nd6 options=201<PERFORMNUD,DAD>
27
+ media: autoselect
28
+ status: active
29
+ bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
30
+ options=63<RXCSUM,TXCSUM,TSO4,TSO6>
31
+ ether 00:00:5e:00:53:01
32
+ Configuration:
33
+ id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
34
+ maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
35
+ root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
36
+ ipfilter disabled flags 0x0
37
+ member: en1 flags=3<LEARNING,DISCOVER>
38
+ ifmaxaddr 0 port 10 priority 0 path cost 0
39
+ member: en2 flags=3<LEARNING,DISCOVER>
40
+ ifmaxaddr 0 port 11 priority 0 path cost 0
41
+ member: en3 flags=3<LEARNING,DISCOVER>
42
+ ifmaxaddr 0 port 12 priority 0 path cost 0
43
+ nd6 options=201<PERFORMNUD,DAD>
44
+ media: <unknown type>
45
+ status: inactive
46
+ utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
47
+ inet6 fe80::4%utun0 prefixlen 64 scopeid 0x13
48
+ nd6 options=201<PERFORMNUD,DAD>
49
+ utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1420
50
+ inet 198.51.100.250 --> 198.51.100.250 netmask 0xffffffff
51
+ inet6 fe80::5%utun4 prefixlen 64 scopeid 0x1d
52
+ inet6 2001:db8::2 prefixlen 128
53
+ nd6 options=201<PERFORMNUD,DAD>
@@ -0,0 +1,39 @@
1
+
2
+ Hardware Port: Ethernet Adapter (en4)
3
+ Device: en4
4
+ Ethernet Address: 00:00:5e:00:53:04
5
+
6
+ Hardware Port: Ethernet Adapter (en5)
7
+ Device: en5
8
+ Ethernet Address: 00:00:5e:00:53:05
9
+
10
+ Hardware Port: Ethernet Adapter (en6)
11
+ Device: en6
12
+ Ethernet Address: 00:00:5e:00:53:06
13
+
14
+ Hardware Port: USB 10/100/1000 LAN
15
+ Device: en8
16
+ Ethernet Address: 00:00:5e:00:53:07
17
+
18
+ Hardware Port: Thunderbolt Bridge
19
+ Device: bridge0
20
+ Ethernet Address: 00:00:5e:00:53:01
21
+
22
+ Hardware Port: Wi-Fi
23
+ Device: en0
24
+ Ethernet Address: 00:00:5e:00:53:08
25
+
26
+ Hardware Port: Thunderbolt 1
27
+ Device: en1
28
+ Ethernet Address: 00:00:5e:00:53:01
29
+
30
+ Hardware Port: Thunderbolt 2
31
+ Device: en2
32
+ Ethernet Address: 00:00:5e:00:53:09
33
+
34
+ Hardware Port: Thunderbolt 3
35
+ Device: en3
36
+ Ethernet Address: 00:00:5e:00:53:0a
37
+
38
+ VLAN Configurations
39
+ ===================
@@ -0,0 +1,8 @@
1
+ Albert en_US # Hello! My name is Albert.
2
+ Bad News en_US # Hello! My name is Bad News.
3
+ Eddy (English (UK)) en_GB # Hello! My name is Eddy.
4
+ Eddy (English (US)) en_US # Hello! My name is Eddy.
5
+ Karen en_AU # Hi my name is Karen
6
+ Samantha en_US # Hello! My name is Samantha.
7
+ Thomas fr_FR # Bonjour, je m’appelle Thomas.
8
+ Zarvox en_US # Hello! My name is Zarvox.
@@ -0,0 +1,44 @@
1
+ Wi-Fi:
2
+
3
+ Software Versions:
4
+ CoreWLAN: 16.0 (1657)
5
+ CoreWLANKit: 16.0 (1657)
6
+ Menu Extra: 17.0 (1728)
7
+ System Information: 15.0 (1502)
8
+ IO80211 Family: 12.0 (1200.13.1)
9
+ Diagnostics: 11.0 (1163)
10
+ AirPort Utility: 6.3.9 (639.23)
11
+ Interfaces:
12
+ en0:
13
+ Card Type: Wi-Fi (0x14E4, 0x4388)
14
+ MAC Address: 00:00:5e:00:53:02
15
+ Locale: FCC
16
+ Country Code: US
17
+ Supported PHY Modes: 802.11 a/b/g/n/ac/ax
18
+ Wake On Wireless: Supported
19
+ AirDrop: Supported
20
+ Auto Unlock: Supported
21
+ Status: Connected
22
+ Current Network Information:
23
+ <redacted>:
24
+ PHY Mode: 802.11ax
25
+ Channel: 36 (5GHz, 80MHz)
26
+ Country Code: US
27
+ Network Type: Infrastructure
28
+ Security: WPA2 Personal
29
+ Signal / Noise: -52 dBm / -94 dBm
30
+ Transmit Rate: 573
31
+ MCS Index: 9
32
+ Other Local Wi-Fi Networks:
33
+ <redacted>:
34
+ PHY Mode: 802.11ac
35
+ Channel: 149 (5GHz, 80MHz)
36
+ Network Type: Infrastructure
37
+ Security: WPA2 Personal
38
+ Signal / Noise: -70 dBm / -94 dBm
39
+ awdl0:
40
+ MAC Address: 00:00:5e:00:53:03
41
+ Supported Channels: 6 (2GHz), 44 (5GHz), 149 (5GHz)
42
+ Status: Connected
43
+ Current Network Information:
44
+ Network Type: Infrastructure
@@ -0,0 +1,14 @@
1
+ Software:
2
+
3
+ System Software Overview:
4
+
5
+ System Version: macOS 15.8.1 (24H32)
6
+ Kernel Version: Darwin 24.6.0
7
+ Boot Volume: Macintosh HD
8
+ Boot Mode: Normal
9
+ Computer Name: Example Mac
10
+ User Name: Example User (example)
11
+ Secure Virtual Memory: Enabled
12
+ System Integrity Protection: Enabled
13
+ Time since boot: 6 days, 2 hours, 34 minutes
14
+
@@ -0,0 +1,58 @@
1
+ USB:
2
+
3
+ USB 3.1 Bus:
4
+
5
+ Host Controller Driver: AppleT8112USBXHCI
6
+
7
+ Flash Drive:
8
+
9
+ Product ID: 0x0001
10
+ Vendor ID: 0x0000
11
+ Version: 1.00
12
+ Serial Number: 0000000000000001
13
+ Speed: Up to 5 Gb/s
14
+ Manufacturer: Example
15
+ Location ID: 0x00100000 / 1
16
+ Current Available (mA): 900
17
+ Current Required (mA): 224
18
+ Extra Operating Current (mA): 0
19
+ Media:
20
+ Flash Drive:
21
+ Capacity: 32.01 GB (32,010,928,128 bytes)
22
+ Removable Media: Yes
23
+ BSD Name: disk4
24
+ Logical Unit: 0
25
+ Partition Map Type: MBR (Master Boot Record)
26
+ USB Interface: 0
27
+ Volumes:
28
+ EXAMPLE:
29
+ Capacity: 32 GB (32,006,733,824 bytes)
30
+ Free: 31.99 GB (31,990,808,576 bytes)
31
+ Writable: Yes
32
+ File System: MS-DOS FAT32
33
+ BSD Name: disk4s1
34
+ Mount Point: /Volumes/EXAMPLE
35
+ Content: Windows_FAT_32
36
+
37
+ Flash Drive:
38
+
39
+ Product ID: 0x0002
40
+ Vendor ID: 0x0000
41
+ Version: 1.00
42
+ Serial Number: 0000000000000002
43
+ Speed: Up to 480 Mb/s
44
+ Manufacturer: Example
45
+ Location ID: 0x00200000 / 2
46
+ Media:
47
+ Flash Drive:
48
+ Capacity: 8 GB (8,004,304,896 bytes)
49
+ Removable Media: Yes
50
+ BSD Name: disk5
51
+ Volumes:
52
+ Example 2:
53
+ Capacity: 8 GB (8,000,110,592 bytes)
54
+ File System: ExFAT
55
+ BSD Name: disk5s1
56
+ Mount Point: /Volumes/Example 2
57
+ Content: Windows_NTFS
58
+
@@ -0,0 +1,50 @@
1
+ require_relative './helper'
2
+ require 'MacOS/VERSION'
3
+
4
+ describe 'macos.rb.gemspec' do
5
+ # Loaded and validated from the gem's own directory, as gem build does, so as neither depends on where the tests run.
6
+ let(:root){File.expand_path('..', __dir__)}
7
+ let(:spec){Dir.chdir(root){Gem::Specification.load('macos.rb.gemspec')}}
8
+
9
+ it "is a valid specification" do
10
+ _(Dir.chdir(root){spec.validate}).must_equal(true)
11
+ end
12
+
13
+ it "is named macos.rb" do
14
+ _(spec.name).must_equal('macos.rb')
15
+ end
16
+
17
+ it "does not pin a date" do
18
+ _(spec.date).must_equal(Gem::Specification.new.date)
19
+ end
20
+
21
+ it "takes its version from MacOS::VERSION" do
22
+ _(spec.version.to_s).must_equal(MacOS::VERSION)
23
+ end
24
+
25
+ it "declares its runtime dependencies" do
26
+ _(spec.runtime_dependencies.map(&:name).sort).must_equal(%w{CFPropertyList plist})
27
+ end
28
+
29
+ it "declares its development dependencies" do
30
+ _(spec.development_dependencies.map(&:name).sort).must_equal(%w{minitest minitest-mock rake})
31
+ end
32
+
33
+ it "ships the gemspec which names it, its Rakefile, and every library" do
34
+ _(spec.files).must_include('macos.rb.gemspec')
35
+ _(spec.files).must_include('Rakefile')
36
+ _(spec.files).must_include('lib/MacOS.rb')
37
+ _(spec.files).must_include('lib/Version.rb')
38
+ end
39
+
40
+ it "ships the tests with their fixtures" do
41
+ _(spec.files).must_include('test/helper.rb')
42
+ _(spec.files).must_include('test/fixtures/ifconfig-a.txt')
43
+ end
44
+
45
+ it "links the homepage and each metadata link to the repository" do
46
+ links = [spec.homepage] + spec.metadata.values
47
+ _(spec.metadata.keys.sort).must_equal(%w{bug_tracker_uri changelog_uri documentation_uri source_code_uri})
48
+ links.each{|link| _(link).must_match(%r{\Ahttps://github\.com/thoran/macos\.rb(/|\z)})}
49
+ end
50
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/spec'
3
+ require 'minitest/mock'
4
+
5
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
6
+
7
+ # What a command printed, captured with its MAC addresses, IP addresses and names made anonymous.
8
+ def fixture(name)
9
+ File.read(File.expand_path("fixtures/#{name}", __dir__))
10
+ end
11
+
12
+ # Runs the block with system stubbed on receiver, returning the commands it was given; each succeeds, setting $?.
13
+ def commands_run_by(receiver)
14
+ commands = []
15
+ succeed = ->(*command, **options){commands << command; Kernel.system('true')}
16
+ receiver.stub(:system, succeed){yield}
17
+ commands
18
+ end