Module: Macos::Artifacts::Apps
- Defined in:
- lib/macos/artifacts/apps.rb
Class Method Summary collapse
- .appInstallLocations ⇒ Object
- .applications ⇒ Object
- .installHistory ⇒ Object
- .packagesReceipts ⇒ Object
Class Method Details
.appInstallLocations ⇒ Object
74 75 76 77 78 79 80 81 82 |
# File 'lib/macos/artifacts/apps.rb', line 74 def self.appInstallLocations history = `mdfind "kMDItemKind == Application"`.split("\n") puts "Application Install Locations:" history.each do |item| if ! item.start_with?("/System") puts " #{item.strip}" end end end |
.applications ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/macos/artifacts/apps.rb', line 6 def self.applications $applicationsPath = "/Applications" $applicationsDirectory = Dir.entries("#{$applicationsPath}") puts "Applications Folder:" $applicationsDirectory.sort!.each do | filename | if ! filename.start_with?(".") if File.extname(filename) == ".app" plist = CFPropertyList::List.new(:file => "#{$applicationsPath}/#{filename}/Contents/Info.plist") data = CFPropertyList.native_types(plist.value) data.each do |k,v| if k == "CFBundleShortVersionString" puts " #{$applicationsPath}/#{filename}: #{v}" end end else if File.directory?("#{$applicationsPath}/#{filename}") puts " #{$applicationsPath}/#{filename}:" subpath = Dir.entries("#{$applicationsPath}/#{filename}") subpath.each do |subdirapp| if ! subdirapp.start_with?(".") if File.extname(subdirapp) == ".app" plist = CFPropertyList::List.new(:file => "#{$applicationsPath}/#{filename}/#{subdirapp}/Contents/Info.plist") data = CFPropertyList.native_types(plist.value) data.each do |k,v| if k == "CFBundleShortVersionString" puts " #{$applicationsPath}/#{filename}/#{subdirapp}: #{v}" end end end end end end end end end end |
.installHistory ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/macos/artifacts/apps.rb', line 53 def self.installHistory history = `system_profiler SPInstallHistoryDataType `.split("\n") history.shift history.shift puts "Application Install History:" history.each do |item| item = item.strip if ! item.empty? if item.start_with?(/^Version:/) puts " #{item}" elsif item.start_with?(/^Source:/) puts " #{item}" elsif item.start_with?(/^Install Date:/) puts " #{item}" else puts " #{item}" end end end end |
.packagesReceipts ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/macos/artifacts/apps.rb', line 43 def self.packagesReceipts pkgReceipts = `pkgutil --packages`.split("\n") pkgReceipts.sort! puts "Package Receipts: " pkgReceipts.each do |pkg| puts " #{pkg.strip}" end end |