Created
June 10, 2013 15:12
-
-
Save noeticpenguin/5749543 to your computer and use it in GitHub Desktop.
Base Rakefile for RubyMotion projects incorporating the Salesforce Mobile SDK(iOS).
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") | |
require 'motion/project/template/ios' | |
require 'rubygems' | |
require 'bundler' | |
Bundler.require | |
require 'sugarcube-repl' | |
Motion::Project::App.setup do |app| | |
# Use `rake config' to see complete project settings. | |
#### General Information | |
app.name = 'Mobile Admin Tools' # <-Set your project name here. | |
app.version = "1.0" # <- This is especially useful during TestFlight testing! | |
app.deployment_target = "6.0" # <- Minimum OS version for client device | |
app.device_family = [:iphone] # <- What devices can run this? other options include: :ipad | |
app.interface_orientations = [:portrait, :landscape_left, :landscape_right] # <- Hopefully obvious | |
#### Application Artwork. | |
app.icons = ["Icon.png", # <- iPhone non-retina standard icon | |
"[email protected]"] # <- Retina iPhone icon | |
#### Application Frameworks | |
# This next line details the list of iOS frameworks that this application will require. | |
# While this list is specific to this application, it's pretty much the bare minimum needed | |
# for utilizing the Salesforce mobile SDK (iOS) | |
app.frameworks += %w(CFNetwork CoreData MobileCoreServices SystemConfiguration Security MessageUI QuartzCore OpenGLES CoreGraphics sqlite3) | |
#### Code signature, profile and Identifier info. ##Headache## | |
# Note well the difference between development (simulator use) and relase (on device use)! | |
app.development do | |
app.entitlements['get-task-allow'] = true | |
# app.identifier = '<<< INSERT YOUR APP IDENTIFIER HERE >>>' | |
# app.provisioning_profile = '<<< INSERT FULL PATH TO YOUR PROVISIONING PROFILE HERE >>>' | |
# app.codesign_certificate = '<<< INSERT NAME OF CODE SIGN CERTIFICATE HERE >>>' | |
end | |
app.release do | |
app.entitlements['get-task-allow'] = false # <- THIS IS CRUCIAL | |
# app.identifier = '<<< INSERT YOUR APP IDENTIFIER HERE >>>' | |
# app.provisioning_profile = '<<< INSERT FULL PATH TO YOUR PROVISIONING PROFILE HERE >>>' | |
# app.codesign_certificate = '<<< INSERT NAME OF CODE SIGN CERTIFICATE HERE >>>' | |
end | |
#### Additional Libraries Needed | |
# These are the minimum required libraries for use with the Salesforce mobile iOS SDK | |
app.libs << "/usr/lib/libxml2.2.dylib" # <- XML? ... yeah, we need it. | |
app.libs << "/usr/lib/libsqlite3.0.dylib" # <- Need to link against Sqlite 3 | |
app.libs << "/usr/lib/libz.dylib" # <- Need to link against zlib | |
# This rakefile assumes you're following the practice of placing a copy of the Salesforce | |
# iOS sdk under <<ProjectRoot>>/vendor/Salesforce | |
app.libs << "vendor/Salesforce/dist/openssl/openssl/libcrypto.a" # <- Salesforce provided crypto lib | |
app.libs << "vendor/Salesforce/dist/openssl/openssl/libssl.a" # <- Salesforce provided SSL lib | |
app.libs << "vendor/Salesforce/dist/sqlcipher/sqlcipher/libsqlcipher.a" # <- Salesforce Provided Sqlite Encryption library | |
app.libs << "vendor/Salesforce/dist/SalesforceCommonUtils/Libraries/libSalesforceCommonUtils.a" # <- Salesforce provided, Non-open source library! | |
#### Entitlements | |
# In order for the application to securely store oAuth credentials, Salesforce apps need | |
# the keychain-access-groups entitlement, this shouldn't change. | |
app.entitlements['keychain-access-groups'] = [ | |
app.seed_id + '.' + app.identifier | |
] | |
#### Vendor Projects, because sometimes, precompiled code sucks. | |
# While Salesforce provides precompiled versions of the following libraries under | |
# /vendor/Salesforce/dist/<<Lib Name>> the following libraries *MUST* be compiled | |
# so that rubymotion builds, and includes the bridgesupport file. This provides | |
# Rubymotion with access to methods that are in Obj-c categories etc. | |
# Restkit, because the pod isn't good enough. | |
# YOU MUST USE THE SALESFORCE DISTRIBUTED VERSION | |
# YOU MUST HAND COMPILE IT VIA VENDOR_PROJECT TO AVOID | |
# RANDOM SELECTOR_NOT_FOUND ERRORS. THAT IS ALL. | |
app.vendor_project "vendor/Salesforce/external/RestKit/RestKit", # <- path to root of library source | |
:xcode, # <- either :xcode or :static, use :xcode if there is a .xcodeproj file present | |
:target => 'RestKit', # <- if :xcode, specify the target you want to build | |
:headers_dir => "build/RestKit" # <- *this is the crucial bit* RubyMotion builds the | |
# .bridgesupport file from the headers, | |
# YOU MUST SPECIFY THE HEADER DIR. | |
# Salesforce SDK oAuth Library | |
# YOU MUST HAND COMPILE FROM SOURCE TO AVOID A SELECTOR | |
# NOT FOUND ERROR ON MACADDRESS. #JUSTSAYING. | |
app.vendor_project "vendor/Salesforce/native/SalesforceOAuth", | |
:xcode, | |
:target => 'SalesforceOAuth', | |
:headers_dir => "Headers/SalesforceOAuth" | |
# Salesforce SDK Libraries | |
# Yeah so trying the precompile versions in vendor dist is just | |
# futile on stupid on #thisIsWhyDevsDrink. Even if you get it | |
# running, it'll bomb with weird ass errors. | |
app.vendor_project "vendor/Salesforce/native/SalesforceSDK", | |
:xcode, | |
:target => "SalesforceSDK", | |
:headers_dir => "SalesforceSDK/Classes" # <- This is the most crucial .bridgesupport file | |
# to be generated. | |
#### CocoaPods! | |
# Who doesn't love them some cocoaPod goodness? | |
app.pods do | |
# pod 'RestKit' # <- Salesforce relies on THEIR FORK! DO NOT USE POD | |
pod 'FlurrySDK' # <- Flury Mobile Analytics SDK, this is optional, but Mobile Data Tools uses it. | |
pod 'Appirater' # <- Cocoa Pod for built in automatic prompting of "rate my app please", Options but Mobile Data Tools uses it. | |
pod 'MGSplitViewController' # <- A more feature rich split view controller, here as an example | |
pod 'MBProgressHUD' # <- For displaying pretty spinners with "wait already!" messages. Not in use in this app. | |
# pod 'SQLCipher' # <- don't use this. #iWasTemptedToo. #fail. | |
# pod 'FMDB' # <- Database wrapper not unlike active record. Not in use in this app | |
end | |
#TestFlight! | |
# While test flight is normally included via a cocoapod, RubyMotion has it's own Gem. This sets it up. | |
# This is optional, but highly recommended for on-device testing. | |
app.testflight.sdk = 'vendor/TestFlight' | |
app.testflight.api_token = '<<< TEST FLIGHT API TOKEN HERE >>>' | |
app.testflight.team_token = '<<< TEST FLIGHT TEAM TOKEN HERE >>>' | |
end # <- End App.setup block. | |
### Helper Rake Tasks | |
# These Rake tasks are helper tasks designed to make development smoother / better / faster / stronger! | |
# #6million$Dev | |
desc "Open latest crash log" # <- When the app crashes in the simulator it writes a .datXXXX file in the root | |
# of the project containing the crash log. this opens the latest one. | |
task :log do | |
app = Motion::Project::App.config | |
exec "less '#{Dir[File.join(ENV['HOME'], "/Library/Logs/DiagnosticReports/#{app.name}*")].last}'" | |
end | |
desc "Run simulator in retina mode" # <- default is non-retina mode | |
task :retina do | |
exec "bundle exec rake simulator retina=true" | |
end | |
desc "Run simulator on iPad" # <- Run on an Ipad, if device family includes :ipad | |
task :ipad do | |
exec "bundle exec rake simulator device_family=ipad" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment