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
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/appcask/local_app.rb', line 14
def fetch_all
puts "\nFetching local app icons..."
puts "Source: #{APPS_DIR}"
puts "Output: #{OUTPUT_BASE}\n\n"
FileUtils.mkdir_p(OUTPUT_BASE)
apps = Dir.glob(File.join(APPS_DIR, "*.app"))
total = apps.count
success = 0
skipped = 0
apps.each_with_index do |app_path, index|
app_name = File.basename(app_path, ".app")
print "\r[#{index + 1}/#{total}] Processing: #{app_name.ljust(30)}"
result = (app_path)
if result
success += 1
else
skipped += 1
end
end
puts "\n\n#{"=" * 50}"
puts "Done!"
puts " Total apps: #{total}"
puts " Extracted: #{success}"
puts " Skipped: #{skipped}"
puts " Output: #{OUTPUT_BASE}"
puts "=" * 50
return unless RUBY_PLATFORM.include?("darwin")
print "\nOpen the folder? (y/n): "
response = $stdin.gets
system("open '#{OUTPUT_BASE}'") if response&.strip&.downcase == "y"
end
|