File tree Expand file tree Collapse file tree 8 files changed +232
-0
lines changed
Expand file tree Collapse file tree 8 files changed +232
-0
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,10 @@ fastlane/test_output
8888# https://github.com/johnno1962/injectionforxcode
8989
9090iOSInjectionProject /
91+
92+ # hh
93+ Package.resolved
94+ xcuserdata
95+ .docker.build
96+ .swiftpm
97+
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [[ " $TRAVIS_OS_NAME " == " Linux" ]]; then
4+ sudo apt-get install -y wget \
5+ clang-3.6 libc6-dev make git libicu52 libicu-dev \
6+ git autoconf libtool pkg-config \
7+ libblocksruntime-dev \
8+ libkqueue-dev \
9+ libpthread-workqueue-dev \
10+ systemtap-sdt-dev \
11+ libbsd-dev libbsd0 libbsd0-dbg \
12+ curl libcurl4-openssl-dev \
13+ libedit-dev \
14+ python2.7 python2.7-dev \
15+ libxml2
16+
17+ sudo update-alternatives --quiet --install /usr/bin/clang clang /usr/bin/clang-3.6 100
18+ sudo update-alternatives --quiet --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 100
19+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # our path is:
4+ # /home/travis/build/NozeIO/Noze.io/
5+
6+ if ! test -z " $SWIFT_SNAPSHOT_NAME " ; then
7+ # Install Swift
8+ wget " ${SWIFT_SNAPSHOT_NAME} "
9+
10+ TARBALL=" ` ls swift-* .tar.gz` "
11+ echo " Tarball: $TARBALL "
12+
13+ TARPATH=" $PWD /$TARBALL "
14+
15+ cd $HOME # expand Swift tarball in $HOME
16+ tar zx --strip 1 --file=$TARPATH
17+ pwd
18+
19+ export PATH=" $PWD /usr/bin:$PATH "
20+ which swift
21+
22+ if [ ` which swift` ]; then
23+ echo " Installed Swift: ` which swift` "
24+ else
25+ echo " Failed to install Swift?"
26+ exit 42
27+ fi
28+ fi
29+
30+ swift --version
31+
32+
33+ # Environment
34+
35+ TT_SWIFT_BINARY=` which swift`
36+
37+ echo " ${TT_SWIFT_BINARY} "
Original file line number Diff line number Diff line change 1+ language : generic
2+
3+ notifications :
4+ slack : nozeio:LIFY1Jtkx0FRcLq3u1WliHRZ
5+
6+ matrix :
7+ include :
8+ - os : Linux
9+ dist : trusty
10+ env : SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-5.0.2-release/ubuntu1404/swift-5.0.2-RELEASE/swift-5.0.2-RELEASE-ubuntu14.04.tar.gz"
11+ sudo : required
12+ - os : Linux
13+ dist : trusty
14+ env : SWIFT_SNAPSHOT_NAME="https://swift.org/builds/swift-5.1.3-release/ubuntu1404/swift-5.1.3-RELEASE/swift-5.1.3-RELEASE-ubuntu14.04.tar.gz"
15+ sudo : required
16+ - os : osx
17+ osx_image : xcode11
18+
19+ before_install :
20+ - ./.travis.d/before-install.sh
21+
22+ install :
23+ - ./.travis.d/install.sh
24+
25+ script :
26+ - export PATH="$HOME/usr/bin:$PATH"
27+ - swift build -c release
28+ - swift build -c debug
Original file line number Diff line number Diff line change 1+ # Makefile
2+
3+ # local config
4+ SWIFT_BUILD =swift build
5+ SWIFT_CLEAN =swift package clean
6+ SWIFT_BUILD_DIR =.build
7+ CONFIGURATION =release
8+
9+ # docker config
10+ # SWIFT_BUILD_IMAGE="helje5/swift-dev:5.1.snap2019-07-01"
11+ # SWIFT_BUILD_IMAGE="swift:5.1.3"
12+ SWIFT_BUILD_IMAGE ="swift:5.0.3"
13+ DOCKER_BUILD_DIR =".docker.build"
14+ SWIFT_DOCKER_BUILD_DIR ="$(DOCKER_BUILD_DIR ) /x86_64-unknown-linux/$(CONFIGURATION ) "
15+ DOCKER_BUILD_PRODUCT ="$(DOCKER_BUILD_DIR ) /$(TOOL_NAME ) "
16+
17+
18+ SWIFT_SOURCES =\
19+ Sources/*/*/*.swift \
20+ Sources/*/*/*/*.swift
21+
22+ all :
23+ $(SWIFT_BUILD ) -c $(CONFIGURATION )
24+
25+ clean :
26+ $(SWIFT_CLEAN )
27+ # We have a different definition of "clean", might be just German
28+ # pickyness.
29+ rm -rf $(SWIFT_BUILD_DIR )
30+
31+ $(DOCKER_BUILD_PRODUCT ) : $(SWIFT_SOURCES )
32+ time docker run --rm \
33+ -v "$(PWD ) :/src" \
34+ -v "$(PWD ) /$(DOCKER_BUILD_DIR ) :/src/.build" \
35+ "$(SWIFT_BUILD_IMAGE)" \
36+ bash -c 'cd /src && swift build -c $(CONFIGURATION)'
37+ ls -lah $(DOCKER_BUILD_PRODUCT)
38+
39+ docker-all : $(DOCKER_BUILD_PRODUCT )
40+
41+ docker-clean :
42+ rm $(DOCKER_BUILD_PRODUCT )
43+
44+ docker-distclean :
45+ rm -rf $(DOCKER_BUILD_DIR )
46+
47+ distclean : clean docker-distclean
48+
49+ docker-emacs :
50+ docker run --rm -it \
51+ -v " $( PWD) :/src" \
52+ -v " $( PWD) /$( DOCKER_BUILD_DIR) :/src/.build" \
53+ " $( SWIFT_BUILD_IMAGE) " \
54+ emacs /src
Original file line number Diff line number Diff line change 1+ // swift-tools-version:5.0
2+
3+ import PackageDescription
4+
5+ let package = Package (
6+
7+ name: " MacroExamples " ,
8+
9+ platforms: [
10+ . macOS( . v10_14) , . iOS( . v11)
11+ ] ,
12+
13+ products: [
14+ . executable( name: " httpd-helloworld " , targets: [ " httpd-helloworld " ] )
15+ ] ,
16+
17+ dependencies: [
18+ . package ( url: " https://github.com/Macro-swift/Macro.git " ,
19+ from: " 0.0.2 " )
20+ ] ,
21+
22+ targets: [
23+ . target( name: " httpd-helloworld " , dependencies: [ " Macro " ] )
24+ ]
25+ )
Original file line number Diff line number Diff line change 1+ <h2 >Macro.swift Examples
2+ <img src="http://zeezide.com/img/MicroExpressIcon1024.png "
3+ align="right" width="100" height="100" />
4+ </h2 >
5+
6+ A small, unopinionated "don't get into my way" / "I don't wanna ` wait ` "
7+ asynchronous web framework for Swift.
8+ With a strong focus on replicating the Node APIs in Swift.
9+ But in a typesafe, and fast way.
10+
11+ This repository contains examples for
12+ [ Macro.swift] ( https://github.com/Macro-swift/Macro ) .
13+
14+ ### Running Examples as Scripts
15+
16+ Single file examples can be run as scripts using the
17+ [ swift-sh] ( https://github.com/mxcl/swift-sh ) ,
18+ which can be installed using a simple ` brew install swift-sh ` .
19+
20+ ### Who
21+
22+ ** Macro** is brought to you by
23+ the
24+ [ Always Right Institute] ( http://www.alwaysrightinstitute.com )
25+ and
26+ [ ZeeZide] ( http://zeezide.de ) .
27+ We like
28+ [ feedback] ( https://twitter.com/ar_institute ) ,
29+ GitHub stars,
30+ cool [ contract work] ( http://zeezide.com/en/services/services.html ) ,
31+ presumably any form of praise you can think of.
32+
33+ There is a ` #microexpress ` channel on the
34+ [ Noze.io Slack] ( http://slack.noze.io/ ) . Feel free to join!
Original file line number Diff line number Diff line change 1+ #!/usr/bin/swift sh
2+
3+ // httpd-helloworld - the most basic HTTP server
4+
5+ import Macro // @Macro-swift ~> 0.0.2
6+
7+ http. createServer { req, res in
8+ // log request
9+ console. log ( " \( req. method) \( req. url) " )
10+
11+ // set content type to HTML
12+ res. writeHead ( 200 , [ " Content-Type " : " text/html " ] )
13+
14+ // write some HTML
15+ res. write ( " <h1>Hello Client: \( req. url) </h1> " )
16+
17+ res. write ( " <table><tbody> " )
18+ for ( key, value ) in req. headers {
19+ res. write ( " <tr><td><nobr> \( key) </nobr></td><td> \( value) </td></tr> " )
20+ }
21+ res. write ( " </tbody></table> " )
22+
23+ // finish up
24+ res. end ( )
25+ }
26+ . listen ( 1337 ) { server in
27+ console. log ( " Server listening on http://localhost:1337/ " )
28+ }
You can’t perform that action at this time.
0 commit comments