Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Sparkel setup #37

Merged
merged 5 commits into from
May 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added *.log
Empty file.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# OS X
.DS_Store

# Sparkle
dsa_priv.pem

Design

# Xcode
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 0.5.0 (Next)

* Your contribution here.
* [#37](https://github.com/Antondomashnev/FBSnapshotsViewer/pull/37): Add AppCode snapshot testing support - [@antondomashnev](https://github.com/antondomashnev).

### 0.4.0 (21.05.2017)

Expand Down
18 changes: 16 additions & 2 deletions FBSnapshotsViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
6D3000471EBFBE86005B6103 /* PreferencesWireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3000461EBFBE86005B6103 /* PreferencesWireframe.swift */; };
6D3000491EBFBE97005B6103 /* PreferencesModuleInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3000481EBFBE97005B6103 /* PreferencesModuleInterface.swift */; };
6D30004B1EBFBECA005B6103 /* PreferencesPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D30004A1EBFBECA005B6103 /* PreferencesPresenter.swift */; };
6D3003B21ED20B13000CCAC8 /* Updater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3003B11ED20B13000CCAC8 /* Updater.swift */; };
6D3003B41ED20B36000CCAC8 /* SUUpdater+Updater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D3003B31ED20B36000CCAC8 /* SUUpdater+Updater.swift */; };
6D33A9D21EB4D38D0089AEDD /* ApplicationSnapshotTestResultListenerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D33A9D11EB4D38D0089AEDD /* ApplicationSnapshotTestResultListenerSpec.swift */; };
6D33A9D41EB4DAF60089AEDD /* AutoHashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D33A9D31EB4DAF60089AEDD /* AutoHashable.swift */; };
6D33A9D61EB4DB650089AEDD /* AutoHashable.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D33A9D51EB4DB650089AEDD /* AutoHashable.generated.swift */; };
Expand Down Expand Up @@ -119,6 +121,7 @@
6DF15B751E662CBD00DFA181 /* TestResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF15B741E662CBD00DFA181 /* TestResultsController.swift */; };
6DF15B771E662CCC00DFA181 /* TestResultsUserInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF15B761E662CCC00DFA181 /* TestResultsUserInterface.swift */; };
6DF15B7A1E662E0500DFA181 /* TestResultsWireframe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DF15B791E662E0500DFA181 /* TestResultsWireframe.swift */; };
6DF7ED851ED3880800A54C54 /* dsa_pub.pem in Resources */ = {isa = PBXBuildFile; fileRef = 6DF7ED841ED3880800A54C54 /* dsa_pub.pem */; };
8CDDC590BF4FDD5C704BD750 /* Pods_FBSnapshotsViewer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CDDF30470ECABA40C67FCA8 /* Pods_FBSnapshotsViewer.framework */; };
9ECFB3D932C1A604705C3060 /* Pods_FBSnapshotsViewerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AB66AD06A529A00E998FD8B /* Pods_FBSnapshotsViewerTests.framework */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -171,6 +174,8 @@
6D3000461EBFBE86005B6103 /* PreferencesWireframe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesWireframe.swift; sourceTree = "<group>"; };
6D3000481EBFBE97005B6103 /* PreferencesModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesModuleInterface.swift; sourceTree = "<group>"; };
6D30004A1EBFBECA005B6103 /* PreferencesPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesPresenter.swift; sourceTree = "<group>"; };
6D3003B11ED20B13000CCAC8 /* Updater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Updater.swift; sourceTree = "<group>"; };
6D3003B31ED20B36000CCAC8 /* SUUpdater+Updater.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SUUpdater+Updater.swift"; sourceTree = "<group>"; };
6D33A9D11EB4D38D0089AEDD /* ApplicationSnapshotTestResultListenerSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplicationSnapshotTestResultListenerSpec.swift; sourceTree = "<group>"; };
6D33A9D31EB4DAF60089AEDD /* AutoHashable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutoHashable.swift; sourceTree = "<group>"; };
6D33A9D51EB4DB650089AEDD /* AutoHashable.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutoHashable.generated.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -252,6 +257,7 @@
6DF15B741E662CBD00DFA181 /* TestResultsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestResultsController.swift; sourceTree = "<group>"; };
6DF15B761E662CCC00DFA181 /* TestResultsUserInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestResultsUserInterface.swift; sourceTree = "<group>"; };
6DF15B791E662E0500DFA181 /* TestResultsWireframe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestResultsWireframe.swift; sourceTree = "<group>"; };
6DF7ED841ED3880800A54C54 /* dsa_pub.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = dsa_pub.pem; sourceTree = "<group>"; };
9EACAED9B9A9448DDC8DDF8F /* Pods-FBSnapshotsViewerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FBSnapshotsViewerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-FBSnapshotsViewerTests/Pods-FBSnapshotsViewerTests.release.xcconfig"; sourceTree = "<group>"; };
B17C48E1D2FE2D15D9563E9C /* Pods-FBSnapshotsViewer.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FBSnapshotsViewer.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FBSnapshotsViewer/Pods-FBSnapshotsViewer.debug.xcconfig"; sourceTree = "<group>"; };
E5BEA4ED9D938AA805237841 /* Pods-FBSnapshotsViewer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FBSnapshotsViewer.release.xcconfig"; path = "Pods/Target Support Files/Pods-FBSnapshotsViewer/Pods-FBSnapshotsViewer.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -421,6 +427,7 @@
6D4724C01E3E9F2400F38161 /* Assets.xcassets */,
6D4724C21E3E9F2400F38161 /* Main.storyboard */,
6D4724C51E3E9F2400F38161 /* Info.plist */,
6DF7ED841ED3880800A54C54 /* dsa_pub.pem */,
);
path = FBSnapshotsViewer;
sourceTree = "<group>";
Expand Down Expand Up @@ -531,6 +538,7 @@
6D8362761E79422D000794AE /* AutoMockable.swift */,
6D8BD71E1EB13949004928F7 /* Application.swift */,
6D789CDD1EC3B6CC00EEF7EE /* AutoCases.swift */,
6D3003B11ED20B13000CCAC8 /* Updater.swift */,
);
path = Protocols;
sourceTree = "<group>";
Expand All @@ -539,6 +547,7 @@
isa = PBXGroup;
children = (
6D8BF2BC1ED0B78700C368D1 /* String+HTML.swift */,
6D3003B31ED20B36000CCAC8 /* SUUpdater+Updater.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -768,6 +777,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6DF7ED851ED3880800A54C54 /* dsa_pub.pem in Resources */,
6D4724C11E3E9F2400F38161 /* Assets.xcassets in Resources */,
6D848C571E68D0C90000FC1E /* TestResultCell.xib in Resources */,
6D4724C41E3E9F2400F38161 /* Main.storyboard in Resources */,
Expand Down Expand Up @@ -948,6 +958,7 @@
6D33A9D61EB4DB650089AEDD /* AutoHashable.generated.swift in Sources */,
6D7D78FE1EAFF2430001C1A0 /* SnapshotTestResultFactory.swift in Sources */,
6D789CDA1EC3B38C00EEF7EE /* DerivedDataFolderType.swift in Sources */,
6D3003B41ED20B36000CCAC8 /* SUUpdater+Updater.swift in Sources */,
6DF15B7A1E662E0500DFA181 /* TestResultsWireframe.swift in Sources */,
6D0AF6B21EC50B6300F9A410 /* AppProcessInfo.swift in Sources */,
6D65C6301E62F3AB00733118 /* ApplicationSnapshotTestResultListener.swift in Sources */,
Expand All @@ -972,6 +983,7 @@
6DA1BF981E7755110017D47B /* Colors.swift in Sources */,
6D789CE61EC3BFA900EEF7EE /* Configuration.swift in Sources */,
6DBD99DB1E7AB3D400E1714E /* FileWatcherFactory.swift in Sources */,
6D3003B21ED20B13000CCAC8 /* Updater.swift in Sources */,
6D33A9D41EB4DAF60089AEDD /* AutoHashable.swift in Sources */,
6DDFBDA61E64E53D00DFC0A4 /* MenuStatusItemMenu.swift in Sources */,
6DE347751E47D8CE004147DF /* MenuController.swift in Sources */,
Expand Down Expand Up @@ -1149,6 +1161,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = XZ2J8VAMV6;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
INFOPLIST_FILE = FBSnapshotsViewer/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
OTHER_CODE_SIGN_FLAGS = "--deep";
Expand All @@ -1169,13 +1182,14 @@
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = XZ2J8VAMV6;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
INFOPLIST_FILE = FBSnapshotsViewer/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
OTHER_CODE_SIGN_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.antondomashnev.FBSnapshotsViewer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "1554e469-0170-445a-8d37-edc1e783edf6";
PROVISIONING_PROFILE_SPECIFIER = "mac_production_ com.antondomashnev.FBSnapshotsView";
PROVISIONING_PROFILE = "a27fb3d0-5018-48f4-aa1a-5c52a85c926e";
PROVISIONING_PROFILE_SPECIFIER = mac_production_com.antondomashnev.FBSnapshotsView;
SWIFT_VERSION = 3.0;
};
name = Release;
Expand Down
16 changes: 16 additions & 0 deletions FBSnapshotsViewer/Extensions/SUUpdater+Updater.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// SUUpdater+Updater.swift
// FBSnapshotsViewer
//
// Created by Anton Domashnev on 21.05.17.
// Copyright © 2017 Anton Domashnev. All rights reserved.
//

