-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from bannzai/imp/replace_directory_name
Imp/replace directory name
- Loading branch information
Showing
52 changed files
with
136 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+9.84 KB
...codeproj/project.xcworkspace/xcuserdata/hirose.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
KuriDemo/KuriDemo.xcodeproj/xcuserdata/hirose.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?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>SchemeUserState</key> | ||
<dict> | ||
<key>KuriDemo.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
11 changes: 11 additions & 0 deletions
11
KuriDemo/KuriDemo/Hoge/Hoge/HogeHogeDynamicGenerateFilePath.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// HogeDynamicGenerateFilePath | ||
// Kuri | ||
// | ||
// Created by hirose on 2018/1/17. | ||
// Copyright © 2018 hirose. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
print("HogeDynamicGenerateFilePath") |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
...Demo/templates/ReplacedContentTemplate/__PREFIX__/__PREFIX__DynamicGenerateFilePath.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// __PREFIX__DynamicGenerateFilePath | ||
// Kuri | ||
// | ||
// Created by __USERNAME__ on __DATE__. | ||
// Copyright © __YEAR__ __USERNAME__. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
print("__PREFIX__DynamicGenerateFilePath") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// | ||
// KuriExtension.swift | ||
// Kuri | ||
// | ||
// Created by kingkong999yhirose on 2016/12/22. | ||
// Copyright © 2016年 kingkong999yhirose. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol Enumerable { | ||
associatedtype Element = Self | ||
} | ||
|
||
extension Enumerable where Element: RawRepresentable, Element.RawValue == Int { | ||
static var enumerate: AnySequence<Element> { | ||
return AnySequence { () -> AnyIterator<Element> in | ||
var i = 0 | ||
return AnyIterator { () -> Element? in | ||
let element = Element(rawValue: i) | ||
i += 1 | ||
return element | ||
} | ||
} | ||
} | ||
static var elements: [Element] { | ||
return Array(enumerate) | ||
} | ||
} | ||
|
||
|
||
extension String { | ||
fileprivate struct DateComponent { | ||
let year: Int | ||
let month: Int | ||
let day: Int | ||
|
||
var date: String { | ||
return "\(year)/\(month)/\(day)" | ||
} | ||
} | ||
func replaceEnvironmentText(prefix: String, targetName: String) -> String { | ||
let userName = run(bash: "echo $USER").stdout | ||
let date: DateComponent = { _ -> DateComponent in | ||
let component = Calendar(identifier: .gregorian).dateComponents([.year, .month, .day], from: Date()) | ||
guard | ||
let year = component.year, | ||
let month = component.month, | ||
let day = component.day | ||
else { | ||
fatalError("Can't get system date") | ||
} | ||
return DateComponent(year: year, month: month, day: day) | ||
}(()) | ||
|
||
let replacedContent = self | ||
.replacingOccurrences(of: "__PREFIX__", with: prefix) | ||
.replacingOccurrences(of: "__TARGET__", with: targetName) | ||
.replacingOccurrences(of: "__USERNAME__", with: userName) | ||
.replacingOccurrences(of: "__DATE__", with: date.date) | ||
.replacingOccurrences(of: "__YEAR__", with: "\(date.year)") | ||
.replacingOccurrences(of: "__MONTH__", with: "\(date.month)") | ||
.replacingOccurrences(of: "__DAY__", with: "\(date.day)") | ||
return replacedContent | ||
} | ||
|
||
} | ||
|
||
extension Array { | ||
subscript(safe index: Int) -> Element? { | ||
return 0 <= index && index < count ? self[index] : nil | ||
} | ||
|
||
var second: Element? { | ||
return self[safe: 1] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters