Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dileping committed Feb 21, 2016
2 parents 882c66a + 0a1c96e commit f3068f8
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
Packages/
.build/

# CocoaPods
Expand Down
87 changes: 56 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,59 @@
language: objective-c
osx_image: xcode7.2
env:
global:
- FRAMEWORK_NAME=PathToRegex
before_install:
- brew update
- brew unlink carthage
- brew install carthage
- brew link carthage
before_script:
# bootstrap the dependencies for the project
# you can remove if you don't have dependencies
- carthage bootstrap
before_deploy:
- carthage build --no-skip-current
- carthage archive $FRAMEWORK_NAME
# - pod trunk push PathToRegex.podspec
script:
- xcodebuild test -project PathToRegex.xcodeproj -scheme PathToRegex
#- xcodebuild test -project Regex.xcodeproj -scheme Regex-iOS -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6'
#- xcodebuild test -project Regex.xcodeproj -scheme Regex-tvOS -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV 1080p'
#- xcodebuild build -project Regex.xcodeproj -scheme Regex-watchOS -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch - 42mm'
global:
- MODULE_NAME=PathToRegex
matrix:
include:
- script:
- xcodebuild test -project $MODULE_NAME.xcodeproj -scheme $MODULE_NAME
os: osx
osx_image: xcode7.2
language: objective-c
before_install:
- brew update
- brew unlink carthage
- brew install carthage
- brew link carthage
before_script:
# bootstrap the dependencies for the project
# you can remove if you don't have dependencies
- carthage bootstrap
before_deploy:
- carthage build --no-skip-current
- carthage archive $MODULE_NAME
deploy:
provider: releases
api_key:
secure: 8Mxwjx8i5YytiW8s95AJ1CTi71WyPLhMd2RGMrR24oizic0zUwHG2rNBgGrnj/ONmd/sUg3XOvNgLXxLl4D5BgI6bsM/Vg+iOd+Gx4xbSmvZSBAt/aqbefSGL8Mpexpfe0vKlT+JXUy8C7WxLpKrlB3kFmaB7r0sq3bc3j/A5FkfI6uGCgEjcOr+emQ+nCr6YI3KcNfHVNquF5nXk1apJMbKJnkQK9D7iQV9wcKzXyIO8uGSMo1qrciWV8wsV6wJgBDXUspUuwa9+Je56doJb6z0kSiIc0cCZwGSkHIQEQY9v9LcB5q0YQ7UkzWM/O01VUnABzjYbKjzwQG1EZxB1PaXu4dH76QGOjg8bD2wh+P5ecYAGxc99GbscTGpEgMtSKqTXQdebsqU9xaQUBxRx5vt0HgLoCv3MTGo+CZ18XXp7Ie9Xkd5T1Nanb/i8MA4QCojNk9vCRpP3YSoGhQpfY7fZgQiRbE+L2+GxTX4jQBSIbLdPaX/ov58qLzbvpSH0nZSgXKJtk7lk4aOApCuzYlTqLs04Z5wgEgWlN3spFKuRqpK/PyAjwMVf1qctacKKZjKOA6HhZijlGtfXkYw3eVut1an/RJCSFagKhXVSvomcG3dnE+FqtLGXtLacP4jtVIkl4tdc1Y5nnTWQJbok/XofgwkNhMq0XXXmF9Lh5c=
file: $MODULE_NAME.framework.zip
skip_cleanup: true
on:
repo: crossroadlabs/PathToRegex
tags: true
- script:
# build (yes for now swift-build should be like this)
- export SBCMD=`which swift-build`
- $SBCMD
# test - temporary disabled because of bug in swift test
# - swift test
sudo: required
dist: trusty
language: generic
before_install:
# install original swift distribution
- wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
- cd ..
- export SWIFT_VERSION=swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a
- wget https://swift.org/builds/development/ubuntu1404/$SWIFT_VERSION/$SWIFT_VERSION-ubuntu14.04.tar.gz
- tar xzf $SWIFT_VERSION-ubuntu14.04.tar.gz
- export PATH="${PWD}/${SWIFT_VERSION}-ubuntu14.04/usr/bin:${PATH}"
# install latest package manager with `swift-test`
- git clone https://github.com/apple/swift-package-manager
- cd swift-package-manager
- Utilities/bootstrap
- export SWIFT_BUILD_PATH=`pwd`
- export PATH=$SWIFT_BUILD_PATH/.build/debug:$PATH
- cd ..
# get back home
- cd $MODULE_NAME
notifications:
email: false
deploy:
provider: releases
api_key:
secure: 8Mxwjx8i5YytiW8s95AJ1CTi71WyPLhMd2RGMrR24oizic0zUwHG2rNBgGrnj/ONmd/sUg3XOvNgLXxLl4D5BgI6bsM/Vg+iOd+Gx4xbSmvZSBAt/aqbefSGL8Mpexpfe0vKlT+JXUy8C7WxLpKrlB3kFmaB7r0sq3bc3j/A5FkfI6uGCgEjcOr+emQ+nCr6YI3KcNfHVNquF5nXk1apJMbKJnkQK9D7iQV9wcKzXyIO8uGSMo1qrciWV8wsV6wJgBDXUspUuwa9+Je56doJb6z0kSiIc0cCZwGSkHIQEQY9v9LcB5q0YQ7UkzWM/O01VUnABzjYbKjzwQG1EZxB1PaXu4dH76QGOjg8bD2wh+P5ecYAGxc99GbscTGpEgMtSKqTXQdebsqU9xaQUBxRx5vt0HgLoCv3MTGo+CZ18XXp7Ie9Xkd5T1Nanb/i8MA4QCojNk9vCRpP3YSoGhQpfY7fZgQiRbE+L2+GxTX4jQBSIbLdPaX/ov58qLzbvpSH0nZSgXKJtk7lk4aOApCuzYlTqLs04Z5wgEgWlN3spFKuRqpK/PyAjwMVf1qctacKKZjKOA6HhZijlGtfXkYw3eVut1an/RJCSFagKhXVSvomcG3dnE+FqtLGXtLacP4jtVIkl4tdc1Y5nnTWQJbok/XofgwkNhMq0XXXmF9Lh5c=
file: $FRAMEWORK_NAME.framework.zip
skip_cleanup: true
on:
repo: crossroadlabs/PathToRegex
tags: true
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "crossroadlabs/Regex" ~> 0.4
github "crossroadlabs/Regex" ~> 0.5
32 changes: 32 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//===--- Package.swift ------------------------------------------------===//
//
//Copyright (c) 2016 Daniel Leping (dileping)
//
//This file is part of PathToRegex.
//
//PathToRegex is free software: you can redistribute it and/or modify
//it under the terms of the GNU Lesser General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//PathToRegex is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public License
//along with PathToRegex. If not, see <http://www.gnu.org/licenses/>.
//
//===----------------------------------------------------------------------===//

