This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install clang libicu-dev libcurl4-openssl-dev lldb git wget unzip -y | |
wget https://swift.org/builds/swift-3.0.1-release/ubuntu1604/swift-3.0.1-RELEASE/swift-3.0.1-RELEASE-ubuntu16.04.tar.gz | |
tar zxf swift-3.0.1*.tar.gz && rm -rf swift-3.0.1*.tar.gz | |
sudo mv swift-3.0.1* /swift-3.0.1 | |
echo "export PATH=/swift-3.0.1/usr/bin:\"\${PATH}\"" >> ~/.bashrc | |
source ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su | |
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install htop -y | |
apt-get install unattended-upgrades -y && dpkg-reconfigure -plow unattended-upgrades | |
apt-get install ntp -y && ntpq -p && service ntp restart | |
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Vapor | |
import SwiftyBeaverVapor | |
import SwiftyBeaver | |
// set-up SwiftyBeaver logging destinations (console, file, cloud, ...) | |
let console = ConsoleDestination() // log to Xcode Console in color | |
let file = FileDestination() // log to file | |
file.logFileURL = URL(string: "file:///tmp/VaporLogs.log")! // set log file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// home route | |
app.get("/") { request in | |
// manual send test | |
NSLog("starting sending test on a serial queue ...") | |
var queue: DispatchQueue? | |
let uuid = NSUUID().uuidString | |
let queueLabel = "swiftybeaver-queue-" + uuid | |
queue = DispatchQueue(label: queueLabel, target: queue) | |
NSLog("using dispatch queue \(queueLabel)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set custom level strings to add color | |
let console = ConsoleDestination() | |
console.levelString.Verbose = "💜 VERBOSE" | |
console.levelString.Debug = "💚 DEBUG" | |
console.levelString.Info = "💙 INFO" | |
console.levelString.Warning = "💛 WARNING" | |
console.levelString.Error = "❤️ ERROR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swift build --clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swift package generate-xcodeproj | |
> generated: ./MyProject.xcodeproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swift package update | |
> Cloning https://github.com/SwiftyBeaver/SwiftyBeaver.git | |
> HEAD is now at 83a0dd4 colored Emojis for native Xcode 8 Console support | |
> Resolved version: 1.0.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PackageDescription | |
let package = Package( | |
name: "MyProject", | |
targets: [], | |
dependencies: [ | |
.Package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", | |
majorVersion: 1, minor: 0) | |
] | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir MyProject | |
cd MyProject | |
swift package init --type executable | |
# will create the following output | |
> Creating executable package: MyProject | |
> Creating Package.swift | |
> Creating .gitignore | |
> Creating Sources/ | |
> Creating Sources/main.swift |