From 8d29ebba3284c68f80e671dc47132cd08bc085c9 Mon Sep 17 00:00:00 2001 From: Emanuel Guerrero Date: Wed, 25 Oct 2017 22:22:25 -0400 Subject: [PATCH] Initial commit --- .gitignore | 70 +++++++++++++++++++++++++ .swiftlint.yml | 38 ++++++++++++++ .travis.yml | 14 +++++ LICENSE | 21 ++++++++ Package.swift | 28 ++++++++++ README.md | 10 ++++ Sources/SwiftEnv/SwiftEnv.swift | 3 ++ Tests/LinuxMain.swift | 6 +++ Tests/SwiftEnvTests/SwiftEnvTests.swift | 16 ++++++ docker-compose.yml | 5 ++ 10 files changed, 211 insertions(+) create mode 100644 .gitignore create mode 100644 .swiftlint.yml create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 Package.swift create mode 100644 README.md create mode 100644 Sources/SwiftEnv/SwiftEnv.swift create mode 100644 Tests/LinuxMain.swift create mode 100644 Tests/SwiftEnvTests/SwiftEnvTests.swift create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4f371fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ +.DS_Store + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +.build/ +/*.xcodeproj +/*.xcworkspace + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..1ca275f --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,38 @@ +included: + - Sources + - Tests + +excluded: + - Package.swift + +opt_in_rules: + - closure_end_indentation + - closure_spacing + - empty_count + - explicit_init + - fatal_error_message + - first_where + - multiline_parameters + - operator_usage_whitespace + - overridden_super_call + - private_outlet + - trailing_closure + - vertical_parameter_alignment_on_call + +disabled_rules: + - empty_enum_arguments + - file_length + - function_body_length + - private_over_fileprivate + - todo + - trailing_whitespace + - type_body_length + - valid_ibinspectable + - vertical_whitespace + +reporter: "html" + +large_tuple: 4 +function_parameter_count: 6 +line_length: 110 +cyclomatic_complexity: 15 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..28abf92 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +matrix: + include: + - os: linux + dist: trusty + sudo: required + - os: osx + osx_image: xcode9 + sudo: required + +before_install: + - git clone https://github.com/IBM-Swift/Package-Builder.git + +script: + - ./Package-Builder/build-package.sh -projectDir $TRAVIS_BUILD_DIR \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..193e760 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Manny Guerrero + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..f3a1cfd --- /dev/null +++ b/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:4.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SwiftEnv", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "SwiftEnv", + targets: ["SwiftEnv"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "SwiftEnv", + dependencies: []), + .testTarget( + name: "SwiftEnvTests", + dependencies: ["SwiftEnv"]), + ] +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..4e3caef --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# SwiftEnv + +An easy to use interface for accessing environment variables with Swift + +[![Build Status](https://travis-ci.org/eman6576/SwiftEnv.svg?branch=master)](https://travis-ci.org/eman6576/SwiftEnv) +[![codecov](https://codecov.io/gh/eman6576/SwiftEnv/branch/master/graph/badge.svg)](https://codecov.io/gh/eman6576/SwiftEnv) +![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat) +[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) +[![DUB](https://img.shields.io/dub/l/vibe-d.svg)](https://github.com/eman6576/SwiftEnv/blob/master/LICENSE) +[![platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey.svg)]() diff --git a/Sources/SwiftEnv/SwiftEnv.swift b/Sources/SwiftEnv/SwiftEnv.swift new file mode 100644 index 0000000..811249c --- /dev/null +++ b/Sources/SwiftEnv/SwiftEnv.swift @@ -0,0 +1,3 @@ +struct SwiftEnv { + var text = "Hello, World!" +} diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..4c60bc4 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,6 @@ +import XCTest +@testable import SwiftEnvTests + +XCTMain([ + testCase(SwiftEnvTests.allTests), +]) diff --git a/Tests/SwiftEnvTests/SwiftEnvTests.swift b/Tests/SwiftEnvTests/SwiftEnvTests.swift new file mode 100644 index 0000000..1784147 --- /dev/null +++ b/Tests/SwiftEnvTests/SwiftEnvTests.swift @@ -0,0 +1,16 @@ +import XCTest +@testable import SwiftEnv + +class SwiftEnvTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(SwiftEnv().text, "Hello, World!") + } + + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c2b78dc --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +SwiftEnv: + image: ibmcom/swift-ubuntu:latest + volumes: + - .:/root/SwiftEnv + command: bash -c "cd /root/SwiftEnv && swift build && swift test" \ No newline at end of file