mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-22 06:25:52 +00:00
Merge branch 'master' of github.com:cappuccino/cappuccino
This commit is contained in:
commit
5e3bad2a36
16 files changed
+1420
-1109
No files matched your search
+8
-9
@@ -137,9 +137,6 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
*/
|
||||
- (CGSize)contentSize
|
||||
{
|
||||
if (![_popoverWindow isVisible])
|
||||
return CGRectMakeZero();
|
||||
|
||||
return [[_contentViewController view] frameSize];
|
||||
}
|
||||
|
||||
@@ -150,7 +147,10 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
*/
|
||||
- (void)setContentSize:(CGSize)aSize
|
||||
{
|
||||
[[_contentViewController view] setFrameSize:aSize];
|
||||
if (!_popoverWindow)
|
||||
[[_contentViewController view] setFrameSize:aSize];
|
||||
else
|
||||
[_popoverWindow updateFrameWithSize:aSize];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -240,13 +240,8 @@ Set the behavior of the CPPopover. It can be:
|
||||
if ([_popoverWindow isClosing])
|
||||
return;
|
||||
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_willShow_)
|
||||
[_delegate popoverWillShow:self];
|
||||
|
||||
if (!_popoverWindow)
|
||||
{
|
||||
_popoverWindow = [[_CPPopoverWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:[self styleMaskForBehavior]];
|
||||
}
|
||||
|
||||
[_popoverWindow setPlatformWindow:[[positioningView window] platformWindow]];
|
||||
[_popoverWindow setAppearance:_appearance];
|
||||
@@ -255,6 +250,10 @@ Set the behavior of the CPPopover. It can be:
|
||||
[_popoverWindow setMovableByWindowBackground:NO];
|
||||
[_popoverWindow setFrame:[_popoverWindow frameRectForContentRect:[[_contentViewController view] frame]]];
|
||||
[_popoverWindow setContentView:[_contentViewController view]];
|
||||
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_willShow_)
|
||||
[_delegate popoverWillShow:self];
|
||||
|
||||
[_popoverWindow positionRelativeToRect:positioningRect ofView:positioningView preferredEdge:preferredEdge];
|
||||
|
||||
if (!_animates && _implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
|
||||
|
||||
@@ -116,7 +116,9 @@ CPTableViewLastColumnOnlyAutoresizingStyle = 4;
|
||||
CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
#define NUMBER_OF_COLUMNS() (_tableColumns.length)
|
||||
#define UPDATE_COLUMN_RANGES_IF_NECESSARY() if (_dirtyTableColumnRangeIndex !== CPNotFound) [self _recalculateTableColumnRanges];
|
||||
#define UPDATE_COLUMN_RANGES_IF_NECESSARY() \
|
||||
if (_dirtyTableColumnRangeIndex !== CPNotFound) \
|
||||
[self _recalculateTableColumnRanges];
|
||||
#define FULL_ROW_HEIGHT() (_rowHeight + _intercellSpacing.height)
|
||||
#define ROW_BOTTOM(__heightInfo) (__heightInfo.y + __heightInfo.height + _intercellSpacing.height)
|
||||
#define HAS_VARIABLE_ROW_HEIGHTS() (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)
|
||||
|
||||
@@ -35,9 +35,11 @@ CPClosableOnBlurWindowMask = 1 << 4;
|
||||
CPPopoverAppearanceMinimal = 0;
|
||||
CPPopoverAppearanceHUD = 1;
|
||||
|
||||
var _CPPopoverWindow_shouldClose_ = 1 << 0,
|
||||
_CPPopoverWindow_didClose_ = 1 << 1,
|
||||
_CPPopoverWindow_didShow_ = 1 << 2;
|
||||
// we don't start from 1 because CPWindow and so CPPanel already
|
||||
// has this delegate bitmask identifier for 1, 2 and 3.
|
||||
var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
_CPPopoverWindow_didClose_ = 1 << 5,
|
||||
_CPPopoverWindow_didShow_ = 1 << 6;
|
||||
|
||||
|
||||
/*!
|
||||
@@ -364,6 +366,24 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0,
|
||||
return CPBrowserStyleProperty('transition') && CPBrowserStyleProperty('transitionend');
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)updateFrameWithSize:(CGSize)aSize
|
||||
{
|
||||
var rect = CGRectMakeZero();
|
||||
rect.size = aSize;
|
||||
rect.origin = [[self contentView] frameOrigin];
|
||||
|
||||
[self setFrame:[self frameRectForContentRect:rect]];
|
||||
|
||||
if ([self isVisible])
|
||||
{
|
||||
var point = [self computeOriginFromRect:[_targetView bounds] ofView:_targetView preferredEdge:[_windowView preferredEdge]];
|
||||
[self setFrameOrigin:point];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Actions
|
||||
|
||||
|
||||
+14
-7
@@ -40,6 +40,7 @@ var _CPToolTipHeight = 24.0,
|
||||
*/
|
||||
@implementation _CPToolTip : CPWindow
|
||||
{
|
||||
CPWindow _toolTipWindow;
|
||||
CPTextField _content;
|
||||
}
|
||||
|
||||
@@ -78,8 +79,7 @@ var _CPToolTipHeight = 24.0,
|
||||
|
||||
var callbackFunction = function() {
|
||||
[_CPToolTip invalidateCurrentToolTipIfNeeded];
|
||||
_CPToolTipCurrentToolTip = [_CPToolTip toolTipWithString:[aView toolTip]];
|
||||
[_CPToolTipCurrentToolTip setPlatformWindow:[[aView window] platformWindow]];
|
||||
_CPToolTipCurrentToolTip = [_CPToolTip toolTipWithString:[aView toolTip] toolTipWindow:[aView window]];
|
||||
};
|
||||
|
||||
_CPToolTipCurrentToolTipTimer = [CPTimer scheduledTimerWithTimeInterval:_CPToolTipDelay
|
||||
@@ -91,9 +91,14 @@ var _CPToolTipHeight = 24.0,
|
||||
/*! Returns an initialized _CPToolTip with the given text and attach it to given view.
|
||||
@param aString the content of the tooltip
|
||||
*/
|
||||
+ (_CPToolTip)toolTipWithString:(CPString)aString
|
||||
+ (_CPToolTip)toolTipWithString:(CPString)aString toolTipWindow:(CPWindow)aWindow
|
||||
{
|
||||
var tooltip = [[_CPToolTip alloc] initWithString:aString styleMask:_CPToolTipWindowMask];
|
||||
// the window might be gone during the timer interval. If so, just ignore as
|
||||
// we don't want to show the tooltip anyway
|
||||
if (!aWindow)
|
||||
return nil;
|
||||
|
||||
var tooltip = [[_CPToolTip alloc] initWithString:aString styleMask:_CPToolTipWindowMask toolTipWindow:aWindow];
|
||||
|
||||
[tooltip showToolTip];
|
||||
|
||||
@@ -158,7 +163,7 @@ var _CPToolTipHeight = 24.0,
|
||||
@param aString the content of the tooltip
|
||||
@param aStyleMask the tooltip's style mask
|
||||
*/
|
||||
- (id)initWithString:(CPString)aString styleMask:(unsigned)aStyleMask
|
||||
- (id)initWithString:(CPString)aString styleMask:(unsigned)aStyleMask toolTipWindow:(CPWindow)aWindow
|
||||
{
|
||||
var toolTipFrame = CGRectMake(0.0, 0.0, 250.0, _CPToolTipHeight),
|
||||
layout = [_CPToolTip computeCorrectSize:toolTipFrame.size text:aString],
|
||||
@@ -168,6 +173,7 @@ var _CPToolTipHeight = 24.0,
|
||||
|
||||
if (self = [super initWithContentRect:toolTipFrame styleMask:aStyleMask])
|
||||
{
|
||||
_toolTipWindow = aWindow;
|
||||
_constrainsToUsableScreen = NO;
|
||||
|
||||
textFrameSize.height += 4;
|
||||
@@ -203,7 +209,7 @@ var _CPToolTipHeight = 24.0,
|
||||
- (void)showToolTip
|
||||
{
|
||||
var mousePosition = [[CPApp currentEvent] globalLocation],
|
||||
nativeRect = [[self platformWindow] nativeContentRect];
|
||||
nativeRect = [[_toolTipWindow platformWindow] nativeContentRect];
|
||||
|
||||
mousePosition.y += 20;
|
||||
|
||||
@@ -217,7 +223,8 @@ var _CPToolTipHeight = 24.0,
|
||||
mousePosition.y = mousePosition.y - CGRectGetHeight([self frame]) - 40;
|
||||
|
||||
[self setFrameOrigin:mousePosition];
|
||||
[self orderFront:nil];
|
||||
|
||||
[_toolTipWindow addChildWindow:self ordered:CPWindowAbove];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -111,7 +111,7 @@ AppController *SharedAppControllerInstance = nil;
|
||||
[[NSApplication sharedApplication] terminate:self];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If we were opened from the command line, self.pathToOpenAtLaunch will be set.
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
@@ -144,13 +144,14 @@ AppController *SharedAppControllerInstance = nil;
|
||||
kDefaultXCCAPIMode: [NSNumber numberWithInt:kXCCAPIModeAuto],
|
||||
kDefaultXCCReactToInodeMod: @YES,
|
||||
kDefaultXCCReopenLastProject: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnWarnings: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnErrors: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnCappLint: @YES,
|
||||
kDefaultXCCAutoShowNotificationOnErrors: @YES,
|
||||
kDefaultXCCAutoShowNotificationOnCappLint: @NO,
|
||||
kDefaultXCCProjectHistory: [NSArray new],
|
||||
kDefaultMaxRecentProjects: @20,
|
||||
kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN],
|
||||
kDefaultAutoOpenXcodeProject: @YES,
|
||||
kDefaultShowProcessingNotices: @YES,
|
||||
kDefaultUseSymlinkWhenCreatingProject: @YES
|
||||
};
|
||||
|
||||
|
||||
@@ -152,12 +152,24 @@
|
||||
[self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status];
|
||||
}
|
||||
}
|
||||
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
|
||||
if ([self.xcc shouldShowErrorNotification])
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
}
|
||||
else if (!self.xcc.isLoadingProject)
|
||||
{
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
BOOL showFinalNotification = YES;
|
||||
|
||||
if ([self.xcc shouldProcessWithCappLint])
|
||||
{
|
||||
showFinalNotification = [self.xcc checkCappLintForPath:[NSArray arrayWithObject:self.sourcePath]];
|
||||
|
||||
if (!showFinalNotification)
|
||||
[self.xcc showCappLintErrors];
|
||||
}
|
||||
|
||||
if (showFinalNotification)
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +190,7 @@
|
||||
nil];
|
||||
|
||||
info[@"projectId"] = self.projectId;
|
||||
info[@"message"] = [NSString stringWithFormat:@"%@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];
|
||||
info[@"message"] = [NSString stringWithFormat:@"Compilation issue: %@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];
|
||||
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
@@ -17,15 +17,16 @@ extern NSString * const kDefaultFirstLaunchVersion;
|
||||
extern NSString * const kDefaultXCCAPIMode;
|
||||
extern NSString * const kDefaultXCCReactToInodeMod;
|
||||
extern NSString * const kDefaultXCCReopenLastProject;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint;
|
||||
extern NSString * const kDefaultXCCAutoShowNotificationOnErrors;
|
||||
extern NSString * const kDefaultXCCAutoShowNotificationOnCappLint;
|
||||
extern NSString * const kDefaultXCCProjectHistory;
|
||||
extern NSString * const kDefaultLastOpenedPath;
|
||||
extern NSString * const kDefaultPathModificationDates;
|
||||
extern NSString * const kDefaultMaxRecentProjects;
|
||||
extern NSString * const kDefaultLogLevel;
|
||||
extern NSString * const kDefaultAutoOpenXcodeProject;
|
||||
extern NSString * const kDefaultShowProcessingNotices;
|
||||
extern NSString * const kDefaultUseSymlinkWhenCreatingProject;
|
||||
|
||||
#endif
|
||||
@@ -15,13 +15,14 @@ NSString * const kDefaultFirstLaunchVersion = @"firstLaunchVersion";
|
||||
NSString * const kDefaultXCCAPIMode = @"XCCAPIMode";
|
||||
NSString * const kDefaultXCCReactToInodeMod = @"XCCReactMode";
|
||||
NSString * const kDefaultXCCReopenLastProject = @"XCCReopenLastProject";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings = @"XCCAutoOpenErrorsPanelOnWarnings";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors = @"XCCAutoOpenErrorsPanelOnErrors";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint = @"XCCAutoOpenErrorsPanelOnCappLint";
|
||||
NSString * const kDefaultXCCAutoShowNotificationOnErrors = @"XCCAutoOpenShowNotificationErrors";
|
||||
NSString * const kDefaultXCCAutoShowNotificationOnCappLint = @"XCCAutoShowNotificationOnCappLint";
|
||||
NSString * const kDefaultXCCProjectHistory = @"XCCProjectHistory";
|
||||
NSString * const kDefaultLastOpenedPath = @"LastOpenedPath";
|
||||
NSString * const kDefaultPathModificationDates = @"pathModificationDates";
|
||||
NSString * const kDefaultMaxRecentProjects = @"maxRecentProjects";
|
||||
NSString * const kDefaultLogLevel = @"logLevel";
|
||||
NSString * const kDefaultAutoOpenXcodeProject = @"autoOpenXcodeProject";
|
||||
NSString * const kDefaultShowProcessingNotices = @"showProcessingNotices";
|
||||
NSString * const kDefaultUseSymlinkWhenCreatingProject = @"useSymlinkWhenCreatingProject";
|
||||
@@ -45,7 +45,8 @@ enum {
|
||||
extern NSString * const XCCConversionDidStartNotification;
|
||||
extern NSString * const XCCConversionDidEndNotification;
|
||||
extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
|
||||
extern NSString * const XCCCappLintDidStartNotification;
|
||||
extern NSString * const XCCCappLintDidEndNotification;
|
||||
|
||||
@interface XcodeCapp : NSObject <NSTableViewDelegate, NSUserNotificationCenterDelegate, GrowlApplicationBridgeDelegate>
|
||||
|
||||
@@ -109,6 +110,9 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
// A list of errors generated from the current batch of source processing
|
||||
@property NSMutableArray *errorList;
|
||||
|
||||
// A list of files name who can be processed, based on xcapp-ignore and path pf the project
|
||||
@property NSMutableArray *xCodeCappTargetedFiles;
|
||||
|
||||
// Panel, table and controller used to display errors
|
||||
@property (strong) IBOutlet NSPanel *errorsPanel;
|
||||
@property (unsafe_unretained) IBOutlet NSTableView *errorTable;
|
||||
@@ -119,6 +123,7 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
- (IBAction)openErrorInEditor:(id)sender;
|
||||
- (IBAction)openXcodeProject:(id)aSender;
|
||||
- (IBAction)synchronizeProject:(id)aSender;
|
||||
- (IBAction)checkProjectWithCappLint:(id)aSender;
|
||||
|
||||
- (BOOL)executablesAreAccessible;
|
||||
- (void)stop;
|
||||
@@ -131,6 +136,8 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
- (BOOL)isXibFile:(NSString *)path;
|
||||
- (BOOL)isXCCIgnoreFile:(NSString *)path;
|
||||
|
||||
- (BOOL)shouldShowErrorNotification;
|
||||
|
||||
- (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path;
|
||||
- (BOOL)hasErrors;
|
||||
|
||||
@@ -142,6 +149,10 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
|
||||
- (NSDictionary*)createProject:(NSString*)aPath;
|
||||
|
||||
- (BOOL)shouldProcessWithCappLint;
|
||||
- (BOOL)checkCappLintForPath:(NSArray*)paths;
|
||||
- (void)showCappLintErrors;
|
||||
|
||||
@end
|
||||
|
||||
@interface XcodeCapp (SnowLeopard)
|
||||
|
||||
@@ -74,6 +74,8 @@ static NSPredicate * XCCDirectoriesToIgnorePredicate = nil;
|
||||
// An array of the default predicates used to ignore paths.
|
||||
static NSArray *XCCDefaultIgnoredPathPredicates = nil;
|
||||
|
||||
NSString * const XCCCappLintDidStartNotification = @"XCCCappLintDidStartNotification";
|
||||
NSString * const XCCCappLintDidEndNotification = @"XCCCappLintDidEndNotification";
|
||||
|
||||
@interface XcodeCapp ()
|
||||
|
||||
@@ -241,7 +243,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
// Make sure we are using jsc as the narwhal engine!
|
||||
self.environment[@"NARWHAL_ENGINE"] = @"jsc";
|
||||
|
||||
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp"];
|
||||
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp", @"capp_lint"];
|
||||
|
||||
// This is used to get the env var of $CAPP_BUILD
|
||||
NSDictionary *processEnvironment = [[NSProcessInfo processInfo] environment];
|
||||
@@ -317,9 +319,10 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
[self clearErrors:self];
|
||||
[self computeIgnoredPaths];
|
||||
|
||||
|
||||
[self prepareXcodeSupport];
|
||||
[self populateXcodeProject];
|
||||
[self populatexCodeCappTargetedFiles];
|
||||
[self waitForOperationQueueToFinishWithSelector:@selector(projectDidFinishLoading)];
|
||||
}
|
||||
|
||||
@@ -372,6 +375,25 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return projectCompatibilityVersion.doubleValue >= appCompatibilityVersion;
|
||||
}
|
||||
|
||||
- (void)populatexCodeCappTargetedFiles
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSDirectoryEnumerator *filesOfProject = [fm enumeratorAtPath:self.projectPath];
|
||||
NSString *filename;
|
||||
|
||||
self.xCodeCappTargetedFiles = [NSMutableArray array];
|
||||
|
||||
while ((filename = [filesOfProject nextObject] )) {
|
||||
|
||||
NSString *fullPath = [self.projectPath stringByAppendingPathComponent:filename];
|
||||
|
||||
if (![self isSourceFile:fullPath])
|
||||
continue;
|
||||
|
||||
[self.xCodeCappTargetedFiles addObject:fullPath];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createXcodeProject
|
||||
{
|
||||
if ([self.fm fileExistsAtPath:self.xcodeProjectPath])
|
||||
@@ -729,7 +751,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
self.pbxOperations[@"add"] = addPaths;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DDLogVerbose(@"%@ %@", NSStringFromSelector(_cmd), path);
|
||||
}
|
||||
|
||||
@@ -1359,6 +1381,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return [path substringFromIndex:self.projectPath.length + 1];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Shadow Files Management
|
||||
|
||||
- (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path
|
||||
@@ -1636,17 +1659,56 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
[self runTaskWithLaunchPath:executablePath arguments:args returnType:kTaskReturnTypeNone];
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowErrorNotification
|
||||
{
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnErrors];
|
||||
}
|
||||
|
||||
- (BOOL)shouldProcessWithCappLint
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
return [defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint]
|
||||
|| [defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint];
|
||||
}
|
||||
|
||||
- (void)showErrors
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnErrors] && self.hasErrors) ||
|
||||
([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnWarnings] && self.errorList.count))
|
||||
if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnErrors] && self.errorList.count)
|
||||
{
|
||||
[self openErrorsPanel:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showCappLintErrors
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint] && self.errorList.count)
|
||||
[self openErrorsPanel:self];
|
||||
|
||||
if ([defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint])
|
||||
{
|
||||
NSUInteger numberError = [self.errorList count];
|
||||
|
||||
if (numberError)
|
||||
{
|
||||
NSDictionary *error = [self.errorList objectAtIndex:0];
|
||||
NSString *filename = [error objectForKey:@"path"];
|
||||
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInteger:self.projectId] , @"projectId",
|
||||
@"Code Style Issues", @"title",
|
||||
filename.lastPathComponent , @"message",
|
||||
nil];
|
||||
|
||||
[self wantUserNotificationWithInfo:dict];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pruneProcessingErrorsForProjectPath:(NSString *)path
|
||||
{
|
||||
// Remove all errors for the path being processed
|
||||
@@ -1674,6 +1736,113 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return index != NSNotFound;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - capp_lint
|
||||
|
||||
- (IBAction)checkProjectWithCappLint:(id)aSender
|
||||
{
|
||||
[self clearErrors:self];
|
||||
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
[center addObserver:self selector:@selector(cappLintDidEndNotification:) name:XCCCappLintDidEndNotification object:nil];
|
||||
|
||||
[self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.xCodeCappTargetedFiles];
|
||||
}
|
||||
|
||||
- (void)cappLintDidEndNotification:(NSNotification*)aNotification
|
||||
{
|
||||
[self showCappLintErrors];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:XCCCappLintDidEndNotification object:nil];
|
||||
}
|
||||
|
||||
- (BOOL)checkCappLintForPath:(NSArray*)paths
|
||||
{
|
||||
DDLogVerbose(@"Checking path %@ with capp_lint", paths);
|
||||
|
||||
NSUInteger numberOfFiles = [paths count];
|
||||
|
||||
if (!numberOfFiles)
|
||||
return YES;
|
||||
|
||||
self.isProcessing = YES;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidStartNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidStartNotification object:self];
|
||||
|
||||
NSString *baseDirectory = [NSString stringWithFormat:@"--basedir='%@'", self.projectPath];
|
||||
NSMutableArray *arguments = [NSMutableArray arrayWithObjects:baseDirectory, nil];
|
||||
[arguments addObjectsFromArray:paths];
|
||||
|
||||
NSDictionary *taskResult = [self runTaskWithLaunchPath:self.executablePaths[@"capp_lint"]
|
||||
arguments:arguments
|
||||
returnType:kTaskReturnTypeStdOut];
|
||||
|
||||
NSInteger status = [taskResult[@"status"] intValue];
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSString *response = taskResult[@"response"];
|
||||
NSMutableArray *errors = [NSMutableArray arrayWithArray:[response componentsSeparatedByString:@"\n\n"]];
|
||||
|
||||
// We need to remove the first object who is the number of errors and the last object who is an empty line
|
||||
[errors removeLastObject];
|
||||
[errors removeObjectAtIndex:0];
|
||||
|
||||
NSInteger numberOfErrors = [errors count];
|
||||
NSInteger i = 0;
|
||||
NSString *path;
|
||||
NSMutableArray *dicts = [NSMutableArray array];
|
||||
|
||||
if (numberOfFiles == 1)
|
||||
path = [paths objectAtIndex:0];
|
||||
|
||||
for (i = 0; i < numberOfErrors; i++)
|
||||
{
|
||||
NSMutableString *error = (NSMutableString*)[errors objectAtIndex:i];
|
||||
NSString *line;
|
||||
NSString *firstCaract = [NSString stringWithFormat:@"%c" ,[error characterAtIndex:0]];
|
||||
|
||||
if ([[NSScanner scannerWithString:firstCaract] scanInt:nil])
|
||||
error = (NSMutableString*)[NSString stringWithFormat:@"%@:%@", path, error];
|
||||
|
||||
NSInteger positionOfFirstColon = [error rangeOfString:@":"].location;
|
||||
|
||||
if (numberOfFiles > 1)
|
||||
path = [error substringToIndex:positionOfFirstColon];
|
||||
|
||||
NSString *errorWithoutPath = [error substringFromIndex:(positionOfFirstColon + 1)];
|
||||
NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location;
|
||||
line = [errorWithoutPath substringToIndex:positionOfSecondColon];
|
||||
|
||||
NSString *messageError = [NSString stringWithFormat:@"Code style issue: %@ \n%@", path.lastPathComponent, errorWithoutPath];
|
||||
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:[line intValue]], @"line",
|
||||
messageError , @"message",
|
||||
path, @"path",
|
||||
nil];
|
||||
|
||||
[dicts addObject:dict];
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(cappLintConversionDidGenerateError:) withObject:dicts waitUntilDone:NO];
|
||||
|
||||
self.isProcessing = NO;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self];
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)cappLintConversionDidGenerateError:(NSArray*)errors
|
||||
{
|
||||
[self.errorListController addObjects:errors];
|
||||
}
|
||||
|
||||
#pragma mark - User notifications
|
||||
|
||||
- (NSString *)applicationNameForGrowl
|
||||
@@ -1713,8 +1882,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
if ([info[@"projectId"] intValue] != self.projectId)
|
||||
return;
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:kDefaultShowProcessingNotices])
|
||||
[self notifyUserWithTitle:info[@"title"] message:info[@"message"]];
|
||||
[self notifyUserWithTitle:info[@"title"] message:info[@"message"]];
|
||||
}
|
||||
|
||||
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification
|
||||
@@ -1723,6 +1891,14 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification
|
||||
{
|
||||
if ([self.errorList count])
|
||||
[self openErrorsPanel:self];
|
||||
|
||||
[center removeDeliveredNotification:notification];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -281,7 +281,7 @@ class LintChecker(object):
|
||||
},
|
||||
{
|
||||
# Filter out possible = within @accessors
|
||||
'filter': {'regex': re.compile(ur'^\s*(?:@outlet\s+)?[a-zA-Z_$]\w*\s+[a-zA-Z_$]\w*\s+@accessors\b'), 'pass': False},
|
||||
'filter': {'regex': re.compile(ur'^\s*(?:@outlet\s+)?[a-zA-Z_$]\w*\s+(<\s*[a-zA-Z_$]*\s*>\s+)?[a-zA-Z_$]\w*\s+@accessors\b'), 'pass': False},
|
||||
|
||||
'preprocess': STD_IGNORES,
|
||||
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(=|[-+*/%^&|]=|<<=|>>>?=)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
|
||||
@@ -291,7 +291,7 @@ class LintChecker(object):
|
||||
},
|
||||
{
|
||||
# Filter out @import statements and @implementation/method declarations
|
||||
'filter': {'regex': re.compile(ur'^(@import\b|@implementation\b|\s*' + METHOD_RE + ')'), 'pass': False},
|
||||
'filter': {'regex': re.compile(ur'^(@import\b|@implementation\b|@protocol\b|\s*' + METHOD_RE + ')|([a-zA-Z_$]*\s+<\s*[a-zA-Z_$]*\s*>)'), 'pass': False},
|
||||
|
||||
'preprocess': STD_IGNORES,
|
||||
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(===?|!==?|[<>]=?)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
|
||||
@@ -299,6 +299,13 @@ class LintChecker(object):
|
||||
'showPositionForGroup': 2,
|
||||
'type': ERROR_TYPE_WARNING
|
||||
},
|
||||
{
|
||||
'preprocess': STD_IGNORES,
|
||||
'regex': re.compile(ur'^(.*<\s+[a-zA-Z_$]*>.*)|(.*<[a-zA-Z_$]*\s+>.*)|(.*<\s+[a-zA-Z_$]*\s+>.*)'),
|
||||
'error': 'bracket operator with extra spaces',
|
||||
'showPositionForGroup': 0,
|
||||
'type': ERROR_TYPE_WARNING
|
||||
},
|
||||
{
|
||||
'regex': re.compile(ur'^(\s+)' + METHOD_RE + '|^\s*[-+](\()[a-zA-Z_$][\w]*\)\s*[a-zA-Z_$]\w*|^\s*[-+]\s*\([a-zA-Z_$][\w]*\)(\s+)[a-zA-Z_$]\w*'),
|
||||
'error': 'extra or missing space in a method declaration',
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
chmod +x capp_lint
|
||||
|
||||
if [[ ! -d /usr/local/narwhal/bin ]]; then
|
||||
sudo mkdir -p /usr/local/narwhal/bin
|
||||
mkdir -p /usr/local/narwhal/bin
|
||||
fi
|
||||
|
||||
sudo cp capp_lint /usr/local/narwhal/bin
|
||||
cp capp_lint /usr/local/narwhal/bin
|
||||
|
||||
if [[ ! -d /usr/local/share/man/man1 ]]; then
|
||||
sudo mkdir -p /usr/local/share/man/man1
|
||||
mkdir -p /usr/local/share/man/man1
|
||||
fi
|
||||
|
||||
sudo cp capp_lint.1 /usr/local/share/man/man1
|
||||
cp capp_lint.1 /usr/local/share/man/man1
|
||||
@@ -172,7 +172,7 @@
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = fontinfo;
|
||||
SDKROOT = macosx10.5;
|
||||
SDKROOT = macosx;
|
||||
SYMROOT = "$(CAPP_BUILD)/Debug/CommonJS/cappuccino/bin";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -186,7 +186,7 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PRODUCT_NAME = fontinfo;
|
||||
SDKROOT = macosx10.5;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -199,7 +199,6 @@
|
||||
E1D3CF6E12AFEE3900CBB79E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -170,7 +170,6 @@
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = imagesize;
|
||||
SDKROOT = macosx10.5;
|
||||
SYMROOT = "$(CAPP_BUILD)/Debug/CommonJS/cappuccino/bin";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -187,7 +186,6 @@
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = imagesize;
|
||||
SDKROOT = macosx10.5;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -201,7 +199,6 @@
|
||||
E1D3CF6E12AFEE3900CBB79E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||
PRODUCT_NAME = imagesize;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
+3
-2
@@ -206,6 +206,7 @@ done
|
||||
|
||||
github_project="$github_user-cappuccino-base"
|
||||
github_path="$github_user/cappuccino-base"
|
||||
local_project="cappuccino-base"
|
||||
|
||||
# The purpose of bootstrap is to install Cappuccino.
|
||||
install_cappuccino="yes"
|
||||
@@ -317,9 +318,9 @@ if [ "$install_cappuccino" ]; then
|
||||
unzip $quiet_arg "$local_distrib" -d "$install_directory"
|
||||
check_and_exit
|
||||
|
||||
mv "$install_directory/$github_project-"*/* "$install_directory/."
|
||||
mv "$install_directory/$local_project-"*/* "$install_directory/."
|
||||
check_and_exit
|
||||
rm -rf "$install_directory/$github_project-"*
|
||||
rm -rf "$install_directory/$local_project-"*
|
||||
check_and_exit
|
||||
else
|
||||
zip_ball="https://github.com/$github_path/zipball/$github_ref"
|
||||
|
||||
Reference in new issue
Block a user