mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 08:15:24 +00:00
35 lines
1.3 KiB
Swift
35 lines
1.3 KiB
Swift
import ArgumentParser
|
|
import CommandLineTools
|
|
import Foundation
|
|
|
|
struct SetupProject: ParsableCommand {
|
|
static let configuration = CommandConfiguration(abstract: "A tool to setup the required components to efficiently run and contribute to Element X iOS")
|
|
|
|
func run() throws {
|
|
try setupGitHooks()
|
|
try brewInstall()
|
|
try mintPackagesInstall()
|
|
try xcodegen()
|
|
}
|
|
|
|
func setupGitHooks() throws {
|
|
try Zsh.run(command: "git config core.hooksPath .githooks")
|
|
}
|
|
|
|
func brewInstall() throws {
|
|
// Uninstall SwiftFormat from HEAD first if it is installed.
|
|
try Zsh.run(command: "if brew list --versions swiftformat | grep -q HEAD; then brew uninstall swiftformat; fi")
|
|
// Uninstall Periphery from the deprecated tap first if it is installed (superseded by the homebrew-core formula).
|
|
try Zsh.run(command: "if brew list --cask --versions periphery &> /dev/null; then brew uninstall --cask periphery; fi")
|
|
try Zsh.run(command: "brew install xcodegen swiftgen swiftformat git-lfs sourcery mint pkl kiliankoe/formulae/swift-outdated localazy/tools/localazy periphery")
|
|
}
|
|
|
|
func mintPackagesInstall() throws {
|
|
try Zsh.run(command: "mint install Asana/locheck")
|
|
}
|
|
|
|
func xcodegen() throws {
|
|
try Zsh.run(command: "xcodegen")
|
|
}
|
|
}
|