Skip to content

Commit

Permalink
Merge branch 'commander'
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Oct 14, 2015
2 parents cb0ef3b + 0b39e80 commit 8f9eb54
Show file tree
Hide file tree
Showing 119 changed files with 4,021 additions and 1,666 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
xcuserdata
lib/

build/
bin/
Frameworks/
Rome/
Carthage/

1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ install:

script:
- set -o pipefail && rake tests | xcpretty -c
- pod lib lint --quick GenumKit/GenumKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
//
// GenumKit
// Copyright (c) 2015 Olivier Halligon
// MIT Licence
//

import Foundation

public enum SwiftGenIndentation {
public enum Indentation {
case Tab
case Spaces(Int)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//
// GenumKit
// Copyright (c) 2015 Olivier Halligon
// MIT Licence
//

import Foundation

extension String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
//
// GenumKit
// Copyright (c) 2015 Olivier Halligon
// MIT Licence
//

import Foundation
//@import SwiftIdentifier
//@import SwiftGenIndentation

public final class SwiftGenAssetsEnumBuilder {
public final class AssetsEnumBuilder {
private var assetNames = [String]()

public init() {}
Expand All @@ -28,7 +32,7 @@ public final class SwiftGenAssetsEnumBuilder {
}
}

public func build(enumName enumName : String = "Asset", indentation indent : SwiftGenIndentation = .Spaces(4)) -> String {
public func build(enumName enumName : String = "Asset", indentation indent : Indentation = .Spaces(4)) -> String {
var text = "// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen\n\n"
let t = indent.string

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
//
// GenumKit
// Copyright (c) 2015 Olivier Halligon
// MIT Licence
//

import Foundation
//@import SwiftIdentifier
//@import SwiftGenIndentation

public final class SwiftGenColorEnumBuilder {
public final class ColorEnumBuilder {
public init() {}

public func addColorWithName(name: String, value: String) {
addColorWithName(name, value: SwiftGenColorEnumBuilder.parse(value))
addColorWithName(name, value: ColorEnumBuilder.parse(value))
}

public func addColorWithName(name: String, value: UInt32) {
Expand Down Expand Up @@ -35,7 +39,7 @@ public final class SwiftGenColorEnumBuilder {
}
}

public func build(enumName enumName: String = "Name", generateStringInit stringInit: Bool = false, indentation indent: SwiftGenIndentation = .Spaces(4)) -> String {
public func build(enumName enumName: String = "Name", generateStringInit stringInit: Bool = false, indentation indent: Indentation = .Spaces(4)) -> String {
var text = "// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen\n\n"
let t = indent.string
text += commonCode(generateStringInit: stringInit, indentationString: t)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
//
// GenumKit
// Copyright (c) 2015 Olivier Halligon
// MIT Licence
//

import Foundation
//@import SwiftIdentifier
//@import SwiftGenIndentation

public final class SwiftGenL10nEnumBuilder {
public final class L10nEnumBuilder {
public init() {}

public func addEntry(entry: Entry) {
Expand All @@ -19,7 +23,7 @@ public final class SwiftGenL10nEnumBuilder {
}
}

public func build(enumName enumName : String = "L10n", indentation indent : SwiftGenIndentation = .Spaces(4)) -> String {
public func build(enumName enumName : String = "L10n", indentation indent : Indentation = .Spaces(4)) -> String {
var text = "// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen\n\n"
text += "import Foundation\n\n"

Expand Down Expand Up @@ -116,20 +120,20 @@ public final class SwiftGenL10nEnumBuilder {
}

public static func fromFormatString(format: String) -> [PlaceholderType] {
return SwiftGenL10nEnumBuilder.typesFromFormatString(format)
return L10nEnumBuilder.typesFromFormatString(format)
}
}

public struct Entry {
let key: String
let types: [PlaceholderType]

init(key: String, types: [PlaceholderType]) {
public init(key: String, types: [PlaceholderType]) {
self.key = key
self.types = types
}

init(key: String, types: PlaceholderType...) {
public init(key: String, types: PlaceholderType...) {
self.key = key
self.types = types
}
Expand All @@ -138,7 +142,7 @@ public final class SwiftGenL10nEnumBuilder {
return try! NSRegularExpression(pattern: "^\"([^\"]+)\"[ \t]*=[ \t]*\"(.*)\"[ \t]*;", options: [])
}()

init?(line: String) {
public init?(line: String) {
let range = NSRange(location: 0, length: (line as NSString).length)
if let match = Entry.lineRegEx.firstMatchInString(line, options: [], range: range) {
let key = (line as NSString).substringWithRange(match.rangeAtIndex(1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
//
// GenumKit
// Copyright (c) 2015 Olivier Halligon
// MIT Licence
//

import Foundation
//@import SwiftIdentifier
//@import SwiftGenIndentation

public final class SwiftGenStoryboardEnumBuilder {
public final class StoryboardEnumBuilder {
private typealias Scene = (storyboardID: String, customClass: String?)
private typealias Segue = (segueID: String, customClass: String?)
private var storyboardsScenes = [String : [Scene]]()
Expand Down Expand Up @@ -84,7 +88,7 @@ public final class SwiftGenStoryboardEnumBuilder {
}
}

public func build(scenesStructName scenesStructName: String = "Scene", seguesStructName: String = "Segue", indentation indent : SwiftGenIndentation = .Spaces(4)) -> String {
public func build(scenesStructName scenesStructName: String = "Scene", seguesStructName: String = "Segue", indentation indent : Indentation = .Spaces(4)) -> String {
var text = "// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen\n\n"
let t = indent.string
text += commonCode(indentationString: t)
Expand Down
28 changes: 28 additions & 0 deletions GenumKit/GenumKit.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Pod::Spec.new do |s|

s.name = "GenumKit"
s.version = "0.5.0"
s.summary = "A tool to build constants using enums for your UIImage, Storyboards, Assets, Colors, and more"

s.description = <<-DESC
GenumKit is a framework to build constants using enums for:
- UIImages from your Assets Catalogs
- Storyboards, to instanciate scenes and identify segues using constants
- UIColors, to have named colors using an enums
- Localizable.strings so that you can format your localized text way easier!
This framework is used by the swiftgen Command Line tool
DESC

s.homepage = "https://github.com/AliSoftware/SwiftGen"
s.license = "MIT"
s.author = { "Olivier Halligon" => "[email protected]" }

s.platform = :osx, '10.9'

s.source = { :git => "https://github.com/AliSoftware/SwiftGen.git", :tag => s.version.to_s }

s.source_files = "**/*.swift"

# s.framework = "Foundation"
end
9 changes: 9 additions & 0 deletions GenumKit/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- MIT LICENSE -

Copyright (c) 2015 Olivier Halligon

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.
11 changes: 11 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
platform :osx, '10.9'
use_frameworks!

target 'swiftgen' do
pod 'Commander'
pod 'GenumKit', :path => 'GenumKit'
end

target 'UnitTests' do
pod 'GenumKit', :path => 'GenumKit'
end
17 changes: 17 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
PODS:
- Commander (0.2.2)
- GenumKit (0.5.0)

DEPENDENCIES:
- Commander
- GenumKit (from `GenumKit`)

EXTERNAL SOURCES:
GenumKit:
:path: GenumKit

SPEC CHECKSUMS:
Commander: 3634740c4e1ed3a76ff55426424950e4c8a822e0
GenumKit: 50007ccd336c3887a503527d4facd07b6183bc62

COCOAPODS: 0.39.0
89 changes: 89 additions & 0 deletions Pods/Commander/Commander/ArgumentConvertible.swift

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

Loading

0 comments on commit 8f9eb54

Please sign in to comment.