Giter Club home page Giter Club logo

toolbox's Introduction

toolbox's People

Contributors

0xtim avatar alephao avatar bennydebock avatar brettrtoomey avatar calebkleveter avatar dannflor avatar dependabot[bot] avatar digidhamu avatar e28eta avatar fabriziobrancati avatar finestructure avatar freak4pc avatar gwynne avatar haikusw avatar joscdk avatar kdawgwilk avatar kyle-ye avatar loganwright avatar nathanflurry avatar nicholascross avatar nsomar avatar orron avatar rugaard avatar s-k avatar siemensikkema avatar skarajic avatar tanner0101 avatar tkrajacic avatar tombio avatar vzsg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

toolbox's Issues

Add support for Vapor’s commands

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

Vapor command line errors

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.

Command for Tests/LinuxMain.swift

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.

Xcode 8 beta 3

Checking at check.qutheory.io doesn't work with new beta of xcode.

Travis builds fail

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.

Install with Gold Master

Temporarily, to install with Gold Master on OSX, use:

curl -sL https://raw.githubusercontent.com/vapor/toolbox/master-bootstrap-temp/master-bootstrap.sh | bash

clean build

It would be nice to have a flag --clean on vapor build that would perform vapor clean first.

Add unit tests

Now that vapor-cli is SPM based, we should add some proper unit tests.

Can not stop service in Ubuntu

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.

Docker TTY error

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

Unable to install Vapor Toolbox

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:

MySql library with standard MacOSX installation package

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.

Installing toolbox through bootstrap script fails with Swift 3.0 release.

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.

move to curl

Installing wget can be confusing for people using the CLI. If we move to curl, they won't have to bother with this.

Doesn't wok with swift3.0

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

Dockerfile update is required to use curl as it failed during docker build process

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

Option to log long operations

Sometimes operations like build can take a long time, it'd be nice if a flag logged out throughout the process if possible.

Vapor new shouldn't copy remote history

Git support is a tiny bit wonky right now w/ Vapor New. Suggestions

  • allow opt-out of git
  • default to fresh initial commit
  • remove origin (right now it points back to official repo)

`vapor xcode` Fails to Generate a Project

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

Vapor CLI not working

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?

Silence the output from `vapor heroku init`

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

vapor docker run fails if directory path has spaces

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 $(PWD). This fails if the value of $(PWD) contains a space (for example, if you put a space in a folder name which is part of the directory path). I am guessing this is a fairly easy fix but I'm not sure, and just wanted to point it out!

Change update URL for spm based install/update

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

http://vapor-cli.qutheory.io

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

Dockerfile has incorrect SWIFT_BRANCH

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?

Error: Git already has a heroku remote.

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)

Add a version flag

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.

Add command line arguments to Xcode build scheme on `vapor xcode` executed

Add command line arguments to Xcode build scheme on vapor xcode executed

Introduction

This feature would allow for the correct port and workDir to be set when generating Xcode projects.

Motivation

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.

Proposed solution

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).

Code snippets

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>

Impact

This will simply make it easier for people to get up and running with new projects without any errors.

Alternatives considered

Not adding it at all, but it saves a lot of time by doing this.

vapor docker build failed

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

Autocomplete

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

  • ships w/ install of toolbox
  • uses swift if possible

Necessary Solution

  • minimum install difficulty
  • easy to update/doesn't require regular updates

Automate build flags

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"
    ]
}

Can not stop app runned by vapor run

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 docker build" not handling Docker's successful build

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

Move script to SPM

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:

  • Better code organisation. There was already at least one case where duplicate functionality was implemented because the authors presumably didn’t see the pre-existing one (getCommand(id:))
  • Testability beyond just running the top level commands in Travis
  • Fastest version deployed, don’t need to rely on people discovering and running self compile (plus we can get rid of that hack)
  • We can use 3rd party libs that support OSX and Linux (like perhaps Swiftline) rather than re-implement everything ourselves just so we can stuff it into one file. (I checked that source libs get compiled into the resulting binary so we don’t have to deal with external frameworks or libs.)

Cons:

  • Deployment is more complicated as we’d have to
    • build two variants, OSX and Linux - ideally automatically from Travis
    • switch on architecture on download or provide different d/l urls

Heroku Init Broken

These steps are missing, some are fatal, some are only fatal in specific scenarios

  • Doesn't Check Git Status
  • Doesn't Write Procfile
  • Doesn't Commit Procfile
  • Procfile doesn't query package name
  • Procfile doesn't properly set Port by default

`self-update` does not install over existing version

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.

Feature request: include command-line arguments for HTTP proxy in vapor docker build

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?

Add check for Ubuntu

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.