/**
 * Glitter Auto Update Object v 0.0.2
 * Glitter is an automatic update class for your iPhone application.  It requires no package managers 
 * to be installed and thus is superior to other auto update classes available.
 *
 * (c) 2008 TheSpicyChicken Software
 *
 * ASSUMPTIONS
 * ===========
 *  - User has BSD Subsystem installed.  I think this is very likely.
**/

#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UIApplication.h>

/**
 * The main update object.  Will check for update and if one is available,
 * then it will download silently in the background.  Once the download is
 * complete then it notifies the delegate the the transfer has been completed.
**/
@interface Glitter : NSObject
{
	UIApplication *_application;
	NSString *_infoURL;
	
	NSString *_working;
	NSString *_pathToArchive;
	NSDictionary *_updatePlist;
	
	BOOL _updateReady;
}

- (id)initWithApplication:(UIApplication *)application URL:(NSString *)infoURL;

- (void)checkForUpdateNow;
- (void)checkForUpdateNow:(NSDictionary *)updatePlist;
- (void)install;
- (BOOL)updateReady;

- (NSDictionary *)dictionaryAtURL:(NSString *)urlString;
- (BOOL)md5IsValid:(NSString *)pathToArchive md5:(NSString *)md5;
- (int)execute:(NSString *)command;
- (void)executeInstallationScript:(NSArray *)executeArray fromPath:(NSString *)working;

- (void)copyFrom:(NSString *)from to:(NSString *)to;
- (void)copyFolderAtPath:(NSString *)from toPath:(NSString *)to;
- (void)copyFileAtPath:(NSString *)from toPath:(NSString *)to;

@end