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

fix: Remove actions support #281

Merged
merged 2 commits into from
Jun 29, 2024
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
11 changes: 0 additions & 11 deletions InContext/Helper/Model/SiteModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ class SiteModel: ObservableObject, Identifiable {
return site.favorites
}

var actions: [Site.Action] {
return site.actions
}

init(rootURL: URL) {
self.rootURL = rootURL
// TODO: Guard the configuration loading.
Expand All @@ -61,13 +57,6 @@ class SiteModel: ObservableObject, Identifiable {
self.server = Server(site: site, tracker: tracker)
}

func run(_ action: Site.Action) {
Task {
let runner = ActionRunner(site: site, action: action, tracker: self.tracker)
runner.run()
}
}

func start() {
dispatchPrecondition(condition: .onQueue(.main))
self.task = Task(priority: .medium) {
Expand Down
47 changes: 0 additions & 47 deletions InContext/Helper/Views/ActionsMenu.swift

This file was deleted.

13 changes: 0 additions & 13 deletions InContext/Helper/Views/LogView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,6 @@ struct LogView: View {
}
}

ToolbarItem {
Menu {
ForEach(siteModel.actions) { action in
Button(action.name) {
siteModel.run(action)
}
}
} label: {
Label("Actions", systemImage: "play")
}
.disabled(siteModel.actions.isEmpty)
}

}
}

Expand Down
1 change: 0 additions & 1 deletion InContext/Helper/Views/SiteMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ struct SiteMenu: View {
}
}
Divider()
ActionsMenu(siteModel: siteModel)
FavoritesMenu(siteModel: siteModel)
Divider()
Button("Logs...") {
Expand Down
4 changes: 0 additions & 4 deletions InContext/InContext.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
D8A739BA2AA6627500946EED /* SettingsMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8A739B92AA6627500946EED /* SettingsMenu.swift */; };
D8AD37AF2AA69FDF0006555F /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8AD37AE2AA69FDF0006555F /* Event.swift */; };
D8E4C1212BC9F81000B09A78 /* Main.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E4C1202BC9F77300B09A78 /* Main.swift */; };
D8E592242AB3A840000EE676 /* ActionsMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E592232AB3A840000EE676 /* ActionsMenu.swift */; };
D8E592262AB3A8C3000EE676 /* FavoritesMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E592252AB3A8C3000EE676 /* FavoritesMenu.swift */; };
D8F672782AC8988D0073900D /* TaskRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F672772AC8988D0073900D /* TaskRow.swift */; };
D8F6727A2AC898B00073900D /* SessionFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F672792AC898B00073900D /* SessionFooter.swift */; };
Expand Down Expand Up @@ -113,7 +112,6 @@
D8A739B92AA6627500946EED /* SettingsMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsMenu.swift; sourceTree = "<group>"; };
D8AD37AE2AA69FDF0006555F /* Event.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = "<group>"; };
D8E4C1202BC9F77300B09A78 /* Main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Main.swift; sourceTree = "<group>"; };
D8E592232AB3A840000EE676 /* ActionsMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionsMenu.swift; sourceTree = "<group>"; };
D8E592252AB3A8C3000EE676 /* FavoritesMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesMenu.swift; sourceTree = "<group>"; };
D8F672772AC8988D0073900D /* TaskRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskRow.swift; sourceTree = "<group>"; };
D8F672792AC898B00073900D /* SessionFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionFooter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -173,7 +171,6 @@
D8121A762AA05DB300EEDF5B /* Views */ = {
isa = PBXGroup;
children = (
D8E592232AB3A840000EE676 /* ActionsMenu.swift */,
D8E592252AB3A8C3000EE676 /* FavoritesMenu.swift */,
D8A739B32AA660F400946EED /* LogView.swift */,
D8A739B52AA6611E00946EED /* LogWindow.swift */,
Expand Down Expand Up @@ -465,7 +462,6 @@
buildActionMask = 2147483647;
files = (
D8A739B62AA6611E00946EED /* LogWindow.swift in Sources */,
D8E592242AB3A840000EE676 /* ActionsMenu.swift in Sources */,
D80E4FD12AA7AD5300FD4BB5 /* HelperTracker.swift in Sources */,
D8A739BA2AA6627500946EED /* SettingsMenu.swift in Sources */,
D80E4FCF2AA7AD3300FD4BB5 /* HelperSession.swift in Sources */,
Expand Down
1 change: 0 additions & 1 deletion Sources/InContextCommand/Commands/Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public struct Command: AsyncParsableCommand {
Build.self,
Clean.self,
Serve.self,
Run.self,
])

public init() {
Expand Down
47 changes: 0 additions & 47 deletions Sources/InContextCommand/Commands/Run.swift

This file was deleted.

92 changes: 0 additions & 92 deletions Sources/InContextCore/ActionRunner.swift

This file was deleted.

20 changes: 0 additions & 20 deletions Sources/InContextCore/Site.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ public struct Site {
public let title: String
}

public struct Action: Identifiable {

public let id: String
public let name: String
public let run: String

init(id: String, name: String? = nil, run: String) {
self.id = id
self.name = name ?? id
self.run = run
}

}

private static let importers: [any Importer] = [
CopyImporter(),
IgnoreImporter(),
Expand Down Expand Up @@ -98,12 +84,6 @@ public struct Site {
}
}

public var actions: [Action] {
return settings.actions.map { name, action in
return Action(id: name, name: action.name, run: action.run)
}
}

public init(rootURL: URL) throws {
self.rootURL = rootURL
self.settingsURL = rootURL.appendingPathComponent("site.yaml")
Expand Down