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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 50fab311c5e4b448110d69d1c86392f6e5502cf865895ab3f7c753e07c53bab3
4
+ data.tar.gz: a897572e9f0c3afc517fb2d9b65387281d72895132a018f18d6a3b0e2ffe4194
5
+ SHA512:
6
+ metadata.gz: 5779e90ab10adb9d07bb35f82557b31d755a4da0ed72d5b0f508281582f382e44ce13534df664b540fb611724c8d3978f3cec5c742c815016c728daa197a7fdd
7
+ data.tar.gz: 6f028499e2a6c255c289d1e77dc6adaafcd1adea2bf00fd78fb28486a553fabb4dcc7cc1b1d18fec1df08ec0b02ed7c948c5b83aa78c5083e1d6e6387ff86963
data/CHANGELOG ADDED
@@ -0,0 +1,572 @@
1
+ # macos.rb/CHANGELOG
2
+
3
+ ## 20261107
4
+
5
+ 0.50.0: The first release as a gem: + gemspec, tests in place of each library's self-run section, README, TODO and ROADMAP.md.
6
+
7
+ 1. + macos.rb.gemspec: macos.rb, for Ruby 2.7 on, depending on CFPropertyList and plist.
8
+ 2. + Gemfile, Rakefile.
9
+ 3. + LICENSE: MIT, 2013 to 2026.
10
+ 4. + README.md, TODO, ROADMAP.md.
11
+ 5. + test/helper.rb, test/MacOS_test.rb, test/VERSION_test.rb, test/gemspec_test.rb, test/commands_test.rb for the command each library sends, and a test for each library under test/MacOS.
12
+ 6. + test/fixtures: the output each library reads, in the form airport, defaults, df, diskutil, dscl, ifconfig, networksetup, say and system_profiler give it, with every MAC address, IP address and name made anonymous.
13
+ 7. - the self-run section of lib/MacOS/Apple80211.rb, Applications.rb, Defaults.rb, Defaults/NSGlobalDomain/NSUserKeyEquivalents.rb, Dmg.rb, HardwarePort.rb, IfConfig.rb, Keychain.rb, SystemProfiler.rb, USBFlashDrive.rb, Users.rb and Voice.rb, the tests taking their place.
14
+ 8. ~ lib/MacOS/Apple80211.rb, Keychain.rb, USBFlashDrive.rb: The header's first line names the file, in place of #!/usr/bin/env ruby, which only the self-run section needed.
15
+ 9. ~ MacOS::VERSION: /0.49.11/0.50.0/
16
+
17
+ 0.49.11: ~ MacOS::Apple80211: Where airport -I gives nothing, as from macOS 14.4 on, the attributes come from system_profiler SPAirPortDataType.
18
+
19
+ 1. ~ MacOS::Apple80211.attributes: airport -I's, or where it gives none, the current network's from system_profiler SPAirPortDataType, with its Channel and Security as channel and link auth too, and its name as SSID where macOS doesn't redact it.
20
+ 2. + MacOS::Apple80211.system_profiler_airport
21
+ 3. + MacOS::Apple80211.airport_attributes, private: airport -I's attributes, as .attributes read them before, less the WARNING line printed in their place from macOS 14.4 on.
22
+ 4. + MacOS::Apple80211.system_profiler_attributes, private.
23
+ 5. ~ MacOS::Apple80211.airport_i: '' where airport isn't there, rather than an Errno::ENOENT.
24
+ 6. ~ MacOS::VERSION: /0.49.10/0.49.11/
25
+
26
+ 0.49.10: ~ lib/MacOS/VPN.rb: The header's second line names MacOS::VPN, rather than repeating the file's name.
27
+
28
+ 1. ~ lib/MacOS/VPN.rb: /# MacOS\/VPN.rb/# MacOS::VPN/ in the header's second line.
29
+ 2. ~ MacOS::VERSION: /0.49.9/0.49.10/
30
+
31
+ 0.49.9: ~ MacOS::DiskUtil.free_bytes_for_device_id, .free_bytes_for_volume_name: The bytes available, as an Integer, rather than the 512-byte blocks used, as a String.
32
+
33
+ 1. ~ MacOS::DiskUtil.free_bytes_for_device_id, .free_bytes_for_volume_name: `df -k`, in place of `df`, and its Available column times 1024, in place of its Used column.
34
+ 2. ~ MacOS::VERSION: /0.49.8/0.49.9/
35
+
36
+ 0.49.8: + require 'yaml' in MacOS::Defaults::ComAppleDock and MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents, and require 'set' in the latter, so as each works loaded on its own.
37
+
38
+ 1. ~ lib/MacOS/Defaults/ComAppleDock.rb: + require 'yaml'. Loaded without lib/MacOS/Defaults.rb, ComAppleDock.to_yaml raised a NameError.
39
+ 2. ~ lib/MacOS/Defaults/NSGlobalDomain/NSUserKeyEquivalents.rb: + require 'set', 'yaml'. Loaded on its own, NSUserKeyEquivalents.to_yaml raised a NameError, and .read_keys did on Rubies before 3.2.
40
+ 3. ~ MacOS::VERSION: /0.49.7/0.49.8/
41
+
42
+ 0.49.7: ~ MacOS::SystemProfiler: Its aliases work on the module, and boot_mode gives the boot mode rather than the boot volume.
43
+
44
+ 1. ~ MacOS::SystemProfiler: + module_function for every alias, from boot_volume_string to time_since_boot. alias_method makes instance methods alone, so MacOS::SystemProfiler.computer_name and the rest raised a NoMethodError.
45
+ 2. ~ MacOS::SystemProfiler.boot_mode, .boot_mode_string: Aliases of boot_mode_data, in place of boot_volume_data.
46
+ 3. ~ MacOS::VERSION: /0.49.6/0.49.7/
47
+
48
+ 0.49.6: ~ MacOS::Keychain.wifi_password: nil where the keychain has no password for the network, rather than a NoMethodError.
49
+
50
+ 1. ~ MacOS::Keychain.wifi_password: stderr[/password: "(.+)"/, 1], in place of stderr.match(/password: "(.+)"/)[1], which called [] on nil when nothing matched.
51
+ 2. ~ MacOS::VERSION: /0.49.5/0.49.6/
52
+
53
+ 0.49.5: ~ MacOS::LaunchControl: An instance holds the plist it's made with, and unloads it.
54
+
55
+ 1. ~ MacOS::LaunchControl#initialize: /init/initialize/. As init, new(path_to_plist) raised an ArgumentError and new left the path unset.
56
+ 2. ~ MacOS::LaunchControl#unload: path_to_plist defaults to the instance's own, as #load uses.
57
+ 3. ~ MacOS::LaunchControl.load, .unload: The plist's path escaped for the shell, so as a path with a space in it is one argument; + require 'shellwords'.
58
+ 4. ~ MacOS::VERSION: /0.49.4/0.49.5/
59
+
60
+ 0.49.4: ~ MacOS::Defaults: Every domain, rather than one; a Defaults for each, rather than an ArgumentError; and from_yaml writes what to_yaml wrote.
61
+
62
+ 1. ~ MacOS::Defaults.domains: `defaults domains`.chomp.split(', '), in place of .split('\n'), which split on a backslash and an n. defaults domains gives every domain on one line, separated by commas.
63
+ 2. ~ MacOS::Defaults.all, .bulk_export_to_plist_files, .bulk_import_from_plist_files, .from_yaml: new(domain: domain), in place of new(domain), initialize taking domain: only.
64
+ 3. ~ MacOS::Defaults.from_yaml: DEFAULT_YAML_FILENAME, in place of DEFAULT_YAML_FILE, which isn't defined.
65
+ 4. ~ MacOS::Defaults#from_yaml: + attributes, the list of single key: value pairs to_yaml writes for the domain, each written with defaults write; true where every write succeeds. It read an attributes it was never given.
66
+ 5. ~ MacOS::Defaults.from_yaml: Each domain's attributes passed on to #from_yaml.
67
+ 6. + MacOS::Defaults#defaults_arguments, private: a value as defaults write takes it, with -bool, -int, -float, -array, -dict or -string as its type.
68
+ 7. ~ MacOS::VERSION: /0.49.3/0.49.4/
69
+
70
+ 0.49.3: Core Ruby in place of the extension libraries other than Version, each of which patched a core class of any program loading macos.rb.
71
+
72
+ 1. ~ MacOS::Applications.start: system('open', path, exception: true), in place of Kernel.run.
73
+ 2. ~ MacOS::Applications: alias_method for launch, open and run, in place of alias_methods; - require 'Kernel/run', 'Module/alias_methods'.
74
+ 3. ~ MacOS::Dmg: alias_method for filename, dmg_filename and image_name, and their writers, in place of alias_methods; - require 'Array/all_but_last', which nothing used, and 'Module/alias_methods'.
75
+ 4. ~ MacOS::HardwarePort.parse: line.match(...)&.captures, in place of line.captures(...); - require 'Thoran/String/Captures/captures'.
76
+ 5. ~ MacOS::IfConfig.parse: line[..., 1] and line.match(...)&.captures, in place of line.capture and line.captures.
77
+ 6. ~ MacOS::IfConfig.all_matching: Regexp.union(pattern), in place of pattern.to_regexp; a String is still matched literally.
78
+ 7. ~ MacOS::IfConfig.bring_down_interface, .destroy_interface: system(..., exception: true), in place of run.
79
+ 8. ~ lib/MacOS/IfConfig.rb: - require 'Kernel/run', 'Regexp/to_regexp', 'String/to_regexp', 'Thoran/String/Capture/capture', 'Thoran/String/Captures/captures'.
80
+ 9. ~ MacOS::SystemProfiler: + .field, private, giving a field's value with system_profiler_output[/<name>: (?<value>.+)$/, :value], in place of grep and split in each of the nine; split[1] and split[3], in place of second and fourth; - require 'Ordinal/Array', 'String/grep'.
81
+ 10. ~ MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents.read_keys: plist_dict.lines.grep(/=/), in place of String#grep; - require 'String/grep'.
82
+ 11. - lib/Kernel/run.rb: Kernel#run 0.3.1
83
+ 12. - lib/Regexp/to_regexp.rb: Regexp#to_regexp 0.0.0
84
+ 13. - lib/String/grep.rb: String#grep 0.2.0
85
+ 14. - lib/String/to_regexp.rb: String#to_regexp 0.3.0
86
+ 15. - lib/Thoran/String/Captures/captures.rb: Thoran::String::Captures#captures 0.3.0
87
+ 16. ~ MacOS::VERSION: /0.49.2/0.49.3/
88
+
89
+ 0.49.2: ~ MacOS::USBFlashDrive.all_mount_points: Every mount point, rather than the first.
90
+
91
+ 1. ~ MacOS::USBFlashDrive.all_mount_points: stdout.scan(/Mount Point: (.+)$/).flatten, in place of stdout.captures(/Mount Point: (.+)$/), which gives the groups of the first match only.
92
+ 2. ~ lib/MacOS/USBFlashDrive.rb: - require 'Thoran/String/Captures/captures', which nothing in it uses now.
93
+ 3. ~ MacOS::VERSION: /0.49.1/0.49.2/
94
+
95
+ 0.49.1: ~ MacOS::IfConfig.parse: Each call starts afresh, and reads its lines with or without a trailing space; MacOS::IfConfig.output is private again.
96
+
97
+ 1. ~ MacOS::IfConfig.parse: ifconfigs and ifconfig are locals, in place of @ifconfigs and @ifconfig on the class. @ifconfig was never reset, so every call after the first began with the previous call's last interface, and returned it twice.
98
+ 2. ~ MacOS::IfConfig.parse: - the unused local interface.
99
+ 3. ~ MacOS::IfConfig.parse: Output with no interfaces gives [], rather than [nil].
100
+ 4. ~ MacOS::IfConfig.parse: / *ether (.+?) ?$/, in place of / *ether (.+) $/. ifconfig no longer ends these lines with a space, so no interface had a MAC address.
101
+ 5. ~ MacOS::IfConfig.parse: / *inet (\d+(?:\.\d+){3}) netmask (.+?) ?$/, in place of one ending (.+) $/. Nor does it end an inet line without a broadcast address with one, so loopback had no IPv4 address.
102
+ 6. ~ MacOS::IfConfig.output: private, as it was until IfConfig 0.6.1 commented the line out.
103
+ 7. ~ MacOS::VERSION: /0.49.0/0.49.1/
104
+
105
+ 0.49.0: + lib/MacOS/VERSION.rb; - each file's own date, version and changes from its header; + CHANGELOG.
106
+
107
+ 1. + lib/MacOS/VERSION.rb: MacOS::VERSION, the library's version.
108
+ 2. ~ lib/MacOS.rb: + require 'MacOS/VERSION'
109
+ 3. ~ lib/MacOS.rb and every file under lib/MacOS: - the date and version lines and the changes noted since the last version, the library's version and the CHANGELOG taking their place.
110
+ 4. + CHANGELOG: an entry for every version from 0.0.0, each what its commit says.
111
+
112
+ 0.48.0: MacOS 0.1.0: Require every library; + MacOS.version, in place of lib/MacOS/Version.rb.
113
+
114
+ 1. + require 'MacOS/Apple80211', 'MacOS/Applications', 'MacOS/Defaults/ComAppleDock', 'MacOS/Defaults/NSGlobalDomain/NSUserKeyEquivalents', 'MacOS/DiskUtil', 'MacOS/Keychain', 'MacOS/USBFlashDrive', 'MacOS/Users', 'MacOS/Voice' and 'MacOS/VPN'.
115
+ 2. - require 'MacOS/Version'
116
+ 3. + MacOS.version, taken from lib/MacOS/Version.rb 0.1.0.
117
+ 4. - lib/MacOS/Version.rb, and with it MacOS::VERSION::STRING, which MacOS.version.to_s gives.
118
+
119
+ 0.47.2: /module Defaults/class Defaults/ for ComAppleDock and NSUserKeyEquivalents, so as they load beside MacOS::Defaults, which is a class.
120
+
121
+ 1. ~ MacOS::Defaults::ComAppleDock 0.5.3: /module Defaults/class Defaults/
122
+ 2. ~ MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents 0.2.1: /module Defaults/class Defaults/
123
+
124
+ 0.47.1: MacOS::Voice 0.0.1: Quote say's ?; read names with spaces in them whole; - the newline at the end of each description.
125
+
126
+ 1. ~ all(): say -v '?', the shell otherwise matching ? against one-character filenames.
127
+ 2. ~ new_from_line(): A name with spaces in it, as Bad News, is read whole, rather than its first word being taken as the name and its second as the localisation.
128
+ 3. ~ new_from_line(): - the newline at the end of the description.
129
+
130
+ 0.47.0: MacOS::Voice 0.0.0: + MacOS::Voice: the voices say knows, each with its name, localisation and description, and a random one, taken from Kernel/say.rb 0.4.2.
131
+
132
+ 1. ~ lib/Kernel/run.rb: Kernel#run /0.3.0/0.3.1/
133
+
134
+
135
+ ## 20260605
136
+
137
+ 0.46.0: MacOS::Applications 0.0.0: + MacOS::Applications: finding installed .app bundles across the system, local and user domains, as which does for executables.
138
+
139
+ 0.45.0: MacOS::Users 0.0.0: + MacOS::Users: the real user accounts, without the system and service ones.
140
+
141
+ 1. - lib/Array/extract_optionsX.rb: Array#extract_options! 0.2.0
142
+ 2. ~ lib/Kernel/run.rb: Kernel#run /0.1.5/0.3.0/
143
+ 3. - lib/Thoran/Array/ExtractOptionsX/extract_optionsX.rb: Thoran::Array::ExtractOptions#extract_options! 0.2.0
144
+
145
+
146
+ ## 20260125
147
+
148
+ 0.44.0: MacOS::IfConfig 0.7.0: Virtual and tunnel interfaces (utun and the like), bringing interfaces down and destroying them, and finding interfaces by pattern.
149
+
150
+ 1. + require 'Kernel/run'
151
+ 2. + require 'Regexp/to_regexp'
152
+ 3. + require 'String/to_regexp'
153
+ 4. ~ parse(): Parse flags from interface header line to support virtual interfaces.
154
+ 5. + alias_method :all_interfaces, :parse
155
+ 6. + all_matching(pattern): Find all interfaces matching a pattern.
156
+ 7. + bring_down_interface(interface_name): Bring down a specific interface.
157
+ 8. + bring_down_matching_interfaces(pattern): Bring down all interfaces matching a pattern.
158
+ 9. + destroy_interface(interface_name): Destroy a specific interface.
159
+ 10. + attr_accessor :flags
160
+ 11. ~ initialize(): Add flags parameter.
161
+ 12. ~ up?(): Check both physical (status-based) and virtual (flags-based) interfaces.
162
+ 13. + virtual?(): Detect if interface is virtual/tunnel interface.
163
+ 14. + lib/Array/extract_optionsX.rb: Array#extract_options! 0.2.0
164
+ 15. + lib/Kernel/run.rb: Kernel#run 0.1.5
165
+ 16. + lib/Regexp/to_regexp.rb: Regexp#to_regexp 0.0.0
166
+ 17. + lib/String/to_regexp.rb: String#to_regexp 0.3.0
167
+ 18. + lib/Thoran/Array/ExtractOptionsX/extract_optionsX.rb: Thoran::Array::ExtractOptions#extract_options! 0.2.0
168
+
169
+
170
+ ## 20250925
171
+
172
+ 0.43.0: MacOS::VPN 0.0.0: + MacOS::VPN.up?, taken from mercurial 0.4.3.
173
+
174
+
175
+ ## 20250506
176
+
177
+ 0.42.0: MacOS::Dmg 0.8.0: Explicitly specify the mount point or fallback to using the disk image name (sans '.pkg') if the mount point isn't specified, rather than assume that it will be the same as the package name.
178
+
179
+ 1. Switch to using named arguments in a number of places.
180
+ 2. + #mount_point(): Previously the package name was assumed, but that's not always true.
181
+ 3. + self.full_path_to_mount_point()
182
+ 4. - #path_to_dmg=(): Replaced with `attr_accessor :path_to_dmg`.
183
+ 5. - #package(): Not necessary and replaced with `attr_accessor :package` also.
184
+ 6. ~ self.run_installer(): Pass in mount point instead and use named arguments.
185
+ 7. ~ self.unmount(): Properly use the mount_point argument.
186
+
187
+
188
+ ## 20250419
189
+
190
+ 0.41.3: MacOS::IfConfig 0.6.1: ~ MacOS::Ifconfig.parse: Rework the regex for the '-->' case.
191
+
192
+
193
+ ## 20250212
194
+
195
+ 0.41.2: MacOS::Defaults::ComAppleDock 0.5.2: ~ read()
196
+
197
+ 0.41.1: MacOS::Defaults::ComAppleDock 0.5.1: + boolean_to_yes_no()
198
+
199
+ 1. + boolean_to_yes_no()
200
+ 2. ~ peristent_app_paths(), ~ read(), ~ to_yaml()
201
+
202
+ 0.41.0: MacOS::Defaults::ComAppleDock 0.5.0: Reading the Dock's persistent apps back, and writing them as YAML.
203
+
204
+ 1. + peristent_app_paths(), + read(), + to_yaml()
205
+
206
+
207
+ ## 20250211
208
+
209
+ 0.40.0: MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents 0.2.0: Reading the shortcuts back, and writing them as YAML.
210
+
211
+ 1. + load(), + read_keys(), + parse_key_code(), + to_yaml()
212
+ 2. ~ key_code()
213
+
214
+ 0.39.0: MacOS::Defaults::ComAppleDock 0.4.0: One writer for general and boolean attributes alike.
215
+
216
+ 1. - general_attribute_write_command_string(), - boolean_attribute_write_command_string(), - load_general_attribute(), - load_boolean_attribute()
217
+ 2. + attribute_write_command(), + load_attribute()
218
+ 3. ~ load()
219
+ 4. - lib/FalseClass/to_boolean.rb: FalseClass#to_boolean 0.0.0
220
+ 5. - lib/Integer/to_boolean.rb: Integer#to_boolean 0.0.0
221
+ 6. - lib/NilClass/to_boolean.rb: NilClass#to_boolean 0.0.0
222
+ 7. - lib/String/to_boolean.rb: String#to_boolean 0.9.0
223
+ 8. - lib/TrueClass/to_boolean.rb: TrueClass#to_boolean 0.0.0
224
+ 9. - lib/_meta/to_boolean.rb: _meta/to_boolean 0.0.0
225
+
226
+ 0.38.0: MacOS::Defaults::ComAppleDock 0.3.0: Persistent apps rather than items, and general and boolean attributes apart.
227
+
228
+ 1. - item_plist(), - urlified_item_string(), - defaults_write_command(), - add_item(), - load_items(), - delete_items()
229
+ 2. + app_plist_data(), + urlified_app_string(), + persistent_app_write_command(), + add_persistent_app(), + load_persistent_apps()
230
+ 3. + delete_item()
231
+ 4. - attribute_command_string(), - load_attribute(), - load_attributes()
232
+ 5. + general_attribute_write_command_string(), + boolean_attribute_write_command_string(), + load_general_attribute(), + load_boolean_attribute()
233
+ 6. ~ delete_all_items(), ~ load()
234
+ 7. + lib/FalseClass/to_boolean.rb: FalseClass#to_boolean 0.0.0
235
+ 8. + lib/Integer/to_boolean.rb: Integer#to_boolean 0.0.0
236
+ 9. + lib/NilClass/to_boolean.rb: NilClass#to_boolean 0.0.0
237
+ 10. + lib/String/to_boolean.rb: String#to_boolean 0.9.0
238
+ 11. + lib/TrueClass/to_boolean.rb: TrueClass#to_boolean 0.0.0
239
+ 12. + lib/_meta/to_boolean.rb: _meta/to_boolean 0.0.0
240
+
241
+ 0.37.0: MacOS::Defaults::ComAppleDock 0.2.0: Adding, loading and deleting items, and loading the Dock's attributes.
242
+
243
+ 1. - write_item(), - write_items(), - delete()
244
+ 2. + add_item(), + load_items(), + delete_items()
245
+ 3. + attribute_command_string(), + load_attribute(), + load_attributes(), + load()
246
+ 4. ~ delete_all_items()
247
+
248
+
249
+ ## 20250210
250
+
251
+ 0.36.0: MacOS::Defaults::ComAppleDock 0.1.0: Items rather than dock items, and deleting them.
252
+
253
+ 1. - dock_item(), - urlified_dock_item_string(), - write_dock_item(), - write_dock_items()
254
+ 2. + item_plist(), + urlified_item_string(), + write_item(), + write_items()
255
+ 3. + delete(), + delete_all_items()
256
+ 4. ~ defaults_write_command()
257
+
258
+ 0.35.0: MacOS::Defaults::ComAppleDock 0.0.0: + MacOS::Defaults::ComAppleDock: the Dock's items.
259
+
260
+ 0.34.0: MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents 0.1.0: ~ key_code()
261
+
262
+ 0.33.0: MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents 0.0.0: + MacOS::Defaults::NSGlobalDomain::NSUserKeyEquivalents: the keyboard shortcuts set for menu items.
263
+
264
+
265
+ ## 20240113
266
+
267
+ 0.32.0: MacOS::DiskUtil 0.0.0: + MacOS::DiskUtil: volumes and their partitions, from diskutil's plist output.
268
+
269
+
270
+ ## 20230212
271
+
272
+ 0.31.0: MacOS::Dmg 0.7.0: ~ self.unmount(): Rather than assume the path or the name of the package, specify the mount point to unmount.
273
+
274
+ 1. ~ lib/Ordinal.rb, lib/Ordinal/Array.rb: Ordinal /0.2.0/0.2.1/
275
+ 2. ~ lib/Version.rb: Version /0.13.1/0.14.0/
276
+
277
+
278
+ ## 20210301
279
+
280
+ 0.30.0: MacOS::USBFlashDrive 0.0.0: + MacOS::USBFlashDrive: the mount points of USB flash drives, from system_profiler.
281
+
282
+
283
+ ## 20210220
284
+
285
+ 0.29.1: MacOS::Keychain 0.1.1: Shellwords for the key given to security.
286
+
287
+ 1. + require 'shellwords'
288
+ 2. ~ find_generic_password_command()
289
+
290
+
291
+ ## 20210212
292
+
293
+ 0.29.0: MacOS::Keychain 0.1.0: Open3 rather than backticks, security writing the password to standard error.
294
+
295
+ 1. + require 'open3'
296
+ 2. + find_generic_password_command()
297
+ 3. ~ find_generic_password()
298
+ 4. ~ wifi_password()
299
+
300
+
301
+ ## 20201218, 20210206
302
+
303
+ 0.28.0: MacOS::Keychain 0.0.0: + MacOS::Keychain: generic passwords, and a Wi-Fi network's password.
304
+
305
+
306
+ ## 20210206
307
+
308
+ 0.27.0: MacOS::Apple80211 0.0.0: + MacOS::Apple80211: the Wi-Fi connection's attributes, among them its channel, SSID and link auth.
309
+
310
+ 1. - lib/String/each.rb: String#each 0.1.0
311
+ 2. ~ lib/String/grep.rb: String#grep /0.1.1/0.2.0/
312
+
313
+
314
+ ## 20200429
315
+
316
+ 0.26.0: MacOS::IfConfig 0.6.0: Finders by interface, MAC address and IPv4 address.
317
+
318
+ 1. + MacOS::Ifconfig.find_by_interface
319
+ 2. + MacOS::Ifconfig.find_by_mac_address
320
+ 3. + MacOS::Ifconfig.find_by_ipv4_address
321
+
322
+
323
+ ## 20200428
324
+
325
+ 0.25.1: MacOS::IfConfig 0.5.1: ~ MacOS::IfConfig.parse, so as it correctly handles the last interface.
326
+
327
+ 0.25.0: MacOS::IfConfig 0.5.0: VPN tunnels, and interfaces by status: active, inactive and up.
328
+
329
+ 1. ~ MacOS::IfConfig.parse, so as it can handle VPN tunnels.
330
+ 2. ~ MacOS::IfConfig.parse, so that it now loads an instance with the value of the status field.
331
+ 3. + MacOS::IfConfig.inactive_interfaces
332
+ 4. + MacOS::IfConfig.inactive_interfaces_names
333
+ 5. + MacOS::IfConfig.up_interfaces
334
+ 6. + MacOS::IfConfig.up_interfaces_names
335
+ 7. /MacOS::IfConfig @active/MacOS::IfConfig @status/
336
+ 8. + MacOS::IfConfig#status
337
+ 9. ~ MacOS::IfConfig#active?, so as to make use of @status
338
+ 10. + MacOS::IfConfig#inactive?
339
+ 11. + MacOS::IfConfig#up?
340
+
341
+ 0.24.0: MacOS::IfConfig 0.4.0: Aligned MacOS::IfConfig more closely with MacOS::HardwarePort.
342
+
343
+ 1. ~ MacOS::IfConfig#parse --> MacOS::IfConfig.parse
344
+ 2. ~ MacOS::IfConfig#interfaces --> MacOS::IfConfig.interfaces && now returns the same as parse.
345
+ 3. ~ MacOS::IfConfig#output --> MacOS::IfConfig.output
346
+ 4. ~ MacOS::IfConfig#active_interfaces --> MacOS::IfConfig.active_interfaces
347
+ 5. + MacOS::IfConfig.interface_names (formerly MacOS::IfConfig#interfaces)
348
+ 6. + MacOS::IfConfig.active_interfaces_names
349
+ 7. + MacOS::IfConfig.mac_addresses
350
+ 8. + MacOS::IfConfig.ipv4_addresses
351
+ 9. + require 'Thoran/String/Capture/capture', so as to support the increased complexity in MacOS::IfConfig.parse.
352
+
353
+
354
+ ## 20191120, 21
355
+
356
+ 0.23.1: MacOS::IfConfig 0.3.1: /new()/initialize()/, a constructor which had been defining new.
357
+
358
+ 1. /new()/initialize()/ (Really!? I did that!?)
359
+ 2. Changed the self-run block to use p instead of pp.
360
+
361
+
362
+ ## 20190901
363
+
364
+ 0.23.0: MacOS 0.0.0: + lib/MacOS.rb, requiring the MacOS libraries.
365
+
366
+
367
+ ## 20190831
368
+
369
+ 0.22.0: MacOS::SystemProfiler 0.3.0: The rest of the software overview: kernel, boot volume and mode, computer and user name, secure virtual memory, system integrity protection and time since boot.
370
+
371
+ 1. + system_profiler_output(), + system_version_data(), + system_version_string()
372
+ 2. + kernel_version_data(), + kernel_name(), + kernel_version_string(), + kernel_version()
373
+ 3. + boot_volume_data(), + boot_mode_data(), + computer_name_data(), + username_data()
374
+ 4. + secure_virtual_memory_data(), + system_integrity_protection_data(), + time_since_boot_data()
375
+ 5. ~ system_version()
376
+
377
+ 0.21.0: MacOS.version 0.1.0: MacOS::VERSION::STRING, the parts being left to the Version.
378
+
379
+ 1. - major_version(), - minor_version(), - tiny_version()
380
+ 2. ~ version()
381
+ 3. + MacOS::VERSION::STRING
382
+
383
+ 0.20.0: MacOS.version 0.0.0: + MacOS.version, and its major, minor and tiny parts.
384
+
385
+ 0.19.0: MacOS::SystemProfiler 0.2.0: A Version rather than a string.
386
+
387
+ 1. + require 'Version'
388
+ 2. ~ system_version()
389
+ 3. ~ major_system_version()
390
+ 4. ~ minor_system_version()
391
+ 5. ~ tiny_system_version()
392
+ 6. + lib/Thoran/String/Capture/capture.rb: Thoran::String::Capture#capture 0.3.1
393
+ 7. + lib/Version.rb: Version 0.13.1
394
+
395
+ 0.18.0: MacOS::SystemProfiler 0.1.0: + MacOS::SystemProfiler, taken from Platform's Platform::OS::OSX::SystemProfiler, reading the version of MacOS 10.14 as well as of OSX 10.4 to 10.9.
396
+
397
+ 1. + lib/Ordinal.rb, lib/Ordinal/Array.rb: Ordinal 0.2.0
398
+ 2. + lib/String/each.rb: String#each 0.1.0
399
+ 3. + lib/String/grep.rb: String#grep 0.1.1
400
+
401
+
402
+ ## 20190829
403
+
404
+ 0.17.1: MacOS::HardwarePort 0.3.1: Finding by interface rather than by device.
405
+
406
+ 1. /MacOS::HardwarePort.find_by_device/MacOS::HardwarePort.find_by_interface/
407
+ 2. + alias_method :find_by_device, :find_by_interface
408
+ 3. + MacOS::HardwarePort#interface
409
+ 4. + alias_method :find_by_hardware_port, :find_by_name
410
+
411
+
412
+ ## 20190828
413
+
414
+ 0.17.0: MacOS::HardwarePort 0.3.0: One entry per hardware port, finders by name and by Ethernet address, and #mac_address.
415
+
416
+ 1. /Hardware/HardwarePort at the top of the file.
417
+ 2. /new()/initialize()/ (Really!? I did that!? Twice!)
418
+ 3. ~ MacOS::HardwarePort.parse, so that it only puts in one entry per hardware port.
419
+ 4. - all()
420
+ 5. + alias_method :all, :parse
421
+ 6. + alias_method :hardware_ports, :parse
422
+ 7. + alias_method :ports, :parse
423
+ 8. + MacOS::HardwarePort.find_by_name
424
+ 9. + MacOS::HardwarePort.find_by_ethernet_address
425
+ 10. + MacOS::HardwarePort#mac_address
426
+
427
+ 0.16.0: /OSX/MacOS/ for HardwarePort, IfConfig, Dmg, Defaults and LaunchControl.
428
+
429
+ 1. ~ MacOS::HardwarePort 0.2.0: /OSX/MacOS/
430
+ 2. ~ MacOS::IfConfig 0.3.0: /OSX/MacOS/
431
+ 3. ~ MacOS::Dmg 0.6.0: /OSX/MacOS/
432
+ 4. ~ MacOS::Defaults 0.4.0: /OSX/MacOS/
433
+ 5. ~ MacOS::LaunchControl 0.1.0: /OSX/MacOS/
434
+
435
+
436
+ ## 20190321
437
+
438
+ 0.15.1: OSX::Defaults 0.3.1: + from_yaml()
439
+
440
+ 1. + from_yaml()
441
+ 2. ~ to_yaml()
442
+
443
+
444
+ ## 20181023
445
+
446
+ 0.15.0: OSX::Defaults 0.3.0: ~ to_yaml()
447
+
448
+ 0.14.0: OSX::Defaults 0.2.0: + to_yaml()
449
+
450
+ 0.13.0: OSX::Defaults 0.1.0: Exporting and importing one domain, beside all of them.
451
+
452
+ 1. + export()
453
+ 2. + import()
454
+ 3. + domain_valid?()
455
+ 4. + global_domain?()
456
+ 5. ~ domains()
457
+ 6. ~ bulk_export_to_plist_files()
458
+ 7. ~ bulk_import_from_plist_files()
459
+ 8. ~ to_h()
460
+
461
+ 0.12.0: OSX::Defaults 0.0.0: + OSX::Defaults: the defaults domains, exported to and imported from plist files in bulk.
462
+
463
+ 1. - lib/Array/lastX.rb: Array#lastX 20060630
464
+ 2. ~ lib/Module/alias_methods.rb: Module#alias_methods /0.0.0/0.1.0/
465
+ 3. + lib/Thoran/Array/AllButLast/all_but_last.rb: Thoran::Array::AllButLast#all_but_last 0.1.0
466
+ 4. + lib/Thoran/Array/LastX/lastX.rb: Thoran::Array::LastX#last! 0.2.3
467
+ 5. + lib/Thoran/Module/AliasMethods/alias_methods.rb: Thoran::Module::AliasMethods#alias_methods 0.1.0
468
+
469
+
470
+ ## 20180209
471
+
472
+ 0.11.0: OSX::IfConfig 0.2.0: + OSX namespace, under the assumption that the output of ifconfig on OSX is different from other operating systems.
473
+
474
+ 0.10.0: IfConfig 0.1.0: String#captures required from the Thoran namespace.
475
+
476
+ 1. - require 'String/captures'
477
+ 2. + require 'Thoran/String/Captures/captures'
478
+ 3. - lib/String/captures.rb: String#captures 0.0.0
479
+
480
+ 0.9.2: OSX::Dmg 0.5.2: Moved Dmg.rb into the newly created OSX directory.
481
+
482
+ 0.9.1: OSX::HardwarePort 0.1.1: String#captures required from the Thoran namespace.
483
+
484
+ 1. - require 'String/captures'
485
+ 2. + require 'Thoran/String/Captures/captures'
486
+ 3. + lib/Thoran/String/Captures/captures.rb: Thoran::String::Captures#captures 0.3.0
487
+
488
+
489
+ ## 20161227
490
+
491
+ 0.9.0: OSX::HardwarePort 0.1.0: + name()
492
+
493
+ 0.8.1: OSX::HardwarePort 0.0.1: ~ parse(): An empty last line ends a port as a blank line does.
494
+
495
+ 0.8.0: OSX::HardwarePort 0.0.0: + OSX::HardwarePort: the hardware ports networksetup lists, each with its device and Ethernet address.
496
+
497
+ 0.7.0: IfConfig 0.0.0: + IfConfig: the interfaces ifconfig lists, and which of them are active.
498
+
499
+ 1. + lib/String/captures.rb: String#captures 0.0.0
500
+
501
+
502
+ ## 20140408
503
+
504
+ 0.6.1: OSX::Dmg 0.5.1: ~ path_to_dmg(), because it had a copy/paste error: /path_to_dmg/image_name/.
505
+
506
+
507
+ ## 20130624
508
+
509
+ 0.6.0: OSX::LaunchControl 0.0.0: + OSX::LaunchControl: loading and unloading launchd plists.
510
+
511
+
512
+ ## 20130623, 24
513
+
514
+ 0.5.0: OSX::Dmg 0.5.0: Aliases: attach, detach and filename.
515
+
516
+ 1. + alias_method :attach, :mount.
517
+ 2. + alias_method :detach, :unmount.
518
+ 3. + alias_method :filename, :path_to_dmg.
519
+ 4. + alias_method :filename=, :path_to_dmg=.
520
+
521
+ 0.4.0: OSX::Dmg 0.4.0: OSX::Dmg.install mounts, installs and unmounts in one go.
522
+
523
+ 1. + OSX::Dmg.install.
524
+ 2. + OSX::Dmg#run_installer, so as it does what OSX::Dmg#install used to do.
525
+ 3. ~ OSX::Dmg.install, so as it now mounts, installs, and ummounts.
526
+ 4. /dismount/unmount/.
527
+
528
+
529
+ ## 20130622
530
+
531
+ 0.3.0: OSX::Dmg 0.3.0: A path to the disk image rather than a URL.
532
+
533
+ 1. ~ OSX::Dmg#initialize, so as to remove url and to add path_to_dmg.
534
+ 2. require 'Array/extract_optionsX'.
535
+ 3. - OSX::Dmg#url, since something to handle disk images shouldn't know anything about URLs probably...
536
+ 4. ~ OSX::Dmg.mount: /disk_image_name/path_to_dmg/.
537
+ 5. ~ OSX::Dmg.install, so as the pkg_name argument can be optional, since on many occasions it can be derived happily from adding '.pkg' to the package name.
538
+ 6. ~ OSX::Dmg.install, so as the pwd is returned to the starting working directory.
539
+ 7. + OSX::Dmg#path_to_dmg (and aliases).
540
+ 8. + OSX::Dmg#path_to_dmg= (and aliases).
541
+ 9. - lib/Array/extract_optionsX.rb: Array#extract_optionsX 0.1.0
542
+ 10. + lib/Module/alias_methods.rb: Module#alias_methods 0.0.0
543
+
544
+ 0.2.0: OSX::Dmg 0.2.0: Instances which mount, install and dismount, the class methods renamed to match.
545
+
546
+ 1. + attr_accessor :verbose in class-level.
547
+ 2. ~ initialize, so that it actually does something!
548
+ 3. + OSX::Dmg#mount.
549
+ 4. + OSX::Dmg#install.
550
+ 5. + OSX::Dmg#dismount.
551
+ 6. + working self-run section.
552
+ 7. /mount_disk_image/mount/.
553
+ 8. /run_installer/install/.
554
+ 9. /dismount_disk_image/dismount/.
555
+ 10. ~ OSX::Dmg#image_name, so as it makes use of directly set values via options rather than derived from the url.
556
+ 11. ~ OSX::Dmg#package, so as it makes use of directly set values via options rather than derived from the url.
557
+ 12. ~ OSX::Dmg#pkg_name, so as it makes use of directly set values via options rather than derived from the url.
558
+
559
+
560
+ ## 20130603, 22
561
+
562
+ 0.1.0: OSX::Dmg 0.1.0: Shellwords for what is passed to the shell.
563
+
564
+ 1. + require 'shellwords'
565
+ 2. ~ OSX?::Dmg.mount_disk_image, so as to make use of Shellwords.
566
+ 3. ~ OSX?::Dmg.run_installer, so as to make use of Shellwords.
567
+ 4. ~ OSX?::Dmg.dismount_disk_image, so as to make use of Shellwords.
568
+ 5. + lib/Array/all_but_last.rb: Array#all_but_last 0.1.0
569
+ 6. + lib/Array/extract_optionsX.rb: Array#extract_optionsX 0.1.0
570
+ 7. + lib/Array/lastX.rb: Array#lastX 20060630
571
+
572
+ 0.0.0: OSX::Dmg 0.0.0: + OSX::Dmg: mounting a disk image, running the installer in it, and dismounting it.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2013-2026 thoran
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.