Skip to content

Commit fe62a9d

Browse files
authored
Merge pull request #6 from polydice/feature/build-scripts
Simpler Project Setup
2 parents a51525b + f97d3fe commit fe62a9d

File tree

17 files changed

+151
-84
lines changed

17 files changed

+151
-84
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ Carthage/
3838
## Production
3939
icook-tv-top-shelf-image.png
4040
keys/
41-
fabric.*

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ disabled_rules:
22
- force_try
33
- line_length
44
- nesting
5+
- vertical_whitespace
56
type_name:
67
excluded:
78
- iCookTVKeys

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode8
2+
osx_image: xcode8.1
33
cache:
44
bundler: true
55
directories:

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44

55
#### Added
66

7-
* A demo API URL
87
* Type safe resources generated by R.swift
9-
* Syntax check with SwiftLint
8+
* Syntax check with SwiftLint [#3](https://github.com/polydice/iCook-tvOS/pull/3)
109
* Code coverage
11-
* A little help from [DangerCI](http://danger.systems/) in Pull Request [#4](https://github.com/polydice/iCook-tvOS/pull/4)
10+
* A little help from [Danger](http://danger.systems/) [#4](https://github.com/polydice/iCook-tvOS/pull/4)
11+
* Protocol extended features
12+
* Swift 3 syntax updates [#5](https://github.com/polydice/iCook-tvOS/pull/5)
13+
* Simpler project quick start [#6](https://github.com/polydice/iCook-tvOS/pull/6)
1214

1315
## v1.0.0
1416

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
pod-install:
2-
bundle exec pod install --no-repo-update
3-
xcproj touch iCookTV.xcodeproj
1+
bootstrap:
2+
brew tap homebrew/bundle
3+
brew bundle
4+
bundle install
5+
# pod install
6+
bundle exec pod keys set BaseAPIURL "https://polydice.com/iCook-tvOS/demo/"
7+
bundle exec pod keys set CrashlyticsAPIKey "-"
8+
bundle exec pod keys set TreasureDataAPIKey "-"
9+
bundle exec pod install
10+
# sh scripts/fabric.sh
11+
echo "fabric.apikey" > keys/fabric.apikey
12+
echo "fabric.buildsecret" > keys/fabric.buildsecret
413

514
coverage:
615
bundle exec slather coverage -s --input-format profdata --scheme iCookTV --workspace iCookTV.xcworkspace iCookTV.xcodeproj

README.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,33 @@ A tvOS app that plays [iCook TV](https://tv.icook.tw/) videos.
1010

1111
## Setup
1212

13-
Install required dependencies using [Homebrew](http://brew.sh/) and [Bundler](http://bundler.io/):
13+
Install [Homebrew](http://brew.sh/) and [Bundler](http://bundler.io/):
1414

1515
```
16-
brew tap homebrew/bundle
17-
brew bundle
16+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
17+
gem install bundler
1818
```
19+
20+
### Quick Start
21+
22+
Run the following commands to install dependencies:
23+
24+
```
25+
make bootstrap
26+
```
27+
28+
### Production Setups
29+
30+
If you work at Polydice, instead of `make bootstrap`, set up the project step by step with the following commands. Fill in the credentials and ask admin for required files.
31+
1932
```
33+
brew tap homebrew/bundle
34+
brew bundle
2035
bundle install
2136
bundle exec pod install
2237
```
2338

24-
### API
39+
#### API
2540

2641
`pod install` will prompt for the required configuration to run the app:
2742

@@ -31,37 +46,34 @@ What is the key for BaseAPIURL
3146
>
3247
```
3348

34-
Input `https://polydice.com/iCook-tvOS/demo/` for `BaseAPIURL`.
35-
3649
> TBD: API details are hidden for now due to proprietary reasons.
3750
38-
### Required Keys
51+
#### Required Keys
52+
53+
Managed by CocoaPods-Keys:
3954

4055
* CrashlyticsAPIKey
4156
* TreasureDataAPIKey
4257

43-
Managed by CocoaPods-Keys, they can be real API keys or any arbitrary strings.
44-
45-
### Required Files
46-
47-
```
48-
./keys/fabric.apikey
49-
./keys/fabric.buildsecret
50-
```
58+
#### Required Files
5159

52-
Required by the Fabric script for the `Release` configuration.
60+
* Required by the Fabric script for the `Release` configuration:
5361

54-
### Ignored
62+
```
63+
./keys/fabric.apikey
64+
./keys/fabric.buildsecret
65+
```
5566

5667
* `icook-tv-top-shelf-image.png` is not included in the repo due to the license of image.
5768

58-
### Known Issues
69+
## Known Issues
5970

6071
* Initializing generic `DataSource` will cause `EXC_BAD_ACCESS` in Xcode 8. Fixed in Xcode 8.1.
6172

6273
## Demo
6374

64-
Install the beta version via <https://testflight.icook.tw>.
75+
* Install the beta version via <https://testflight.icook.tw>.
76+
* Download the tvOS app from [App Store](https://itunes.apple.com/tw/app/ai-liao-li/id554065086).
6577

6678
## Contact
6779

iCookTV.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@
547547
);
548548
runOnlyForDeploymentPostprocessing = 0;
549549
shellPath = /bin/sh;
550-
shellScript = "sh ${SRCROOT}/scripts/set-up-fabric.sh";
550+
shellScript = "sh ${SRCROOT}/scripts/fabric.sh";
551551
};
552552
B52DFA9C1CF8006E005B9D67 /* Run Swiftlint */ = {
553553
isa = PBXShellScriptBuildPhase;
@@ -561,7 +561,7 @@
561561
);
562562
runOnlyForDeploymentPostprocessing = 0;
563563
shellPath = /bin/sh;
564-
shellScript = "if which swiftlint >/dev/null; then swiftlint; fi";
564+
shellScript = "sh ${SRCROOT}/scripts/swiftlint.sh";
565565
};
566566
B5BA3B4A1CF6D19800B0A022 /* Run R.swift Script */ = {
567567
isa = PBXShellScriptBuildPhase;
@@ -575,7 +575,7 @@
575575
);
576576
runOnlyForDeploymentPostprocessing = 0;
577577
shellPath = /bin/sh;
578-
shellScript = "${PODS_ROOT}/R.swift/rswift ${SRCROOT}/iCookTV";
578+
shellScript = "sh ${SRCROOT}/scripts/rswift.sh";
579579
};
580580
D98BF45783F7971E01068E78 /* [CP] Embed Pods Frameworks */ = {
581581
isa = PBXShellScriptBuildPhase;
@@ -797,7 +797,7 @@
797797
GCC_WARN_UNUSED_FUNCTION = YES;
798798
GCC_WARN_UNUSED_VARIABLE = YES;
799799
MTL_ENABLE_DEBUG_INFO = NO;
800-
OTHER_SWIFT_FLAGS = "";
800+
OTHER_SWIFT_FLAGS = "-D TRACKING";
801801
SDKROOT = appletvos;
802802
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
803803
SWIFT_VERSION = 3.0;

iCookTV/AppDelegate.swift

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
//
2626

2727
import UIKit
28-
import Crashlytics
29-
import Fabric
3028
import TreasureData_tvOS_SDK
3129

3230
@UIApplicationMain
@@ -40,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
4038

4139
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
4240
GroundControl.sync()
43-
setUpAnalytics()
41+
Tracker.setUpAnalytics()
4442

4543
window = UIWindow(frame: UIScreen.main.bounds)
4644
window?.rootViewController = TrackableNavigationController(rootViewController: LaunchViewController())
@@ -50,17 +48,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5048
}
5149

5250
func applicationDidEnterBackground(_ application: UIApplication) {
53-
TreasureData.sharedInstance().endSession(Tracker.sessionsTable)
54-
55-
backgroundTask = application.beginBackgroundTask (expirationHandler: { [weak self] in
56-
self?.endBackgroundTask(inApplication: application)
57-
})
58-
59-
TreasureData.sharedInstance().uploadEvents(callback: { [weak self] in
60-
self?.endBackgroundTask(inApplication: application)
61-
}) { [weak self] _ in
62-
self?.endBackgroundTask(inApplication: application)
63-
}
51+
#if TRACKING
52+
TreasureData.sharedInstance().endSession(Tracker.sessionsTable)
53+
54+
backgroundTask = application.beginBackgroundTask (expirationHandler: { [weak self] in
55+
self?.endBackgroundTask(inApplication: application)
56+
})
57+
58+
TreasureData.sharedInstance().uploadEvents(callback: { [weak self] in
59+
self?.endBackgroundTask(inApplication: application)
60+
}) { [weak self] _ in
61+
self?.endBackgroundTask(inApplication: application)
62+
}
63+
#endif
6464
}
6565

6666
// MARK: - Private Methods
@@ -70,19 +70,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7070
backgroundTask = UIBackgroundTaskInvalid
7171
}
7272

73-
private func setUpAnalytics() {
74-
Crashlytics.start(withAPIKey: iCookTVKeys.CrashlyticsAPIKey)
75-
Fabric.with([Crashlytics.self])
76-
77-
TreasureData.initializeApiEndpoint("https://in.treasuredata.com")
78-
TreasureData.initialize(withApiKey: iCookTVKeys.TreasureDataAPIKey)
79-
TreasureData.sharedInstance().enableAutoAppendUniqId()
80-
TreasureData.sharedInstance().enableAutoAppendModelInformation()
81-
TreasureData.sharedInstance().enableAutoAppendAppInformation()
82-
TreasureData.sharedInstance().enableAutoAppendLocaleInformation()
83-
84-
TreasureData.sharedInstance().defaultDatabase = Tracker.defaultDatabase
85-
TreasureData.sharedInstance().startSession(Tracker.sessionsTable)
86-
}
87-
8873
}

iCookTV/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
"filename" : "App Icon - Small.imagestack",
1313
"role" : "primary-app-icon"
1414
},
15+
{
16+
"size" : "2320x720",
17+
"idiom" : "tv",
18+
"filename" : "Top Shelf Image Wide.imageset",
19+
"role" : "top-shelf-image-wide"
20+
},
1521
{
1622
"size" : "1920x720",
1723
"idiom" : "tv",
@@ -23,4 +29,4 @@
2329
"version" : 1,
2430
"author" : "xcode"
2531
}
26-
}
32+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "tv",
5+
"scale" : "1x"
6+
}
7+
],
8+
"info" : {
9+
"version" : 1,
10+
"author" : "xcode"
11+
}
12+
}

0 commit comments

Comments
 (0)