# frozen_string_literal: true require "find" require "pathname" # This module provides classes for the Makit gem. module Makit class Show def modified(path) if File.file?(path) puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(File.mtime(path))}".colorize(:cyan) elsif File.directory?(path) puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(Makit::Directory.modified(path))}".colorize(:cyan) else puts "#{path} does not exist" end end def age(path) if File.file?(path) modified = File.mtime(path) age = (Time.now - modified).to_f puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan) elsif File.directory?(path) modified = Makit::Directory.modified(path) age = (Time.now -modified).to_f puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan) else puts "#{path} does not exist" end end def file(path) if File.file?(path) modified = File.mtime(path) age = (Time.now - modified).to_f humanized_size = Makit::Humanize.get_humanized_size(File.size(path)) puts "#{file_symbol} ".colorize(:grey) + "#{humanized_size.rjust(10)} ".colorize(:cyan) +" #{path} ".colorize(:grey) else puts "#{path} does not exist" end end def file_symbol #📄 (U+1F4C4) – "Page with Curl" #"\u{1F4C4}" "@" end def directory_symbol # 📁 (U+1F4C1) – "File Folder" "\u{1F4C1}" end def task_symbol # 🛠️ (U+1F6E0) Hammer and Wrench – Represents tools, suitable for tasks and automation. "\u{1F6E0}" end def size(path) if File.file?(path) puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))}".colorize(:cyan) elsif File.directory?(path) puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan) else puts "#{path} does not exist" end end def task(task) puts ("=" * 80).colorize(:grey) puts " ".colorize(:grey) + "#{task}".colorize(:green) #puts ("=" * 100).colorize(:grey) end def info(text) puts " ".colorize(:grey) + "#{text}".colorize(:cyan) end def success(text) puts " ".colorize(:grey) + "#{text}".colorize(:green) end end end #Code42-#{VERSION}-win10-x64 ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size("artifacts/Code42-0.0.0-win10-x64"))}".colorize(:cyan)