Skip to content

Commit

Permalink
Merge pull request #47 from raptorxcz/feature/swift_syntax
Browse files Browse the repository at this point in the history
Update Rubicon app
  • Loading branch information
libec authored Sep 15, 2023
2 parents 834a69f + 883721d commit 2dd1209
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 167 deletions.
25 changes: 15 additions & 10 deletions Rubicon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
6656B5EB2AA9F805003E6391 /* Rubicon in Frameworks */ = {isa = PBXBuildFile; productRef = 6656B5EA2AA9F805003E6391 /* Rubicon */; };
6647D88B2AB1CCDB0064CCEB /* Rubicon in Frameworks */ = {isa = PBXBuildFile; productRef = 6647D88A2AB1CCDB0064CCEB /* Rubicon */; };
6647D88D2AB1CCE00064CCEB /* Rubicon in Frameworks */ = {isa = PBXBuildFile; productRef = 6647D88C2AB1CCE00064CCEB /* Rubicon */; };
66990B3125D4835D00F5875B /* XcodeKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBF3D3871EC78F2B00FAB739 /* XcodeKit.framework */; };
66990B3225D4835D00F5875B /* XcodeKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BBF3D3871EC78F2B00FAB739 /* XcodeKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
669D6860202660CB00600E59 /* InvocationGeneratorOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669D685F202660CB00600E59 /* InvocationGeneratorOutput.swift */; };
669D68622026624800600E59 /* PasteboardGeneratorOutput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669D68612026624800600E59 /* PasteboardGeneratorOutput.swift */; };
BB0168D31EC78945001024A9 /* IndentationFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0168D21EC78945001024A9 /* IndentationFormatter.swift */; };
BB0474341EC0609100FC2B34 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0474331EC0609100FC2B34 /* AppDelegate.swift */; };
BB0474361EC0609100FC2B34 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB0474351EC0609100FC2B34 /* ViewController.swift */; };
BB0474381EC0609100FC2B34 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BB0474371EC0609100FC2B34 /* Assets.xcassets */; };
Expand Down Expand Up @@ -70,10 +70,9 @@

