mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-07 22:54:11 -05:00
Properly separate ConvenienceFunctions out of PackageUtils and move additional functions into MiscFunctions, and document the various roles of each class (#10343)
This commit is contained in:
committed by
GitHub
parent
e84b0cca05
commit
ecf7885ebc
@@ -1,5 +1,5 @@
|
||||
require_relative '../lib/const'
|
||||
require_relative '../lib/convert_size'
|
||||
require_relative '../lib/misc_functions'
|
||||
require_relative '../lib/package_utils'
|
||||
|
||||
class Command
|
||||
@@ -41,6 +41,6 @@ class Command
|
||||
# Print the filelist, the total number of files, and the total size of those files.
|
||||
puts filelist
|
||||
puts "\nTotal found: #{filelist.count}".lightgreen
|
||||
puts "Disk usage: #{human_size(size)}".lightgreen
|
||||
puts "Disk usage: #{MiscFunctions.human_size(size)}".lightgreen
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
require 'fileutils'
|
||||
require_relative '../lib/const'
|
||||
require_relative '../lib/convenience_functions'
|
||||
require_relative '../lib/package'
|
||||
require_relative '../lib/package_utils'
|
||||
|
||||
class Command
|
||||
def self.remove(pkg, verbose)
|
||||
device_json = PackageUtils.load_json
|
||||
device_json = ConvenienceFunctions.load_symbolized_json
|
||||
|
||||
# Make sure the package is actually installed before we attempt to remove it.
|
||||
unless PackageUtils.installed?(pkg.name)
|
||||
@@ -98,7 +99,7 @@ class Command
|
||||
device_json[:installed_packages].delete_if { |entry| entry[:name] == pkg.name }
|
||||
|
||||
# Update device.json with our changes.
|
||||
PackageUtils.save_json(device_json)
|
||||
ConvenienceFunctions.save_json(device_json)
|
||||
|
||||
# Perform any operations required after package removal.
|
||||
pkg.postremove
|
||||
|
||||
Reference in New Issue
Block a user