├── .gitignore
├── .travis.yml
├── Checkman.xcodeproj
└── project.pbxproj
├── Checkman.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ └── Checkman.xccheckout
├── Checkman
├── ApplicationDelegate.h
├── ApplicationDelegate.m
├── AsyncTask.h
├── AsyncTask.m
├── Check.h
├── Check.m
├── CheckCollection.h
├── CheckCollection.m
├── CheckDebuggingView.h
├── CheckDebuggingView.m
├── CheckDebuggingWindow.h
├── CheckDebuggingWindow.m
├── CheckManager.h
├── CheckManager.m
├── CheckMenuItem.h
├── CheckMenuItem.m
├── CheckRun.h
├── CheckRun.m
├── Checkfile.h
├── Checkfile.m
├── CheckfileCollection.h
├── CheckfileCollection.m
├── CheckfileEntry.h
├── CheckfileEntry.m
├── Checkman-Info.plist
├── Checkman-Prefix.pch
├── CustomNotification.h
├── CustomNotification.m
├── CustomNotifier.h
├── CustomNotifier.m
├── FSChanges.h
├── FSChangesDispatchWatcher.h
├── FSChangesDispatchWatcher.m
├── FSChangesNotifier.h
├── FSChangesNotifier.m
├── FSChangesObserver.h
├── FSChangesObserver.m
├── FSChangesTracker.h
├── FSChangesTracker.m
├── Growl.framework
│ ├── Growl
│ ├── Headers
│ ├── Resources
│ └── Versions
│ │ ├── A
│ │ ├── Growl
│ │ ├── Headers
│ │ │ ├── Growl.h
│ │ │ ├── GrowlApplicationBridge.h
│ │ │ └── GrowlDefines.h
│ │ ├── Resources
│ │ │ └── Info.plist
│ │ └── _CodeSignature
│ │ │ └── CodeResources
│ │ └── Current
├── GrowlNotification.h
├── GrowlNotification.m
├── GrowlNotifier.h
├── GrowlNotifier.m
├── HTTPConnection.h
├── HTTPConnection.m
├── HTTPRequest.h
├── HTTPRequest.m
├── HTTPServer.h
├── HTTPServer.m
├── Images
│ ├── icon-fail-changing.png
│ ├── icon-fail.png
│ ├── icon-ok-changing.png
│ ├── icon-ok.png
│ ├── icon-undetermined-changing.png
│ ├── icon-undetermined.png
│ └── icons.sketch
│ │ ├── Data
│ │ ├── QuickLook
│ │ ├── Preview.png
│ │ └── Thumbnail.png
│ │ ├── fonts
│ │ └── version
├── InfoMenuItem.h
├── InfoMenuItem.m
├── MenuController.h
├── MenuController.m
├── NSCustomTicker.h
├── NSCustomTicker.m
├── NSObject+Delayed.h
├── NSObject+Delayed.m
├── NSWindow+KeepOpen.h
├── NSWindow+KeepOpen.m
├── NotificationPanel.h
├── NotificationPanel.m
├── NotificationPanelView.h
├── NotificationPanelView.m
├── NotificationsController.h
├── NotificationsController.m
├── SectionedMenu.h
├── SectionedMenu.m
├── SeparatorMenuItem.h
├── SeparatorMenuItem.m
├── Settings.h
├── Settings.m
├── StickiesController.h
├── StickiesController.m
├── Sticky.h
├── Sticky.m
├── StickyPanel.h
├── StickyPanel.m
├── StickyPanelView.h
├── StickyPanelView.m
├── TCPBufferedStreams.h
├── TCPBufferedStreams.m
├── TCPConnection.h
├── TCPConnection.m
├── TCPServer.h
├── TCPServer.m
├── TaggedObject.h
├── TaggedObject.m
├── WebSocketConnection.h
├── WebSocketConnection.m
├── WebSocketFrame.h
├── WebSocketFrame.m
├── WebSocketSec.h
├── WebSocketSec.m
├── WebUI.h
├── WebUI.m
├── WebUIHandler.h
├── WebUIHandler.m
├── WebUIMessages.h
├── WebUIMessages.m
├── WebUIStaticFileHandler.h
├── WebUIStaticFileHandler.m
├── WebUIWebSocketHandler.h
├── WebUIWebSocketHandler.m
├── en.lproj
│ └── MainMenu.xib
└── main.m
├── CheckmanTests
├── CedarAsync
│ ├── Headers
│ │ ├── AsyncActualValue.h
│ │ ├── CedarAsync.h
│ │ ├── InTimeShouldSyntax.h
│ │ └── Timing.h
│ └── Timing.mm
├── CheckCollectionSpec.mm
├── CheckmanTests-Info.plist
├── CheckmanTests-Prefix.pch
├── FSChangesNotifierSpec.mm
├── Frameworks
│ └── Cedar.framework
│ │ ├── Cedar
│ │ ├── Headers
│ │ ├── ActualValue.h
│ │ ├── AnyArgument.h
│ │ ├── AnyInstanceArgument.h
│ │ ├── Argument.h
│ │ ├── Base.h
│ │ ├── BeCloseTo.h
│ │ ├── BeEmpty.h
│ │ ├── BeGTE.h
│ │ ├── BeGreaterThan.h
│ │ ├── BeInstanceOf.h
│ │ ├── BeLTE.h
│ │ ├── BeLessThan.h
│ │ ├── BeNil.h
│ │ ├── BeSameInstanceAs.h
│ │ ├── BeTruthy.h
│ │ ├── CDRClassFake.h
│ │ ├── CDRExampleBase.h
│ │ ├── CDRExampleParent.h
│ │ ├── CDRExampleReporter.h
│ │ ├── CDRFake.h
│ │ ├── CDRFunctions.h
│ │ ├── CDRProtocolFake.h
│ │ ├── CDRSharedExampleGroupPool.h
│ │ ├── CDRSpec.h
│ │ ├── CDRSpecFailure.h
│ │ ├── CDRSpy.h
│ │ ├── Cedar.h
│ │ ├── CedarComparators.h
│ │ ├── CedarDouble.h
│ │ ├── CedarDoubles.h
│ │ ├── CedarMatchers.h
│ │ ├── CedarStringifiers.h
│ │ ├── ComparatorsBase.h
│ │ ├── ComparatorsContainer.h
│ │ ├── CompareEqual.h
│ │ ├── CompareGreaterThan.h
│ │ ├── Contain.h
│ │ ├── Equal.h
│ │ ├── HaveReceived.h
│ │ ├── InvocationMatcher.h
│ │ ├── RaiseException.h
│ │ ├── ReturnValue.h
│ │ ├── ShouldSyntax.h
│ │ ├── SpecHelper.h
│ │ ├── StringifiersBase.h
│ │ ├── StringifiersContainer.h
│ │ ├── StubbedMethod.h
│ │ └── ValueArgument.h
│ │ ├── Resources
│ │ └── Info.plist
│ │ └── Versions
│ │ ├── A
│ │ ├── Cedar
│ │ ├── Headers
│ │ │ ├── ActualValue.h
│ │ │ ├── AnyArgument.h
│ │ │ ├── AnyInstanceArgument.h
│ │ │ ├── Argument.h
│ │ │ ├── Base.h
│ │ │ ├── BeCloseTo.h
│ │ │ ├── BeEmpty.h
│ │ │ ├── BeGTE.h
│ │ │ ├── BeGreaterThan.h
│ │ │ ├── BeInstanceOf.h
│ │ │ ├── BeLTE.h
│ │ │ ├── BeLessThan.h
│ │ │ ├── BeNil.h
│ │ │ ├── BeSameInstanceAs.h
│ │ │ ├── BeTruthy.h
│ │ │ ├── CDRClassFake.h
│ │ │ ├── CDRExampleBase.h
│ │ │ ├── CDRExampleParent.h
│ │ │ ├── CDRExampleReporter.h
│ │ │ ├── CDRFake.h
│ │ │ ├── CDRFunctions.h
│ │ │ ├── CDRProtocolFake.h
│ │ │ ├── CDRSharedExampleGroupPool.h
│ │ │ ├── CDRSpec.h
│ │ │ ├── CDRSpecFailure.h
│ │ │ ├── CDRSpy.h
│ │ │ ├── Cedar.h
│ │ │ ├── CedarComparators.h
│ │ │ ├── CedarDouble.h
│ │ │ ├── CedarDoubles.h
│ │ │ ├── CedarMatchers.h
│ │ │ ├── CedarStringifiers.h
│ │ │ ├── ComparatorsBase.h
│ │ │ ├── ComparatorsContainer.h
│ │ │ ├── CompareEqual.h
│ │ │ ├── CompareGreaterThan.h
│ │ │ ├── Contain.h
│ │ │ ├── Equal.h
│ │ │ ├── HaveReceived.h
│ │ │ ├── InvocationMatcher.h
│ │ │ ├── RaiseException.h
│ │ │ ├── ReturnValue.h
│ │ │ ├── ShouldSyntax.h
│ │ │ ├── SpecHelper.h
│ │ │ ├── StringifiersBase.h
│ │ │ ├── StringifiersContainer.h
│ │ │ ├── StubbedMethod.h
│ │ │ └── ValueArgument.h
│ │ └── Resources
│ │ │ └── Info.plist
│ │ └── Current
│ │ ├── Cedar
│ │ ├── Headers
│ │ ├── ActualValue.h
│ │ ├── AnyArgument.h
│ │ ├── AnyInstanceArgument.h
│ │ ├── Argument.h
│ │ ├── Base.h
│ │ ├── BeCloseTo.h
│ │ ├── BeEmpty.h
│ │ ├── BeGTE.h
│ │ ├── BeGreaterThan.h
│ │ ├── BeInstanceOf.h
│ │ ├── BeLTE.h
│ │ ├── BeLessThan.h
│ │ ├── BeNil.h
│ │ ├── BeSameInstanceAs.h
│ │ ├── BeTruthy.h
│ │ ├── CDRClassFake.h
│ │ ├── CDRExampleBase.h
│ │ ├── CDRExampleParent.h
│ │ ├── CDRExampleReporter.h
│ │ ├── CDRFake.h
│ │ ├── CDRFunctions.h
│ │ ├── CDRProtocolFake.h
│ │ ├── CDRSharedExampleGroupPool.h
│ │ ├── CDRSpec.h
│ │ ├── CDRSpecFailure.h
│ │ ├── CDRSpy.h
│ │ ├── Cedar.h
│ │ ├── CedarComparators.h
│ │ ├── CedarDouble.h
│ │ ├── CedarDoubles.h
│ │ ├── CedarMatchers.h
│ │ ├── CedarStringifiers.h
│ │ ├── ComparatorsBase.h
│ │ ├── ComparatorsContainer.h
│ │ ├── CompareEqual.h
│ │ ├── CompareGreaterThan.h
│ │ ├── Contain.h
│ │ ├── Equal.h
│ │ ├── HaveReceived.h
│ │ ├── InvocationMatcher.h
│ │ ├── RaiseException.h
│ │ ├── ReturnValue.h
│ │ ├── ShouldSyntax.h
│ │ ├── SpecHelper.h
│ │ ├── StringifiersBase.h
│ │ ├── StringifiersContainer.h
│ │ ├── StubbedMethod.h
│ │ └── ValueArgument.h
│ │ └── Resources
│ │ └── Info.plist
├── SectionedMenu+InsertItemSpec.mm
├── SectionedMenu+InsertSectionSpec.mm
├── SectionedMenu+RemoveSectionSpec.mm
└── en.lproj
│ └── InfoPlist.strings
├── LICENSE
├── README.md
├── Rakefile
├── bin
├── Checkman.zip
├── build
└── install
├── screenshots
└── checkman.jpg
├── scripts
├── airbrake.check
├── buildkite.check
├── cctray.check
├── cf_apps.check
├── circleci.check
├── circlecijson.check
├── codeship.check
├── concourse.check
├── github_issues.check
├── jenkins_build.check
├── semaphore.check
├── site.check
├── site_with_retry.check
├── snapci.check
├── specs
│ ├── Gemfile
│ ├── Gemfile.lock
│ ├── buildkite_spec.rb
│ ├── cctray_spec.rb
│ ├── check_shared_examples.rb
│ ├── circleci_spec.rb
│ ├── circlecijson_spec.rb
│ ├── concourse_spec.rb
│ ├── fixtures
│ │ └── .flyrc
│ ├── github_issues_spec.rb
│ ├── jenkins_build_spec.rb
│ ├── semaphore_spec.rb
│ ├── site_spec.rb
│ ├── spec_helper.rb
│ ├── tddium_spec.rb
│ ├── test_spec.rb
│ ├── tracker_spec.rb
│ └── travis_spec.rb
├── tddium.check
├── test.check
├── tracker.check
└── travis.check
└── web_ui
├── check.js
├── checks.js
├── connection.js
├── heart_beat.js
├── index.html
├── styles.css
└── ui.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | build/*
3 | *.pbxuser
4 | !default.pbxuser
5 | *.mode1v3
6 | !default.mode1v3
7 | *.mode2v3
8 | !default.mode2v3
9 | *.perspectivev3
10 | !default.perspectivev3
11 | !default.xcworkspace
12 | xcuserdata
13 | profile
14 | *.moved-aside
15 | # Rubymine
16 | .idea
17 | # Finder
18 | .DS_Store
19 | #deploy script
20 | deploy
21 | rakefile*.rb
22 | upload*.sh
23 | pkg/
24 |
25 | # default project workspace
26 | project.xcworkspace
27 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 |
3 | rvm:
4 | - 2.3
5 | - 2.4
6 | - 2.5
7 | - 2.6
8 |
9 | script: >
10 | gem install bundler &&
11 | bundle install --gemfile=./scripts/specs/Gemfile &&
12 | LC_CTYPE="en_US.UTF-8" rake
13 |
--------------------------------------------------------------------------------
/Checkman.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Checkman.xcworkspace/xcshareddata/Checkman.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | C87D0A9D-903A-4BC2-911F-60C857D77905
9 | IDESourceControlProjectName
10 | Checkman
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 317A134F-2B96-4CD2-A4A4-BCDEF0F1E398
14 | http://github.com/cppforlife/checkman
15 |
16 | IDESourceControlProjectPath
17 | Checkman.xcworkspace
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 317A134F-2B96-4CD2-A4A4-BCDEF0F1E398
21 | ..
22 |
23 | IDESourceControlProjectURL
24 | http://github.com/cppforlife/checkman
25 | IDESourceControlProjectVersion
26 | 110
27 | IDESourceControlProjectWCCIdentifier
28 | 317A134F-2B96-4CD2-A4A4-BCDEF0F1E398
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 317A134F-2B96-4CD2-A4A4-BCDEF0F1E398
36 | IDESourceControlWCCName
37 | checkman
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Checkman/ApplicationDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface ApplicationDelegate : NSObject
4 | @end
5 |
--------------------------------------------------------------------------------
/Checkman/AsyncTask.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class AsyncTask;
4 |
5 | @protocol AsyncTaskDelegate
6 | // Will be executed on the thread started by -run.
7 | - (void)asyncTaskDidComplete:(AsyncTask *)task;
8 | @end
9 |
10 | @interface AsyncTask : NSObject
11 |
12 | @property (nonatomic, assign) id delegate;
13 |
14 | - (void)setLaunchPath:(NSString *)launchPath;
15 | - (void)setCurrentDirectoryPath:(NSString *)currentDirectoryPath;
16 | - (void)setArguments:(NSArray *)arguments;
17 |
18 | // Runs task on a separate thread in a non-blocking manner.
19 | - (void)run;
20 |
21 | - (NSData *)stdOutData;
22 | - (NSData *)stdErrData;
23 | @end
24 |
25 | @interface AsyncTask (Bash)
26 | + (AsyncTask *)bashTaskWithCommand:(NSString *)command
27 | directoryPath:(NSString *)directoryPath;
28 | @end
29 |
30 | @interface AsyncTask (Command)
31 | - (NSString *)executedCommand;
32 | @end
33 |
--------------------------------------------------------------------------------
/Checkman/Check.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "TaggedObject.h"
3 |
4 | typedef enum {
5 | CheckStatusOk = 99,
6 | CheckStatusFail = 98,
7 | CheckStatusUndetermined = 97
8 | } CheckStatus;
9 |
10 | @class Check;
11 |
12 | @protocol CheckDelegate
13 | - (void)checkDidChangeStatus:(NSNotification *)notification;
14 | - (void)checkDidChangeChanging:(NSNotification *)notification;
15 | - (void)checkDidChangeRunning:(NSNotification *)notification;
16 | @end
17 |
18 | @interface Check : TaggedObject
19 |
20 | @property (nonatomic, strong) NSString *primaryContextName;
21 | @property (nonatomic, strong) NSString *secondaryContextName;
22 |
23 | @property (nonatomic, assign) NSUInteger runInterval;
24 | @property (nonatomic, assign, getter = isDisabled) BOOL disabled;
25 |
26 | - (id)initWithName:(NSString *)name
27 | command:(NSString *)command
28 | directoryPath:(NSString *)directoryPath;
29 |
30 | - (NSString *)name;
31 | - (NSString *)command;
32 |
33 | - (void)startImmediately:(BOOL)immediately;
34 | - (void)stop;
35 | - (BOOL)isRunning;
36 | - (BOOL)isAfterFirstRun;
37 |
38 | - (CheckStatus)status;
39 | - (BOOL)isChanging;
40 |
41 | - (NSArray *)info;
42 | - (NSURL *)url;
43 | @end
44 |
45 | @interface Check (Observers)
46 | - (void)addObserver:(id)observer;
47 | - (void)removeObserver:(id)observer;
48 | @end
49 |
50 | @interface Check (Image)
51 | + (NSString *)statusImageNameForCheckStatus:(CheckStatus)status changing:(BOOL)changing;
52 | @end
53 |
54 | @interface Check (Notification)
55 | - (NSString *)statusNotificationName;
56 | - (NSString *)statusNotificationStatus;
57 | - (NSString *)statusNotificationText;
58 | - (NSColor *)statusNotificationColor;
59 | @end
60 |
61 | @interface Check (Debugging)
62 | - (NSString *)executedCommand;
63 | - (NSString *)stdOut;
64 | - (NSString *)stdErr;
65 | @end
66 |
--------------------------------------------------------------------------------
/Checkman/CheckCollection.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "Check.h"
3 |
4 | @class CheckCollection;
5 |
6 | @protocol CheckCollectionDelegate
7 | - (void)checkCollection:(CheckCollection *)collection
8 | didUpdateStatusFromCheck:(Check *)check;
9 |
10 | - (void)checkCollection:(CheckCollection *)collection
11 | didUpdateChangingFromCheck:(Check *)check;
12 |
13 | @optional
14 | - (void)checkCollection:(CheckCollection *)collection
15 | checkDidChangeStatus:(Check *)check;
16 |
17 | - (void)checkCollection:(CheckCollection *)collection
18 | checkDidChangeChanging:(Check *)check;
19 | @end
20 |
21 | @interface CheckCollection : NSObject
22 |
23 | @property (nonatomic, assign) id delegate;
24 |
25 | - (void)addCheck:(Check *)check;
26 | - (void)removeCheck:(Check *)check;
27 |
28 | - (NSUInteger)indexOfCheck:(Check *)check;
29 | - (Check *)checkWithTag:(NSInteger)tag;
30 |
31 | - (CheckStatus)status;
32 | - (BOOL)isChanging;
33 |
34 | - (NSString *)statusDescription;
35 | - (NSString *)extendedStatusDescription;
36 |
37 | - (NSUInteger)numberOfDisabledChecks;
38 | - (NSUInteger)count;
39 | @end
40 |
--------------------------------------------------------------------------------
/Checkman/CheckDebuggingView.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Check;
4 |
5 | @interface CheckDebuggingView : NSView
6 | - (id)initWithCheck:(Check *)check;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/CheckDebuggingWindow.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "NSWindow+KeepOpen.h"
3 |
4 | @class Check;
5 |
6 | @interface CheckDebuggingWindow : NSWindow
7 | - (id)initWithCheck:(Check *)check;
8 | - (void)show;
9 | @end
10 |
--------------------------------------------------------------------------------
/Checkman/CheckDebuggingWindow.m:
--------------------------------------------------------------------------------
1 | #import "CheckDebuggingWindow.h"
2 | #import "CheckDebuggingView.h"
3 | #import "Check.h"
4 |
5 | @interface CheckDebuggingWindow ()
6 | @property (nonatomic, strong) Check *check;
7 | @end
8 |
9 | @implementation CheckDebuggingWindow
10 | @synthesize check = _check;
11 |
12 | - (id)initWithCheck:(Check *)check {
13 | if (self = [super init]) {
14 | self.check = check;
15 | self.contentView = [[CheckDebuggingView alloc] initWithCheck:check];
16 |
17 | self.title = check.name;
18 | self.styleMask =
19 | NSBorderlessWindowMask | NSTitledWindowMask |
20 | NSClosableWindowMask | NSResizableWindowMask;
21 | }
22 | return self;
23 | }
24 |
25 | - (void)show {
26 | [self setFrame:NSMakeRect(0, 0, 400, 500) display:NO];
27 | [self center];
28 | [self makeKeyAndOrderFront:nil];
29 | [self orderFrontRegardless];
30 | }
31 | @end
32 |
--------------------------------------------------------------------------------
/Checkman/CheckManager.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class MenuController, StickiesController, NotificationsController, WebUI, Settings;
4 |
5 | @interface CheckManager : NSObject
6 |
7 | - (id)initWithMenuController:(MenuController *)menuController
8 | stickiesController:(StickiesController *)stickiesController
9 | notificationsController:(NotificationsController *)notificationsController
10 | webUI:(WebUI *)webUI
11 | settings:(Settings *)settings;
12 |
13 | - (void)loadCheckfiles;
14 | - (void)reloadCheckfiles;
15 | @end
16 |
--------------------------------------------------------------------------------
/Checkman/CheckMenuItem.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CheckMenuItem, Check;
4 |
5 | @protocol CheckMenuItemDelegate
6 | - (void)checkMenuItemWasClicked:(CheckMenuItem *)item;
7 | @end
8 |
9 | @interface CheckMenuItem : NSMenuItem
10 |
11 | @property (nonatomic, assign) id delegate;
12 |
13 | - (id)initWithCheck:(Check *)check;
14 | - (Check *)check;
15 | @end
16 |
--------------------------------------------------------------------------------
/Checkman/CheckRun.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CheckRun;
4 |
5 | @protocol CheckRunDelegate
6 | - (void)checkRunDidFinish:(CheckRun *)run;
7 | @end
8 |
9 | @interface CheckRun : NSObject
10 |
11 | @property (nonatomic, assign) id delegate;
12 |
13 | - (id)initWithCommand:(NSString *)command
14 | directoryPath:(NSString *)directoryPath;
15 |
16 | - (void)start;
17 | - (BOOL)isValid;
18 |
19 | - (BOOL)isSuccessful;
20 | - (BOOL)isChanging;
21 | - (NSURL *)url;
22 | - (NSArray *)info;
23 | @end
24 |
25 | @interface CheckRun (Debugging)
26 | - (NSString *)executedCommand;
27 | - (NSString *)stdOut;
28 | - (NSString *)stdErr;
29 | @end
30 |
--------------------------------------------------------------------------------
/Checkman/Checkfile.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "TaggedObject.h"
3 |
4 | @class Checkfile, CheckfileEntry, FSChangesNotifier;
5 |
6 | @protocol CheckfileDelegate
7 | - (void)checkfile:(Checkfile *)checkfile didAddEntry:(CheckfileEntry *)entry;
8 | - (void)checkfile:(Checkfile *)checkfile willRemoveEntry:(CheckfileEntry *)entry;
9 | @end
10 |
11 | @interface Checkfile : TaggedObject
12 |
13 | @property (nonatomic, assign) id delegate;
14 |
15 | - (id)initWithFilePath:(NSString *)filePath
16 | fsChangesNotifier:(FSChangesNotifier *)fsChangesNotifier;
17 |
18 | - (NSString *)name;
19 | - (NSString *)resolvedDirectoryPath;
20 |
21 | - (void)trackChanges;
22 |
23 | - (NSArray *)entries;
24 | - (NSUInteger)indexOfEntry:(CheckfileEntry *)entry;
25 | @end
26 |
--------------------------------------------------------------------------------
/Checkman/CheckfileCollection.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CheckfileCollection, Checkfile;
4 |
5 | @protocol CheckfileCollectionDelegate
6 | - (void)checkfileCollection:(CheckfileCollection *)collection
7 | didAddCheckfile:(Checkfile *)checkfile;
8 |
9 | - (void)checkfileCollection:(CheckfileCollection *)collection
10 | willRemoveCheckfile:(Checkfile *)checkfile;
11 | @end
12 |
13 | @interface CheckfileCollection : NSObject
14 |
15 | @property (nonatomic, assign) id delegate;
16 |
17 | + (CheckfileCollection *)collectionFromCheckmanUserDirectoryPath;
18 |
19 | - (id)initWithDirectoryPath:(NSString *)directoryPath;
20 |
21 | - (void)trackChanges;
22 | - (void)reloadFiles;
23 |
24 | - (NSArray *)files;
25 | - (NSUInteger)indexOfCheckfile:(Checkfile *)checkfile;
26 | @end
27 |
--------------------------------------------------------------------------------
/Checkman/CheckfileEntry.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "TaggedObject.h"
3 |
4 | @interface CheckfileEntry : TaggedObject
5 | + (CheckfileEntry *)fromLine:(NSString *)line;
6 |
7 | - (BOOL)isCommandEntry;
8 | - (BOOL)isSeparatorEntry;
9 | - (BOOL)isTitledSeparatorEntry;
10 | @end
11 |
12 | @interface CheckfileCommandEntry : CheckfileEntry
13 | // e.g. 'command-name: bash command'
14 | + (CheckfileCommandEntry *)fromLine:(NSString *)line;
15 |
16 | @property (nonatomic, retain) NSString *primaryContextName;
17 | @property (nonatomic, retain) NSString *secondaryContextName;
18 |
19 | - (id)initWithName:(NSString *)name command:(NSString *)command;
20 | - (NSString *)name;
21 | - (NSString *)command;
22 | @end
23 |
24 | @interface CheckfileSeparatorEntry : CheckfileEntry
25 | // e.g. '#-'
26 | + (CheckfileSeparatorEntry *)fromLine:(NSString *)line;
27 | @end
28 |
29 | @interface CheckfileTitledSeparatorEntry : CheckfileEntry
30 | // e.g. '#- title for a separator'
31 | + (CheckfileTitledSeparatorEntry *)fromLine:(NSString *)line;
32 |
33 | - (id)initWithTitle:(NSString *)title;
34 | - (NSString *)title;
35 | @end
36 |
--------------------------------------------------------------------------------
/Checkman/Checkman-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | com.tomato.Checkman
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 7
25 | LSApplicationCategoryType
26 | public.app-category.utilities
27 | LSMinimumSystemVersion
28 | ${MACOSX_DEPLOYMENT_TARGET}
29 | LSUIElement
30 |
31 | NSMainNibFile
32 | MainMenu
33 | Git SHA
34 | GIT_SHA_PLACEHOLDER
35 | NSPrincipalClass
36 | NSApplication
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Checkman/Checkman-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'Checkman' target in the 'Checkman' project
3 | //
4 |
5 | #ifdef __OBJC__
6 |
7 | #import
8 |
9 | #endif
10 |
11 | #define F(f, ...) [NSString stringWithFormat:f, ##__VA_ARGS__]
12 |
--------------------------------------------------------------------------------
/Checkman/CustomNotification.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface CustomNotification : NSObject
4 | @property (nonatomic, strong) NSString *name;
5 | @property (nonatomic, strong) NSString *status;
6 | @property (nonatomic, strong) NSColor *color;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/CustomNotification.m:
--------------------------------------------------------------------------------
1 | #import "CustomNotification.h"
2 |
3 | @implementation CustomNotification
4 | @synthesize
5 | name = _name,
6 | status = _status,
7 | color = _color;
8 | @end
9 |
--------------------------------------------------------------------------------
/Checkman/CustomNotifier.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CustomNotification;
4 |
5 | @interface CustomNotifier : NSObject
6 | - (void)showNotification:(CustomNotification *)notification;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/FSChanges.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @protocol FSChangesObserver;
4 |
5 | @protocol FSChangesTracker
6 | - (void)startTrackingFilePath:(NSString *)filePath
7 | observer:(id)observer;
8 |
9 | - (void)stopTrackingFilePath:(NSString *)filePath
10 | observer:(id)observer;
11 | @end
12 |
13 | @protocol FSChangesObserver
14 | - (void)handleChangeForFilePath:(NSString *)path
15 | tracker:(id)tracker;
16 | @end
17 |
--------------------------------------------------------------------------------
/Checkman/FSChangesDispatchWatcher.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class FSChangesDispatchWatcher;
4 |
5 | @protocol FSChangesDispatchWatcherDelegate
6 | - (void)fsChangesDispatchWatcher:(FSChangesDispatchWatcher *)watcher
7 | didNoticeChangeToPath:(NSString *)path;
8 | @end
9 |
10 | @interface FSChangesDispatchWatcher : NSObject
11 | @property (nonatomic, assign) id delegate;
12 |
13 | - (void)addPath:(NSString *)path;
14 | - (void)removePath:(NSString *)path;
15 | @end
16 |
--------------------------------------------------------------------------------
/Checkman/FSChangesDispatchWatcher.m:
--------------------------------------------------------------------------------
1 | #import "FSChangesDispatchWatcher.h"
2 |
3 | @interface FSChangesDispatchWatcher ()
4 | @property (nonatomic, assign) dispatch_queue_t queue;
5 | @property (nonatomic, assign) dispatch_group_t group;
6 | @property (nonatomic, strong) NSMutableDictionary *paths;
7 | @end
8 |
9 | @implementation FSChangesDispatchWatcher
10 | @synthesize
11 | delegate = _delegate,
12 | queue = _queue,
13 | group = _group,
14 | paths = _paths;
15 |
16 | - (id)init {
17 | if (self = [super init]) {
18 | self.queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
19 | self.group = dispatch_group_create();
20 | self.paths = [NSMutableDictionary dictionary];
21 | }
22 | return self;
23 | }
24 |
25 | - (void)dealloc {
26 | NSAssert(self.paths.count == 0, @"All paths must be removed.");
27 | dispatch_group_leave(self.group);
28 | #if !__has_feature(objc_arc)
29 | [super dealloc];
30 | #endif
31 | }
32 |
33 | - (void)addPath:(NSString *)path {
34 | int fd = open(path.UTF8String, O_EVTONLY);
35 | if (fd <= 0) return NSLog(@"FSChangesDispatchWatcher - addPath: failed to add %@", path);
36 |
37 | dispatch_source_t source = dispatch_source_create(
38 | DISPATCH_SOURCE_TYPE_VNODE, (uintptr_t)fd,
39 | DISPATCH_VNODE_WRITE, self.queue);
40 |
41 | NSValue *sourcePointer =
42 | [NSValue value:&source withObjCType:@encode(dispatch_source_t)];
43 | [self.paths setObject:sourcePointer forKey:path];
44 |
45 | __block typeof(self) that = self;
46 | dispatch_source_set_cancel_handler(source, ^{ close(fd); });
47 | dispatch_source_set_event_handler(source, ^{
48 | [that.delegate fsChangesDispatchWatcher:that didNoticeChangeToPath:path];
49 | });
50 |
51 | dispatch_resume(source);
52 | }
53 |
54 | - (void)removePath:(NSString *)path {
55 | dispatch_source_t source = NULL;
56 | [[self.paths objectForKey:path] getValue:&source];
57 |
58 | if (source) {
59 | dispatch_source_cancel(source);
60 | [self.paths removeObjectForKey:path];
61 | }
62 | }
63 | @end
64 |
--------------------------------------------------------------------------------
/Checkman/FSChangesNotifier.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class FSChangesNotifier;
4 |
5 | @protocol FSChangesNotifierDelegate
6 | - (void)fsChangesNotifier:(FSChangesNotifier *)notifier
7 | filePathDidChange:(NSString *)filePath;
8 | @end
9 |
10 | @interface FSChangesNotifier : NSObject
11 |
12 | + (FSChangesNotifier *)sharedNotifier;
13 |
14 | - (void)startNotifying:(id)delegate
15 | forFilePath:(NSString *)filePath;
16 |
17 | - (void)stopNotifying:(id)delegate;
18 | @end
19 |
--------------------------------------------------------------------------------
/Checkman/FSChangesObserver.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "FSChanges.h"
3 |
4 | @class FSChangesObserver;
5 |
6 | @protocol FSChangesObserverDelegate
7 | - (void)fsChangesObserverDidNoticeChange:(FSChangesObserver *)observer;
8 | @end
9 |
10 | @interface FSChangesObserver : NSObject
11 |
12 | @property (nonatomic, assign) id delegate;
13 |
14 | - (id)initWithFilePath:(NSString *)filePath;
15 | - (NSString *)filePath;
16 |
17 | - (void)startTracking:(id)tracker;
18 | - (void)stopTracking:(id)tracker;
19 |
20 | - (void)handleChangeForFilePath:(NSString *)filePath
21 | tracker:(id)tracker;
22 | @end
23 |
--------------------------------------------------------------------------------
/Checkman/FSChangesTracker.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "FSChanges.h"
3 |
4 | @interface FSChangesTracker : NSObject
5 | @end
6 |
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Growl:
--------------------------------------------------------------------------------
1 | Versions/Current/Growl
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Versions/A/Growl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Growl.framework/Versions/A/Growl
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Versions/A/Headers/Growl.h:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #ifdef __OBJC__
4 | # include
5 | #endif
6 |
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Versions/A/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | BuildMachineOSBuild
6 | 12C60
7 | CFBundleDevelopmentRegion
8 | English
9 | CFBundleExecutable
10 | Growl
11 | CFBundleIdentifier
12 | com.growl.growlframework
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 2.0.1
19 | CFBundleSignature
20 | GRRR
21 | CFBundleVersion
22 | 2.0.1
23 | DTCompiler
24 | com.apple.compilers.llvm.clang.1_0
25 | DTPlatformBuild
26 | 4G2008a
27 | DTPlatformVersion
28 | GM
29 | DTSDKBuild
30 | 12C37
31 | DTSDKName
32 | macosx10.8
33 | DTXcode
34 | 0452
35 | DTXcodeBuild
36 | 4G2008a
37 | NSPrincipalClass
38 | GrowlApplicationBridge
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Versions/A/_CodeSignature/CodeResources:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | files
6 |
7 | Resources/Info.plist
8 |
9 | VZb3f8My4te/5JwcjfvotgCXTAs=
10 |
11 |
12 | rules
13 |
14 | ^Resources/
15 |
16 | ^Resources/.*\.lproj/
17 |
18 | optional
19 |
20 | weight
21 | 1000
22 |
23 | ^Resources/.*\.lproj/locversion.plist$
24 |
25 | omit
26 |
27 | weight
28 | 1100
29 |
30 | ^version.plist$
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Checkman/Growl.framework/Versions/Current:
--------------------------------------------------------------------------------
1 | A
--------------------------------------------------------------------------------
/Checkman/GrowlNotification.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface GrowlNotification : NSObject
4 | @property (nonatomic, strong) NSString *name;
5 | @property (nonatomic, strong) NSString *status;
6 | @property (nonatomic, strong) NSString *type;
7 | @property (nonatomic, assign) NSInteger tag;
8 |
9 | - (NSNumber *)tagAsNumber;
10 | @end
11 |
--------------------------------------------------------------------------------
/Checkman/GrowlNotification.m:
--------------------------------------------------------------------------------
1 | #import "GrowlNotification.h"
2 |
3 | @implementation GrowlNotification
4 | @synthesize
5 | name = _name,
6 | status = _status,
7 | type = _type,
8 | tag = _tag;
9 |
10 | - (NSNumber *)tagAsNumber {
11 | return [NSNumber numberWithInteger:self.tag];
12 | }
13 | @end
14 |
--------------------------------------------------------------------------------
/Checkman/GrowlNotifier.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class GrowlNotification, GrowlNotifier;
4 |
5 | @protocol GrowlNotifierDelegate
6 | - (void)growlNotifier:(GrowlNotifier *)notifier
7 | didClickOnNotificationWithTag:(NSInteger)tag;
8 | @end
9 |
10 | @interface GrowlNotifier : NSObject
11 |
12 | @property (nonatomic, assign) id delegate;
13 |
14 | - (id)initWithNotificationTypes:(NSDictionary *)notificationTypes;
15 |
16 | - (BOOL)canShowNotification;
17 | - (void)showNotification:(GrowlNotification *)notification;
18 | @end
19 |
--------------------------------------------------------------------------------
/Checkman/GrowlNotifier.m:
--------------------------------------------------------------------------------
1 | #import "GrowlNotifier.h"
2 | #import "GrowlNotification.h"
3 | #import
4 |
5 | @interface GrowlNotifier ()
6 | @property (nonatomic, strong) NSDictionary *notificationTypes;
7 | @property (nonatomic, assign) BOOL canShowNotification;
8 | @end
9 |
10 | @implementation GrowlNotifier
11 | @synthesize
12 | delegate = _delegate,
13 | notificationTypes = _notificationTypes,
14 | canShowNotification = _canShowNotification;
15 |
16 | - (id)initWithNotificationTypes:(NSDictionary *)notificationTypes {
17 | if (self = [super init]) {
18 | self.notificationTypes = notificationTypes;
19 | self.canShowNotification = GrowlApplicationBridge.isGrowlRunning;
20 | GrowlApplicationBridge.growlDelegate = self;
21 | }
22 | return self;
23 | }
24 |
25 | - (void)dealloc {
26 | GrowlApplicationBridge.growlDelegate = nil;
27 | }
28 |
29 | - (void)showNotification:(GrowlNotification *)notification {
30 | NSLog(@"GrowlNotifier - show: %@", notification.name);
31 |
32 | [GrowlApplicationBridge
33 | notifyWithTitle:notification.name
34 | description:notification.status
35 | notificationName:notification.type
36 | iconData:nil priority:0 isSticky:NO
37 | clickContext:notification.tagAsNumber];
38 | }
39 |
40 | #pragma mark - GrowlApplicationBridgeDelegate
41 |
42 | - (NSDictionary *)registrationDictionaryForGrowl {
43 | return [NSDictionary dictionaryWithObjectsAndKeys:
44 | NSProcessInfo.processInfo.processName, GROWL_APP_NAME,
45 | GROWL_NOTIFICATIONS_ALL, GROWL_NOTIFICATIONS_DEFAULT,
46 | self.notificationTypes.allKeys, GROWL_NOTIFICATIONS_ALL,
47 | self.notificationTypes, GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES, nil];
48 | }
49 |
50 | - (void)growlNotificationWasClicked:(id)clickContext {
51 | NSNumber *checkTag = (NSNumber *)clickContext;
52 | [self.delegate growlNotifier:self didClickOnNotificationWithTag:checkTag.integerValue];
53 | }
54 | @end
55 |
--------------------------------------------------------------------------------
/Checkman/HTTPConnection.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class TCPConnection, HTTPConnection, HTTPRequest;
4 |
5 | @protocol HTTPConnectionDelegate
6 | - (void)HTTPConnectionDidClose:(HTTPConnection *)connection;
7 | @end
8 |
9 | @protocol HTTPConnectionDataDelegate
10 | - (void)HTTPConnection:(HTTPConnection *)connection
11 | didReceiveHTTPRequest:(HTTPRequest *)request;
12 | @end
13 |
14 | @interface HTTPConnection : NSObject
15 | @property (nonatomic, assign) id ownerDelegate;
16 | @property (nonatomic, assign) id connectionDelegate;
17 | @property (nonatomic, assign) id dataDelegate;
18 |
19 | - (id)initWithTCPConnection:(TCPConnection *)connection;
20 | - (TCPConnection *)tcpConnection;
21 |
22 | - (void)close;
23 |
24 | // Indicates whether there are any pending HTTP responses.
25 | // (Pending here means:
26 | // - not all requests were answered by a response
27 | // - not all responses were written to tcp conn.)
28 | - (BOOL)isFlushed;
29 | @end
30 |
--------------------------------------------------------------------------------
/Checkman/HTTPRequest.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class HTTPRequest;
4 |
5 | @protocol HTTPRequestDelegate
6 | - (void)HTTPRequestDidRespond:(HTTPRequest *)request;
7 | @end
8 |
9 | @interface HTTPRequest : NSObject
10 |
11 | @property (nonatomic, assign) id delegate;
12 | @property (nonatomic, assign) CFHTTPMessageRef request;
13 | @property (nonatomic, assign) CFHTTPMessageRef response;
14 |
15 | - (id)initWithRequest:(CFHTTPMessageRef)request;
16 |
17 | #pragma mark - Request
18 |
19 | - (NSString *)requestMethod;
20 |
21 | - (NSString *)requestVersion;
22 | - (BOOL)isHTTP11;
23 |
24 | - (NSURL *)requestURL;
25 | - (NSString *)requestNamedHeaderValue:(NSString *)name;
26 |
27 | #pragma mark - Response
28 |
29 | // Also sets HTTP 1.1 and Content-Length: 0
30 | - (void)setResponseStatus:(CFIndex)status;
31 |
32 | - (void)setResponseHeader:(NSString *)name value:(NSString *)value;
33 | - (NSString *)responseNamedHeaderValue:(NSString *)name;
34 | - (BOOL)isResponseConnectionUpgrade;
35 |
36 | // Automatically sets Content-Length: to data's length
37 | - (void)setResponseBody:(NSData *)data;
38 |
39 | - (void)respond;
40 | - (BOOL)hasResponded;
41 | - (NSData *)responseAsData;
42 | @end
43 |
--------------------------------------------------------------------------------
/Checkman/HTTPServer.h:
--------------------------------------------------------------------------------
1 | #import "TCPServer.h"
2 |
3 | @class HTTPServer, HTTPConnection, HTTPRequest;
4 |
5 | @protocol HTTPServerDelegate
6 | - (void)HTTPServer:(HTTPServer *)server
7 | HTTPConnection:(HTTPConnection *)connection
8 | didReceiveHTTPRequest:(HTTPRequest *)request;
9 | @end
10 |
11 | @interface HTTPServer : TCPServer
12 | @property (nonatomic, assign) id requestDelegate;
13 |
14 | + (HTTPServer *)onPort:(uint16_t)port;
15 |
16 | - (id)initWithTCPServer:(TCPServer *)tcpServer;
17 |
18 | - (BOOL)start:(NSError **)error;
19 | - (BOOL)stop;
20 |
21 | - (void)hijackConnection:(HTTPConnection *)connection;
22 | @end
23 |
--------------------------------------------------------------------------------
/Checkman/Images/icon-fail-changing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icon-fail-changing.png
--------------------------------------------------------------------------------
/Checkman/Images/icon-fail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icon-fail.png
--------------------------------------------------------------------------------
/Checkman/Images/icon-ok-changing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icon-ok-changing.png
--------------------------------------------------------------------------------
/Checkman/Images/icon-ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icon-ok.png
--------------------------------------------------------------------------------
/Checkman/Images/icon-undetermined-changing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icon-undetermined-changing.png
--------------------------------------------------------------------------------
/Checkman/Images/icon-undetermined.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icon-undetermined.png
--------------------------------------------------------------------------------
/Checkman/Images/icons.sketch/Data:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icons.sketch/Data
--------------------------------------------------------------------------------
/Checkman/Images/icons.sketch/QuickLook/Preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icons.sketch/QuickLook/Preview.png
--------------------------------------------------------------------------------
/Checkman/Images/icons.sketch/QuickLook/Thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icons.sketch/QuickLook/Thumbnail.png
--------------------------------------------------------------------------------
/Checkman/Images/icons.sketch/fonts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cppforlife/checkman/e5e6fa3132f92bf145b59642489df55b87399fcb/Checkman/Images/icons.sketch/fonts
--------------------------------------------------------------------------------
/Checkman/Images/icons.sketch/version:
--------------------------------------------------------------------------------
1 | 4
--------------------------------------------------------------------------------
/Checkman/InfoMenuItem.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface InfoMenuItem : NSMenuItem
4 | + (InfoMenuItem *)menuItemWithName:(NSString *)name value:(NSString *)value;
5 | - (id)initWithName:(NSString *)name value:(NSString *)value;
6 | @end
7 |
--------------------------------------------------------------------------------
/Checkman/InfoMenuItem.m:
--------------------------------------------------------------------------------
1 | #import "InfoMenuItem.h"
2 |
3 | @interface InfoMenuItem ()
4 | @property (nonatomic, strong) NSString *value;
5 | @end
6 |
7 | @implementation InfoMenuItem
8 | @synthesize value = _value;
9 |
10 | + (InfoMenuItem *)menuItemWithName:(NSString *)name value:(NSString *)value {
11 | if ([name isEqualToString:@"-"]) {
12 | return (id)[self separatorItem];
13 | }
14 | return [[self alloc] initWithName:name value:value];
15 | }
16 |
17 | - (id)initWithName:(NSString *)name value:(NSString *)value {
18 | if (self = [super init]) {
19 | self.value = value;
20 | self.enabled = NO;
21 |
22 | NSString *title = F(@"%@: %@", name, value);
23 | NSMutableAttributedString *attributedTitle =
24 | [[NSMutableAttributedString alloc] initWithString:title];
25 | [attributedTitle
26 | addAttribute:NSForegroundColorAttributeName
27 | value:NSColor.darkGrayColor
28 | range:NSMakeRange(0, title.length)];
29 | self.attributedTitle = attributedTitle;
30 |
31 | self.target = self;
32 | self.action = @selector(performAction);
33 | }
34 | return self;
35 | }
36 |
37 | - (void)performAction {
38 | [self writeStringToPasteBoard:self.value];
39 | }
40 |
41 | - (void)writeStringToPasteBoard:(NSString *)string {
42 | if (self.value) {
43 | NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
44 | [pasteBoard clearContents];
45 | [pasteBoard writeObjects:[NSArray arrayWithObject:string]];
46 | }
47 | }
48 | @end
49 |
--------------------------------------------------------------------------------
/Checkman/MenuController.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Check, MenuController;
4 |
5 | @protocol MenuControllerDelegate
6 | - (void)menuController:(MenuController *)controller
7 | didActOnCheck:(Check *)check
8 | flags:(NSUInteger)flags;
9 | @end
10 |
11 | @interface MenuController : NSObject
12 |
13 | @property (nonatomic, assign) id delegate;
14 |
15 | - (id)initWithGitSha:(NSString *)gitSha;
16 |
17 | - (Check *)checkWithTag:(NSInteger)tag;
18 |
19 | #pragma mark - Sections
20 |
21 | - (void)insertSectionWithTag:(NSInteger)tag atIndex:(NSUInteger)index;
22 | - (void)removeSectionWithTag:(NSInteger)tag;
23 |
24 | #pragma mark - Items
25 |
26 | - (void)insertCheck:(Check *)check
27 | atIndex:(NSUInteger)index
28 | inSectionWithTag:(NSInteger)sectionTag;
29 |
30 | - (void)insertSeparatorItemWithTag:(NSInteger)tag
31 | atIndex:(NSUInteger)index
32 | inSectionWithTag:(NSInteger)sectionTag;
33 |
34 | - (void)insertTitledSeparatorItemWithTag:(NSInteger)tag
35 | title:(NSString *)title
36 | atIndex:(NSUInteger)index
37 | inSectionWithTag:(NSInteger)sectionTag;
38 |
39 | - (void)removeItemWithTag:(NSInteger)tag inSectionWithTag:(NSInteger)sectionTag;
40 | @end
41 |
--------------------------------------------------------------------------------
/Checkman/NSCustomTicker.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class NSCustomTicker;
4 |
5 | @protocol NSCustomTickerDelegate
6 | - (void)customTickerDidTick:(NSCustomTicker *)ticker;
7 | @end
8 |
9 | @interface NSCustomTicker : NSObject
10 | @property (nonatomic, assign) id delegate;
11 | - (id)initWithInterval:(NSTimeInterval)interval;
12 | @end
13 |
--------------------------------------------------------------------------------
/Checkman/NSCustomTicker.m:
--------------------------------------------------------------------------------
1 | #import "NSCustomTicker.h"
2 |
3 | @interface NSCustomTickerTarget : NSObject
4 | @property (nonatomic, assign) NSCustomTicker *ticker;
5 | @end
6 |
7 |
8 | @interface NSCustomTicker ()
9 | @property (nonatomic, assign) NSTimer *timer;
10 | @property (nonatomic, strong) NSCustomTickerTarget *target;
11 | @end
12 |
13 | @implementation NSCustomTicker
14 | @synthesize
15 | delegate = _delegate,
16 | timer = _timer,
17 | target = _target;
18 |
19 | - (id)initWithInterval:(NSTimeInterval)interval {
20 | if (self = [super init]) {
21 | // Need to creat an object to refer to self
22 | // since NSTimer retains the target and we want to
23 | // dealloc ourselves without first needing to invalidate.
24 | self.target = [[NSCustomTickerTarget alloc] init];
25 | self.target.ticker = self;
26 |
27 | self.timer =
28 | [NSTimer scheduledTimerWithTimeInterval:interval
29 | target:self.target selector:@selector(perform)
30 | userInfo:nil repeats:YES];
31 | }
32 | return self;
33 | }
34 |
35 | - (void)dealloc {
36 | self.target.ticker = nil;
37 | [self.timer invalidate];
38 | }
39 |
40 | - (void)perform {
41 | [self.delegate customTickerDidTick:self];
42 | }
43 | @end
44 |
45 |
46 | @implementation NSCustomTickerTarget
47 | @synthesize ticker = _ticker;
48 |
49 | - (void)perform {
50 | [self.ticker perform];
51 | }
52 | @end
53 |
--------------------------------------------------------------------------------
/Checkman/NSObject+Delayed.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface NSObject (Delayed)
4 | - (void)performSelectorOnNextTick:(SEL)selector;
5 | - (void)performSelectorOnNextTick:(SEL)selector afterDelay:(NSTimeInterval)delay;
6 | - (void)cancelPerformSelectorOnNextTick:(SEL)selector;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/NSObject+Delayed.m:
--------------------------------------------------------------------------------
1 | #import "NSObject+Delayed.h"
2 |
3 | @implementation NSObject (Delayed)
4 | - (void)performSelectorOnNextTick:(SEL)selector {
5 | [self performSelectorOnNextTick:selector afterDelay:0];
6 | }
7 |
8 | - (void)performSelectorOnNextTick:(SEL)selector afterDelay:(NSTimeInterval)delay {
9 | NSArray *modes = [NSArray arrayWithObjects:NSRunLoopCommonModes, NSEventTrackingRunLoopMode, nil];
10 | [self performSelector:selector withObject:nil afterDelay:delay inModes:modes];
11 | }
12 |
13 | - (void)cancelPerformSelectorOnNextTick:(SEL)selector {
14 | [NSObject cancelPreviousPerformRequestsWithTarget:self selector:selector object:nil];
15 | }
16 | @end
17 |
--------------------------------------------------------------------------------
/Checkman/NSWindow+KeepOpen.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface NSWindow (KeepOpen)
4 | - (void)keepOpenUntilClosed;
5 | @end
6 |
--------------------------------------------------------------------------------
/Checkman/NSWindow+KeepOpen.m:
--------------------------------------------------------------------------------
1 | #import "NSWindow+KeepOpen.h"
2 |
3 | @implementation NSWindow (KeepOpen)
4 | - (void)keepOpenUntilClosed {
5 | self.releasedWhenClosed = YES;
6 | [self retain];
7 | }
8 | @end
9 |
--------------------------------------------------------------------------------
/Checkman/NotificationPanel.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CustomNotification;
4 |
5 | @interface NotificationPanel : NSPanel
6 | - (id)initWithNotification:(CustomNotification *)notification;
7 | - (void)show;
8 | @end
9 |
--------------------------------------------------------------------------------
/Checkman/NotificationPanel.m:
--------------------------------------------------------------------------------
1 | #import "NotificationPanel.h"
2 | #import "NotificationPanelView.h"
3 | #import "CustomNotification.h"
4 |
5 | @interface NotificationPanel ()
6 | @property (nonatomic, strong) CustomNotification *notification;
7 | @end
8 |
9 | @implementation NotificationPanel
10 | @synthesize notification = _notification;
11 |
12 | - (id)initWithNotification:(CustomNotification *)notification {
13 | if (self = [super init]) {
14 | self.notification = notification;
15 |
16 | self.level = NSStatusWindowLevel;
17 | self.styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask;
18 | self.backgroundColor = NSColor.clearColor;
19 | self.alphaValue = 0.95;
20 | self.opaque = NO;
21 |
22 | NotificationPanelView *view =
23 | [[NotificationPanelView alloc] initWithNotification:notification];
24 | self.minSize = view.frame.size;
25 | self.contentView = view;
26 | [self useOptimizedDrawing:YES];
27 |
28 | self.excludedFromWindowsMenu = NO;
29 | self.hidesOnDeactivate = NO;
30 | self.oneShot = YES;
31 | self.canHide = NO;
32 | }
33 | return self;
34 | }
35 |
36 | - (void)show {
37 | [self setFrame:CGRectMake(0, 0, self.minSize.width, self.minSize.height) display:NO];
38 | [self center];
39 | [self makeKeyAndOrderFront:nil];
40 | [self orderFrontRegardless];
41 | }
42 | @end
43 |
--------------------------------------------------------------------------------
/Checkman/NotificationPanelView.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CustomNotification;
4 |
5 | @interface NotificationPanelView : NSView
6 | - (id)initWithNotification:(CustomNotification *)notification;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/NotificationsController.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Check, NotificationsController;
4 |
5 | @protocol NotificationsControllerDelegate
6 | - (void)notificationsController:(NotificationsController *)controller
7 | didActOnCheck:(Check *)check;
8 | @end
9 |
10 | @interface NotificationsController : NSObject
11 |
12 | @property (nonatomic, assign) id delegate;
13 | @property (nonatomic, assign) BOOL allowCustom;
14 | @property (nonatomic, assign) BOOL allowGrowl;
15 | @property (nonatomic, assign) BOOL allowNotificationCenter;
16 |
17 | - (void)addCheck:(Check *)check;
18 | - (void)removeCheck:(Check *)check;
19 | @end
20 |
--------------------------------------------------------------------------------
/Checkman/SectionedMenu.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface SectionedMenu : NSMenu
4 |
5 | #pragma mark - Sections
6 |
7 | - (void)insertSectionWithTag:(NSInteger)tag atIndex:(NSUInteger)index;
8 | - (void)removeSectionWithTag:(NSInteger)tag;
9 |
10 | #pragma mark - Section items
11 |
12 | - (void)insertItem:(NSMenuItem *)item
13 | atIndex:(NSUInteger)index
14 | inSectionWithTag:(NSInteger)sectionTag;
15 |
16 | - (NSMenuItem *)itemWithTag:(NSInteger)tag
17 | inSectionWithTag:(NSInteger)sectionTag;
18 |
19 | - (void)removeItemWithTag:(NSInteger)tag
20 | inSectionWithTag:(NSInteger)sectionTag;
21 | @end
22 |
--------------------------------------------------------------------------------
/Checkman/SeparatorMenuItem.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface SeparatorMenuItem : NSMenuItem
4 | + (SeparatorMenuItem *)separator;
5 | + (SeparatorMenuItem *)separatorWithTitle:(NSString *)title;
6 | @end
7 |
--------------------------------------------------------------------------------
/Checkman/SeparatorMenuItem.m:
--------------------------------------------------------------------------------
1 | #import "SeparatorMenuItem.h"
2 | #import
3 |
4 | @implementation SeparatorMenuItem
5 | + (SeparatorMenuItem *)separator {
6 | NSMenuItem *item = NSMenuItem.separatorItem;
7 | object_setClass(item, [SeparatorMenuItem class]);
8 | return (SeparatorMenuItem *)item;
9 | }
10 |
11 | + (SeparatorMenuItem *)separatorWithTitle:(NSString *)title {
12 | SeparatorMenuItem *item = [[SeparatorMenuItem alloc] init];
13 | item.attributedTitle = [self _separatorTitle:title];
14 | item.enabled = NO;
15 | return item;
16 | }
17 |
18 | + (NSAttributedString *)_separatorTitle:(NSString *)title {
19 | NSDictionary *attributes =
20 | [NSDictionary dictionaryWithObjectsAndKeys:
21 | NSCursor.arrowCursor, NSCursorAttributeName,
22 | NSColor.lightGrayColor, NSForegroundColorAttributeName,
23 | [NSFont fontWithName:@"Lucida Grande" size:10], NSFontAttributeName, nil];
24 | return [[NSAttributedString alloc] initWithString:title attributes:attributes];
25 | }
26 | @end
27 |
--------------------------------------------------------------------------------
/Checkman/Settings.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Settings;
4 |
5 | @protocol SettingsDelegate
6 | - (void)settingsDidChange:(Settings *)settings;
7 | @end
8 |
9 | @interface Settings : NSObject
10 |
11 | @property (nonatomic, assign) id delegate;
12 |
13 | + (Settings *)userSettings;
14 |
15 | - (void)trackChanges;
16 |
17 | #pragma mark - Check specific
18 |
19 | - (NSUInteger)runIntervalForCheckWithName:(NSString *)name
20 | inCheckfileWithName:(NSString *)checkfileName;
21 |
22 | - (BOOL)isCheckWithNameDisabled:(NSString *)name
23 | inCheckfileWithName:(NSString *)checkfileName;
24 |
25 | #pragma mark - Stickies
26 |
27 | - (BOOL)allowStickies;
28 |
29 | #pragma mark - Notifications
30 |
31 | - (BOOL)allowCustomNotifications;
32 | - (BOOL)allowGrowlNotifications;
33 | - (BOOL)allowNotificationCenterNotifications;
34 |
35 | #pragma mark - WebUI
36 |
37 | - (uint16_t)webUIPort;
38 | @end
39 |
--------------------------------------------------------------------------------
/Checkman/StickiesController.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Check;
4 |
5 | @interface StickiesController : NSObject
6 |
7 | @property (nonatomic, assign, getter = isAllowed) BOOL allow;
8 |
9 | - (void)addCheck:(Check *)check;
10 | - (void)removeCheck:(Check *)check;
11 | @end
12 |
--------------------------------------------------------------------------------
/Checkman/Sticky.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface Sticky : NSObject
4 | @property (nonatomic, strong) NSString *name;
5 | @property (nonatomic, strong) NSString *status;
6 | @property (nonatomic, strong) NSColor *color;
7 | @property (nonatomic, assign) NSInteger tag;
8 | @end
9 |
--------------------------------------------------------------------------------
/Checkman/Sticky.m:
--------------------------------------------------------------------------------
1 | #import "Sticky.h"
2 |
3 | @implementation Sticky
4 | @synthesize
5 | name = _name,
6 | status = _status,
7 | color = _color,
8 | tag = _tag;
9 | @end
10 |
--------------------------------------------------------------------------------
/Checkman/StickyPanel.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Sticky;
4 |
5 | @interface StickyPanel : NSPanel
6 | - (id)initWithSticky:(Sticky *)sticky;
7 | - (Sticky *)sticky;
8 |
9 | - (void)showOnRightScreenEdge:(NSPoint)origin;
10 | - (void)moveDownBy:(CGFloat)distance;
11 | - (void)moveDownOffScreen;
12 | @end
13 |
--------------------------------------------------------------------------------
/Checkman/StickyPanel.m:
--------------------------------------------------------------------------------
1 | #import "StickyPanel.h"
2 | #import "StickyPanelView.h"
3 | #import "Sticky.h"
4 |
5 | @interface StickyPanel ()
6 | @property (nonatomic, strong) Sticky *sticky;
7 | @end
8 |
9 | @implementation StickyPanel
10 | @synthesize sticky = _sticky;
11 |
12 | - (id)initWithSticky:(Sticky *)sticky {
13 | if (self = [super init]) {
14 | self.sticky = sticky;
15 |
16 | self.level = NSStatusWindowLevel;
17 | self.styleMask = NSBorderlessWindowMask | NSNonactivatingPanelMask;
18 | self.backgroundColor = NSColor.clearColor;
19 | self.alphaValue = 0.95;
20 | self.opaque = NO;
21 |
22 | StickyPanelView *view =
23 | [[StickyPanelView alloc] initWithSticky:sticky];
24 | self.minSize = view.frame.size;
25 | self.contentView = view;
26 | [self useOptimizedDrawing:YES];
27 |
28 | self.excludedFromWindowsMenu = NO;
29 | self.hidesOnDeactivate = NO;
30 | self.oneShot = YES;
31 | self.canHide = NO;
32 | }
33 | return self;
34 | }
35 |
36 | - (void)showOnRightScreenEdge:(NSPoint)origin {
37 | NSScreen *mainScreen = [NSScreen.screens objectAtIndex:0];
38 | [self setFrame:CGRectMake(
39 | mainScreen.frame.size.width - self.minSize.width - origin.x,
40 | origin.y,
41 | self.minSize.width,
42 | self.minSize.height
43 | ) display:NO];
44 |
45 | [self makeKeyAndOrderFront:nil];
46 | [self orderFrontRegardless];
47 | }
48 |
49 | - (void)moveDownBy:(CGFloat)distance {
50 | NSRect frame = self.frame;
51 | NSPoint origin = frame.origin;
52 | origin.y -= distance;
53 | frame.origin = origin;
54 | [self setFrame:frame display:YES animate:YES];
55 | }
56 |
57 | - (void)moveDownOffScreen {
58 | NSRect frame = self.frame;
59 | NSPoint origin = frame.origin;
60 | origin.y = -frame.size.height;
61 | frame.origin = origin;
62 | [self setFrame:frame display:YES animate:YES];
63 | }
64 | @end
65 |
--------------------------------------------------------------------------------
/Checkman/StickyPanelView.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Sticky;
4 |
5 | @interface StickyPanelView : NSView
6 | - (id)initWithSticky:(Sticky *)sticky;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/TCPBufferedStreams.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface TCPBufferedStream : NSObject
4 | @property (nonatomic, assign) id delegate;
5 | - (NSStream *)stream;
6 | - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode;
7 | - (void)open;
8 | - (void)close;
9 | @end
10 |
11 |
12 | @interface TCPBufferedInputStream : TCPBufferedStream
13 | - (id)initWithStream:(NSInputStream *)stream;
14 |
15 | - (const void *)bufferBytes;
16 | - (NSUInteger)bufferLength;
17 |
18 | - (NSUInteger)read;
19 | - (void)takeUntilLengthLeft:(NSUInteger)length;
20 | @end
21 |
22 |
23 | @interface TCPBufferedOutputStream : TCPBufferedStream
24 | - (id)initWithStream:(NSOutputStream *)stream;
25 |
26 | - (NSInteger)writeData:(NSData *)data;
27 |
28 | - (NSInteger)flush;
29 | - (BOOL)isFlushed;
30 | @end
31 |
--------------------------------------------------------------------------------
/Checkman/TCPConnection.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class TCPConnection, TCPBufferedInputStream, TCPBufferedOutputStream;
4 |
5 | @protocol TCPConnectionDelegate
6 | - (void)TCPConnectionDidClose:(TCPConnection *)connection;
7 | @end
8 |
9 | @protocol TCPConnectionDataDelegate
10 | - (void)TCPConnectionProcessIncomingBytes:(TCPConnection *)connection;
11 | - (void)TCPConnectionProcessOutgoingBytes:(TCPConnection *)connection;
12 | @end
13 |
14 | @interface TCPConnection : NSObject
15 | @property (nonatomic, assign) id ownerDelegate;
16 | @property (nonatomic, assign) id connectionDelegate;
17 | @property (nonatomic, assign) id dataDelegate;
18 |
19 | // If set to true connection will be closed next time
20 | // something is written to the wire and everything is flushed.
21 | @property (nonatomic, assign) BOOL canClose;
22 |
23 | - (id)initWithAddress:(NSData *)address
24 | socketHandle:(CFSocketNativeHandle)socketHandle
25 | inputStream:(NSInputStream *)inputStream
26 | outputStream:(NSOutputStream *)outputStream;
27 |
28 | - (TCPBufferedInputStream *)istream;
29 | - (TCPBufferedOutputStream *)ostream;
30 |
31 | - (void)close;
32 | @end
33 |
--------------------------------------------------------------------------------
/Checkman/TCPServer.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | NSString * const TCPServerErrorDomain;
5 |
6 | typedef enum {
7 | kTCPServerCouldNotBindToIPv4Address = 1,
8 | kTCPServerCouldNotBindToIPv6Address = 2,
9 | kTCPServerNoSocketsAvailable = 3,
10 | } TCPServerErrorCode;
11 |
12 | @class TCPServer, TCPConnection;
13 |
14 | @protocol TCPServerDelegate
15 | - (void)TCPServer:(TCPServer *)server
16 | TCPConnectionDidStart:(TCPConnection *)connection;
17 | @end
18 |
19 | @interface TCPServer : NSObject
20 | @property (nonatomic, assign) id delegate;
21 |
22 | - (id)initWithPort:(uint16_t)port;
23 | - (uint16_t)port;
24 |
25 | - (BOOL)start:(NSError **)error;
26 | - (BOOL)stop;
27 |
28 | - (void)hijackConnection:(TCPConnection *)connection;
29 | @end
30 |
--------------------------------------------------------------------------------
/Checkman/TaggedObject.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface TaggedObject : NSObject
4 | @property (nonatomic, assign) NSInteger tag;
5 | - (NSNumber *)tagAsNumber;
6 | @end
7 |
--------------------------------------------------------------------------------
/Checkman/TaggedObject.m:
--------------------------------------------------------------------------------
1 | #import "TaggedObject.h"
2 |
3 | @implementation TaggedObject
4 | @synthesize tag = _tag;
5 |
6 | + (NSInteger)_nextTag {
7 | static NSInteger tag = 0;
8 | NSAssert(++tag != 0, @"Tag must not be zero.");
9 | return tag;
10 | }
11 |
12 | - (id)init {
13 | if (self = [super init]) {
14 | self.tag = self.class._nextTag;
15 | }
16 | return self;
17 | }
18 |
19 | - (NSNumber *)tagAsNumber {
20 | return [NSNumber numberWithInteger:self.tag];
21 | }
22 |
23 | - (BOOL)isEqual:(id)object {
24 | if ([object respondsToSelector:@selector(tag)] && [object tag]) {
25 | return self.tag == [object tag];
26 | } else {
27 | return self == object;
28 | }
29 | }
30 | @end
31 |
--------------------------------------------------------------------------------
/Checkman/WebSocketConnection.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class TCPConnection, WebSocketConnection, WebSocketFrame;
4 |
5 | @protocol WebSocketConnectionDelegate
6 | - (void)WebSocketConnectionDidClose:(WebSocketConnection *)connection;
7 | @end
8 |
9 | @protocol WebSocketConnectionDataDelegate
10 | - (void)WebSocketConnection:(WebSocketConnection *)connection
11 | didReceiveFrame:(WebSocketFrame *)frame;
12 | @end
13 |
14 | @interface WebSocketConnection : NSObject
15 | @property (nonatomic, assign) id ownerDelegate;
16 | @property (nonatomic, assign) id connectionDelegate;
17 | @property (nonatomic, assign) id dataDelegate;
18 |
19 | - (id)initWithTCPConnection:(TCPConnection *)connection;
20 | - (TCPConnection *)tcpConnection;
21 |
22 | - (void)close;
23 |
24 | - (void)sendMessage:(NSString *)message;
25 | @end
26 |
--------------------------------------------------------------------------------
/Checkman/WebSocketConnection.m:
--------------------------------------------------------------------------------
1 | #import "WebSocketConnection.h"
2 | #import "TCPConnection.h"
3 | #import "TCPBufferedStreams.h"
4 | #import "WebSocketFrame.h"
5 |
6 | @interface WebSocketConnection ()
7 |
8 | @property (nonatomic, retain) TCPConnection *tcpConnection;
9 | @end
10 |
11 | @implementation WebSocketConnection
12 | @synthesize
13 | ownerDelegate = _ownerDelegate,
14 | connectionDelegate = _connectionDelegate,
15 | dataDelegate = _dataDelegate,
16 | tcpConnection = _tcpConnection;
17 |
18 | - (id)initWithTCPConnection:(TCPConnection *)tcpConnection {
19 | if (self = [super init]) {
20 | self.tcpConnection = tcpConnection;
21 | self.tcpConnection.dataDelegate = self;
22 | }
23 | return self;
24 | }
25 |
26 | - (void)dealloc {
27 | self.ownerDelegate = nil;
28 | self.connectionDelegate = nil;
29 | self.dataDelegate = nil;
30 | }
31 |
32 | #pragma mark - Closing connection
33 |
34 | - (void)close {
35 | [self.tcpConnection close];
36 | }
37 |
38 | - (void)TCPConnectionDidClose:(TCPConnection *)connection {
39 | [self.connectionDelegate WebSocketConnectionDidClose:self];
40 | [self.ownerDelegate WebSocketConnectionDidClose:self];
41 | }
42 |
43 | #pragma mark -
44 |
45 | - (void)sendMessage:(NSString *)message {
46 | WebSocketFrame *frame = [[WebSocketFrame alloc] init];
47 | frame.data = message;
48 | [self.tcpConnection.ostream writeData:frame.asWireData];
49 | }
50 |
51 | #pragma mark - TCPConnectionDataDelegate
52 |
53 | - (void)TCPConnectionProcessIncomingBytes:(TCPConnection *)connection {
54 | // Not implemented
55 | }
56 |
57 | - (void)TCPConnectionProcessOutgoingBytes:(TCPConnection *)connection {}
58 | @end
59 |
--------------------------------------------------------------------------------
/Checkman/WebSocketFrame.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface WebSocketFrame : NSObject
4 | @property (nonatomic, retain) id data;
5 |
6 | - (NSData *)asWireData;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/WebSocketSec.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface WebSocketSec : NSObject
4 | // Use to populate Sec-WebSocket-Accept header value
5 | // (secKey is Sec-WebSocket-Key header value).
6 | + (NSString *)secAcceptWithSecKey:(NSString *)secKey;
7 | @end
8 |
--------------------------------------------------------------------------------
/Checkman/WebSocketSec.m:
--------------------------------------------------------------------------------
1 | #import "WebSocketSec.h"
2 |
3 | @implementation WebSocketSec
4 |
5 | + (NSString *)secAcceptWithSecKey:(NSString *)secKey {
6 | static NSString *magic = @"258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
7 | NSString *secKeyMagic = [NSString stringWithFormat:@"%@%@", secKey, magic];
8 | return [self _sha1ThenBase64EncodeString:secKeyMagic];
9 | }
10 |
11 | #pragma mark -
12 |
13 | + (NSString *)_sha1ThenBase64EncodeString:(NSString *)string {
14 | NSString *cmd = [NSString stringWithFormat:
15 | @"echo -n '%@' | openssl dgst -binary -sha1 | openssl enc -base64", string];
16 |
17 | NSTask *task = [[NSTask alloc] init];
18 | task.launchPath = @"/bin/bash";
19 | task.arguments = [NSArray arrayWithObjects:@"-c", cmd, nil];
20 |
21 | task.standardOutput = [NSPipe pipe];
22 | task.standardError = [NSPipe pipe];
23 | [task launch];
24 | [task waitUntilExit];
25 |
26 | NSData *output =
27 | [[task.standardOutput fileHandleForReading] readDataToEndOfFile];
28 | NSString *outputString =
29 | [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding];
30 |
31 | return [outputString stringByTrimmingCharactersInSet:
32 | NSCharacterSet.whitespaceAndNewlineCharacterSet];
33 | }
34 | @end
35 |
--------------------------------------------------------------------------------
/Checkman/WebUI.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class Check;
4 |
5 | @interface WebUI : NSObject
6 |
7 | - (id)initWithPort:(uint16_t)port;
8 | - (void)start;
9 |
10 | - (void)addCheck:(Check *)check;
11 | - (void)removeCheck:(Check *)check;
12 | @end
13 |
--------------------------------------------------------------------------------
/Checkman/WebUIHandler.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class HTTPServer, HTTPConnection, HTTPRequest;
4 |
5 | @interface WebUIHandler : NSObject
6 | - (id)initWithHTTPServer:(HTTPServer *)server
7 | HTTPConnection:(HTTPConnection *)connection
8 | HTTPRequest:(HTTPRequest *)request;
9 |
10 | - (HTTPServer *)server;
11 | - (HTTPConnection *)connection;
12 | - (HTTPRequest *)request;
13 |
14 | // Override in subclass
15 | - (void)handle;
16 | @end
17 |
18 | @interface WebUIHandler (Helpers)
19 | - (BOOL)_handleUnsupportedVersion;
20 | - (BOOL)_handleUnsupportedRequest;
21 | - (BOOL)_handleNonGetRequest;
22 | - (BOOL)_respondWithStatus:(CFIndex)status;
23 | @end
24 |
--------------------------------------------------------------------------------
/Checkman/WebUIHandler.m:
--------------------------------------------------------------------------------
1 | #import "WebUIHandler.h"
2 | #import "HTTPServer.h"
3 | #import "HTTPConnection.h"
4 | #import "HTTPRequest.h"
5 |
6 | @interface WebUIHandler ()
7 | @property (nonatomic, retain) HTTPServer *server;
8 | @property (nonatomic, retain) HTTPConnection *connection;
9 | @property (nonatomic, retain) HTTPRequest *request;
10 | @end
11 |
12 | @implementation WebUIHandler
13 | @synthesize
14 | server = _server,
15 | connection = _connection,
16 | request = _request;
17 |
18 | - (id)initWithHTTPServer:(HTTPServer *)server
19 | HTTPConnection:(HTTPConnection *)connection
20 | HTTPRequest:(HTTPRequest *)request {
21 | if (self = [super init]) {
22 | self.server = server;
23 | self.connection = connection;
24 | self.request = request;
25 | }
26 | return self;
27 | }
28 |
29 | - (void)handle {
30 | NSAssert(NO, @"Override in subclass");
31 | }
32 | @end
33 |
34 | @implementation WebUIHandler (Helpers)
35 |
36 | - (BOOL)_handleUnsupportedVersion {
37 | if (!self.request.isHTTP11) {
38 | return [self _respondWithStatus:505];
39 | }
40 | return NO;
41 | }
42 |
43 | - (BOOL)_handleUnsupportedRequest {
44 | if (!self.request.requestMethod) {
45 | return [self _respondWithStatus:400];
46 | }
47 | return NO;
48 | }
49 |
50 | - (BOOL)_handleNonGetRequest {
51 | if (![self.request.requestMethod isEqual:@"GET"]) {
52 | return [self _respondWithStatus:405];
53 | }
54 | return NO;
55 | }
56 |
57 | - (BOOL)_respondWithStatus:(CFIndex)status {
58 | self.request.responseStatus = status;
59 | [self.request respond];
60 | return YES;
61 | }
62 | @end
63 |
--------------------------------------------------------------------------------
/Checkman/WebUIMessages.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @class CheckCollection, Check;
4 |
5 | @interface WebUIMessages : NSObject
6 |
7 | - (NSString *)heartBeatJSONMessage:(CheckCollection *)checks;
8 |
9 | - (NSString *)showCheckJSONMessage:(Check *)check;
10 | - (NSString *)hideCheckJSONMessage:(Check *)check;
11 | @end
12 |
--------------------------------------------------------------------------------
/Checkman/WebUIStaticFileHandler.h:
--------------------------------------------------------------------------------
1 | #import "WebUIHandler.h"
2 |
3 | @interface WebUIStaticFileHandler : WebUIHandler
4 | @end
5 |
--------------------------------------------------------------------------------
/Checkman/WebUIStaticFileHandler.m:
--------------------------------------------------------------------------------
1 | #import "WebUIStaticFileHandler.h"
2 | #import "HTTPRequest.h"
3 |
4 | @implementation WebUIStaticFileHandler
5 |
6 | - (void)handle {
7 | [self _handleUnsupportedVersion]
8 | || [self _handleUnsupportedRequest]
9 | || [self _handleNonGetRequest]
10 | || [self _respondWithData]
11 | || [self _respondWithStatus:404];
12 | }
13 |
14 | #pragma mark - Responding with data
15 |
16 | - (NSData *)_fetchDataAtPath:(NSString *)path {
17 | NSString *filePath =
18 | [NSString stringWithFormat:@"%@%@", NSBundle.mainBundle.resourcePath, path];
19 | NSLog(@"WebUIStaticFileHandler - returning: %@", filePath);
20 | return [NSData dataWithContentsOfFile:filePath];
21 | }
22 |
23 | - (BOOL)_respondWithData {
24 | NSData *data = [self _fetchDataAtPath:self.request.requestURL.path];
25 | if (data) {
26 | self.request.responseStatus = 200;
27 | self.request.responseBody = data;
28 | [self.request
29 | setResponseHeader:@"Content-Length"
30 | value:[NSString stringWithFormat:@"%ld", data.length]];
31 | [self.request respond];
32 | return YES;
33 | }
34 | return NO;
35 | }
36 | @end
37 |
--------------------------------------------------------------------------------
/Checkman/WebUIWebSocketHandler.h:
--------------------------------------------------------------------------------
1 | #import "WebUIHandler.h"
2 |
3 | @class WebUIWebSocketHandler, WebSocketConnection;
4 |
5 | @protocol WebUIWebSocketHandlerDelegate
6 | - (void)WebUIWebSocketHandler:(WebUIWebSocketHandler *)handler
7 | WebSocketConnectionDidStart:(WebSocketConnection *)connection;
8 | - (void)WebUIWebSocketHandler:(WebUIWebSocketHandler *)handler
9 | WebSocketConnectionDidEnd:(WebSocketConnection *)connection;
10 | @end
11 |
12 | @interface WebUIWebSocketHandler : WebUIHandler
13 | @property (nonatomic, assign) id delegate;
14 | - (void)sendMessage:(NSString *)string;
15 | @end
16 |
--------------------------------------------------------------------------------
/Checkman/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | int main(int argc, char *argv[]) {
4 | return NSApplicationMain(argc, (const char **)argv);
5 | }
6 |
--------------------------------------------------------------------------------
/CheckmanTests/CedarAsync/Headers/CedarAsync.h:
--------------------------------------------------------------------------------
1 | #import "AsyncActualValue.h"
2 | #import "InTimeShouldSyntax.h"
3 | #import "Timing.h"
4 |
5 | #ifndef CEDAR_ASYNC_COMPATIBLITY_MODE
6 | using namespace CedarAsync;
7 | #endif
8 |
--------------------------------------------------------------------------------
/CheckmanTests/CedarAsync/Headers/InTimeShouldSyntax.h:
--------------------------------------------------------------------------------
1 | #import "AsyncActualValue.h"
2 |
3 | namespace CedarAsync {
4 | template
5 | struct InTimeMarker {
6 | T(^actualExpression)(void);
7 | const char *fileName;
8 | int lineNumber;
9 | };
10 |
11 | template
12 | const AsyncActualValue operator,(const InTimeMarker & marker, const Cedar::Matchers::ActualValueMarker & _) {
13 | return AsyncActualValue(marker.fileName, marker.lineNumber, marker.actualExpression);
14 | }
15 |
16 | template
17 | const AsyncActualValueMatchProxy operator,(const AsyncActualValue & actualValue, bool negate) {
18 | return negate ? actualValue.to_not : actualValue.to;
19 | }
20 |
21 | template
22 | void operator,(const AsyncActualValueMatchProxy & matchProxy, const MatcherType & matcher) {
23 | matchProxy(matcher);
24 | }
25 | }
26 |
27 | #ifndef CEDAR_ASYNC_DISALLOW_IN_TIME
28 | #define in_time(x) (InTimeMarker){^{return x;}, __FILE__, __LINE__}
29 | #endif
30 |
--------------------------------------------------------------------------------
/CheckmanTests/CedarAsync/Headers/Timing.h:
--------------------------------------------------------------------------------
1 | #import
2 | #include
3 |
4 | namespace CedarAsync {
5 | namespace Timing {
6 | extern NSTimeInterval default_poll, current_poll;
7 | extern NSTimeInterval default_timeout, current_timeout;
8 | }
9 |
10 | void with_timeout(NSTimeInterval, void(^)(void));
11 | }
12 |
13 | typedef enum {
14 | CDRATimingPollContinue = 99,
15 | CDRATimingPollStop = 98
16 | } CDRATimingPoll;
17 |
18 | @interface CDRATiming : NSObject
19 | + (void)pollRunLoop:(CDRATimingPoll(^)(BOOL))block
20 | every:(NSTimeInterval)poll
21 | timeout:(NSTimeInterval)timeout;
22 | @end
23 |
24 | @interface CDRAResetTimeout : NSObject
25 | + (void)beforeEach;
26 | @end
27 |
--------------------------------------------------------------------------------
/CheckmanTests/CedarAsync/Timing.mm:
--------------------------------------------------------------------------------
1 | #import "Timing.h"
2 |
3 | namespace CedarAsync {
4 | namespace Timing {
5 | NSTimeInterval default_poll = 0.1;
6 | NSTimeInterval current_poll = default_poll;
7 |
8 | NSTimeInterval default_timeout = 1;
9 | NSTimeInterval current_timeout = default_timeout;
10 | }
11 |
12 | void with_timeout(NSTimeInterval timeout, void(^block)(void)) {
13 | NSTimeInterval before = Timing::current_timeout;
14 | Timing::current_timeout = timeout;
15 | block();
16 | Timing::current_timeout = before;
17 | }
18 | }
19 |
20 | @implementation CDRATiming
21 | + (void)pollRunLoop:(CDRATimingPoll(^)(BOOL))block
22 | every:(NSTimeInterval)poll
23 | timeout:(NSTimeInterval)timeout {
24 |
25 | NSAssert(poll > 0, @"Poll must be > 0");
26 |
27 | while (block(timeout <= 0) == CDRATimingPollContinue) {
28 | NSTimeInterval step = MIN(timeout, poll);
29 | timeout -= step;
30 |
31 | NSDate *futureDate = [NSDate dateWithTimeIntervalSinceNow:step];
32 | [[NSRunLoop currentRunLoop] runUntilDate:futureDate];
33 | }
34 | }
35 | @end
36 |
37 | @implementation CDRAResetTimeout
38 | + (void)beforeEach {
39 | using namespace CedarAsync::Timing;
40 | current_poll = default_poll;
41 | current_timeout = default_timeout;
42 | }
43 | @end
44 |
--------------------------------------------------------------------------------
/CheckmanTests/CheckmanTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.tomato.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/CheckmanTests/CheckmanTests-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'CheckmanTests' target in the 'CheckmanTests' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #import
8 | #endif
9 |
10 | #define F(f, ...) [NSString stringWithFormat:f, ##__VA_ARGS__]
11 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Cedar:
--------------------------------------------------------------------------------
1 | Versions/Current/Cedar
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/AnyArgument.h:
--------------------------------------------------------------------------------
1 | #import "Argument.h"
2 |
3 | namespace Cedar { namespace Doubles {
4 |
5 | class AnyArgument : public Argument {
6 | private:
7 | AnyArgument & operator=(const AnyArgument &);
8 |
9 | public:
10 | AnyArgument() {};
11 | virtual ~AnyArgument() {};
12 | // Allow default copy ctor.
13 |
14 | virtual const char * const value_encoding() const { return ""; };
15 | virtual void * value_bytes() const { return NULL; };
16 | virtual NSString * value_string() const { return @"anything"; };
17 |
18 | virtual bool matches_encoding(const char *) const { return true; }
19 | virtual bool matches_bytes(void *) const { return true; }
20 |
21 | };
22 |
23 | namespace Arguments {
24 | static const Argument::shared_ptr_t anything = Argument::shared_ptr_t(new Doubles::AnyArgument());
25 | }
26 |
27 | }}
28 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/AnyInstanceArgument.h:
--------------------------------------------------------------------------------
1 | #import "Argument.h"
2 |
3 | namespace Cedar { namespace Doubles {
4 |
5 | class AnyInstanceArgument : public Argument {
6 | private:
7 | AnyInstanceArgument & operator=(const AnyInstanceArgument &);
8 |
9 | public:
10 | explicit AnyInstanceArgument(const Class);
11 | virtual ~AnyInstanceArgument();
12 | // Allow default copy ctor.
13 |
14 | virtual const char * const value_encoding() const;
15 | virtual void * value_bytes() const { return NULL; }
16 | virtual NSString * value_string() const;
17 |
18 | virtual bool matches_encoding(const char *) const;
19 | virtual bool matches_bytes(void *) const;
20 |
21 | private:
22 | const Class class_;
23 | };
24 |
25 |
26 | namespace Arguments {
27 | Argument::shared_ptr_t any(Class);
28 | }
29 | }}
30 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/Argument.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "CompareEqual.h"
3 | #import "CedarStringifiers.h"
4 | #import "CedarComparators.h"
5 | #import
6 |
7 | namespace Cedar { namespace Doubles {
8 |
9 | #pragma mark - Argument
10 | class Argument {
11 | public:
12 | virtual ~Argument() = 0;
13 |
14 | virtual const char * const value_encoding() const = 0;
15 | virtual void * value_bytes() const = 0;
16 | virtual NSString * value_string() const = 0;
17 |
18 | virtual bool matches_encoding(const char *) const = 0;
19 | virtual bool matches_bytes(void *) const = 0;
20 |
21 | typedef std::shared_ptr shared_ptr_t;
22 | };
23 |
24 | inline /* virtual */ Argument::~Argument() {}
25 |
26 | }}
27 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/BeEmpty.h:
--------------------------------------------------------------------------------
1 | #import "Base.h"
2 |
3 | namespace Cedar { namespace Matchers {
4 | class BeEmpty : public Base<> {
5 | private:
6 | BeEmpty & operator=(const BeEmpty &);
7 |
8 | public:
9 | inline BeEmpty() : Base<>() {}
10 | inline ~BeEmpty() {}
11 | // Allow default copy ctor.
12 |
13 | inline const BeEmpty & operator()() const { return *this; }
14 |
15 | template
16 | bool matches(const U &) const;
17 |
18 | protected:
19 | inline /*virtual*/ NSString * failure_message_end() const { return @"be empty"; }
20 | };
21 |
22 | static const BeEmpty be_empty = BeEmpty();
23 |
24 | #pragma mark Generic
25 | template
26 | bool BeEmpty::matches(const U & actualValue) const {
27 | return Comparators::compare_empty(actualValue);
28 | }
29 | }}
30 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/BeGreaterThan.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "Base.h"
3 |
4 | namespace Cedar { namespace Matchers {
5 |
6 | template
7 | class BeGreaterThan : public Base<> {
8 | private:
9 | BeGreaterThan & operator=(const BeGreaterThan &);
10 |
11 | public:
12 | explicit BeGreaterThan(const T & expectedValue);
13 | ~BeGreaterThan();
14 | // Allow default copy ctor.
15 |
16 | template
17 | bool matches(const U &) const;
18 |
19 | protected:
20 | virtual NSString * failure_message_end() const;
21 |
22 | private:
23 | const T & expectedValue_;
24 | };
25 |
26 | template
27 | BeGreaterThan be_greater_than(const T & expectedValue) {
28 | return BeGreaterThan(expectedValue);
29 | }
30 |
31 | template
32 | BeGreaterThan::BeGreaterThan(const T & expectedValue)
33 | : Base<>(), expectedValue_(expectedValue) {
34 | }
35 |
36 | template
37 | BeGreaterThan::~BeGreaterThan() {
38 | }
39 |
40 | template
41 | /*virtual*/ NSString * BeGreaterThan::failure_message_end() const {
42 | NSString * expectedValueString = Stringifiers::string_for(expectedValue_);
43 | return [NSString stringWithFormat:@"be greater than <%@>", expectedValueString];
44 | }
45 |
46 | template template
47 | bool BeGreaterThan::matches(const U & actualValue) const {
48 | return Comparators::compare_greater_than(actualValue, expectedValue_);
49 | }
50 |
51 | #pragma mark operators
52 | template
53 | bool operator>(const ActualValue & actualValue, const U & expectedValue) {
54 | return actualValue.to > expectedValue;
55 | }
56 |
57 | template
58 | bool operator>(const ActualValueMatchProxy & actualValueMatchProxy, const U & expectedValue) {
59 | actualValueMatchProxy(be_greater_than(expectedValue));
60 | return true;
61 | }
62 | }}
63 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/BeLessThan.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "Base.h"
3 |
4 | namespace Cedar { namespace Matchers {
5 |
6 | template
7 | class BeLessThan : public Base<> {
8 | private:
9 | BeLessThan & operator=(const BeLessThan &);
10 |
11 | public:
12 | explicit BeLessThan(const T & expectedValue);
13 | ~BeLessThan();
14 | // Allow default copy ctor.
15 |
16 | template
17 | bool matches(const U &) const;
18 |
19 | protected:
20 | virtual NSString * failure_message_end() const;
21 |
22 | private:
23 | const T & expectedValue_;
24 | };
25 |
26 | template
27 | BeLessThan be_less_than(const T & expectedValue) {
28 | return BeLessThan(expectedValue);
29 | }
30 |
31 | template
32 | BeLessThan::BeLessThan(const T & expectedValue)
33 | : Base<>(), expectedValue_(expectedValue) {
34 | }
35 |
36 | template
37 | BeLessThan::~BeLessThan() {
38 | }
39 |
40 | template
41 | /*virtual*/ NSString * BeLessThan::failure_message_end() const {
42 | NSString * expectedValueString = Stringifiers::string_for(expectedValue_);
43 | return [NSString stringWithFormat:@"be less than <%@>", expectedValueString];
44 | }
45 |
46 | template template
47 | bool BeLessThan::matches(const U & actualValue) const {
48 | return !Comparators::compare_greater_than(actualValue, expectedValue_) && !Comparators::compare_equal(actualValue, expectedValue_);
49 | }
50 |
51 | #pragma mark operators
52 | template
53 | bool operator<(const ActualValue & actualValue, const U & expectedValue) {
54 | return actualValue.to < expectedValue;
55 | }
56 |
57 | template
58 | bool operator<(const ActualValueMatchProxy & actualValueMatchProxy, const U & expectedValue) {
59 | actualValueMatchProxy(be_less_than(expectedValue));
60 | return true;
61 | }
62 | }}
63 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/BeNil.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "Base.h"
3 | #import "CDRSpecFailure.h"
4 |
5 | #include
6 |
7 | namespace Cedar { namespace Matchers {
8 | struct BeNilMessageBuilder {
9 | template
10 | static NSString * string_for_actual_value(const U & value) {
11 | throw std::logic_error("Should never generate a failure message for a nil comparison to non-pointer type.");
12 | }
13 |
14 | template
15 | static NSString * string_for_actual_value(U * const & value) {
16 | return value ? [NSString stringWithFormat:@"%p", value] : @"nil";
17 | }
18 | };
19 |
20 | class BeNil : public Base {
21 | private:
22 | BeNil & operator=(const BeNil &);
23 |
24 | public:
25 | inline BeNil() : Base() {}
26 | inline ~BeNil() {}
27 | // Allow default copy ctor.
28 |
29 | inline const BeNil & operator()() const { return *this; }
30 |
31 | template
32 | bool matches(const U &) const;
33 |
34 | template
35 | bool matches(U * const &) const;
36 |
37 | protected:
38 | inline /*virtual*/ NSString * failure_message_end() const { return @"be nil"; }
39 | };
40 |
41 | static const BeNil be_nil = BeNil();
42 |
43 | #pragma mark Generic
44 | template
45 | bool BeNil::matches(const U & actualValue) const {
46 | [[CDRSpecFailure specFailureWithReason:@"Attempt to compare non-pointer type to nil"] raise];
47 | return NO;
48 | }
49 |
50 | template
51 | bool BeNil::matches(U * const & actualValue) const {
52 | return !actualValue;
53 | }
54 |
55 | }}
56 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/BeSameInstanceAs.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "Base.h"
3 |
4 | namespace Cedar { namespace Matchers {
5 | template
6 | class BeSameInstanceAs : public Base<> {
7 | private:
8 | BeSameInstanceAs & operator=(const BeSameInstanceAs &);
9 |
10 | public:
11 | explicit BeSameInstanceAs(T * const expectedValue);
12 | ~BeSameInstanceAs();
13 | // Allow default copy ctor.
14 |
15 | template
16 | bool matches(const U &) const;
17 |
18 | template
19 | bool matches(U * const &) const;
20 |
21 | protected:
22 | virtual NSString * failure_message_end() const;
23 |
24 | private:
25 | const T * expectedValue_;
26 | };
27 |
28 | template
29 | BeSameInstanceAs be_same_instance_as(T * const expectedValue) {
30 | return BeSameInstanceAs(expectedValue);
31 | }
32 |
33 | template
34 | BeSameInstanceAs::BeSameInstanceAs(T * const expectedValue)
35 | : Base<>(), expectedValue_(expectedValue) {
36 | }
37 |
38 | template
39 | BeSameInstanceAs::~BeSameInstanceAs() {
40 | }
41 |
42 | template
43 | /*virtual*/ NSString * BeSameInstanceAs::failure_message_end() const {
44 | return [NSString stringWithFormat:@"be same instance as <%p>", expectedValue_];
45 | }
46 |
47 | #pragma mark Generic
48 | template template
49 | bool BeSameInstanceAs::matches(const U & actualValue) const {
50 | [[CDRSpecFailure specFailureWithReason:@"Attempt to compare non-pointer type for sameness."] raise];
51 | return NO;
52 | }
53 |
54 | template template
55 | bool BeSameInstanceAs::matches(U * const & actualValue) const {
56 | return actualValue == expectedValue_;
57 | }
58 |
59 | }}
60 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/BeTruthy.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "Base.h"
3 |
4 | namespace Cedar { namespace Matchers {
5 | class BeTruthy : public Base<> {
6 | private:
7 | BeTruthy & operator=(const BeTruthy &);
8 |
9 | public:
10 | inline BeTruthy() : Base<>() {}
11 | inline ~BeTruthy() {}
12 | // Allow default copy ctor.
13 |
14 | inline const BeTruthy & operator()() const { return *this; }
15 |
16 | template
17 | bool matches(const U &) const;
18 |
19 | protected:
20 | inline /*virtual*/ NSString * failure_message_end() const { return @"evaluate to true"; }
21 | };
22 |
23 | static const BeTruthy be_truthy = BeTruthy();
24 |
25 | #pragma mark Generic
26 | template
27 | bool BeTruthy::matches(const U & actualValue) const {
28 | return !!actualValue;
29 | }
30 |
31 | }}
32 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRClassFake.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "CDRFake.h"
3 | #import "CedarDouble.h"
4 |
5 | @interface CDRClassFake : CDRFake
6 |
7 | @end
8 |
9 | id CDR_fake_for(Class klass, bool require_explicit_stubs = true);
10 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRExampleBase.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "CDRExampleParent.h"
3 |
4 | @protocol CDRExampleReporter;
5 |
6 | typedef void (^CDRSpecBlock)(void);
7 |
8 | enum CDRExampleState {
9 | CDRExampleStateIncomplete = 0x00,
10 | CDRExampleStateSkipped = 0x01,
11 | CDRExampleStatePassed = 0x03,
12 | CDRExampleStatePending = 0x07,
13 | CDRExampleStateFailed = 0x0F,
14 | CDRExampleStateError = 0x1F
15 | };
16 | typedef enum CDRExampleState CDRExampleState;
17 |
18 | @interface CDRExampleBase : NSObject {
19 | NSString *text_;
20 | id parent_;
21 | BOOL focused_;
22 | NSTimeInterval runTime_;
23 | }
24 |
25 | @property (nonatomic, readonly) NSString *text;
26 | @property (nonatomic, assign) id parent;
27 | @property (nonatomic, assign, getter=isFocused) BOOL focused;
28 | @property (nonatomic) NSUInteger stackAddress;
29 |
30 | - (id)initWithText:(NSString *)text;
31 |
32 | - (void)run;
33 | - (BOOL)shouldRun;
34 |
35 | - (BOOL)hasChildren;
36 | - (BOOL)hasFocusedExamples;
37 |
38 | - (NSString *)message;
39 | - (NSString *)fullText;
40 | - (NSMutableArray *)fullTextInPieces;
41 | @end
42 |
43 | @interface CDRExampleBase (RunReporting)
44 | - (CDRExampleState)state;
45 | - (NSTimeInterval)runTime;
46 | - (float)progress;
47 | @end
48 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRExampleParent.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @protocol CDRExampleParent
4 |
5 | - (BOOL)shouldRun;
6 |
7 | - (void)setUp;
8 | - (void)tearDown;
9 |
10 | @optional
11 | - (BOOL)hasFullText;
12 | - (NSString *)fullText;
13 | - (NSMutableArray *)fullTextInPieces;
14 |
15 | - (NSUInteger)stackAddress;
16 | @end
17 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRExampleReporter.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @protocol CDRExampleReporter
4 |
5 | - (void)runWillStartWithGroups:(NSArray *)groups andRandomSeed:(unsigned int)seed;
6 | - (void)runDidComplete;
7 | - (int)result;
8 |
9 | @end
10 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRFake.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "CedarDouble.h"
3 |
4 | @interface CDRFake : NSObject
5 |
6 | @property (nonatomic, assign) Class klass;
7 |
8 | - (id)initWithClass:(Class)klass requireExplicitStubs:(bool)requireExplicitStubs;
9 |
10 | @end
11 |
12 | #ifndef CEDAR_DOUBLES_COMPATIBILITY_MODE
13 | #define fake_for(x) CDR_fake_for((x))
14 | #define nice_fake_for(x) CDR_fake_for((x), false)
15 | #endif
16 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRFunctions.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | NSArray *CDRReportersFromEnv(const char*defaultReporterClassName);
4 |
5 | int runSpecs();
6 | int runAllSpecs() __attribute__((deprecated));
7 | int runSpecsWithCustomExampleReporters(NSArray *reporters);
8 | NSArray *specClassesToRun();
9 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRProtocolFake.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "CedarDouble.h"
3 | #import "CDRFake.h"
4 |
5 | #import
6 | #import
7 |
8 | @interface CDRProtocolFake : CDRFake
9 |
10 | - (id)initWithClass:(Class)klass forProtocol:(Protocol *)protocol requireExplicitStubs:(bool)requireExplicitStubs;
11 |
12 | @end
13 |
14 | id CDR_fake_for(Protocol *protocol, bool require_explicit_stubs = true);
15 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRSharedExampleGroupPool.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @protocol CDRSharedExampleGroupPool
4 | @end
5 |
6 | typedef void (^CDRSharedExampleGroupBlock)(NSDictionary *);
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 | void sharedExamplesFor(NSString *, CDRSharedExampleGroupBlock);
12 | void itShouldBehaveLike(NSString *);
13 | #ifdef __cplusplus
14 | }
15 | #endif
16 |
17 | @interface CDRSharedExampleGroupPool : NSObject
18 | @end
19 |
20 | @interface CDRSharedExampleGroupPool (SharedExampleGroupDeclaration)
21 | - (void)declareSharedExampleGroups;
22 | @end
23 |
24 | #define SHARED_EXAMPLE_GROUPS_BEGIN(name) \
25 | @interface SharedExampleGroupPoolFor##name : CDRSharedExampleGroupPool \
26 | @end \
27 | @implementation SharedExampleGroupPoolFor##name \
28 | - (void)declareSharedExampleGroups {
29 |
30 | #define SHARED_EXAMPLE_GROUPS_END \
31 | } \
32 | @end
33 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRSpecFailure.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | @interface CDRSpecFailure : NSException {
4 | NSString *fileName_;
5 | int lineNumber_;
6 | }
7 |
8 | @property (nonatomic, retain, readonly) NSString *fileName;
9 | @property (nonatomic, assign, readonly) int lineNumber;
10 |
11 | + (id)specFailureWithReason:(NSString *)reason;
12 | + (id)specFailureWithReason:(NSString *)reason fileName:(NSString *)fileName lineNumber:(int)lineNumber;
13 | + (id)specFailureWithRaisedObject:(NSObject *)object;
14 |
15 | - (id)initWithReason:(NSString *)reason;
16 | - (id)initWithReason:(NSString *)reason fileName:(NSString *)fileName lineNumber:(int)lineNumber;
17 | - (id)initWithRaisedObject:(NSObject *)object;
18 |
19 | @end
20 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CDRSpy.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "CedarDouble.h"
3 |
4 | @interface CDRSpy : NSProxy
5 |
6 | + (void)interceptMessagesForInstance:(id)instance;
7 |
8 | @end
9 |
10 | namespace Cedar { namespace Doubles {
11 | inline void CDR_spy_on(id instance) {
12 | if (![[instance class] conformsToProtocol:@protocol(CedarDouble)]) {
13 | [CDRSpy interceptMessagesForInstance:instance];
14 | }
15 | }
16 | }}
17 |
18 | #ifndef CEDAR_DOUBLES_COMPATIBILITY_MODE
19 | #define spy_on(x) CDR_spy_on((x))
20 | #endif
21 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/Cedar.h:
--------------------------------------------------------------------------------
1 | #import "CDRFunctions.h"
2 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CedarComparators.h:
--------------------------------------------------------------------------------
1 | #import "ComparatorsBase.h"
2 | #import "ComparatorsContainer.h"
3 |
4 | #ifdef CEDAR_CUSTOM_COMPARATORS
5 | #import CEDAR_CUSTOM_COMPARATORS
6 | #endif
7 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CedarDouble.h:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | namespace Cedar { namespace Doubles {
4 | class StubbedMethod;
5 | }}
6 |
7 | @protocol CedarDouble
8 |
9 | - (Cedar::Doubles::StubbedMethod &)add_stub:(const Cedar::Doubles::StubbedMethod &)stubbed_method;
10 | - (NSArray *)sent_messages;
11 | - (void)reset_sent_messages;
12 |
13 | @end
14 |
15 | namespace Cedar { namespace Doubles {
16 |
17 | struct MethodStubbingMarker {
18 | const char *fileName;
19 | int lineNumber;
20 | };
21 |
22 | id operator,(id, const MethodStubbingMarker &);
23 |
24 | void operator,(id, const StubbedMethod &);
25 | }}
26 |
27 | #ifndef CEDAR_MATCHERS_DISALLOW_STUB_METHOD
28 | #define stub_method(x) ,(Cedar::Doubles::MethodStubbingMarker){__FILE__, __LINE__},Cedar::Doubles::StubbedMethod((x))
29 | #endif
30 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CedarDoubles.h:
--------------------------------------------------------------------------------
1 | #import "CDRSpy.h"
2 | #import "CDRFake.h"
3 | #import "CDRClassFake.h"
4 | #import "CDRProtocolFake.h"
5 | #import "HaveReceived.h"
6 | #import "StubbedMethod.h"
7 |
8 | #import "Argument.h"
9 | #import "AnyArgument.h"
10 | #import "ValueArgument.h"
11 | #import "AnyInstanceArgument.h"
12 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CedarMatchers.h:
--------------------------------------------------------------------------------
1 | // Base
2 | #import "Equal.h"
3 | #import "BeTruthy.h"
4 | #import "BeNil.h"
5 | #import "BeCloseTo.h"
6 | #import "BeSameInstanceAs.h"
7 | #import "BeInstanceOf.h"
8 | #import "BeGreaterThan.h"
9 | #import "BeGTE.h"
10 | #import "BeLessThan.h"
11 | #import "BeLTE.h"
12 | #import "RaiseException.h"
13 |
14 | // Container
15 | #import "BeEmpty.h"
16 | #import "Contain.h"
17 |
18 | #ifdef CEDAR_CUSTOM_MATCHERS
19 | #import CEDAR_CUSTOM_MATCHERS
20 | #endif
21 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/CedarStringifiers.h:
--------------------------------------------------------------------------------
1 | #import "StringifiersBase.h"
2 | #import "StringifiersContainer.h"
3 |
4 | #ifdef CEDAR_CUSTOM_STRINGIFIERS
5 | #import CEDAR_CUSTOM_STRINGIFIERS
6 | #endif
7 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/ComparatorsBase.h:
--------------------------------------------------------------------------------
1 | #import "CompareEqual.h"
2 | #import "CompareGreaterThan.h"
3 |
--------------------------------------------------------------------------------
/CheckmanTests/Frameworks/Cedar.framework/Headers/Contain.h:
--------------------------------------------------------------------------------
1 | #import "Base.h"
2 |
3 | namespace Cedar { namespace Matchers {
4 | template
5 | class Contain : public Base<> {
6 | private:
7 | Contain & operator=(const Contain &);
8 |
9 | public:
10 | explicit Contain(const T & element);
11 | ~Contain();
12 | // Allow default copy ctor.
13 |
14 | template
15 | bool matches(const U &) const;
16 |
17 | protected:
18 | virtual NSString * failure_message_end() const;
19 |
20 | private:
21 | const T & element_;
22 | };
23 |
24 | template
25 | inline Contain contain(const T & element) {
26 | return Contain(element);
27 | }
28 |
29 | template
30 | inline Contain::Contain(const T & element)
31 | : Base<>(), element_(element) {
32 | }
33 |
34 | template
35 | Contain::~Contain() {
36 | }
37 |
38 | template
39 | inline /*virtual*/ NSString * Contain::failure_message_end() const {
40 | NSString * elementString = Stringifiers::string_for(element_);
41 | return [NSString stringWithFormat:@"contain <%@>", elementString];
42 | }
43 |
44 | #pragma mark Generic
45 | template template
46 | bool Contain