Skip to content

Commit

Permalink
Adds tooling to easily install project dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachOrr committed Nov 24, 2018
1 parent 75d821d commit 91a4265
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 122 deletions.
11 changes: 11 additions & 0 deletions Brewfile
@@ -0,0 +1,11 @@
cask_args appdir: "/Applications"

# Xcode - lastest from the App Store *should* be fine
mas "Xcode", id: 497799835

# Ruby, for Cocoapods, gems, etc (we should do better about find a version of Ruby)
# This will probably already be installed on your system because it's needed for Homebrew
# brew "ruby"

# Node, for install React Native deps
brew "node"
128 changes: 6 additions & 122 deletions README.md
@@ -1,103 +1,12 @@
The Blue Alliance - iOS App
===
[![Build Status](https://travis-ci.org/the-blue-alliance/the-blue-alliance-ios.svg?branch=master)](https://travis-ci.org/the-blue-alliance/the-blue-alliance-ios)

An iOS app for accessing information about the FIRST Robotics Competition.

Setup
===

Install Build Tool Dependencies
---
The Blue Alliance for iOS has a few build tool dependencies. Here's how to install those, if you need them. The commands below suggest [Homebrew](https://brew.sh/) to install the dependencies. If you're on Windows or Linux, follow the links to find platform-specific setup instructions.

1. Install [Xcode](https://developer.apple.com/xcode/)
* The Blue Alliance for iOS is written in Swift 4.2, which comes with Xcode 10
2. Install [Ruby](https://www.ruby-lang.org/en/) (if it's not already installed on your system) and [Bundler](https://bundler.io/)
* `brew install ruby`
* `gem install bundler`
3. Install [Node/npm](https://nodejs.org/en/)
* `brew install node`


Install Project Dependencies
---
These should be done after you've cloned the project and navigated to the project directory

1. Install [React Native](https://facebook.github.io/react-native) dependencies
* `cd subtrees/the-blue-alliance-react && npm install && cd ../..`
2. Install Ruby dependencies
* `bundle install`
3. Install [Cocoapods](http://guides.cocoapods.org/using/getting-started.html#getting-started) dependencies
* `bundle exec pod install --repo-update`

Setup Firebase
---
The Blue Alliance's mobile apps depend on Firebase. We configure Firebase in The Blue Alliance for iOS using a `GoogleService-Info.plist` file, provided by Firebase. You can setup your own Firebase application to develop against.

1. Navigate to the [Firebase Console](https://console.firebase.google.com/u/0/)
2. Click `Add Project`
3. Enter a project name to work with - preferrably something namespaced to yourself (ex: `zach-tba-dev`)
4. After your project is done setting up, click your newly created project
5. On the landing page, click `Add Firebase to your iOS app`
6. Enter a locally namespaced bundle identifier (ex: `com.the-blue-alliance.tba.zach-tba-dev`)
7. Click `Register App`
8. Download the `GoogleService-Info.plist`

Setup Realtime Database
---
The Blue Alliance uses Firebase’s [Realtime Database](https://firebase.google.com/docs/database/) feature to sync information about FMS data availability and “down” events in realtime to clients. You may want to simulate this in your app for testing.

1. Navigate to your Firebase project
2. Click `Database`, under `Develop` in the left hand toolbar
3. Create a Realtime Database - NOT a Cloud Firestore
4. For simplicity, when prompted to set security rules for your Realtime Database, select `Start in test mode`
5. Click `Enable`
6. Under the hierarchy in your database, click the `+` button to add key/values

Here’s an example of a configuration a Realtime Database where the FMS data feed is up, and one event (2018mike2) is offline.

![realtime-database-example](screenshots/realtime-database-example.png)

Setup TBA API
---
The Blue Alliance's mobile apps depend on The Blue Alliance's API for providing data. You'll need an API key to develop with when testing/building.

1. Navigate to [The Blue Alliance's Account page](https://www.thebluealliance.com/account) (sign in if prompted)
2. Scroll down to `Read API Keys`
3. Enter a locally namespaced description (ex: `zach-tba-ios-dev`)
4. Click `+ Add New Key` to generate a new API key

We'll use this key in the [Setup Secrets](#setup-secrets) step when setting up local secrets in the The Blue Alliance for iOS project.

Setup Secrets
---
The Blue Alliance for iOS stores secrets locally in a `Secrets.plist` file, which is loaded dynamically at runtime as a dictionary to be used in the app. Create a `Secrets.plist` file from the template `mock-Secrets.plist`

```
$ cp mock-Secrets.plist the-blue-alliance-ios/Secrets.plist
```

If linked properly, the `Secrets.plist` file in the Xcode project navigation should go from being red to being black. Click `Secrets.plist` to edit it, and fill out the secret values. `tba_api_key` should be the TBA API key you generated in the [Setup TBA API](#setup-tba-api) step.

Building in Xcode
---
Before building in Xcode, make sure you've setup a Firebase project, as described in the [Setup Firebase](#setup-firebase) section

1. Be sure you have all required build tools, as described in the [Install Build Tool Dependencies](#install-build-tool-dependencies) section
2. Install project dependencies, as described in the [Install Project Dependencies](#install-project-dependencies) section
3. Open the workspace file (`the-blue-alliance-ios.xcworkspace`)
4. Modify your bundle identifier to the same bundle identifier you used during your Firebase setup
* Click `the-blue-alliance-ios` project in the left sidebar in Xcode
* On the left sidebar, under `Targets` click `The Blue Alliance`
* Click the `General` tab along the top bar
* Change `Bundle Identifier` to the bundle identifier you set during Firebase setup
5. Replace the existing `GoogleService-Info.plist` is in the `the-blue-alliance-ios/the-blue-alliance-ios` folder.
6. Build and run The Blue Alliance for iOS!
An iOS app for accessing information about the FIRST Robotics Competition. This is a native mobile version of [The Blue Alliance](http://www.thebluealliance.com).

Contributing
============

Want to add features, fix bugs, or just poke around the code? No problem!
===
Want to add features, fix bugs, or just poke around the code? No problem! [Setup instructions](https://github.com/the-blue-alliance/the-blue-alliance-ios/wiki/Setup) (and lots of other documentation) can be found in [the Wiki](https://github.com/the-blue-alliance/the-blue-alliance-ios/wiki).

Project Communication
---
Expand All @@ -108,13 +17,11 @@ iOS discussion happens in the `#dev-ios` channel in the Slack

Learning
---
Future information on project structure, classes, etc. coming later
Information about the app's architecture, tooling used for this repo, and more can be found in [the Wiki](https://github.com/the-blue-alliance/the-blue-alliance-ios/wiki).

Finding Tasks
---
Outstanding work for The Blue Alliance for iOS is tracked in [GitHub Issues](https://github.com/the-blue-alliance/the-blue-alliance-ios/issues). All Issues are [tagged with labels](https://github.com/the-blue-alliance/the-blue-alliance-ios/labels). Issues have a priority (`high priority`, `low priority`, `nice to have`) and a type (`bug`, `enhancement`), as well as some additional information (`feature parity`, `good first issue`, `TBAKit`, etc).

If you're new to The Blue Alliance for iOS, the [`good first issue` label](https://github.com/the-blue-alliance/the-blue-alliance-ios/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) is a great place to start!
Outstanding work for The Blue Alliance for iOS is tracked in [GitHub Issues](https://github.com/the-blue-alliance/the-blue-alliance-ios/issues). All Issues are [tagged with labels](https://github.com/the-blue-alliance/the-blue-alliance-ios/labels). If you're new to The Blue Alliance for iOS, the [`good first issue` label](https://github.com/the-blue-alliance/the-blue-alliance-ios/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) is a great place to start!

Make Commits!
---
Expand All @@ -123,26 +30,3 @@ Make Commits!
3. Submit a pull request here and we'll review it and get it added in!

For more detailed instructions, see [GitHub's Guide to Contributing](https://guides.github.com/activities/contributing-to-open-source/).

Miscellaneous
===
This is the junk drawer of sections. If you're looking for information not covered above, it might be here. Eventually, this information will move to the Wiki.

Working with React Native
---

Instructions for installing, building, and debugging/running locally the React Native code can be found in [the-blue-alliance-react](https://github.com/the-blue-alliance/the-blue-alliance-react) repo. Execute these commands while in the `subtrees/the-blue-alliance-react` folder

If you make changes to the React Native code and want to push them upstream, you can do this locally from this repo

1. Add your forked project remote
* `git remote add <REMOTE NAME> <YOUR FORK URL>`
* Example: `git remote add zach-the-blue-alliance-react https://github.com/ZachOrr/the-blue-alliance-react.git`
2. Push your changes to your forked repo
* `git subtree push --prefix=subtrees/the-blue-alliance-react <REMOTE NAME> <REMOTE BRANCH>`
* Example: `git subtree push --prefix=subtrees/the-blue-alliance-react zach-the-blue-alliance-react master`
3. Open a [Pull Request](https://github.com/the-blue-alliance/the-blue-alliance-react/pulls) against [the-blue-alliance-react](https://github.com/the-blue-alliance/the-blue-alliance-react) repo!

myTBA Debug Setup
------------------
Debug builds of the TBA app cannot receive (Firebase Cloud Messaging) push notifications from production TBA servers. To test the myTBA features of the app, e.g. to test push notifications end-to-end, you must set up a debug [TBA server](https://github.com/the-blue-alliance/the-blue-alliance) then configure the server and temporarily modify the app code.
7 changes: 7 additions & 0 deletions fastlane/Fastfile
Expand Up @@ -2,6 +2,13 @@ default_platform :ios

platform :ios do

desc "Install project dependencies"
lane :install_deps do
bundle_install # Update bundle deps
sh("npm install --prefix ../subtrees/the-blue-alliance-react") # Install React Native deps
cocoapods(repo_update: true, use_bundle_exec: true) # Install pods
end

desc "Setup CI"
lane :setup_ci do
setup_travis
Expand Down
5 changes: 5 additions & 0 deletions fastlane/README.md
Expand Up @@ -16,6 +16,11 @@ or alternatively using `brew cask install fastlane`

# Available Actions
## iOS
### ios install_deps
```
fastlane ios install_deps
```
Install project dependencies
### ios setup_ci
```
fastlane ios setup_ci
Expand Down

0 comments on commit 91a4265

Please sign in to comment.