| 1 | The following are notes by my mentor Randall Wood on the MacPorts.Framework |
| 2 | GSoC project. I will be using them as a sort of Roadmap to track my progress as the summer progresses. |
| 3 | |
| 4 | = MacPorts Frameworks = |
| 5 | The MacPorts Project would benefit from having Cocoa frameworks wrapped around the core APIs. Currently in a user's space on the MacPorts SVN server, there is a rough MacPorts.Framework. This document attempts to define a stronger framework. Please note that when this document refers to a current class or the current state, it is referring to the existing Framework code. |
| 6 | |
| 7 | == MacPorts Foundation (MacPorts.Framework) == |
| 8 | The MacPorts Foundation needs to provide for the following capabilities:[[BR]] |
| 9 | 1. Allow for Port discovery (search the PortIndexes) |
| 10 | This is trivial and the current MPMacPorts class provides methods for doing this. |
| 11 | |
| 12 | 2. Provide information about Ports (state, indexed information, files, etc) |
| 13 | The port discovery methods return wither a single MPPort object or an array of such objects. The MPPort currently provides state and indexed information about the port. |
| 14 | |
| 15 | 3. Manipulate Ports (install, uninstall, upgrade, etc) |
| 16 | The MPPort class has methods for doing this, but they are incomplete as they accept no arguments (like a list of variants during install) |
| 17 | |
| 18 | 4. Expose the MacPorts configuration |
| 19 | With some exceptions, this is not currently done, and may not be really necessary. The important exception is that there is a method for getting the MacPorts ${prefix} path. |
| 20 | |
| 21 | 5. Notify the system of MacPorts activity (upgrade/installation/uninstallation of port foo has started/stopped/failed) |
| 22 | I think this may be the most difficult part of making this framework, but that may simply reflect the reality that I have not been able to sit down for more than about an hour at time to work on it. I think the ideal situation would be that activity in the Foundation framework should be spewed in either local or global notifications depending on the activity |
| 23 | |
| 24 | |
| 25 | |
| 26 | == MacPorts Application Kit (MacPortsAppKit.Framework) == |
| 27 | The MacPorts Application Kit should provide the following:[[BR]] |
| 28 | 1. A memory resident index of ports that can be rapidly searched |
| 29 | This is currently the MPIndex class, but I think this can be pulled from the Foundation, as it really only benefits GUI applications where rapid response to user input is required |
| 30 | |
| 31 | 2. A GUI for authenticating to perform MacPorts activities |
| 32 | This would entail embedding a helper application in the AppKit that can be launched in a privaleged manner to perform privaleged tasks. It should use the standard Authorization services to the greatest extent possible |
| 33 | |
| 34 | 3. A GUI for selecting variants |
| 35 | A panel that can be attached to a window? |
| 36 | |
| 37 | 4. A GUI for responding to errors and --force requests |
| 38 | Another panel that can be attached to a window? |
| 39 | |
| 40 | 5. Extend MPPort to add methods identical in scope to the standard methods (install/uninstall/upgrade/etc) that accept the (id)sender argument and enable a GUI for handling the standard MPPort methods |
| 41 | This is basically a requirement to make MPPort behave as expected in a GUI environment and is an enabler for those panels that the AppKit provides. Ideally the sender should be an NSWindow, NSWindow Delegate, or an MPMacPorts Delegate (see 6 below) |
| 42 | |
| 43 | 6. Define a protocol for delegates to handle feedback |
| 44 | The delegates would be delegates to MPMacPorts as extended by the Application Kit and delegation would allow for applications to override the App Kit to use their own GUI or to automate activities that the Framework should not (for example, the App Kit should not automate the forcing of the uninstallation of an inactive port, but a GUI application may allow a user to say that it should always force that, in which case the Application would just tell the App Kit to drive on). |
| 45 | |