Awesome
Welcome
This repository contains the source code for the Mammoth app for iOS, iPadOS and MacOS, released under the GNU Affero General Public License.
Feel free to take a look around. We are not yet taking patches as we still have a little bit of tidying up to do. When we do, there will be a contributor license agreement. Also, over the next week or two we'll start having some simple "infrastructure" (think: discord channel, etc.). Stay tuned... Bear with us; it's launch week and weekend!
The Mammoth Team
Getting Started
Requirements:
We use Arkana to obfuscate API keys and secrets in Mammoth, which requires the following versions:
- Ruby 3.1+
- Node.js 16+
- Xcode 13+
- Swift 5+
- Clone the repo
% git clone https://github.com/TheBLVD/mammoth.git
- Navigate to the repo, and copy the
sample.env
to.env
:
% cd mammoth
% cp sample.env .env
- Install
rbenv
if not already installed. See Installingrbenv
below for instructions. - Install a compatible version of ruby:
% rbenv install
- Install ruby dependencies to get the needed gems:
% bundle install
- Regenerate the
ArkanaKeys
package for managing API keys and secrets. This step can be repeated as whenever you change your.env
file's contents:
% bin/arkana
Installing rbenv
- Install Homebrew if you don't already have it:
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install rbenv using Homebrew:
% brew install rbenv ruby-build
- Initialize
rbenv
by installing it in your zsh profile, and reload the profile (this assumes you are usingzsh
by default — if you aren't, please runrbenv init
instead and follow instructions):
% echo "eval \"\$(rbenv init - zsh)\"" >> ~/.zshrc
% exec zsh
- Install a compatible version of ruby, and continue the steps above:
% rbenv install
- You can verify the right version of Ruby is installed by running
ruby --version
:
% ruby --version
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin22]
- Install SwiftLint
brew install swiftlint
Troubleshooting
-
If you run
bin/arkana
and see the following, it can't find a valid.env
file. Make sure you've copied the provided sample correctly and that it is in the root of the repo. -
If you see this in Xcode. Then Arkana has failed to generate the local package. Verify you have a valid
.env
and runbin/arkana
from the root of the repo. -
If you run
bin/arkana
and see the following:
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
You must use Bundler 2 or greater with this lockfile.
Ruby 3 is required. Check your ruby version ruby --version
, and check Installing rbenv
above for instructions on installing a new version.
Adding Private Keys
Steps to adding a new key/value to the project using Arkana. Upfront there are two options.
-
Global: same key/value for staging and production
-
Environment: one value for staging, and separate value for production. Both will reference the same key in the app
-
First Step Add your env name to
.arkana.yml
either under 'global_secrets' or 'environment_secrets' -
Second Step Add the key/value pair to your local
.env
file and key names tosample.env
NOTE: for global keys, they are added to the top of the file just once like this:
#.env
...
ExampleSecretKey=2903847
If you're using 'environment_secrets' you'll need 2 key/value entries with appended 'Staging' & 'Production':
#.env
...
ExampleSecretKeyStaging=03948092348504
ExampleSecretKeyProduction=02398450349
- Finally From the root of the project on the command line run
bin/arkana
. This embeds the env values in the Arkana swift package and the are now available to call in your code like this
///randomProjectFile.swift
/// env that is global
ArkanaKeys.Global().exampleSecretKey
/// env var for staging
ArkanaKeys.Staging().exampleSecretKey
If bin/arkan
throws an error, see troublshooting above ☝.
License
This repository contains the source code for the Mammoth app for iOS, iPadOS and MacOS, released under the GNU Affero General Public License.
See LICENSE for details.
All conversations in Issues will be licensed under CC-0. https://creativecommons.org/publicdomain/zero/1.0/
Unless otherwise noted, all files © 2023 The BLVD. All rights reserved.