Language
Swift
Created
07/03/2022
Last updated
04/27/2024
autowiki
Software Version
0.0.8Basic
Generated from
Commit
436c8d
Generated on
04/27/2024

Cork
Edit section
Copy link

• • •
Architecture Diagram for Cork
Architecture Diagram for Cork

Cork is a macOS application that provides a user-friendly interface for managing Homebrew packages, taps, and services. The application offers a comprehensive set of features, including package installation, removal, and updating, as well as maintenance tasks like cache cleanup and orphan package uninstallation.

The most important functionality of the Cork application is centered around the …/Views, …/Logic, and …/Models directories. These directories contain the core implementation of the application's user interface, business logic, and data models, respectively.

The …/Views directory houses the SwiftUI views that make up the application's user interface. This includes the main views for package management, such as the Package Details view, the Installation view, and the Removal view. Additionally, the views for Tap Management, Service Management, and Maintenance Tasks are also located in this directory.

The …/Logic directory contains the core business logic of the application, including functionality for Brewfile management, Discoverability, File System interactions, Package Installation and Removal, JSON processing, Maintenance tasks, Networking, Notifications, Package Loading, and Package Searching.

The …/Models directory defines the data models and observable objects used throughout the application, covering areas such as Discoverability, Outdated Packages, Package Installation, Package Uninstallation, Package Management, Searching, Services, and Updating.

The Cork application relies on several key technologies and design choices:

  • SwiftUI: The entire user interface is built using the SwiftUI framework, which provides a declarative approach to building user interfaces.
  • Homebrew Integration: The application integrates closely with the Homebrew package manager, using its command-line interface to perform various package-related operations.
  • Asynchronous Operations: Many of the application's tasks, such as package installation and maintenance, are performed asynchronously to provide a responsive user experience.
  • State Management: The application uses various ObservableObject types to manage the state of the application, including the package list, outdated packages, and service status.
  • Modular Design: The codebase is organized into several directories and files, each focusing on a specific aspect of the application's functionality, promoting modularity and maintainability.

For more details on the specific functionality and implementation of the Cork application, please refer to the following sections of the wiki:

Package Management
Edit section
Copy link

References: Cork/Views/Installation, Cork/Views/Packages, Cork/Logic/Installation & Removal, Cork/Models/Packages

• • •
Architecture Diagram for Package Management
Architecture Diagram for Package Management

The functionality related to installing, removing, and updating Homebrew packages is primarily implemented in the following directories and files:

Read more

Package Installation
Edit section
Copy link

References: Cork/Views/Installation, Cork/Views/Installation/Sub-Views, Cork/Models/Packages

• • •
Architecture Diagram for Package Installation
Architecture Diagram for Package Installation

The …/Installation directory contains the implementation of various views and components related to the package installation process in the Cork application. This includes the initial view for displaying top packages, the view for searching and selecting packages, the view for displaying the installation progress, and the views for handling specific scenarios like when sudo access is required or when the package architecture is incompatible.

Read more

Initial Package Selection
Edit section
Copy link

References: Cork/Views/Installation/Sub-Views/Initial

• • •
Architecture Diagram for Initial Package Selection
Architecture Diagram for Initial Package Selection

The TopPackagesSection view in the …/Initial directory is responsible for displaying the initial view that shows the top Homebrew packages (both formulae and casks) that the user can install.

Read more

Package Search and Selection
Edit section
Copy link

References: Cork

• • •
Architecture Diagram for Package Search and Selection
Architecture Diagram for Package Search and Selection

The …/Search for Package.swift file contains the core functionality for searching for Homebrew packages in the Cork application.

Read more

Installation Progress and Handling
Edit section
Copy link

References: Cork

• • •
Architecture Diagram for Installation Progress and Handling
Architecture Diagram for Installation Progress and Handling

The InstallationProgressTracker class in …/Installation Progress Tracker.swift is responsible for managing the installation process of Homebrew packages in the Cork application. This class tracks the progress of the installation and provides a way to display the progress to the user.

Read more

Package Removal
Edit section
Copy link

References: Cork/Logic/Installation & Removal/Removal

• • •
Architecture Diagram for Package Removal
Architecture Diagram for Package Removal

The uninstallSelectedPackage() function in the …/Uninstall Packages.swift file is responsible for the core functionality of uninstalling a selected Homebrew package from the user's system. This function plays a crucial role in the package removal process within the Cork application.

Read more

Package Synchronization
Edit section
Copy link

