lindegroup/autopkgr — pull request #199 by eahrold (2014-11-17 20:45:05+00:00)
Title: PR for official starting point of v1.2-beta Branch

@futureimperfect, @homebysix, @jsenick...

I would like to put this up for consideration for the starting point of v1.2

Since the AutoPkgr with Helper Tool branch had been tracking for so long, and had a long list of duplicate merges etc., this is a rebased offering.

#### Things of Note:
* LaunchD / Priviledged Helper tool
* see [main.m](https://github.com/lindegroup/autopkgr/blob/8b463aadb671d6c04cef7ecc314df799cd89c1c0/AutoPkgr/main.m) for how this is implemented.

* To test `/path/to/AutoPkgr.app/Contents/MacOS/AutoPkgr -runInBackground YES`.

* Now uses a custom keychain to store keychain items (namely email password).
* This keychain item is located in ~/Library/Keychains/AutoPkgr.keychain and it's password is the computer's serial number.
* _The other way I found that I could get the emailing to work at the login window was to use the system keychain, but that was only functioning when running as root, introducing a level of insecurity. The version here actually runs as the current user by specifying the `UserName` key in the LaunchDaemon._

* This introduces three new pods
* [AHKeychain](https://github.com/eahrold/AHKeychain) Derivative of SSKeychain, but lets us create and modify any keychain, not just the login.
* [AHCodesignVerifier](https://github.com/eahrold/AHCodesignVerifier) checks that the binary getting scheduled has a valid code signature, and that it is the same as that of the helper tool.
* [AHLaunchCtl](https://github.com/eahrold/AHLaunchCtl) an objective-c version of launchctl

* LGAutoPkgTask as NSOperation subclass
* subclassing allows adding dependencies to operations, so now we can easily run `autopkg repo-update` prior to each `autopkg run ...`. This way repos are less likely to become outdated. Also I think it will have the additional benefit of keeping the launch more responsive.

* Everything happens on correct thread inside of the class, no longer need to wrap all UI updates in an [NSOperationQueue mainQueue]

* all Object parsing logic happens inside of the class, and passes a nice clean dictionary out [L626 - L644](https://github.com/lindegroup/autopkgr/blob/8b463aadb671d6c04cef7ecc314df799cd89c1c0/AutoPkgr/LGAutoPkgTask.m#L626-L644) actually constructs a dictionary with two keys `kLGAutoPkgRepoURLKey` and `kLGAutoPkgRepoPathKey` so now LGPopularRepositories only needs to deal with that dictionary rather than having the parsing logic there. ( @futureimperfect , I would love it if you could take a look at this section however, you may have some ideas as to how to better split the values out with your mad regex skills. )

* NSUserNotifications
* I always wished that there would be some notification of when a successful email was sent. Now there is.
* This is just a starting point and I think we can do a lot of neat things here.

There are a number of things for relating to `SMJobBless()` that I'd be happy to go into more detail about if you're interested.

If you prefer I put up the 1.2-alpha branch for consideration or break this branch down into smaller components,
let me know.

If anyone wants to take the lead here for code review, please self assign. Otherwise if you would just sign off and I'd be happy to move this forward.

As always, thanks for your consideration.
--Eldon