-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46d2084
commit 40cef93
Showing
9 changed files
with
37 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Foundation | ||
|
||
guard CommandLine.arguments.count > 1 else { | ||
exit(1) | ||
} | ||
let version = CommandLine.arguments[1] | ||
|
||
let basePath = "../" | ||
let files = (try? FileManager.default.contentsOfDirectory(atPath: basePath)) ?? [] | ||
let specs = files.filter { $0.range(of: ".podspec") != nil } | ||
for path in specs { | ||
print(path) | ||
let path = basePath + path | ||
guard var content = try? String(contentsOfFile: path) as NSString, | ||
let regex = try? NSRegularExpression(pattern: "s\\.version\\ +=\\ +'(.+)'", options: []) else { | ||
exit(1) | ||
} | ||
let result = regex.firstMatch(in: String(content), options: [], range: NSRange(location: 0, length: content.length)) | ||
if let range = result.flatMap({ | ||
$0.range(at: 1) | ||
}) { | ||
content = content.replacingCharacters(in: range, with: version) as NSString | ||
do { | ||
try String(content).write(toFile: path, atomically: false, encoding: .utf8) | ||
} catch { | ||
exit(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
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
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
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
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