Skip to content

Commit

Permalink
Merge pull request #84 from vadymmarkov/feature/spm-support
Browse files Browse the repository at this point in the history
Enable SwiftPackageManager support
  • Loading branch information
vadymmarkov authored Oct 17, 2017
2 parents f8ee294 + 34ca129 commit 61976ba
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ DerivedData

# CocoaPods
Pods

Packages
.build
4 changes: 2 additions & 2 deletions Fakery.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Fakery"
s.version = "3.1.0"
s.version = "3.2.0"
s.summary = "Swift fake data generator"
s.homepage = "https://github.com/vadymmarkov/Fakery"
s.license = {
Expand All @@ -27,6 +27,6 @@ Pod::Spec.new do |s|
'Faker' => ['Resources/Locales/*.{json}']
}

s.source_files = 'Source/**/*'
s.source_files = 'Sources/**/*'
s.frameworks = 'Foundation'
end
24 changes: 16 additions & 8 deletions Fakery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
children = (
D59B6D0F1D99C6C7007CB072 /* Project */,
BCFFA1471BF9F912005A3BC1 /* Resources */,
BCFFA1611BF9F912005A3BC1 /* Source */,
BCFFA1611BF9F912005A3BC1 /* Sources */,
BCFFA1761BF9F912005A3BC1 /* Tests */,
BCF0DF3B1BF9F77E00427DB4 /* Products */,
);
Expand Down Expand Up @@ -374,16 +374,12 @@
path = Locales;
sourceTree = "<group>";
};
BCFFA1611BF9F912005A3BC1 /* Source */ = {
BCFFA1611BF9F912005A3BC1 /* Sources */ = {
isa = PBXGroup;
children = (
BCFFA1621BF9F912005A3BC1 /* Config.swift */,
BCFFA1681BF9F912005A3BC1 /* Faker.swift */,
BCFFA1631BF9F912005A3BC1 /* Data */,
BCFFA1661BF9F912005A3BC1 /* Extensions */,
BCFFA1691BF9F912005A3BC1 /* Generators */,
D535B6521F954FC20023F851 /* Fakery */,
);
path = Source;
path = Sources;
sourceTree = "<group>";
};
BCFFA1631BF9F912005A3BC1 /* Data */ = {
Expand Down Expand Up @@ -431,6 +427,18 @@
path = Tests;
sourceTree = "<group>";
};
D535B6521F954FC20023F851 /* Fakery */ = {
isa = PBXGroup;
children = (
BCFFA1621BF9F912005A3BC1 /* Config.swift */,
BCFFA1681BF9F912005A3BC1 /* Faker.swift */,
BCFFA1631BF9F912005A3BC1 /* Data */,
BCFFA1661BF9F912005A3BC1 /* Extensions */,
BCFFA1691BF9F912005A3BC1 /* Generators */,
);
path = Fakery;
sourceTree = "<group>";
};
D59B6CEC1D99C5FD007CB072 /* Fakery */ = {
isa = PBXGroup;
children = (
Expand Down
10 changes: 10 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "Fakery",
targets: [
.target(name: "Fakery")
]
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class Parser {
options: .caseInsensitive)
let matches = regex.matches(in: string as String,
options: .reportCompletion,
range: NSMakeRange(0, string.length))
range: NSRange(location: 0, length: string.length))

guard !matches.isEmpty else {
return template
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import Foundation

extension Array {
func at(_ index: Int?) -> Element? {
guard let index = index , index >= 0 && index < endIndex else {
guard let index = index, index >= 0 && index < endIndex else {
return nil
}

return self[index]
}

func random() -> Element? {
// swiftlint:disable empty_count
guard count > 0 else {
return nil
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public final class Address: Generator {
if stateAbbreviation.isEmpty {
return bothify(generate("address.postcode"))
}

return bothify(generate("address.postcode_by_state.\(stateAbbreviation)"))
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public final class Commerce: Generator {
}

public func price() -> Double {
let arc4randoMax:Double = 0x100000000
let arc4randoMax: Double = 0x100000000
return floor(Double((Double(arc4random()) / arc4randoMax) * 100.0) * 100) / 100.0
}

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Generator {
}

public func letterify(_ string: String) -> String {
return String(string.characters.enumerated().map { (index, item) in
return String(string.characters.enumerated().map { _, item in
let count = UInt32(Constants.uppercaseLetters.count)
let char = Constants.uppercaseLetters[Int(arc4random_uniform(count))]
return String(item) == "?" ? char : item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ public final class Internet: Generator {
}

public func templateImage(width: Int = 320, height: Int = 200,
backColorHex: String = "000000", frontColorHex: String = "ffffff") -> String {
backColorHex: String = "000000", frontColorHex: String = "ffffff") -> String {
return "https://dummyimage.com/\(width)x\(height)/\(backColorHex)/\(frontColorHex)"
}

public func hashtag() -> String {
return generate("internet.hashtag")
}

// @ToDo - slug
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 61976ba

Please sign in to comment.