/* Begin PBXFileReference section */
2C57FE2A28E5DB9700CCFB1D /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
6656B5E92AA9F7E6003E6391 /* Rubicon */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Rubicon; sourceTree = "<group>"; };
6647D8892AB1CC1E0064CCEB /* Rubicon */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Rubicon; sourceTree = "<group>"; };
669D685F202660CB00600E59 /* InvocationGeneratorOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvocationGeneratorOutput.swift; sourceTree = "<group>"; };
669D68612026624800600E59 /* PasteboardGeneratorOutput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasteboardGeneratorOutput.swift; sourceTree = "<group>"; };
BB0168D21EC78945001024A9 /* IndentationFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndentationFormatter.swift; sourceTree = "<group>"; };
BB0168D41EC789FF001024A9 /* RubiconApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RubiconApp.entitlements; sourceTree = "<group>"; };
BB0474311EC0609100FC2B34 /* Rubicon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Rubicon.app; sourceTree = BUILT_PRODUCTS_DIR; };
BB0474331EC0609100FC2B34 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -95,14 +94,15 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6656B5EB2AA9F805003E6391 /* Rubicon in Frameworks */,
6647D88B2AB1CCDB0064CCEB /* Rubicon in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BB04749F1EC068FA00FC2B34 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6647D88D2AB1CCE00064CCEB /* Rubicon in Frameworks */,
66990B3125D4835D00F5875B /* XcodeKit.framework in Frameworks */,
BB0474A51EC068FA00FC2B34 /* Cocoa.framework in Frameworks */,
);
Expand All @@ -114,7 +114,7 @@
6656B5E82AA9F7E6003E6391 /* Packages */ = {
isa = PBXGroup;
children = (
6656B5E92AA9F7E6003E6391 /* Rubicon */,
6647D8892AB1CC1E0064CCEB /* Rubicon */,
);
name = Packages;
sourceTree = "<group>";
Expand Down Expand Up @@ -150,7 +150,6 @@
669D68612026624800600E59 /* PasteboardGeneratorOutput.swift */,
669D685F202660CB00600E59 /* InvocationGeneratorOutput.swift */,
BB0474A91EC068FA00FC2B34 /* SourceEditorExtension.swift */,
BB0168D21EC78945001024A9 /* IndentationFormatter.swift */,
);
path = RubiconExtension;
sourceTree = "<group>";
Expand Down Expand Up @@ -204,7 +203,7 @@
);
name = RubiconApp;
packageProductDependencies = (
6656B5EA2AA9F805003E6391 /* Rubicon */,
6647D88A2AB1CCDB0064CCEB /* Rubicon */,
);
productName = RubiconApp;
productReference = BB0474311EC0609100FC2B34 /* Rubicon.app */;
Expand All @@ -224,6 +223,9 @@
dependencies = (
);
name = RubiconExtension;
packageProductDependencies = (
6647D88C2AB1CCE00064CCEB /* Rubicon */,
);
productName = RubiconExtension;
productReference = BB0474A21EC068FA00FC2B34 /* Rubicon.appex */;
productType = "com.apple.product-type.xcode-extension";
Expand Down Expand Up @@ -314,7 +316,6 @@
files = (
669D6860202660CB00600E59 /* InvocationGeneratorOutput.swift in Sources */,
BB0474AA1EC068FA00FC2B34 /* SourceEditorExtension.swift in Sources */,
BB0168D31EC78945001024A9 /* IndentationFormatter.swift in Sources */,
669D68622026624800600E59 /* PasteboardGeneratorOutput.swift in Sources */,
BB0474AC1EC068FA00FC2B34 /* Generate.swift in Sources */,
);
Expand Down Expand Up @@ -618,7 +619,11 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
6656B5EA2AA9F805003E6391 /* Rubicon */ = {
6647D88A2AB1CCDB0064CCEB /* Rubicon */ = {
isa = XCSwiftPackageProductDependency;
productName = Rubicon;
};
6647D88C2AB1CCE00064CCEB /* Rubicon */ = {
isa = XCSwiftPackageProductDependency;
productName = Rubicon;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
9 changes: 9 additions & 0 deletions Rubicon/Sources/Rubicon/Integration/Rubicon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,13 @@ public final class Rubicon {
)
}

public func updateTearDown(text: String, spacing: Int) throws -> String {
let parser = NilableVariablesParserImpl()
let tearDownInteractor = TearDownInteractor(nilableVariablesParser: parser)
return try tearDownInteractor.execute(text: text, spacing: spacing)
}

func x() {
Rubicon().makeSpy(code: <#T##String#>, accessLevel: <#T##AccessLevel#>, indentStep: <#T##String#>)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ final class SpyIntegrationTests: XCTestCase {
var name: String? { get }
var color: Int { get set }
@MainActor
func go()
func load(with stuff: Int, label: String) throws -> Int
func isFull(validate: @escaping () -> Void) -> Bool
Expand Down
4 changes: 2 additions & 2 deletions RubiconApp/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17506"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down
20 changes: 4 additions & 16 deletions RubiconApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,19 @@
import Cocoa
import Rubicon

class ViewController: NSViewController, GeneratorOutput {
class ViewController: NSViewController {
@IBOutlet weak var sourceTextField: NSTextView!
@IBOutlet var resultLabel: NSTextView!

@IBAction func generateSpy(_ sender: Any) {
let spyMocksController = MocksGeneratorControllerImpl(output: self, interactor: CreateSpyInteractor(accessLevel: .internal))
let texts = [sourceTextField.string]
spyMocksController.run(texts: texts)
resultLabel.string = Rubicon().makeSpy(code: sourceTextField.string, accessLevel: .internal, indentStep: " ").joined(separator: "\n\n")
}

@IBAction func generateStub(_ sender: Any) {
let spyMocksController = MocksGeneratorControllerImpl(output: self, interactor: CreateStubInteractor(accessLevel: .internal))
let texts = [sourceTextField.string]
spyMocksController.run(texts: texts)
resultLabel.string = Rubicon().makeStub(code: sourceTextField.string, accessLevel: .internal, indentStep: " ").joined(separator: "\n\n")
}

@IBAction func generateDummy(_ sender: Any) {
let spyMocksController = MocksGeneratorControllerImpl(output: self, interactor: CreateDummyInteractor(accessLevel: .internal))
let texts = [sourceTextField.string]
spyMocksController.run(texts: texts)
}

// MARK: - GeneratorOutput

func save(text: String) {
resultLabel.string = text
resultLabel.string = Rubicon().makeDummy(code: sourceTextField.string, accessLevel: .internal, indentStep: " ").joined(separator: "\n\n")
}
}
Loading

0 comments on commit 2dd1209

Please sign in to comment.