Created
March 4, 2012 18:15
-
-
Save rubenfonseca/1974242 to your computer and use it in GitHub Desktop.
Rakefile + CoffeeScript + Titanium Mobile example
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
var app = { | |
classes: { }, | |
models : { } | |
}; | |
Ti.include('js/main.js'); |
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
Ti.include '/lib/underscore.js' | |
Ti.include '/lib/backbone.js' | |
Ti.include '/js/main_view_controller.js' | |
mvc = new app.classes.MainViewController() | |
mvc.open() |
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 MainViewController | |
constructor: -> | |
@window = Ti.UI.createWindow | |
title: "Main Window" | |
@button = Ti.UI.createButton | |
title: "button" | |
@window.add @button | |
@button.addEventListener 'click', this.handle_btn_click | |
open: -> | |
@window.open() | |
handle_btn_click: (e) => | |
Ti.API.warn "button clicked: #{JSON.stringify e}" | |
app.classes.MainViewController = MainViewController |
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
DEV_PROVISIONING_UUID = "3E4D9E49-E44B-4B73-AFAD-248C720ECD53" | |
DEV_SIGN = "Ruben Fonseca" | |
DEV_APP_NAME = "My greatest app" | |
DEV_APP_ID = 'com.0x82.app' | |
TITANIUM_SDK_VERSION = '1.8.2' | |
IPHONE_SDK_VERSION = '5.0' | |
BUILDER_PATH = "/Library/Application Support/Titanium/mobilesdk/osx/#{TITANIUM_SDK_VERSION}/iphone/builder.py" | |
if File.exists?(BUILDER_PATH) | |
BUILDER = BUILDER_PATH | |
elsif File.exists?(File.expand_path('~') + BUILDER_PATH) | |
BUILDER = File.expand_path('~') + BUILDER_PATH | |
else | |
raise "Couldn't found builder.py for iPhone Titanium SDK #{TITANIUM_SDK_VERSION}" | |
end | |
task :run do | |
sh 'coffee -c -l -o Resources/js coffee' | |
FileUtils.mkdir_p('build/iphone') | |
sh BUILDER, 'simulator', IPHONE_SDK_VERSION, File.dirname(__FILE__), DEV_APP_ID, DEV_APP_NAME | |
end | |
task :clean do | |
sh "rm -rf ./build" | |
end | |
task :fresh => %w(clean run) | |
task :coffee do | |
sh 'coffee -c -w -l -o Resources/js coffee' | |
end | |
task :default => [:run] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool 1 line of my contribution was accepted =D