import Foundation
import Sparkle

extension SUUpdater: Updater {
func checkForUpdates() {
self.checkForUpdates(nil)
}
}
6 changes: 5 additions & 1 deletion FBSnapshotsViewer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>0.5.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>3</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand All @@ -30,5 +30,9 @@
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUFeedURL</key>
<string>https://whispering-savannah-78358.herokuapp.com/FBSnapshotsViewer/appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>dsa_pub.pem</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions FBSnapshotsViewer/Menu/MenuModuleInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ protocol MenuModuleInterface: class, AutoMockable {
func showTestResults()
func showPreferences()
func showApplicationMenu()
func checkForUpdates()
func quit()
}
9 changes: 8 additions & 1 deletion FBSnapshotsViewer/Menu/Presenter/MenuPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,29 @@
//

import Cocoa
import Sparkle

class MenuPresenter {
fileprivate let application: Application
fileprivate let updater: Updater
let configuration: Configuration
var wireframe: MenuWireframe?
var interactor: MenuInteractorInput?
weak var userInterface: MenuUserInterface?

init(configuration: Configuration = Configuration.default(), application: Application = NSApp) {
init(configuration: Configuration = Configuration.default(), application: Application = NSApp, updater: Updater = SUUpdater.shared()) {
self.application = application
self.configuration = configuration
self.updater = updater
}
}

// MARK: - MenuModuleInterface
extension MenuPresenter: MenuModuleInterface {
func checkForUpdates() {
updater.checkForUpdates()
}

func showTestResults() {
guard let testResults = interactor?.foundTestResults, !testResults.isEmpty else {
return
Expand Down
4 changes: 4 additions & 0 deletions FBSnapshotsViewer/Menu/User Interface/MenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ extension MenuController: MenuStatusItemMenuTarget {
func menuStatusItemMenu(_ menu: NSMenu, preferencesItemClicked: NSMenuItem) {
eventHandler?.showPreferences()
}

func menuStatusItemMenu(_ menu: NSMenu, checkForUpdatesItemClicked: NSMenuItem) {
eventHandler?.checkForUpdates()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Cocoa
protocol MenuStatusItemMenuTarget: class {
func menuStatusItemMenu(_ menu: NSMenu, quitItemClicked: NSMenuItem)
func menuStatusItemMenu(_ menu: NSMenu, preferencesItemClicked: NSMenuItem)
func menuStatusItemMenu(_ menu: NSMenu, checkForUpdatesItemClicked: NSMenuItem)
}

class MenuStatusItemMenu: NSMenu {
Expand All @@ -31,7 +32,8 @@ class MenuStatusItemMenu: NSMenu {
func buildUp() {
let quitItem = NSMenuItem(title: "Quit", action: #selector(quitItemClicked(sender:)), keyEquivalent: "Q")
let preferencesItem = NSMenuItem(title: "Preferences", action: #selector(preferencesItemClicked(sender:)), keyEquivalent: "P")
let items = [preferencesItem, quitItem]
let checkForUpdates = NSMenuItem(title: "Check for Updates", action: #selector(checkForUpdatesItemClicked(sender:)), keyEquivalent: "U")
let items = [preferencesItem, checkForUpdates, quitItem]
for item in items {
item.target = self
addItem(item)
Expand All @@ -47,4 +49,8 @@ class MenuStatusItemMenu: NSMenu {
@objc func quitItemClicked(sender: NSMenuItem) {
target?.menuStatusItemMenu(self, quitItemClicked: sender)
}

@objc func checkForUpdatesItemClicked(sender: NSMenuItem) {
target?.menuStatusItemMenu(self, checkForUpdatesItemClicked: sender)
}
}
13 changes: 13 additions & 0 deletions FBSnapshotsViewer/Protocols/Updater.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Updater.swift
// FBSnapshotsViewer
//
// Created by Anton Domashnev on 21.05.17.
// Copyright © 2017 Anton Domashnev. All rights reserved.
//

import Foundation

protocol Updater: AutoMockable {
func checkForUpdates()
}
36 changes: 36 additions & 0 deletions FBSnapshotsViewer/dsa_pub.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-----BEGIN PUBLIC KEY-----
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
o1fwsl3Dbje2UrNoLRJW
-----END PUBLIC KEY-----
20 changes: 20 additions & 0 deletions FBSnapshotsViewerTests/MenuControllerSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@ class MenuControllerSpec: QuickSpec {
}
}

describe("menuStatusItemMenu.preferencesItemClicked") {
beforeEach {
menuController.menuStatusItemMenu(NSMenu(), preferencesItemClicked: NSMenuItem())
}

it("quits") {
expect(eventHandler.showPreferencesCalled).to(beTrue())
}
}

describe("menuStatusItemMenu.checkForUpdatesItemClicked") {
beforeEach {
menuController.menuStatusItemMenu(NSMenu(), checkForUpdatesItemClicked: NSMenuItem())
}

it("quits") {
expect(eventHandler.checkForUpdatesCalled).to(beTrue())
}
}

describe(".handleIconMouseEvent") {
context("when rightMouseUp") {
beforeEach {
Expand Down
14 changes: 13 additions & 1 deletion FBSnapshotsViewerTests/MenuPresenterSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,32 @@ class MenuPresenterSpec: QuickSpec {
var presenter: MenuPresenter!
var interactor: MenuInteractorInputMock!
var wireframe: MenuPresenter_MockMenuWireframe!
var updater: UpdaterMock!

beforeEach {
updater = UpdaterMock()
derivedDataFolder = DerivedDataFolder.xcodeCustom(path: "Users/antondomashnev/Library/Xcode/temporaryFolder")
configuration = FBSnapshotsViewer.Configuration(derivedDataFolder: derivedDataFolder)
application = ApplicationMock()
wireframe = MenuPresenter_MockMenuWireframe()
interactor = MenuInteractorInputMock()
presenter = MenuPresenter(configuration: configuration, application: application)
presenter = MenuPresenter(configuration: configuration, application: application, updater: updater)
userInterface = MenuUserInterfaceMock()
presenter.userInterface = userInterface
presenter.interactor = interactor
presenter.wireframe = wireframe
}

describe(".checkForUpdates") {
beforeEach {
presenter.checkForUpdates()
}

it("checks for updaters") {
expect(updater.checkForUpdatesCalled).to(beTrue())
}
}

describe(".showPreferences") {
beforeEach {
presenter.showPreferences()
Expand Down
15 changes: 15 additions & 0 deletions FBSnapshotsViewerTests/MenuStatusItemMenuSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class MenuStatusItemMenu_MockMenuStatusItemMenuTarget: MenuStatusItemMenuTarget
func menuStatusItemMenu(_ menu: NSMenu, preferencesItemClicked: NSMenuItem) {
menuStatusItemMenuPreferencesItemClickedCalled = true
}

var menuStatusItemMenuCheckForUpdatesItemClickedCalled: Bool = false
func menuStatusItemMenu(_ menu: NSMenu, checkForUpdatesItemClicked: NSMenuItem) {
menuStatusItemMenuCheckForUpdatesItemClickedCalled = true
}
}

class MenuStatusItemMenuSpec: QuickSpec {
Expand All @@ -43,6 +48,16 @@ class MenuStatusItemMenuSpec: QuickSpec {
}
}

describe(".checkForUpdatesItemClicked") {
beforeEach {
itemMenu.checkForUpdatesItemClicked(sender: NSMenuItem(title: "Check for Updates", action: nil, keyEquivalent: "U"))
}

it("notifies target") {
expect(target.menuStatusItemMenuCheckForUpdatesItemClickedCalled).to(beTrue())
}
}

describe(".quitItemClicked") {
beforeEach {
itemMenu.quitItemClicked(sender: NSMenuItem(title: "Quit", action: nil, keyEquivalent: "Q"))
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ target 'FBSnapshotsViewer' do
pod 'Sourcery', '~> 0.5'
pod 'SwiftGen', '~> 4.2'
pod 'SwiftLint', '~> 0.16'
pod 'Sparkle', '~> 1.17'
target 'FBSnapshotsViewerTests' do
inherit! :search_paths
pod 'Quick', '~> 1.0'
Expand Down
Loading