References: Cork

• • •
Architecture Diagram for Package Synchronization
Architecture Diagram for Package Synchronization

The …/Synchnorize Installed Packages.swift file contains the synchronizeInstalledPackages() function, which is responsible for synchronizing the list of installed Homebrew packages with the application's state.

Read more

Package Details and Discoverability
Edit section
Copy link

References: Cork/Views/Packages, Cork/Views/Packages/Package Details, Cork/Models/Packages/Discoverability

The …/Package Details directory contains the main components responsible for displaying detailed information about a specific Homebrew package in the Cork application. This includes various subviews that handle different aspects of the package details, such as caveats, dependencies, system information, and modification actions.

Read more

Tap Management
Edit section
Copy link

References: Cork/Views/Taps, Cork/Logic/JSON

• • •
Architecture Diagram for Tap Management
Architecture Diagram for Tap Management

The Tap Management section covers the functionality related to managing Homebrew taps, including adding, removing, and displaying tap details.

Read more

Adding Taps
Edit section
Copy link

References: Cork/Views/Taps/Sub-Views, Cork/Views/Taps/Add Tap View.swift

The AddTapView struct in the …/Add Tap View.swift file is responsible for handling the process of adding a new Homebrew tap to the application.

Read more

Removing Taps
Edit section
Copy link

References: Cork/Views/Taps/Tap Details/Tap Details.swift

• • •
Architecture Diagram for Removing Taps
Architecture Diagram for Removing Taps

The TapDetailView struct in the file …/Tap Details.swift provides the functionality for removing a Homebrew tap from the system.

Read more

Displaying Tap Details
Edit section
Copy link

References: Cork/Views/Taps/Tap Details, Cork/Views/Taps/Tap Details/Sub-Views

• • •
Architecture Diagram for Displaying Tap Details
Architecture Diagram for Displaying Tap Details

The TapDetailView struct in the …/Tap Details.swift file is responsible for displaying detailed information about a specific Homebrew tap. It fetches the tap information asynchronously and parses the retrieved JSON data to extract relevant details, such as the tap's homepage, official status, included formulae and casks, and the total number of packages.

Read more

Extracting Tap Information from JSON
Edit section
Copy link

References: Cork/Logic/JSON/Get Various Tap Info from JSON

• • •
Architecture Diagram for Extracting Tap Information from JSON
Architecture Diagram for Extracting Tap Information from JSON

The …/ directory contains several Swift files that are responsible for extracting various information about Homebrew taps from a JSON data source. The key functionality includes:

Read more

Service Management
Edit section
Copy link

References: Cork/Views/Services, Cork/Logic/Services, Cork/Models/Services

• • •
Architecture Diagram for Service Management
Architecture Diagram for Service Management

The Service Management section covers the functionality related to managing Homebrew services, including displaying service status and details.

Read more

Service Status and Details
Edit section
Copy link

References: Cork/Views/Services/Service Detail, Cork/Logic/Services/Service Details

• • •
Architecture Diagram for Service Status and Details
Architecture Diagram for Service Status and Details

The …/Service Detail directory contains the main view responsible for displaying detailed information about a HomebrewService object. This view handles the loading and display of the service details, as well as error handling when the details fail to load.

Read more

Service Sidebar
Edit section
Copy link

References: Cork/Views/Services/Services Sidebar

• • •
Architecture Diagram for Service Sidebar
Architecture Diagram for Service Sidebar

The ServicesSidebarView struct is the main component that defines the sidebar view for the services section of the Cork application. This view is responsible for displaying the list of Homebrew services and providing a search functionality to filter the displayed services.

Read more

Service State Management
Edit section
Copy link

References: Cork/Views/Services/Services State.swift, Cork/Models/Services

• • •
Architecture Diagram for Service State Management
Architecture Diagram for Service State Management

The ServicesState class is an ObservableObject that manages the state related to services in the Cork application. It has two main properties:

Read more

Maintenance Tasks
Edit section
Copy link

References: Cork/Views/Menu Bar, Cork/Logic/Maintenance

The Maintenance Tasks section covers the functionality related to performing various maintenance tasks in the Cork application, such as cleaning up the Homebrew cache, deleting cached downloads, and uninstalling orphaned packages.

Read more

Cache Cleanup
Edit section
Copy link

References: Cork/Views/Menu Bar/Sub-Views/Menu Bar - Cache Cleanup.swift, Cork/Logic/Maintenance/Utility Functions/Purge Cache Utility.swift

