Skip to content
This repository has been archived by the owner on Apr 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #37 from chintan1891/master
Browse files Browse the repository at this point in the history
Resolved : #27
  • Loading branch information
Galeas committed Aug 24, 2015
2 parents c0d42b5 + 3e2de83 commit 0080b5b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CocoaPodUI/CocoaPodUI-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string>1</string>
<key>DVTPlugInCompatibilityUUIDs</key>
<array>
<string>7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90</string>
<string>E969541F-E6F9-4D25-8158-72DC3545A6C6</string>
<string>8DC44374-2B35-4C57-A6FE-2AD66A36AAD9</string>
<string>9F75337B-21B4-4ADC-B558-F9CADF7073A7</string>
<string>992275C1-432A-4CF7-B659-D84ED6D42D3F</string>
Expand Down
2 changes: 1 addition & 1 deletion CocoaPodUI/Controllers/CreatePodController.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (void)setPlatformName:(NSString *)platformName
- (NSArray *)versions
{
if ([self.platformName isEqualToString:@"iOS"]) {
return @[@"4.3", @"5.0", @"6.0", @"7.0"];
return @[@"4.3", @"5.0", @"6.0", @"7.0", @"8.0", @"9.0"];
}
else {
return @[@"10.5", @"10.6", @"10.7", @"10.8", @"10.9"];
Expand Down
47 changes: 32 additions & 15 deletions CocoaPodUI/Controllers/PodsManagementViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -650,18 +650,12 @@ - (void)installTask:(PodTask)type completion:(void(^)(BOOL, NSError*))success

__weak typeof(self) weakSelf = self;
__block NSError *error = nil;
__block BOOL successFlag = YES;

id logView = self.enableConsoleOutput ? [self logView:nil] : nil;
[output setReadabilityHandler:^(NSFileHandle *fileHandler) {
NSData *data = [fileHandler availableData]; // this will read to EOF, so call only once
NSString *text = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
if ([text rangeOfString:@"[!] From now on use"].location == NSNotFound || [text rangeOfString:@"Integrating client project"].location == NSNotFound) {
NSRange possibleErrorRange = [text rangeOfString:@"[!] "];
if (possibleErrorRange.location != NSNotFound) {
error = [NSError errorWithDomain:@"error::CocoaPodUI" code:666 userInfo:@{@"reason":[text substringFromIndex:NSMaxRange(possibleErrorRange)]}];
successFlag = NO;
}
}

NSString *logString = [NSString stringWithFormat:@"\n%@", text];
[weakSelf.overlayController performSelectorOnMainThread:@selector(appendText:) withObject:logString waitUntilDone:YES];
if (logView) {
Expand All @@ -681,13 +675,13 @@ - (void)installTask:(PodTask)type completion:(void(^)(BOOL, NSError*))success
}
}];

[installTask setTerminationHandler:^(NSTask *task) {
DLog(@"COCOAPODUI::INSTALLATION TERMINATION HANDLER");
if (success != nil) {
DLog(@"COCOAPODUI::WILL_PERFORM_INSTALSUCCESS_BLOCK");
success(successFlag, error);
}
}];
// [installTask setTerminationHandler:^(NSTask *task) {
// DLog(@"COCOAPODUI::INSTALLATION TERMINATION HANDLER");
// if (success != nil) {
// DLog(@"COCOAPODUI::WILL_PERFORM_INSTALSUCCESS_BLOCK");
// success(successFlag, error);
// }
// }];

NSMutableDictionary * environment = [[[NSProcessInfo processInfo] environment] mutableCopy];
environment[@"LC_ALL"]=@"en_US.UTF-8";
Expand All @@ -701,6 +695,29 @@ - (void)installTask:(PodTask)type completion:(void(^)(BOOL, NSError*))success
}

[installTask waitUntilExit];

int status = [installTask terminationStatus];

if (status == 0) {
if (success != nil) {
DLog(@"COCOAPODUI::WILL_PERFORM_INSTALSUCCESS_BLOCK");
success(YES, error);
}
}
else {
NSData *data = [output availableData]; // this will read to EOF, so call only once
NSString *text = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSRange possibleErrorRange = [text rangeOfString:@"[!] "];
if (possibleErrorRange.location != NSNotFound) {
error = [NSError errorWithDomain:@"error::CocoaPodUI" code:666 userInfo:@{@"reason":[text substringFromIndex:NSMaxRange(possibleErrorRange)]}];
success(NO, error);
}
else {
error = [NSError errorWithDomain:@"error::CocoaPodUI" code:666 userInfo:@{@"reason":text}];
success(NO, error);
}

}
}

- (NSString*)podfileString
Expand Down
8 changes: 5 additions & 3 deletions CocoaPodUI/Controllers/PodsManagementViewController.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PodsManagementViewController">
Expand Down Expand Up @@ -34,9 +34,10 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" tag="666" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" alternatingRowBackgroundColors="YES" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="72" rowSizeStyle="automatic" viewBased="YES" id="eCO-Lk-Fnc">
<rect key="frame" x="0.0" y="0.0" width="308" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="installed" width="305" minWidth="40" maxWidth="1000" id="hHO-Di-KeU">
Expand Down Expand Up @@ -351,6 +352,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" tag="999" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="72" rowSizeStyle="automatic" viewBased="YES" id="S9E-vT-gHo">
<rect key="frame" x="0.0" y="0.0" width="303" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
Expand Down

0 comments on commit 0080b5b

Please sign in to comment.