vapor / toolbox Goto Github PK
View Code? Open in Web Editor NEWSimplifies common command line tasks when using Vapor
License: MIT License
Simplifies common command line tasks when using Vapor
License: MIT License
We can host the buildpack and add some convenience flags etc. and merge changes from master.
Hi,
using the standard MySQL installation package (v.5.7.x, .dmg downloaded from MySQL.org) the include
and lib
are put under a common folder. It would be good to add them to the -I and -L options when doing vapor build --mysql
and vapor xcode --mysql
.
The correct folders are:
-I/usr/local/mysql/include
-L/usr/local/mysql/lib
I tried it myself with swift build ...
and Xcode 8 GM and the standard template project plus FluentMySQL compiles and link just fine.
All Travis builds seem to fail early on when installing swiftenv
, when running
eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)”
Here’s the relevant part of the log:
Downloading https://swift.org/builds/development/ubuntu1404/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a/swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a-ubuntu14.04.tar.gz
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
travis_time:end:18d01670:start=1464337566567830145,finish=1464337695805551807,duration=129237721662
�[0K
�[31;1mThe command "eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)"" failed and exited with 2 during .�[0m
Your build has been stopped.
I’ve run the eval command locally and it worked.
After restart Ubuntu device, things go wrong...
Aloks-MacBook-Pro:~ alok$ which swift
/usr/bin/swift
Aloks-MacBook-Pro:~ alok$ swift --version
Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)
Target: x86_64-apple-macosx10.9
Aloks-MacBook-Pro:~ alok$ curl -sL toolbox.vapor.sh | bash
✅ Compatible
Downloading...
Compiling...
Installing...
Install failed, trying sudo
Password:
Error: Installation failed.
Use vapor --help and vapor <command> --help to learn more.
I've follow the instruction to use Vapor in my environment (ElementaryOS based on Ubuntu 14.04).
I'm using Swiftenv to manage swift. And my swift already shows that its version is
Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift fc261045a5)
Target: x86_64-unknown-linux-gnu
And below is the errors when i start type command vapor
, vapor new project-name
, etc.
/usr/local/bin/vapor:145:14: warning: extraneous '_' in parameter: 'command' has no keyword argument name
func run(_ command: String) throws {
^~
/usr/local/bin/vapor:163:14: warning: extraneous '_' in parameter: 'command' has no keyword argument name
func run(_ command: String, orFail errorMessage: String) {
^~
/usr/local/bin/vapor:177:15: warning: extraneous '_' in parameter: 'message' has no keyword argument name
func fail(_ message: String) {
^~
/usr/local/bin/vapor:101:17: error: use of undeclared type 'ErrorProtocol'
enum Error: ErrorProtocol {
^~~~~~~~~~~~~
/usr/local/bin/vapor:101:10: error: type 'Vapor.Error' does not conform to protocol 'RawRepresentable'
enum Error: ErrorProtocol {
^
Swift.RawRepresentable:9:20: note: protocol requires nested type 'RawValue'
associatedtype RawValue
^
/usr/local/bin/vapor:136:42: error: value of type '[String]' has no member 'joined'
print("Usage: \(arguments[0]) [\(names.joined(separator: "|"))]")
^~~~~ ~~~~~~
/usr/local/bin/vapor:149:25: error: thrown expression type 'Vapor.Error' does not conform to 'ErrorType'
throw Error.Cancelled
~~~~~~^~~~~~~~~
/usr/local/bin/vapor:151:25: error: thrown expression type 'Vapor.Error' does not conform to 'ErrorType'
throw Error.System(result)
~~~~~~^~~~~~~~~~~~~~
/usr/local/bin/vapor:198:30: error: value of type '[String]' has no member 'joined'
var buildFlags = flags.joined(separator: " ")
^~~~~ ~~~~~~
/usr/local/bin/vapor:229:30: error: value of type '[String]' has no member 'joined'
let flagString = flags.joined(separator: " ")
Anyone can give me a solution to my problem? Thanks.
Hi,
Me again with running Vapor in Docker. Minor point but worth mentioning: I got to the final step of running vapor docker run
, which provides a command to run on the command line involving the value of
Hello! When I'm trying to run vapor build
(or any other vapor ...
command), I get following errors:
mb:hello-world alexander$ vapor build
/usr/local/bin/vapor:48:14: error: 'popen' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
let fp = popen(command, "r")
^~~~~
Darwin.popen:2:13: note: 'popen' has been explicitly marked unavailable here
public func popen(: UnsafePointer!, : UnsafePointer!) -> UnsafeMutablePointer!
^
/usr/local/bin/vapor:70:18: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
let result = system(command)
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:80:12: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
return system(command) == 0
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:88:12: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
return system("hash (command) 2>/dev/null") == 0
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:92:12: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
return system("ls (fileName) > /dev/null 2>&1") == 0
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:96:12: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
return system("test -z "$(git status --porcelain)" || exit 1") == 0
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:51:9: error: 'pclose' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
pclose(fp)
^~~~~~
Darwin.pclose:2:13: note: 'pclose' has been explicitly marked unavailable here
public func pclose(: UnsafeMutablePointer!) -> Int32
^
/usr/local/bin/vapor:51:9: warning: result of call to 'pclose' is unused
pclose(fp)
^ ~~~~
/usr/local/bin/vapor:590:17: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
system("git init (escapedName)")
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:590:17: warning: result of call to 'system' is unused
system("git init (escapedName)")
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/bin/vapor:591:17: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
system("cd (escapedName) && git add . && git commit -m "initial vapor project setup"")
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:591:17: warning: result of call to 'system' is unused
system("cd (escapedName) && git add . && git commit -m "initial vapor project setup"")
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/bin/vapor:605:17: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
system("open (escapedName)/.xcodeproj")
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(_: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:605:17: warning: result of call to 'system' is unused
system("open (escapedName)/.xcodeproj")
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/bin/vapor:783:16: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
return system(cmd) != 0
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:940:13: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
system("git add .")
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:940:13: warning: result of call to 'system' is unused
system("git add .")
^ ~~~~~~~~~~~~~
/usr/local/bin/vapor:941:13: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
system("git commit -m "setting up heroku"")
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:941:13: warning: result of call to 'system' is unused
system("git commit -m "setting up heroku"")
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/bin/vapor:942:13: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
system("git push heroku master")
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:942:13: warning: result of call to 'system' is unused
system("git push heroku master")
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
How can I fix it?
Hello. Can not init heroku app with newly created vapor project via cli.
$: vapor new HiVapor
Cloning Template [Done]
$: cd HiVapor
$: ls
Config Localization Package.swift Procfile Public README.md Resources Sources app.json license
$: vapor heroku init
Error: Git already has a heroku remote
$: git status
fatal: Not a git repository (or any of the parent directories): .git
$: vapor version
Vapor Toolbox v0.10.0
$: swiftenv version
DEVELOPMENT-SNAPSHOT-2016-08-18-a (set by /Users/Georg/Develop/VaporTest/HiVapor/.swift-version)
Shouldn't be too hard to build, and it's driving me nuts to maintain this. I would like this to open a new command set fix
(name pending). I'd like something that conveys the fragility inherent in the command set, but in the meantime, fix is concise and understandable.
The first LinuxMain will be:
vapor fix linux-main // fixes linux main
If there's time, I may attempt a secondary command
vapor fix alltests // fixes the `allTests` variable in tests
If secondary implemented
vapor fix tests // does alltests _and_ linuxmain
The fix commandset can be used for other annoyances associated w/ general dev, none come to mind right now.
Git support is a tiny bit wonky right now w/ Vapor New. Suggestions
Hi there,
I got Vapor running locally and was trying to get it running in Docker. When I used vapor docker init
and then vapor docker build
, I got a build error:
Error: Docker build failed: The command '/bin/sh -c SWIFT_ARCHIVE_NAME=swift-$SWIFT_VERSION-$SWIFT_PLATFORM && SWIFT_URL=https://swift.org/builds/$SWIFT_BRANCH/$(echo "$SWIFT_PLATFORM" | tr -d .)/swift-$SWIFT_VERSION/$SWIFT_ARCHIVE_NAME.tar.gz && wget -q $SWIFT_URL && wget -q $SWIFT_URL.sig && gpg --verify $SWIFT_ARCHIVE_NAME.tar.gz.sig && tar -xzf $SWIFT_ARCHIVE_NAME.tar.gz --directory / --strip-components=1 && rm -rf $SWIFT_ARCHIVE_NAME* /tmp/* /var/tmp/*' returned a non-zero code: 8
I dug deep for a while and discovered that in my version of Swift (which is DEVELOPMENT-SNAPSHOT-2016-07-25-a), the URL for fetching the Swift snapshot is being constructed incorrectly because SWIFT_BRANCH
is set to swift-3.0-preview-2. Note that I used DEVELOPMENT-SNAPSHOT-2016-07-25-a in accordance with your YouTube video from a few days ago.
When, however, I change SWIFT_BRANCH
to development, to correctly construct the URL, then Docker is able to build the image.
I don't really have a fix for this because I'm a Docker noob, but I wanted to mention it to you. Perhaps you can have some logic to match the SWIFT_BRANCH with the SWIFT_VERSION better, or allow it to be passed in as a docker build argument?
Bug?:
Server continues to run after closing the terminal window.
Proposed Solution:
Sever should automatically shut down once the terminal window is closed.
Temporarily, to install with Gold Master on OSX, use:
curl -sL https://raw.githubusercontent.com/vapor/toolbox/master-bootstrap-temp/master-bootstrap.sh | bash
Checking at check.qutheory.io doesn't work with new beta of xcode.
Would be nice to have something like
vapor new model --name <name>
and
vapor new controller --name <name>
With default needed stuff
Add a simple top level file. vapor.json
whose contents may be potentially expanded in future, but for now will support build-flags
. This means that all packages that opt-in can add this file.
After fetch, recursively search Packages/ for additional vapor.json
files and aggregate.
This allows for custom commands like linking mysql, or a generic build flag the user needs more often. It is also flexible enough that the user can pass whatever they might need to, including customized arguments etc.
Proposed format:
"build-flags": {
"all": [
"--customflag"
],
"linux": [
"--customLinuxLinker",
"--otherLinker"
]
"macOS": [
"--custom/linux/linker"
]
}
From #30 (comment) :
Also if you look at the console stuff powering that, you can see there's some cool code here for doing colors, etc.
I think it could be worth breaking this out into it's own package so both Vapor and the CLI can use it: https://github.com/qutheory/vapor/tree/master/Sources/Vapor/Console
https://github.com/vapor/toolbox/blob/master/bootstrap.sh
curl -sL "check.qutheory.io" | bash || exit 1;
is pointing to
https://raw.githubusercontent.com/qutheory/vapor/0.15.3/Utilities/compatibility.sh
I'm not sure where to find that redirect, so created an issue instead
We did a PR to fix the snapshot version
when running the command:
curl -sL toolbox.qutheory.io | bash
It gets stuck after Compiling once "Installing..." shows up.
Im sure I have the correct swift version and xcodebuild, but this step just stalls.
When I check vapor --help I receive:
/usr/local/bin/vapor:40:18: error: missing argument label 'message:' in call
fail("Invalid number of arguments.")
^
message:
/usr/local/bin/vapor:60:18: error: missing argument label 'message:' in call
fail("Unknown command: (Process.arguments[1])")
^
message:
/usr/local/bin/vapor:95:22: error: 'system' is unavailable in Swift: Use posix_spawn APIs or NSTask instead.
let result = system(command)
^~~~~~
Darwin.system:3:13: note: 'system' has been explicitly marked unavailable here
public func system(_: UnsafePointer!) -> Int32
^
/usr/local/bin/vapor:104:21: error: missing argument label 'command:' in call
try run(command)
^
command:
/usr/local/bin/vapor:106:18: error: missing argument label 'message:' in call
fail(errorMessage)
^
message:
/usr/local/bin/vapor:116:12: error: missing argument label 'command:' in call
run("rm -rf Packages .build", orFail: "Could not clean")
^
command:
/usr/local/bin/vapor:134:21: error: missing argument label 'command:' in call
try run("swift build (buildFlags)")
^
command:
/usr/local/bin/vapor:143:18: error: missing argument label 'message:' in call
fail("Could not build project.")
^
message:
/usr/local/bin/vapor:149:12: error: missing argument label 'command:' in call
run("mkdir -p .build", orFail: "Could not create .build directory")
^
command:
/usr/local/bin/vapor:178:21: error: missing argument label 'command:' in call
try run("(cc) (cflags) (files) -I (include) -L (lib) -lVapor -lJay -lHummingbird -llibc -lStrand (rpath) -o .build/VaporApp")
^
command:
/usr/local/bin/vapor:186:18: error: missing argument label 'message:' in call
fail("Could not build project.")
^
message:
/usr/local/bin/vapor:196:25: error: missing argument label 'command:' in call
try run(".build/VaporApp")
^
command:
/usr/local/bin/vapor:211:25: error: missing argument label 'command:' in call
try run(".build/(folder)/(name) (args)")
^
command:
/usr/local/bin/vapor:215:22: error: missing argument label 'message:' in call
fail("Could not run project")
^
message:
/usr/local/bin/vapor:218:18: error: missing argument label 'message:' in call
fail("Unknown error")
^
message:
/usr/local/bin/vapor:225:18: error: missing argument label 'message:' in call
fail("Invalid number of arguments.")
^
message:
/usr/local/bin/vapor:231:21: error: missing argument label 'command:' in call
try run("mkdir (escapedName)")
^
command:
/usr/local/bin/vapor:232:21: error: missing argument label 'command:' in call
try run("curl -L https://github.com/qutheory/vapor-example/archive/master.tar.gz > (escapedName)/vapor-example.tar.gz")
^
command:
/usr/local/bin/vapor:233:21: error: missing argument label 'command:' in call
try run("tar -xzf (escapedName)/vapor-example.tar.gz --strip-components=1 --directory (escapedName)")
^
command:
/usr/local/bin/vapor:234:30: error: missing argument label 'command:' in call
let _ = try? run("rm (escapedName)/vapor-example.tar.gz")
^
command:
/usr/local/bin/vapor:240:18: error: missing argument label 'message:' in call
fail("Could not clone repository")
^
message:
swiftenv versions
* 3.0
2.2
Swift3.0 is contained in Xcode8 beta version
vapor -help
0 swift 0x0000000108c9134b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1 swift 0x0000000108c90636 llvm::sys::RunSignalHandlers() + 70
2 swift 0x0000000108c9199f SignalHandler(int) + 287
3 libsystem_platform.dylib 0x00007fff8a21952a _sigtramp + 26
4 libsystem_platform.dylib 0x00000000594dfdf0 _sigtramp + 3475794144
5 swift 0x0000000106be3b5f swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 831
6 swift 0x0000000106be3c26 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1030
7 swift 0x0000000106be3dcf swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1455
8 swift 0x0000000106be3de4 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1476
9 swift 0x0000000106be2766 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 26870
10 swift 0x0000000106be774d swift::ModuleFile::readMembers(llvm::SmallVectorImpl<swift::Decl*>&) + 253
11 swift 0x0000000106bea0c4 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 212
12 swift 0x0000000106f0a395 swift::ExtensionDecl::getMembers() const + 21
13 swift 0x0000000106f485d8 swift::NominalTypeDecl::lookupDirect(swift::DeclName, bool) + 56
14 swift 0x0000000106f46c35 swift::DeclContext::lookupQualified(swift::Type, swift::DeclName, unsigned int, swift::LazyResolver*, llvm::SmallVectorImpl<swift::ValueDecl*>&) const + 3253
15 swift 0x0000000106e11fa6 swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>)::$_1::operator()() const + 262
16 swift 0x0000000106e11e5e swift::TypeChecker::lookupMember(swift::DeclContext*, swift::Type, swift::DeclName, swift::OptionSet<swift::NameLookupFlags, unsigned int>) + 350
17 swift 0x0000000106d3edc1 swift::constraints::ConstraintSystem::lookupMember(swift::Type, swift::DeclName) + 241
18 swift 0x0000000106d97bf4 swift::constraints::ConstraintSystem::performMemberLookup(swift::constraints::ConstraintKind, swift::DeclName, swift::Type, swift::constraints::ConstraintLocator*, bool) + 2484
19 swift 0x0000000106d9941d swift::constraints::ConstraintSystem::simplifyMemberConstraint(swift::constraints::Constraint const&) + 381
20 swift 0x0000000106d9a09b swift::constraints::ConstraintSystem::simplifyConstraint(swift::constraints::Constraint const&) + 267
21 swift 0x0000000106d9c8f7 swift::constraints::ConstraintSystem::simplify(bool) + 119
22 swift 0x0000000106d9f4b2 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 50
23 swift 0x0000000106da34f0 swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 8832
24 swift 0x0000000106d9f5b0 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 304
25 swift 0x0000000106da3b1a swift::constraints::ConstraintSystem::solveSimplified(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 10410
26 swift 0x0000000106d9f5b0 swift::constraints::ConstraintSystem::solveRec(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 304
27 swift 0x0000000106d9f392 swift::constraints::ConstraintSystem::solve(llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 66
28 swift 0x0000000106dcc7d0 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 752
29 swift 0x0000000106dd1f9f swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*) + 559
30 swift 0x0000000106e35223 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 451
31 swift 0x0000000106e33d1f swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 335
32 swift 0x0000000106e3459c swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 188
33 swift 0x0000000106dfc356 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) + 166
34 swift 0x0000000106dfcdfb swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1371
35 swift 0x0000000106b56555 swift::CompilerInstance::performSema() + 3349
36 swift 0x000000010674e92e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 958
37 swift 0x000000010674d619 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2873
38 swift 0x000000010671b6c4 main + 2852
39 libdyld.dylib 0x00007fff8d4c65ad start + 1
40 libdyld.dylib 0x000000000000000e start + 1924373090
Stack dump:
0. Program arguments: /Users/jianglei/Documents/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret /usr/local/bin/vapor -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -color-diagnostics -module-name vapor -- -help
1. While type-checking 'fail' at /usr/local/bin/vapor:15:11
2. While type-checking expression at [/usr/local/bin/vapor:17:5 - line:17:30] RangeText="print("Error: \(message)")"
3. While loading members for declaration 0x7ffb79262ea0 at <invalid loc>
4. While deserializing 'applyingTransform' (FuncDecl #2164)
Segmentation fault: 11
From #30 (comment) :
The Vapor commands can be read about in the docs here: https://vapor.readme.io/v0.12/docs/command
Basically Vapor has a little bit of CLI functionality itself now for serving and running preparations (migrations).
You run this by doing .build/debug/App serve
.build/debug/App prepare --revert
etc.
I want to make the CLI reduce the typing here by doing vapor run serve
To accomplish this we would need to parse the Package.swift to figure out the name of the package, then run the executable from either the debug or release folders.
so something like vapor run serve --release
would translate to .build/release/MyAppName serve
I noticed that only a part of my change for the self-update
location came across to this repo. What was lost was the in-place update.
In other words, right now when you are in dir foo
and have vapor
in ~/bin/
you'll end up with foo/vapor
and the one in ~/bin
is unchanged.
The fix is simple, use Process.arguments[0]
instead of directory
when moving the downloaded file.
Since I'm proposing to do a compile instead of a move in #10 I could do both in one go.
commands.append(Version)
change to
commands.append(Version.self)
ok.
I am trying to fix one of the vapor docker issue and came across this error. Please note I was running all the commands directly rather than using vapor docker
commands to figure out from console output.
/usr/bin/swift-build: error while loading shared libraries: libcurl.so.4: cannot open shared object file:
To fix above error, we need to update Dockerfile located at docker.vapor.sh
(vapor docker init
).
RUN apt-get update && \
apt-get install -y build-essential wget clang curl libedit-dev python2.7 python2.7-dev libicu52 rsync libxml2 git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Commands I used
docker build --rm -t vapor/swift:DEVELOPMENT-SNAPSHOT-2016-09-06-a --build-arg SWIFT_VERSION=DEVELOPMENT-SNAPSHOT-2016-09-06-a .
docker run --rm -it -v $(PWD):/vapor -p 8080:8080 vapor/swift:DEVELOPMENT-SNAPSHOT-2016-09-06-a
Please advise
I’m getting increasingly confused while working on the vapor
script which one it actually is, especially when I install them somewhere and then run self-update. This would probably also be useful for self-update to report what versions it’s dealing with.
Not sure what the best mechanism would be for this. Since we distribute only the actual script itself, it would either have to be a (manually updated) variable inside the script that a version
command echoes. Or we could have the script run an md5 or sha1 sum on itself and return that.
The latter option would mean there’s no need to maintain a version variable but the downside is we’d either need to pull in some pure swift implementation of md5 or sha1 or find a command line tool that’s widely available to do a system
call for.
OSX has md5
but the ubuntu 14.04 I just checked doesn’t.
A variable is probably best even though there’s a good chance it’ll grow stale. The hash option feels like overkill.
PS: If I get the compiled version of the vapor
script to run on Linux and in case that becomes the default way to install it, a hash function in the script should to ok performance wise, although the source file would get bigger.
Just came across this while working on the docker
command: When there’s trailing whitespace the trimmedSpaces
function eats the whole string:
Currently the docker commands can't be run from an NSTask
. The complain about not having direct access to tty
.
As a workaround, I made it so run
and enter
print out the formatted command that can be copy/pasted into the terminal.
I think the solution to this will involve using posix_spawn
directly instead of NSTask
. It might be worth creating our own wrapper aroundposix_spawn
and possibly even contributing it to Foundation since NSTask
really sucked.
cc/@feinstruktur
These steps are missing, some are fatal, some are only fatal in specific scenarios
With changing to SPM based building came a change to how the script is installed. Instead of downloading the actual script and compiling it in place, with SPM based install we pull down a bootstrap.swift
script that builds and installs the vapor
binary.
That also means these two mechanisms need different files to be served from the install URL. It is probably not a good idea to change cli.qutheory.io
to serving bootstrap.swift
, because it will break the update mechanism of all older versions of vapor-cli
. Instead, it would be better to add a new endpoint, for example
which would serve bootstrap.swift
and in tandem we will then change the SPM installers update URL to this.
I went ahead and have done this in anticipation of us making this change here: 6ce5ba1
Things like heroku push take a while to finish, like 5-10 minutes. It's really nice to be able to see the logs as they come in if we could do that.
Now that vapor-cli
is SPM based, we should add some proper unit tests.
I'm not entirely sure how other CLI tools get autocomplete to work. It would be a great feature to have with the Vapor Toolbox.
Ideal Solution
Necessary Solution
Using 0.10, on macOS 10.12 (16A313a), vapor xcode
will pull dependencies, but will fail to generate an xcodeproj file afterwards. No errors or feedback are given by the command line tool after failure.
Additionally, if you attempt to pass a file path to vapor xcode
, for example vapor xcode ~/Developer/macOS/project
, this causes the application to print all of the normal console output you would see, but does not pull dependencies or generate the project. This behavior may be related (which I suspect), or it may be another issue altogether.
Per @loganwright, I am not the first to mention this, and I am filing this Issue accordingly
I have refreshed the project with vapor docker init & build
and I am getting below error with latest Vapor Toolbox 1.0.3
Error: Could not determine Swift version from .swift-version file.
vapor run
could start and work well with toolbox v10.0.1. However, after ctrl + C
to stop, in Ubuntu 16.04, the port (default is 8080) will not be released and the service is still on.
Update to work with the latest Swift snapshot.
Since we moved from git remote get-url origin
to git remote show origin
the output became more chatty.
The old output was https://git.heroku.com/vapor-test-swift.git
The new output
* remote heroku
Fetch URL: https://git.heroku.com/vapor-test-swift.git
Push URL: https://git.heroku.com/vapor-test-swift.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (up to date)
We can solve this by discarding the output from STDOUT a file and check the status code of executing the command.
Note:
When executing git remote show origin
the return code is 0 if heroku exists and 128 if it does not.
PR related:
#21
Installing wget
can be confusing for people using the CLI. If we move to curl
, they won't have to bother with this.
Sometimes operations like build can take a long time, it'd be nice if a flag logged out throughout the process if possible.
Using vapor v0.10.0
Start server using 'vapour run serve'
close server using 'Ctrl + C'
the server does not actually shutdown . Noticed also that mongkitten connection is not closed either.
All errors emitted are silently failing without printing.
Hello.
I have tried Ctrl+C
Ctrl+D
Ctrl+X
.
App is still up and i have no idea how to kill them during vapor. When browser page refreshed app continuously logging into terminal where session was started.
GET /
GET /styles/app.css
GET /images/vapor-logo.png
GET /
GET /styles/app.css
GET /images/vapor-logo.png
ls
Config Localization Packages Public Resources app.json
Dockerfile Package.swift Procfile README.md Sources license
➜ HiVapor git:(master) ✗ GET /
GET /styles/app.css
GET /images/vapor-logo.png
GET /
GET /styles/app.css
GET /images/vapor-logo.png
➜ HiVapor git:(master) ✗ ls
Config Localization Packages Public Resources app.json
Dockerfile Package.swift Procfile README.md Sources license
➜ HiVapor git:(master) ✗ GET /
GET /styles/app.css
GET /images/vapor-logo.png
vapor stop
Usage: vapor <new|build|run|fetch|clean|test|xcode|version|self|heroku|docker>
Error: Command "stop" not found.
➜ HiVapor git:(master) ✗ GET /
GET /styles/app.css
GET /images/vapor-logo.png
I tried right now, and if app started without vapor cli .buid/debug/App
it will be canceled via Ctrl+C
as expected.
vapor xcode
executedThis feature would allow for the correct port and workDir to be set when generating Xcode projects.
When running a Vapor application from Xcode, the wording directory is not the same as if running it from the command line. Because of this, the app can't find files properly using the default working directory in Xcode.
To fix this, I propose that when vapor xcode
is executed, it automatically updates the build scheme to add the flags --config:app.port=8080 --workDir=$(SRCROOT)
.
I don't know too much about how .xcodeproj
files are structured, but from what I can tell, the CLI would have to edit the file VaporApp.xcodeproj/xcuserdata/<username>.xcuserdatad/xcschemes/App.xcscheme
and add this under the proper launch action:
<CommandLineArguments>
<CommandLineArgument
argument = "--config:app.port=8080"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--workDir=$(SRCROOT)"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
This will simply make it easier for people to get up and running with new projects without any errors.
Not adding it at all, but it saves a lot of time by doing this.
When installing on Ubuntu without swiftenv, the bootstrap script looks for the string swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a
(SWIFT_VERSION
) in the path. An earlier step in the documentation has the user rename the folder to swift
, causing this check to fail and the script to exit.
https://github.com/qutheory/vapor-toolbox/blob/master/bootstrap.sh#L24
Quick fix was to skip the rename step, but there is probably a better way so the documentation can remain consistent across platforms.
I could see Vapor Toolbox is not existing even after Docker command succeeds with version 0.10.4. Below is console log. However, I can see docker images are built and ready to run in container.
compname:helloworld username$ vapor docker build
Building Docker image [ • ]
compname:helloworld username$ vapor docker run
Copy and run the following line:
docker run --rm -it -v $(PWD):/vapor -p 8080:8080 vapor/swift:DEVELOPMENT-SNAPSHOT-2016-09-06-a
compname:helloworld username$ docker run --rm -it -v $(PWD):/vapor -p 8080:8080 vapor/swift:DEVELOPMENT-SNAPSHOT-2016-09-06-a
Compile CLibreSSL a_bitstr.c
...
compname:helloworld username$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
vapor/swift DEVELOPMENT-SNAPSHOT-2016-09-06-a 7945a182914f 4 minutes ago 989.4 MB
ubuntu 14.04 4a725d3b3b1c 2 weeks ago 188 MB
Hi,
I sit behind a corporate firewall and currently I have to go off the corporate network to be able to use vapor docker build
. Docker actually allows you to supply build-time arguments using --build-arg <ARG>=<VALUE>
, which is how I would normally supply the HTTP proxy to get through the firewall. Any chance in the future of adding support for command line arguments to vapor docker build
to allow us to supply those values?
The main source file is getting quite big so I’ve taken a quick look into what it could look like broken up into separate files and built it with SPM on both OSX and Linux (DEVELOPMENT-SNAPSHOT-2016-05-09-a) here: https://github.com/qutheory/vapor-cli/tree/spm
The pros are:
getCommand(id:)
)self compile
(plus we can get rid of that hack)Cons:
I use vapor docker build,then failed,finally i use this success:
FROM kylef/swiftenv
RUN swiftenv install 3.0
WORKDIR /vapor
VOLUME /vapor
EXPOSE 8080
CMD swift build && .build/debug/App
# docker build -t xiangyue/swift-docker .
# docker run --rm -it -v /Users/xiangyue/Desktop/vapor:/vapor -p 8080:8080 xiangyue/swift-docker
It would be nice to have a flag --clean
on vapor build
that would perform vapor clean
first.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.