• • •
Architecture Diagram for Cache Cleanup
Architecture Diagram for Cache Cleanup

The Purge Cache Utility.swift file in the …/ directory contains a utility function purgeHomebrewCacheUtility() that is responsible for purging the Homebrew cache on the system. This function is designed to handle any errors that may occur during the cache purging process and provide information about any packages that are holding back the cache purge.

Read more

Cached Downloads Cleanup
Edit section
Copy link

References: Cork/Views/Menu Bar/Sub-Views/Menu Bar - Cached Downloads Cleanup.swift, Cork/Logic/Maintenance/Steps/Delete Cached Downloads.swift

• • •
Architecture Diagram for Cached Downloads Cleanup
Architecture Diagram for Cached Downloads Cleanup

The Menu Bar - Cached Downloads Cleanup.swift file contains the implementation of the MenuBar_CachedDownloadsCleanup view, which is responsible for managing the cleanup of cached downloads in the Cork application. This view is part of the application's menu bar and provides functionality to delete the cached downloads and display the amount of space reclaimed after the cleanup process.

Read more

Orphan Cleanup
Edit section
Copy link

References: Cork/Views/Menu Bar/Sub-Views/Menu Bar - Orphan Cleanup.swift, Cork/Logic/Maintenance/Steps/Uninstall Orphaned Packages.swift, Cork/Logic/Maintenance/Utility Functions/Uninstall Orphans - Utility.swift

• • •
Architecture Diagram for Orphan Cleanup
Architecture Diagram for Orphan Cleanup

The MenuBar_OrphanCleanup view in the …/Menu Bar - Orphan Cleanup.swift file is responsible for handling the functionality related to uninstalling orphaned packages in the Cork application. This view provides a button that, when clicked, initiates a task to uninstall any orphaned packages and sends a notification with the results of the operation.

Read more

Homebrew Health Check
Edit section
Copy link

References: Cork/Logic/Maintenance/Steps/Perform Brew Health Check.swift

• • •
Architecture Diagram for Homebrew Health Check
Architecture Diagram for Homebrew Health Check

The performBrewHealthCheck() function in …/Perform Brew Health Check.swift is responsible for running the Homebrew "doctor" command and handling any errors that are reported.

Read more

Maintenance Utilities
Edit section
Copy link

References: Cork/Logic/Maintenance/Utility Functions/Purge Cache Utility.swift, Cork/Logic/Maintenance/Utility Functions/Uninstall Orphans - Utility.swift

The Purge Cache Utility.swift file in the …/ directory contains a utility function purgeHomebrewCacheUtility() that is responsible for purging the Homebrew cache on the system. This function is designed to handle any errors that may occur during the cache purging process and provide information about any packages that are holding back the cache purge.

Read more

Discoverability and Analytics
Edit section
Copy link

References: Cork/Views/Start Page, Cork/Logic/Discoverability, Cork/Models/Discoverability

• • •
Architecture Diagram for Discoverability and Analytics
Architecture Diagram for Discoverability and Analytics

The Cork application provides functionality for discovering top Homebrew packages and managing the user's analytics settings.

Read more

Top Packages
Edit section
Copy link

References: Cork/Models/Discoverability, Cork/Logic/Discoverability

• • •
Architecture Diagram for Top Packages
Architecture Diagram for Top Packages

The TopPackagesTracker class in …/Top Packages Tracker.swift is responsible for tracking and publishing the top Homebrew packages and casks. This class has two published properties:

Read more

Analytics Management
Edit section
Copy link

References: Cork/Views/Start Page/Sub-Views/Analytics Status Box.swift, Cork/Views/Start Page/Sub-Views/Analytics Status Box 2.swift

• • •
Architecture Diagram for Analytics Management
Architecture Diagram for Analytics Management

The AnalyticsStatusBox view in the …/Analytics Status Box 2.swift file is responsible for displaying the user's analytics settings in the Cork application. This view uses the @AppStorage property wrapper to access the allowBrewAnalytics boolean value, which determines whether analytics are enabled or disabled for the application.

Read more

Settings and Preferences
Edit section
Copy link

References: Cork/Views/Settings, Cork/Models/Misc

The Settings and Preferences section covers the functionality related to configuring the application's settings and preferences, including advanced options, Homebrew-related settings, and notification preferences.

Read more

Advanced Settings
Edit section
Copy link

References: Cork/Views/Settings/Panes/Advanced Pane.swift, Cork/Views/Settings/Panes/Brew Pane.swift