import PackageDescription

let package = Package(
name: "PathToRegex",
targets: [
Target(
name: "PathToRegex"
)
],
dependencies: [.Package(url: "https://github.com/crossroadlabs/Regex.git", versions: Version(0,5,0)..<Version(1,0,0))]
)
17 changes: 13 additions & 4 deletions PathToRegex.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
children = (
65E7DAC91C690A4300C5D00A /* PathToRegex */,
65E7DAD51C690A4300C5D00A /* PathToRegexTests */,
962A8B391C74E5B8008E2BB3 /* Frameworks */,
65E7DAC81C690A4300C5D00A /* Products */,
65E7DAE31C690C5000C5D00A /* Regex.framework */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -105,7 +105,16 @@
65E7DAD61C690A4300C5D00A /* PathToRegexTests.swift */,
65E7DAD81C690A4300C5D00A /* Info.plist */,
);
path = PathToRegexTests;
name = PathToRegexTests;
path = Tests/PathToRegex;
sourceTree = "<group>";
};
962A8B391C74E5B8008E2BB3 /* Frameworks */ = {
isa = PBXGroup;
children = (
65E7DAE31C690C5000C5D00A /* Regex.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
Expand Down Expand Up @@ -380,7 +389,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = PathToRegexTests/Info.plist;
INFOPLIST_FILE = Tests/PathToRegex/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.PathToRegexTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -395,7 +404,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = PathToRegexTests/Info.plist;
INFOPLIST_FILE = Tests/PathToRegex/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = xyz.crossroadlabs.PathToRegexTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion PathToRegex/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1</string>
<string>0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
4 changes: 1 addition & 3 deletions PathToRegex/PathToRegex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ func tokensToRegex (tokens:[Token], options:Options = Options()) throws -> Regex
var groups = [String]()

// Iterate over the tokens and create our regexp string.
for (var i = 0; i < tokens.count; i++) {
let token = tokens[i]

for token in tokens {
switch token {
case .Simple(token: let token): route += escapeString(token)
case .Complex(name: let tokenName, prefix: let prefix, delimeter: _, optional: let optional, repeating: let repeating, pattern: let pattern):
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# PathToRegex

![🐧 linux: ready](https://img.shields.io/badge/%F0%9F%90%A7%20linux-ready-red.svg)
[![GitHub license](https://img.shields.io/badge/license-LGPL v3-lightgrey.svg)](https://raw.githubusercontent.com/crossroadlabs/Express/master/LICENSE)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
![Platform OS X | Linux](https://img.shields.io/badge/platform-OS%20X%20%7C%20Linux-orange.svg)
Expand Down
28 changes: 28 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//===--- LinuxMain.swift ---------------------------------------------------===//
//
//Copyright (c) 2016 Daniel Leping (dileping)
//
//This file is part of PathToRegex.
//
//PathToRegex is free software: you can redistribute it and/or modify
//it under the terms of the GNU Lesser General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//PathToRegex is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public License
//along with PathToRegex. If not, see <http://www.gnu.org/licenses/>.
//
//===----------------------------------------------------------------------===//

import XCTest

@testable import PathToRegextest

XCTMain([
PathToRegexTests(),
])
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ import Regex
@testable import PathToRegex

class PathToRegexTests: XCTestCase {

override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}


func testPaths() {
let digitOptionalVar = try! pathToRegex("/:test(\\d+)?")
XCTAssert("/123" =~ digitOptionalVar)
Expand Down Expand Up @@ -67,13 +57,15 @@ class PathToRegexTests: XCTestCase {
let methodFormat = try! pathToRegex("/api/user/:id.:format")
XCTAssertEqual("123", methodFormat.findFirst("/api/user/123.json")!.group("id")!)
XCTAssertEqual("json", methodFormat.findFirst("/api/user/123.json")!.group("format")!)
}
}

#if os(Linux)
extension PathToRegexTests : XCTestCaseProvider {
var allTests : [(String, () throws -> Void)] {
return [
("testPaths", testPaths)
]
}

func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock {
// Put the code you want to measure the time of here.
}
}

}
#endif

0 comments on commit f3068f8

Please sign in to comment.