Skip to content

Commit 5e7d284

Browse files
authored
Merge pull request #511 from nimblehq/release/4.7.0
Release - 4.7.0
2 parents 8336744 + da4526d commit 5e7d284

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+472
-51
lines changed

.github/wiki/Deliverable-Configurations.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ The file [DeliverableConstants.rb](https://github.com/nimblehq/ios-templates/blo
1212
## Configure later
1313

1414
- Developer can modify the `DeliverableConstants` at any time.
15-
- Use the command `sh deliverable_setup.sh` to open `DeliverableConstants` with Xcode.
1615
- Open the file manually at `fastlane/Constants/DeliverableConstants.rb` with any IDE.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Selecting User Interface
2+
3+
Current the template supports setup with two user interfaces:
4+
- UIKit
5+
- SwiftUI
6+
7+
To select a user interface when creating a project pass the argument `--interface [SwiftUI or UIKit]` with the `make` script.
8+
9+
```bash
10+
sh make.sh --bundle-id [BUNDLE_ID_PRODUCTION] --bundle-id-staging [BUNDLE_ID_STAGING] --project-name [PROJECT_NAME] --interface SwiftUI
11+
```

.github/wiki/_Sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- [[Home]]
44
- [[Getting Started]]
55
- [[Deliverable Configurations]]
6+
- [[Selecting User Interface]]
67

78
## Architecture
89

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test SwiftUI Install Script
2+
3+
on:
4+
push:
5+
branches: [ feature/**, bug/**, chore/** ]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
Test:
13+
name: Test
14+
runs-on: macOS-12
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Bundle install
19+
run: bundle install
20+
21+
- name: Start Install Script for SwiftUI Template App
22+
run: sh make.sh --bundle-id co.nimblehq.template --bundle-id-staging co.nimblehq.template.staging --project-name TemplateApp --interface SwiftUI
23+
24+
- name: Build and Test
25+
run: bundle exec fastlane buildAndTest
26+
env:
27+
CI: true

.github/workflows/test_install_script.yml renamed to .github/workflows/test_uikit_install_script.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test Install Script
1+
name: Test UIKit Install Script
22

33
on:
44
push:
@@ -14,14 +14,12 @@ jobs:
1414
runs-on: macOS-latest
1515
steps:
1616
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
1917

2018
- name: Bundle install
2119
run: bundle install
2220

23-
- name: Start Install Script for Template App
24-
run: sh make.sh --bundle-id co.nimblehq.template --bundle-id-staging co.nimblehq.template.staging --project-name TemplateApp
21+
- name: Start Install Script for UIKit Template App
22+
run: sh make.sh --bundle-id co.nimblehq.template --bundle-id-staging co.nimblehq.template.staging --project-name TemplateApp --interface UIKit
2523

2624
- name: Build and Test
2725
run: bundle exec fastlane buildAndTest

.github/workflows/test_upload_build_to_firebase.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ jobs:
4747
${{ runner.os }}-pods-
4848
4949
- name: Start Install Script for Template App
50-
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp
50+
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit
5151

5252
- name: Start Setup Script for Template App Firebase Upload
53-
run: sh set_up_test_firebase.sh
53+
run: cat Scripts/Swift/SetUpTestFirebase.swift Scripts/Swift/Extensions/FileManager+Utils.swift | swift -
5454
env:
5555
MATCH_REPO: ${{ secrets.MATCH_REPO }}
5656
STAGING_FIREBASE_APP_ID: ${{ secrets.STAGING_FIREBASE_APP_ID }}

.github/workflows/test_upload_build_to_test_flight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
${{ runner.os }}-pods-
4545
4646
- name: Start Install Script for Template App
47-
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp
47+
run: sh make.sh --bundle-id co.nimblehq.ios.templates --bundle-id-staging co.nimblehq.ios.templates.staging --project-name TemplateApp --interface UIKit
4848

4949
- name: Start Setup Script for Template App TestFlight Upload
5050
run: sh set_up_test_testflight.sh

Dangerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require './fastlane/Constants/Constants'
4-
53
# Warn when there is a big PR
64
warn("This pull request is quite big (#{git.lines_of_code} lines changed), please consider splitting it into multiple pull requests.") if git.lines_of_code > 500
75

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import Foundation
2+
3+
extension FileManager {
4+
5+
func moveFiles(in directory: String, to destination: String) {
6+
let currentDirectory = currentDirectoryPath
7+
let files = try? contentsOfDirectory(
8+
atPath: "\(currentDirectory)/\(directory)"
9+
)
10+
if let files = files {
11+
for file in files {
12+
guard file != ".DS_Store" else { continue }
13+
do {
14+
try moveItem(
15+
atPath: "\(currentDirectory)/\(directory)/\(file)",
16+
toPath:"\(currentDirectory)/\(destination)/\(file)"
17+
)
18+
} catch {
19+
print("Error \(error)")
20+
}
21+
}
22+
}
23+
}
24+
25+
func rename(file: String, to destination: String) {
26+
let currentDirectory = currentDirectoryPath
27+
do {
28+
try moveItem(
29+
atPath: "\(currentDirectory)/\(file)",
30+
toPath:"\(currentDirectory)/\(destination)"
31+
)
32+
} catch {
33+
print("Error \(error)")
34+
}
35+
}
36+
37+
func removeItems(in directory: String) {
38+
let currentDirectory = currentDirectoryPath
39+
do {
40+
try removeItem(atPath: "\(currentDirectory)/\(directory)")
41+
} catch {
42+
print("Error \(error)")
43+
}
44+
}
45+
46+
func replaceAllOccurrences(of original: String, to replacing: String) {
47+
let files = try? allFiles(in: currentDirectoryPath)
48+
guard let files else { return print("Cannot find any files in current directory") }
49+
for file in files {
50+
do {
51+
let text = try String(contentsOf: file, encoding: .utf8)
52+
let modifiedText = text.replacingOccurrences(of: original, with: replacing)
53+
try modifiedText.write(to: file, atomically: true, encoding: .utf8)
54+
} catch {
55+
print(error.localizedDescription)
56+
}
57+
}
58+
}
59+
60+
private func allFiles(in directory: String) throws -> [URL] {
61+
let url = URL(fileURLWithPath: directory)
62+
var files = [URL]()
63+
if let enumerator = enumerator(
64+
at: url,
65+
includingPropertiesForKeys: [.isRegularFileKey],
66+
options: [.skipsHiddenFiles, .skipsPackageDescendants]
67+
) {
68+
for case let fileURL as URL in enumerator {
69+
let fileAttributes = try? fileURL.resourceValues(forKeys:[.isRegularFileKey])
70+
guard fileAttributes?.isRegularFile ?? false else { continue }
71+
files.append(fileURL)
72+
}
73+
}
74+
return files
75+
}
76+
}

Scripts/Swift/Helpers/SafeShell.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Foundation
2+
3+
@discardableResult
4+
func safeShell(_ command: String) throws -> String? {
5+
let task = Process()
6+
let pipe = Pipe()
7+
8+
task.standardOutput = pipe
9+
task.standardError = pipe
10+
task.arguments = ["-c", command]
11+
task.executableURL = URL(fileURLWithPath: "/bin/zsh")
12+
task.standardInput = nil
13+
14+
try task.run()
15+
16+
let data = pipe.fileHandleForReading.readDataToEndOfFile()
17+
let output = String(data: data, encoding: .utf8)
18+
19+
return output
20+
}

0 commit comments

Comments
 (0)