The AdvancedPane in the …/Advanced Pane.swift file provides access to advanced settings for the Cork application. This subsection covers the key functionality related to these advanced settings.

Read more

General Preferences
Edit section
Copy link

References: Cork/Views/Settings/Panes/General Pane.swift

The GeneralPane struct in the …/General Pane.swift file defines the user interface and functionality for the general settings pane in the Cork application. This pane allows users to configure various settings related to package management, search, and application behavior.

Read more

Installation and Uninstallation
Edit section
Copy link

References: Cork/Views/Settings/Panes/Installation Pane.swift

The InstallationAndUninstallationPane in …/Installation Pane.swift provides settings related to the installation and uninstallation of Homebrew packages in the Cork application.

Read more

Maintenance Tasks
Edit section
Copy link

References: Cork/Views/Settings/Panes/Maintenance Pane.swift

• • •
Architecture Diagram for Maintenance Tasks
Architecture Diagram for Maintenance Tasks

The MaintenancePane struct in the file …/Maintenance Pane.swift provides a settings pane for configuring default settings related to various maintenance tasks in the Cork application. This pane allows users to customize the behavior of operations such as uninstalling orphaned packages, purging the Homebrew cache, deleting cached downloads, and performing a Homebrew health check.

Read more

Notification Preferences
Edit section
Copy link

References: Cork/Views/Settings/Panes/Notifications Pane.swift

• • •
Architecture Diagram for Notification Preferences
Architecture Diagram for Notification Preferences

The NotificationsPane struct in the …/Notifications Pane.swift file provides the user interface for managing notification settings in the Cork application.

Read more

Discoverability Settings
Edit section
Copy link

References: Cork/Views/Settings/Panes/Discoverability Pane.swift

• • •
Architecture Diagram for Discoverability Settings
Architecture Diagram for Discoverability Settings

The DiscoverabilityPane struct in the file …/Discoverability Pane.swift is responsible for rendering the Discoverability settings pane in the Cork application. This pane allows users to configure various settings related to package discoverability.

Read more

Onboarding and Licensing
Edit section
Copy link

References: Cork/Views/Onboarding, Cork/Views/Licensing

• • •
Architecture Diagram for Onboarding and Licensing
Architecture Diagram for Onboarding and Licensing

The …/Onboarding directory and the …/Licensing directory contain the core functionality for the onboarding experience and licensing management in the Cork application.

Read more

Onboarding Experience
Edit section
Copy link

References: Cork/Views/Onboarding, Cork/Views/Onboarding/Sub-Views

• • •
Architecture Diagram for Onboarding Experience
Architecture Diagram for Onboarding Experience

The OnboardingView struct in the …/Onboarding.swift file is responsible for the application's onboarding experience. This view allows users to configure various settings and preferences related to the app's functionality, such as real-time terminal output, uninstallation options, dependency display, search features, notifications, and more.

Read more

Licensing Management
Edit section
Copy link

References: Cork/Views/Licensing, Cork/Views/Licensing/Sub-Views

The Licensing_BoughtView struct is responsible for displaying a screen that indicates the user has successfully purchased a license. This view interacts with the AppState environment object and updates several AppStorage values related to the licensing workflow.

Read more

Utility Functions and Helpers
Edit section
Copy link

References: Cork/Logic/Helpers, Cork/Logic/JSON, Cork/Logic/Networking, Cork/Logic/Notifications, Cork/Logic/Tagging

• • •
Architecture Diagram for Utility Functions and Helpers
Architecture Diagram for Utility Functions and Helpers

This section covers the various utility functions and helper classes used throughout the application.

Read more

Application Lifecycle
Edit section
Copy link

References: Cork/Logic/Helpers/Restart App.swift, Cork/Logic/Helpers/Switch Cork to Foreground.swift

The Cork application provides utility functions to handle the application's lifecycle, including restarting the application and bringing it to the foreground.

Read more

User Interface and Navigation
Edit section
Copy link

References: Cork/Views/Sidebar, Cork/Views/Menu Bar, Cork/Views/Start Page

The Cork application's user interface and navigation are implemented across several key components:

Read more

Start Page
Edit section
Copy link

References: Cork/Views/Start Page, Cork/Views/Start Page/Sub-Views, Cork/Views/Start Page/Sub-Views/Outdated Packages

The start page is the main entry point for the Cork application, displaying an overview of the user's installed packages, taps, analytics status, cached downloads, and outdated packages.

Read more