Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Anderson committed Aug 22, 2016
0 parents commit 29e5547
Show file tree
Hide file tree
Showing 286 changed files with 29,248 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

## Other
*.xcscmblueprint

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
# Pods/

.idea
63 changes: 63 additions & 0 deletions Astro.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#
# Be sure to run `pod lib lint Astro.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = "Astro"
s.version = "1.0.0"
s.summary = "A RoboPod containing a small collection of utilities for project reuse"
s.homepage = "https://RobotsAndPencils.com"
# s.actualHomepage = "https://github.com/RobotsAndPencils/Astro" <-- we needed a publicly accessible s.homepage or else we couldn't publish to our own repository
s.license = {
:type => 'MIT',
:text => <<-LICENSE
Copyright (c) 2015 Robots and Pencils, Inc. All rights reserved.
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:
Neither the name of the Robots and Pencils, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
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.
LICENSE
}
s.authors = {
"Chad Sykes" => "[email protected]",
"Colin Gislason" => "[email protected]",
"Dominic Pepin" => "[email protected]",
"Michael Beaureguard" => "[email protected]"
}
s.source = { :git => "[email protected]:RobotsAndPencils/Astro.git", :tag => s.version.to_s }

s.ios.deployment_target = '8.0'
s.platform = :ios, '8.0'
s.requires_arc = true

s.subspec 'Logging' do | log |
log.source_files = 'Astro/Logging/**/*.swift'
end

s.subspec 'Networking' do | net |
net.source_files = 'Astro/Networking/**/*.swift'
net.dependency 'Astro/Logging'
net.dependency 'Alamofire', '~> 3.3'
net.dependency 'Freddy', '~> 2.0'
net.dependency 'SwiftTask', '5.0'
end

s.subspec 'Security' do | security |
security.source_files = 'Astro/Security/**/*.swift'
security.dependency 'Astro/Logging'
end

s.subspec 'UI' do | ui |
ui.source_files = 'Astro/UI/**/*.swift'
ui.frameworks = 'UIKit'
end

s.subspec 'Utils' do | utils |
utils.source_files = 'Astro/Utils/**/*.swift'
end

end
721 changes: 721 additions & 0 deletions Astro.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Astro.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions Astro.xcodeproj/xcshareddata/xcschemes/Astro.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "638C62461BD454FD0004ECE1"
BuildableName = "Astro.framework"
BlueprintName = "Astro"
ReferencedContainer = "container:Astro.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "638C62501BD454FD0004ECE1"
BuildableName = "AstroTests.xctest"
BlueprintName = "AstroTests"
ReferencedContainer = "container:Astro.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "638C62501BD454FD0004ECE1"
BuildableName = "AstroTests.xctest"
BlueprintName = "AstroTests"
ReferencedContainer = "container:Astro.xcodeproj">
</BuildableReference>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "638C62461BD454FD0004ECE1"
BuildableName = "Astro.framework"
BlueprintName = "Astro"
ReferencedContainer = "container:Astro.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "638C62461BD454FD0004ECE1"
BuildableName = "Astro.framework"
BlueprintName = "Astro"
ReferencedContainer = "container:Astro.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "638C62461BD454FD0004ECE1"
BuildableName = "Astro.framework"
BlueprintName = "Astro"
ReferencedContainer = "container:Astro.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
10 changes: 10 additions & 0 deletions Astro.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Astro/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
79 changes: 79 additions & 0 deletions Astro/Logging/Log.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright © 2016 Robots and Pencils, Inc. All rights reserved.
//
// 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:
//
// Neither the name of the Robots and Pencils, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
// 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.
//

import Foundation

public protocol Logger {
func log(level: Log.Level, message: String);
}

public struct Log {

public enum Level: Int {
case Debug
case Info
case Warning
case Error
case Silent
}

public struct BasicLogger: Logger {
public func log(level: Level, message: String) {
var prefix = ""

switch level {
case .Debug:
prefix = "DEBUG"
break
case .Info:
prefix = "INFO"
break
case .Warning:
prefix = "WARN"
break
case .Error:
prefix = "ERROR"
break
default:
prefix = ""
}
NSLog("%@", "\(prefix): \(message)")
}
}

public static var level = Level.Error
public static var logger: Logger = BasicLogger()

public static func debug(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Debug.rawValue {
logger.log(.Debug, message: msg())
}
}

public static func info(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Info.rawValue {
logger.log(.Info, message: msg())
}
}

public static func warn(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Warning.rawValue {
logger.log(.Warning, message: msg())
}
}

public static func error(@autoclosure msg: () -> String) {
if level.rawValue <= Level.Error.rawValue {
logger.log(.Error, message: msg())
}
}
}

Loading

0 comments on commit 29e5547

Please sign in to comment.