CarterA / Tribo

Extremely fast static site generator written in Objective-C
http://cartera.me/2011/10/16/made-on-a-mac/
Other
42 stars 6 forks source link

Publishing via SFTP or FTP #33

Closed CarterA closed 12 years ago

CarterA commented 12 years ago

This branch implements publishing via SFTP and FTP. The two protocols are implemented in separate classes (although each are subclasses of the abstract base class TBPublisher).

SFTP support is provided by Rsync, forked out via an NSTask. Quite a bit of complexity is required here, as Rsync authentication is done through SSH, and SSH command line authentication must be done through a separate process. This necessitated the creation of a separate tool, the aptly-named Tribo Authentication Tool, which handles all of those requirements. Overall, using Rsync is not optimal, but it is fast. Not only is the initial upload quite fast, but re-publishing after a minor change is practically instant. This speed is a product of the Rsync algorithm, and it is the biggest reason why I'd like to stick with Rsync until we can implement the same algorithm natively.

FTP support is provided by libcurl and CurlHandle. This is the best FTP implementation I was able to come up with, and believe me, I tried a several:

Using libcurl seems like it'll work out quite well. Curl is battle-tested, and as an added bonus, it is included as a .dylib in OS X and iOS, meaning we don't have to include all the code. Oh, and see how I listed iOS there? Yeah, iOS is supported by Curl as well, meaning we can use the FTP publisher in the theoretical iOS app someday. I can't say the same for Rsync, sadly.

I'd appreciate a bit of code review on this, but there is a lot of new code, so I don't expect anyone to read all of it.