Skip to content

Instantly share code, notes, and snippets.

@ParkinT
Last active October 7, 2015 07:18
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ParkinT/3126259 to your computer and use it in GitHub Desktop.
Save ParkinT/3126259 to your computer and use it in GitHub Desktop.
RubyMotion Rakefile - improved workflow
class AppProperties
VERSION = '0.9'
APP_DELEGATE = 'AppDelegate' #default
COMPANY_NAME = 'com.websembly.'
def name
'App Name Here'
end
def version
VERSION
end
def requires #add libraries to listed in Rakefile as 'require'
["sugarcube"]
end
def frameworks
[]
end
def contributors
["Thom Parkin" => "https://github.com/ParkinT/"]
end
def developer_certificate
'iPhone Developer: Thom Parkin (67L9Y9KX66)'
end
def provisioning
'./provisioning' #symlink
end
def testflight?
false
end
def pixate?
true
end
def delegate
APP_DELEGATE
end
def icons
icn = ["#{self.name}.png", "#{self.name}-72.png", "#{self.name}@2x.png"]
end
def devices
[:iphone, :ipad]
end
def orientations
[:portrait, :landscape_left, :landscape_right] #:portrait_upside_down
end
def identifier
COMPANY_NAME + APP_DELEGATE
end
end
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
# custom rake tasks
require '../raketasks/gemerator.rb'
desc "Open latest crash log"
task :log do
app = Motion::Project::App.config
exec "less '#{Dir[File.join(ENV['HOME'], "/Library/Logs/DiagnosticReports/#{app.name}*")].last}'"
end
require './app_properties'
props = AppProperties.new
props.requires.each { |r| require r } if props.requires.size > 0
Motion::Project::App.setup do |app|
app.name = props.name
app.identifier = props.identifier
app.delegate_class = props.delegate
app.version = props.version.scan(/\d+/).flatten.first
app.short_version = props.version.scan(/\d+/).first #required to be incremented for AppStore (http://iconoclastlabs.com/cms/blog/posts/updating-a-rubymotion-app-store-submission)
app.icons = props.icons
app.device_family = props.devices
app.interface_orientations = props.orientations
app.provisioning_profile = props.provisioning
app.codesign_certificate = props.developer_certificate
if props.testflight?
require 'motion-testflight'
app.testflight.sdk = 'vendor/TestFlight'
app.testflight.api_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
app.testflight.team_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
app.testflight.distribution_lists = ['Developers', 'Testers']
end
if props.pixate?
require 'rubygems'
require 'motion-pixate'
app.pixate.user = 'USER ID'
app.pixate.key = 'XXXX-XXXX-XXXX-XXXX-XXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXX-XX'
app.pixate.framework = 'vendor/PXEngine.framework'
end
end
@ParkinT
Copy link
Author

ParkinT commented Jul 17, 2012

In an attempt to improve my workflow in RubyMotion, I have been experimenting with ways to abstract the few details that must be changed from one application to the next.
This Rakefile exists in a root directory.
Each new project has a copy of the app_properties.rb (with all the appropriate details) and a symlink to the Rakefile.
In this way, I can simplify (and hopefully expedite) the process.

{This is an update to this}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment