-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall.swift
executable file
·42 lines (29 loc) · 1.83 KB
/
Install.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Foundation
import Files // marathon:https://github.com/JohnSundell/Files.git
import ShellOut // marathon:https://github.com/JohnSundell/ShellOut.git
let fontsFolder = try Folder.home.subfolder(atPath: "Library/Fonts")
if !fontsFolder.containsFile(named: "SourceCodePro-Regular.ttf") {
print("🅰️ Downloading Source Code Pro font...")
let fontZipURL = URL(string: "https://github.com/adobe-fonts/source-code-pro/archive/2.030R-ro/1.050R-it.zip")!
let fontZipData = try Data(contentsOf: fontZipURL)
print("🅰️ Installing Source Code Pro font...")
let fontZipFile = try fontsFolder.createFile(named: "SourceCodePro.zip", contents: fontZipData)
try shellOut(to: "unzip \(fontZipFile.name) -d SourceCodePro", at: fontsFolder.path)
let sourceCodeProFolder = try fontsFolder.subfolder(named: "SourceCodePro")
let ttfFolder = try sourceCodeProFolder.subfolders.first!.subfolder(named: "TTF")
try ttfFolder.files.move(to: fontsFolder)
try sourceCodeProFolder.delete()
try fontZipFile.delete()
}
print("🎨 Downloading Xcode theme...")
let themeURL = URL(string: "https://raw.githubusercontent.com/PoissonBallon/XcodeTheme/master/Poisson's%20One%20Dark.dvtcolortheme")!
let themeData = try Data(contentsOf: themeURL)
print("🎨 Installing Xcode theme...")
let xcodeFolder = try Folder.home.subfolder(atPath: "Library/Developer/Xcode")
let userDataFolder = try xcodeFolder.createSubfolderIfNeeded(withName: "UserData")
let themeFolder = try userDataFolder.createSubfolderIfNeeded(withName: "FontAndColorThemes")
let themeFile = try themeFolder.createFile(named: "PoissonOneDark.dvtcolortheme")
try themeFile.write(data: themeData)
print("")
print("🎉 Poisson One Dark theme successfully installed")
print("👍 Select it in Xcode's preferences to start using it (you may have to restart Xcode first)")