Compile the code
See instructions for compile. There are about 130 classes with 14,700 lines of code in RsyncOSX.
This is some information about the design and code of RsyncOSX. The documentation is only a brief summary of some parts of RsyncOSX. The design of RsyncOSX is based upon ideas of the MVC pattern. One of the objectives in the MVC pattern is to separate the views and models.
Every time RsyncOSX executes a command, RsyncOSX is listening for two notifications
NSFileHandleDataAvailable. Those two notifications kicks of other functions depended upon the state of RsyncOSX.
I am also adapting the code to SwiftLint guidelines. This project commenced because I wanted to learn Swift. The codebase from the beginning to today is changed a lot. RsyncOSX has matured during the years and the application today is robust and stable. It is also important to say that I am not a professional developer. I don´t read a lot of Swift resources, but follows a few from time to time. I use Gooogle when developing and have got a few ideas by searching for solutions.
I also try to use Swift as effective as I can. There is no need to develop code when Swift supports the functionality by default. The Swift code is more or less traditional code, no SwiftUI code and there are not any plans for converting to SwiftUI either.
RsyncOSX is prepared for localization. Dates are stored on permanent storage and used in calculations. Dates in views are localized and saved on permanent storage in “en_US” format. All calculations utilizing dates is based upon the
en_US date format.
The views has no knowledge about the models or data stored about configurations, schedules and logdata. Data presented in RsyncOSX are mostly table data. Presenting table data in all views utilizes the NSTableViewDelegate. All data which are saved to permanent storage (configurations, schedules, logs and userconfig) are stored as xml-files (plist files). RsyncOSX does not utilize the Core Data because the data about configurations, schedules and logs are simple and there is no need for a complex datamodel.
Data is read from permanent store and loaded when RsyncOSX either starts or a new profile is either selected or created. The Synchronize view loads and holds the data objects during lifetime of data. There are two main objects which holds the data about configurations and schedules including logdata. The objects lives during lifetime of RsyncOSX or until a profile is either selected or created.
Classes in Swift are by reference and both the configurations and schedules objects are created in the Synchronize view of RsyncOSX. Other objects utilizing data and methods in configurations and schedules objects are by protocol functions, getting the reference for the data objects. The references to configurations and schedules are weak to avoid strong cyclic references and memory leaks.
The class Configurations (plural) holds required data, as an Array, about all tasks including all parameters for rsync and user selected parameters. All Configuration objects, which is a struct about one task, are stored in memory in an Array in order loaded from permanent storage. Last timestamp for execution is also stored in the configuration object.
- the struct Configuration.swift holds data about one task
- the class Configurations.swift holds all computed data and methods operating on tasks
Documentation of Configurations.
Scheduled tasks and log records
All log records are stored in a Schedule record. For one task it might be several schedule records depended upon type of schedule and start of scheduled task. The type of schedules are manual, once, daily and monthly. If Schedules is not used meaning only manually executed tasks, one Schedule record is created with type manual. All log records for this manually executed tasks are added to this record.
Documentation of scheduled tasks and log records.
Reading and writing data to permanent storage
One object takes care of reading and writing data to permanent storage. The object is also responsible to either read or write data utilizing profiles.
Documentation of reading and writing.
Parameters to rsync
Rsync utilizes a ton of parameters. RsyncOSX let the user pass any parameter to rsync. A few rsync parameters are predefined, both mandatory and user selected. Documentation of rsync parameters in RsyncOSX.
The main view controller
Documentation of the main viewcontroller.
LastMod 2020-07-01 (fc83707)