-
Notifications
You must be signed in to change notification settings - Fork 12
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 #511 from nimblehq/release/4.7.0
Release - 4.7.0
- Loading branch information
Showing
51 changed files
with
472 additions
and
51 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Selecting User Interface | ||
|
||
Current the template supports setup with two user interfaces: | ||
- UIKit | ||
- SwiftUI | ||
|
||
To select a user interface when creating a project pass the argument `--interface [SwiftUI or UIKit]` with the `make` script. | ||
|
||
```bash | ||
sh make.sh --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME] --interface SwiftUI | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Test SwiftUI Install Script | ||
|
||
on: | ||
push: | ||
branches: [ feature/**, bug/**, chore/** ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Test: | ||
name: Test | ||
runs-on: macOS-12 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Bundle install | ||
run: bundle install | ||
|
||
- name: Start Install Script for SwiftUI Template App | ||
run: sh make.sh --bundle-id co.nimblehq.template --bundle-id-staging co.nimblehq.template.staging --project-name TemplateApp --interface SwiftUI | ||
|
||
- name: Build and Test | ||
run: bundle exec fastlane buildAndTest | ||
env: | ||
CI: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import Foundation | ||
|
||
extension FileManager { | ||
|
||
func moveFiles(in directory: String, to destination: String) { | ||
let currentDirectory = currentDirectoryPath | ||
let files = try? contentsOfDirectory( | ||
atPath: "\(currentDirectory)/\(directory)" | ||
) | ||
if let files = files { | ||
for file in files { | ||
guard file != ".DS_Store" else { continue } | ||
do { | ||
try moveItem( | ||
atPath: "\(currentDirectory)/\(directory)/\(file)", | ||
toPath:"\(currentDirectory)/\(destination)/\(file)" | ||
) | ||
} catch { | ||
print("Error \(error)") | ||
} | ||
} | ||
} | ||
} | ||
|
||
func rename(file: String, to destination: String) { | ||
let currentDirectory = currentDirectoryPath | ||
do { | ||
try moveItem( | ||
atPath: "\(currentDirectory)/\(file)", | ||
toPath:"\(currentDirectory)/\(destination)" | ||
) | ||
} catch { | ||
print("Error \(error)") | ||
} | ||
} | ||
|
||
func removeItems(in directory: String) { | ||
let currentDirectory = currentDirectoryPath | ||
do { | ||
try removeItem(atPath: "\(currentDirectory)/\(directory)") | ||
} catch { | ||
print("Error \(error)") | ||
} | ||
} | ||
|
||
func replaceAllOccurrences(of original: String, to replacing: String) { | ||
let files = try? allFiles(in: currentDirectoryPath) | ||
guard let files else { return print("Cannot find any files in current directory") } | ||
for file in files { | ||
do { | ||
let text = try String(contentsOf: file, encoding: .utf8) | ||
let modifiedText = text.replacingOccurrences(of: original, with: replacing) | ||
try modifiedText.write(to: file, atomically: true, encoding: .utf8) | ||
} catch { | ||
print(error.localizedDescription) | ||
} | ||
} | ||
} | ||
|
||
private func allFiles(in directory: String) throws -> [URL] { | ||
let url = URL(fileURLWithPath: directory) | ||
var files = [URL]() | ||
if let enumerator = enumerator( | ||
at: url, | ||
includingPropertiesForKeys: [.isRegularFileKey], | ||
options: [.skipsHiddenFiles, .skipsPackageDescendants] | ||
) { | ||
for case let fileURL as URL in enumerator { | ||
let fileAttributes = try? fileURL.resourceValues(forKeys:[.isRegularFileKey]) | ||
guard fileAttributes?.isRegularFile ?? false else { continue } | ||
files.append(fileURL) | ||
} | ||
} | ||
return files | ||
} | ||
} |
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,20 @@ | ||
import Foundation | ||
|
||
@discardableResult | ||
func safeShell(_ command: String) throws -> String? { | ||
let task = Process() | ||
let pipe = Pipe() | ||
|
||
task.standardOutput = pipe | ||
task.standardError = pipe | ||
task.arguments = ["-c", command] | ||
task.executableURL = URL(fileURLWithPath: "/bin/zsh") | ||
task.standardInput = nil | ||
|
||
try task.run() | ||
|
||
let data = pipe.fileHandleForReading.readDataToEndOfFile() | ||
let output = String(data: data, encoding: .utf8) | ||
|
||
return output | ||
} |
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,50 @@ | ||
#!/usr/bin/swift | ||
|
||
import Foundation | ||
|
||
let fileManager = FileManager.default | ||
|
||
enum CICDService { | ||
case github, bitrise, codemagic, later | ||
|
||
init?(_ name: String) { | ||
switch name.lowercased() { | ||
case "g", "github": | ||
self = .github | ||
case "b", "bitrise": | ||
self = .bitrise | ||
case "c", "codemagic": | ||
self = .codemagic | ||
case "l", "later": | ||
self = .later | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
var service: CICDService? = nil | ||
|
||
while service == nil { | ||
print("Which CI/CD service do you use (Can be edited later) [(g)ithub/(b)itrise/(c)odemagic/(l)ater]: ") | ||
service = CICDService(readLine() ?? "") | ||
} | ||
|
||
switch service { | ||
case .github: | ||
print("Setting template for Github Actions") | ||
fileManager.removeItems(in: "bitrise.yml") | ||
fileManager.removeItems(in: "codemagic.yaml") | ||
case .bitrise: | ||
print("Setting template for Bitrise") | ||
fileManager.removeItems(in: "codemagic.yaml") | ||
fileManager.removeItems(in: ".github/workflows") | ||
case .codemagic: | ||
print("Setting template for CodeMagic") | ||
fileManager.removeItems(in: "bitrise.yml") | ||
fileManager.removeItems(in: ".github/workflows") | ||
case .later, .none: | ||
print("You can manually setup the template later.") | ||
} | ||
|
||
print("✅ Completed") |
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,18 @@ | ||
#!/usr/bin/swift | ||
|
||
import Foundation | ||
|
||
let fileManager = FileManager.default | ||
|
||
print("Do you want to set up Constants values? (Can be edited later) [Y/n]: ") | ||
|
||
var arg = readLine() ?? "y" | ||
|
||
switch arg.lowercased() { | ||
case "y", "yes", "": | ||
let error = try safeShell("open -a Xcode fastlane/Constants/Constant.swift") | ||
guard let error = error, !error.isEmpty else { break } | ||
print("Could not open Xcode. Make sure Xcode is installed and try again.\nRaw error: \(error)") | ||
default: | ||
print("✅ Completed. You can edit this file at 'fastlane/Constants/Constant.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,25 @@ | ||
#!/usr/bin/swift | ||
|
||
import Foundation | ||
|
||
let fileManager = FileManager.default | ||
|
||
var interface = "UIKit" | ||
|
||
switch CommandLine.arguments[1] { | ||
case "SwiftUI", "s", "S": | ||
print("=> 🦅 Setting up SwiftUI") | ||
interface = "SwiftUI" | ||
let swiftUIAppDirectory = "tuist/Interfaces/SwiftUI/Sources/Application" | ||
fileManager.rename( | ||
file: "\(swiftUIAppDirectory)/App.swift", | ||
to: "\(swiftUIAppDirectory)/\(CommandLine.arguments[2])App.swift" | ||
) | ||
default: | ||
print("=> 🦉 Setting up UIKit") | ||
interface = "UIKit" | ||
} | ||
|
||
fileManager.moveFiles(in: "tuist/Interfaces/\(interface)/Project", to: "") | ||
fileManager.moveFiles(in: "tuist/Interfaces/\(interface)/Sources", to: "{PROJECT_NAME}/Sources") | ||
fileManager.removeItems(in: "tuist/Interfaces") |
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,16 @@ | ||
let teamIdPlaceholder = "<#teamId#>" | ||
let stagingFirebaseAppIdPlaceholder = "<#stagingFirebaseAppId#>" | ||
let firebaseTesterGroupsPlaceholder = "<#group1#>, <#group2#>" | ||
let matchRepoPlaceholder = "[email protected]:{organization}/{repo}.git" | ||
|
||
let envMatchRepo = ProcessInfo.processInfo.environment["MATCH_REPO"] ?? "" | ||
let envStagingFirebaseAppId = ProcessInfo.processInfo.environment["STAGING_FIREBASE_APP_ID"] ?? "" | ||
let envTeamId = ProcessInfo.processInfo.environment["TEAM_ID"] ?? "" | ||
let firebaseTesterGroup = "nimble" | ||
|
||
let fileManager = FileManager.default | ||
|
||
fileManager.replaceAllOccurrences(of: teamIdPlaceholder, to: envTeamId) | ||
fileManager.replaceAllOccurrences(of: stagingFirebaseAppIdPlaceholder, to: envStagingFirebaseAppId) | ||
fileManager.replaceAllOccurrences(of: firebaseTesterGroupsPlaceholder, to: firebaseTesterGroup) | ||
fileManager.replaceAllOccurrences(of: matchRepoPlaceholder, to: envMatchRepo) |
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,9 @@ | ||
sources: | ||
- {PROJECT_NAME}/Sources | ||
templates: | ||
- tools/sourcery/templates | ||
output: | ||
{PROJECT_NAME}Tests/Sources/Mocks/Sourcery | ||
args: | ||
autoMockableTestableImports: | ||
- {PROJECT_NAME} |
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,60 @@ | ||
platform :ios, '14.0' | ||
use_frameworks! | ||
inhibit_all_warnings! | ||
|
||
def testing_pods | ||
pod 'Quick', '~> 6.0' | ||
pod 'Nimble', '~> 11.0' | ||
pod 'Sourcery' | ||
pod 'SwiftFormat/CLI' | ||
end | ||
|
||
target '{PROJECT_NAME}' do | ||
# UI | ||
pod 'Kingfisher' | ||
|
||
# Backend | ||
pod 'Alamofire' | ||
pod 'JSONAPIMapper', :git => 'https://github.com/nimblehq/JSONMapper', :tag => '1.1.1' | ||
|
||
# Storage | ||
pod 'KeychainAccess' | ||
|
||
# Tools | ||
pod 'Firebase/Crashlytics' | ||
pod 'NimbleExtension', :git => 'https://github.com/nimblehq/NimbleExtension', :branch => 'master' | ||
pod 'R.swift' | ||
pod 'Factory' | ||
|
||
# Development | ||
pod 'SwiftLint' | ||
pod 'Wormholy', :configurations => ['Debug Staging', 'Debug Production'] | ||
pod 'xcbeautify' | ||
pod "ArkanaKeys", path: "./ArkanaKeys/ArkanaKeys" | ||
pod "ArkanaKeysInterfaces", path: "./ArkanaKeys/ArkanaKeysInterfaces" | ||
|
||
target '{PROJECT_NAME}Tests' do | ||
inherit! :search_paths | ||
testing_pods | ||
end | ||
|
||
target '{PROJECT_NAME}KIFUITests' do | ||
testing_pods | ||
pod 'KIF', :configurations => ['Debug Staging', 'Debug Production'] | ||
pod 'KIF/IdentifierTests', :configurations => ['Debug Staging', 'Debug Production'] | ||
end | ||
end | ||
|
||
post_install do |installer| | ||
installer.pods_project.targets.each do |target| | ||
target.build_configurations.each do |config| | ||
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' | ||
config.build_settings['ENABLE_BITCODE'] = 'NO' | ||
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle" | ||
target.build_configurations.each do |config| | ||
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' | ||
end | ||
end | ||
end | ||
end | ||
end |
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,10 @@ | ||
import SwiftUI | ||
|
||
@main | ||
struct {PROJECT_NAME}App: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
HomeView() | ||
} | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.