nyc titanium user's group - accelerated development with tishadow
TRANSCRIPT
NYC Titanium User’s Group
Accelerated Developmentwith TiShadow
1
October 24th, 2013
Thursday, October 24, 13
NYC Titanium User’s Group
Credit, Where Credit is Do
David Bankier is the creator and primary author of TiShadow.
He currently has a SaaS service 9caster.io in private beta to provide hosted TiShadow services.
2
Thursday, October 24, 13
NYC Titanium User’s Group
First, a Li=le Demo ...
How quickly can we build and deploy the app shown on the right using the standard method?
How quickly can we build and deploy the same app using TiShadow?
3
Thursday, October 24, 13
NYC Titanium User’s Group
Let’s Talk Architecture
TiShadow Components‣ TiShadow Server‣ TiShadow App‣ TiShadow CLI‣ Application Bundles
4
Thursday, October 24, 13
NYC Titanium User’s Group
TiShadow Server
Hub of the SystemNode.jsWeb-SocketsBundle CachingWeb UI
5
Thursday, October 24, 13
NYC Titanium User’s Group
TiShadow App
Titanium based ‘run-time’Configured connection with TiShadow ServerWeb-SocketsExecutes Application BundlesEmbeds JasmineRedirects logging and errors to serverVariant: appified app
6
Thursday, October 24, 13
NYC Titanium User’s Group
TiShadow CLINode.js basedtishadow <sub-command>Configured connection with TiShadow ServerWeb-SocketsCreates Skeletal TiShadow AppCreates Application Bundles & Appified AppsREPLJasmine testingand more....
7
Thursday, October 24, 13
NYC Titanium User’s Group
Installing TiShadowRequires Node.js 0.8.x or laterInstall from NPM:> sudo npm install -‐g 9shadowInstall from GitHub: (my preference)> git clone [email protected]:dbankier/TiShadow.git> sudo npm install -‐g
8
Thursday, October 24, 13
NYC Titanium User’s Group
Star9ng a Local Server InstanceGenerally:> 9shadow server -‐p <port #> -‐i <internal IP address> -‐-‐manage-‐versions -‐-‐long-‐polling
Typically:> 9shadow server -‐p <port #> -‐-‐manage-‐versions
Let’s do it ....
9
Thursday, October 24, 13
NYC Titanium User’s Group
Crea9ng, Building and Deployingthe TiShadow App
Use the following to create the TiShadow app: > 9shadow app -‐d <des9na9on directory>Note that the application created is a ‘classic’ Titanium applicationIf you use Titanium Studio, import the applicationBuild and deploy to a device, simulator or emulatorConnect to TiShadow server
Let’s do it ....
10
Thursday, October 24, 13
NYC Titanium User’s Group
Build and Deploy Applica9on BundleWe will be using the simple Alloy application we saw earlier.> git clone h=ps://github.com/joliva/ShadowTest.gitRun the Alloy compiler first for Alloy applications> alloy compile -‐c plaOorm=iosPerform a full build and deploy of the application bundle> 9shadow runConsider using aliases for commands...
Let’s do it ....
11
Thursday, October 24, 13
NYC Titanium User’s Group
Update & Deploy Applica9on BundleUsing aliases:alias ac=’alloy compile -‐c plaOorm=ios‘ // required for Alloy appsalias act=’ac && 9shadow run‘ // full build and deployalias actu=’ac && 9shadow run -‐u‘ // incr build and deployUpdate the demo application’s view to add a couple of buttons...Because we have previously performed a full build we can do an incremental build and deploy.> actu
Let’s do it ....
12
Thursday, October 24, 13
NYC Titanium User’s Group
Configura9on, Logs, House KeepingDon’t have to provide the host, port and room with CLI commands when switching TiShadow servers:> 9shadow config -‐o <host> -‐p <port> -‐r <room>
Can continuously watch the TiShadow server’s status messages and connected TiShadow app: logging and errors from the CLI:> 9shadow log
Can close and clean up deployed application bundles:> 9shadow close, 9shadow clear
13
Thursday, October 24, 13
NYC Titanium User’s Group
Customizing the TiShadow AppThe TiShadow app needs to be customized to support any native modules that are used by the application bundles.Adding the native modules to the TiShadow app is accomplished using the normal process used for any Titanium application.Let’s extend the demo app we have been using to use a native module.
Let’s do it ....
14
Thursday, October 24, 13
NYC Titanium User’s Group
Crea9ng an Appified AppWhat is an appified app and what does it do for us?‣ TiShadow app + application bundle + server config‣ further accelerates the code/build/test development
cycle (auto-start, auto-connect, auto-download updates)‣ improves beta testing‣ improves testing (even if in the field)
✦ execution of code snippets,✦ inspect/modify objects using spies✦ run Jasmine tests
Start off in the Titanium projects top directoryDecide which TiShadow server and room (optional)Create the appified app:> 9shadow appify -‐d <dest_directory> -‐o <host> -‐p <port> -‐r <room>
15
Thursday, October 24, 13
NYC Titanium User’s Group
Crea9ng an Appified App (cont)The appified app should have now been created in the specified destination directoryIf using Titanium Studio, import the applicationBuild and deploy to target devices, simulators, etc. using the conventional process for Titanium apps.
Let’s do it ....
16
Thursday, October 24, 13
NYC Titanium User’s Group
Using the Appified AppStart up the appified app and it should immediately load and execute the embedded application bundle and connect to the TiShadow serverUsage from the CLI is identical (REPL, log, etc.), but any updates sent are retained - niceWith the TiShadow server running in managed versions mode, the appified app will receive newer application bundles upon startup.Can decouple deployment from TiShadow app updates:> 9shadow deploy -‐o <host> -‐p <port> -‐r <room>
Let’s do it ....17
Thursday, October 24, 13
NYC Titanium User’s Group
Things We Didn’t CoverDynamic LocalizationAutomatically updating application bundles when the source changesHosting TiShadow server in the cloudMore detailed use of the REPLUsing spies to inspect/modify objectsJasmine based testing
Check out the TiShadow series on my blog: olivalabs.com.
18
Thursday, October 24, 13
NYC Titanium User’s Group
Resources1. ShadowTest test applica9on: h=ps://github.com/joliva/ShadowTest2. TiShadow blog series: h=p://olivalabs.com/?p=1823. TiShadow on GitHub: h=ps://github.com/dbankier/TiShadow4. TiShadow website: h=p://9shadow.yydigital.com5. 9caster hosted service: h=ps://www.9caster.io
19
Thursday, October 24, 13
NYC Titanium User’s Group 20
Contact Info
NYC Titanium User’s Group
John OlivaOrganizer for NYC Titanium User’s GroupCertified Titanium Developer & Titanium Titan
e-mail: [email protected]: (908) 812-3667twitter : @jolivalinkedin: http://bit.ly/joliva63website: http://olivalabs.com
Thursday, October 24, 13