diff --git a/.gitignore b/.gitignore index 02c0875..3d5bea6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store -/.build +/.build* /Packages /*.xcodeproj +/*.pins +/*.resolved \ No newline at end of file diff --git a/Package.swift b/Package.swift index a585113..13fbc77 100644 --- a/Package.swift +++ b/Package.swift @@ -1,3 +1,6 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + // // Package.swift // Perfect-RegEx @@ -20,5 +23,20 @@ import PackageDescription let package = Package( - name: "Regex" + name: "Regex", + products: [ + .library( + name: "Regex", + targets: ["Regex"]), + ], + dependencies: [ + ], + targets: [ + .target( + name: "Regex", + dependencies: []), + .testTarget( + name: "RegexTests", + dependencies: ["Regex"]), + ] ) diff --git a/README.md b/README.md index b1bc3a1..76ee585 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@
-
+
@@ -45,21 +45,14 @@ This project provides a light weight / simple regular expression extension for S
This package builds with Swift Package Manager and is part of the [Perfect](https://github.com/PerfectlySoft/Perfect) project. It was written to be stand-alone and so does not require PerfectLib or any other components.
-Ensure you have installed and activated the latest Swift 3.0 tool chain.
+Ensure you have installed and activated the latest Swift 4.0 tool chain.
-## Issues
-
-We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.
-
-If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to [http://jira.perfect.org:8080/servicedesk/customer/portal/1](http://jira.perfect.org:8080/servicedesk/customer/portal/1) and raise it.
-
-A comprehensive list of open issues can be found at [http://jira.perfect.org:8080/projects/ISS/issues](http://jira.perfect.org:8080/projects/ISS/issues)
## Building
Add this project as a dependency in your Package.swift file.
``` swift
-.Package(url:"https://github.com/PerfectSideRepos/Perfect-RegEx.git", majorVersion: 1)
+.Package(url:"https://github.com/PerfectSideRepos/Perfect-RegEx.git", majorVersion: 3)
```
Then please add the following line to the beginning part of swift sources:
@@ -97,5 +90,13 @@ extension String {
`[(rangeBegin: Int, rangeEnd: Int, extraction: String)]` - a tuple array, each element is the range begin / end mark, with the extraction value; if nothing found or error happened, the result set will be empty.
+## Issues
+
+We are transitioning to using JIRA for all bugs and support related issues, therefore the GitHub issues has been disabled.
+
+If you find a mistake, bug, or any other helpful suggestion you'd like to make on the docs please head over to [http://jira.perfect.org:8080/servicedesk/customer/portal/1](http://jira.perfect.org:8080/servicedesk/customer/portal/1) and raise it.
+
+A comprehensive list of open issues can be found at [http://jira.perfect.org:8080/projects/ISS/issues](http://jira.perfect.org:8080/projects/ISS/issues)
+
## Further Information
For more information on the Perfect project, please visit [perfect.org](http://perfect.org).
diff --git a/README.zh_CN.md b/README.zh_CN.md
index 4d616db..c7e1286 100644
--- a/README.zh_CN.md
+++ b/README.zh_CN.md
@@ -1,4 +1,4 @@
-# 字符串正则表达式扩展 [English](README.md)
+# 字符串正则表达式扩展
@@ -23,7 +23,7 @@
-
+
@@ -47,26 +47,26 @@
该软件使用SPM进行编译和测试,本软件也是[Perfect](https://github.com/PerfectlySoft/Perfect)项目的一部分。本软件包可独立使用,因此使用时可以脱离PerfectLib等其他组件。
-请确保您已经安装并激活了最新版本的 Swift 3.0 tool chain 工具链。
+请确保您已经安装并激活了最新版本的 Swift 4.0 tool chain 工具链。
-### 问题报告、内容贡献和客户支持
-
-我们目前正在过渡到使用JIRA来处理所有源代码资源合并申请、修复漏洞以及其它有关问题。因此,GitHub 的“issues”问题报告功能已经被禁用了。
-
-如果您发现了问题,或者希望为改进本文提供意见和建议,[请在这里指出](http://jira.perfect.org:8080/servicedesk/customer/portal/1).
-在您开始之前,请参阅[目前待解决的问题清单](http://jira.perfect.org:8080/projects/ISS/issues).
## 编译
+
请在您的Package.swift 文件中增加如下依存关系:
``` swift
-.Package(url:"https://github.com/PerfectSideRepos/Perfect-RegEx.git", majorVersion: 1)
+
+.Package(url:"https://github.com/PerfectSideRepos/Perfect-RegEx.git", majorVersion: 3)
+
```
然后在源代码开头部分引用函数库:
+
``` swift
+
import Regex
+
```
## 快速上手
@@ -99,6 +99,13 @@ extension String {
`[(rangeBegin: Int, rangeEnd: Int, extraction: String)]` - 一个元组数组,每个元素分别有三个单元,依次为检索结果的起点为止、终点位置,以及随后提取的匹配字符串。如果没找到或者出错,返回值为空数组。
+### 问题报告、内容贡献和客户支持
+
+我们目前正在过渡到使用JIRA来处理所有源代码资源合并申请、修复漏洞以及其它有关问题。因此,GitHub 的“issues”问题报告功能已经被禁用了。
+
+如果您发现了问题,或者希望为改进本文提供意见和建议,[请在这里指出](http://jira.perfect.org:8080/servicedesk/customer/portal/1).
+
+在您开始之前,请参阅[目前待解决的问题清单](http://jira.perfect.org:8080/projects/ISS/issues).
## 更多信息
关于本项目更多内容,请参考[perfect.org](http://perfect.org).
diff --git a/Sources/Regex.swift b/Sources/Regex/Regex.swift
similarity index 100%
rename from Sources/Regex.swift
rename to Sources/Regex/Regex.swift
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..24e39a6
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,13 @@
+echo "-------------- OS X / Xcode ----------------"
+rm -rf .build
+rm -rf Package.pins
+rm -rf Package.resolved
+swift build
+swift build -c release
+swift test
+echo "-------------- LINUX SWIFT 4.0 ----------------"
+rm -rf .build_linux
+rm -rf Package.resolved
+docker pull rockywei/swift:4.0
+docker run -it -v $PWD:/home rockywei/swift:4.0 /bin/bash -c "cd /home;swift build --build-path=.build_linux; swift build -c release --build-path=.build_linux;swift test --build-path=.build_linux"
+