-
-
Save dblandin/8509457 to your computer and use it in GitHub Desktop.
Managing RubyMotion environment variables
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
TESTFLIGHT_APP_TOKEN=90210 | |
TESTFLIGHT_TEAM_TOKEN=90210 | |
TESTFLIGHT_API_TOKEN=90210 | |
BUGSENSE_API_KEY=90210 | |
BUGSENSE_API_TOKEN=90210 | |
DEVELOPMENT_CERTIFICATE_NAME="iPhone Developer: yourName" | |
DEVELOPMENT_PROVISIONING_PROFILE_PATH="/path/to/development.mobileprovision" | |
ADHOC_CERTIFICATE_NAME="iPhone Distribution: yourCompany, Inc." | |
ADHOC_PROVISIONING_PROFILE_PATH="/path/to/adhoc_distribution.mobileprovision" | |
RELEASE_CERTIFICATE_NAME="iPhone Distribution: yourCompany, Inc." | |
RELEASE_PROVISIONING_PROFILE_PATH="/path/to/store_distribution.mobileprovision" |
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
module App; module ENV | |
class << self | |
def [](key) | |
vars["ENV_#{key}"] | |
end | |
def vars | |
@vars ||= info_dictionary.select { |key, value| key.start_with? 'ENV_' } | |
end | |
def info_dictionary | |
NSBundle.mainBundle.infoDictionary | |
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
source 'https://rubygems.org' | |
... | |
gem 'dotenv', '~> 0.9.0' | |
... |
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
# -*- coding: utf-8 -*- | |
$:.unshift('/Library/RubyMotion/lib') | |
... | |
environment_variables = Dotenv.load | |
Motion::Project::App.setup do |app| | |
... | |
app.testflight do |config| | |
config.api_token = ENV['TESTFLIGHT_API_TOKEN'] | |
config.team_token = ENV['TESTFLIGHT_TEAM_TOKEN'] | |
config.app_token = ENV['TESTFLIGHT_APP_TOKEN'] | |
end | |
app.bugsense do |config| | |
config.api_key = ENV['BUGSENSE_API_KEY'] | |
config.token = ENV['BUGSENSE_API_TOKEN'] | |
end | |
... | |
environment_variables.each { |key, value| app.info_plist["ENV_#{key}"] = value } | |
... | |
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
class SomeClass | |
def activate_bugsense! | |
... | |
BugSenseController.sharedControllerWithBugSenseAPIKey(App::ENV['BUGSENSE_API_KEY']) | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment