2. 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.
NYC Titanium User’s Group
Thursday, October 24, 13
2
3. 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?
NYC Titanium User’s Group
Thursday, October 24, 13
3
4. Let’s
Talk
Architecture
TiShadow Components
‣
‣
‣
‣
TiShadow Server
TiShadow App
TiShadow CLI
Application Bundles
NYC Titanium User’s Group
Thursday, October 24, 13
4
5. TiShadow
Server
Hub of the System
Node.js
Web-Sockets
Bundle Caching
Web UI
NYC Titanium User’s Group
Thursday, October 24, 13
5
6. TiShadow
App
Titanium based ‘run-time’
Configured connection
with TiShadow Server
Web-Sockets
Executes Application
Bundles
Embeds Jasmine
Redirects logging and
errors to server
Variant: appified app
NYC Titanium User’s Group
Thursday, October 24, 13
6
7. TiShadow
CLI
Node.js based
tishadow <sub-command>
Configured connection
with TiShadow Server
Web-Sockets
Creates Skeletal TiShadow
App
Creates Application
Bundles & Appified Apps
REPL
Jasmine testing
and more....
NYC Titanium User’s Group
Thursday, October 24, 13
7
8. Installing
TiShadow
Requires Node.js 0.8.x or later
Install from NPM:
>
sudo
npm
install
-‐g
9shadow
Install from GitHub: (my preference)
>
git
clone
git@github.com:dbankier/TiShadow.git
>
sudo
npm
install
-‐g
NYC Titanium User’s Group
Thursday, October 24, 13
8
9. Star9ng
a
Local
Server
Instance
Generally:
>
9shadow
server
-‐p
<port
#>
-‐i
<internal
IP
address>
-‐-‐manage-‐
versions
-‐-‐long-‐polling
Typically:
>
9shadow
server
-‐p
<port
#>
-‐-‐manage-‐versions
Let’s do it ....
NYC Titanium User’s Group
Thursday, October 24, 13
9
10. Crea9ng,
Building
and
Deploying
the
TiShadow
App
Use the following to create the TiShadow app:
>
9shadow
app
-‐d
<des9na9on
directory>
Note that the application created is a ‘classic’
Titanium application
If you use Titanium Studio, import the application
Build and deploy to a device, simulator or emulator
Connect to TiShadow server
Let’s do it ....
NYC Titanium User’s Group
Thursday, October 24, 13
10
11. Build
and
Deploy
Applica9on
Bundle
We will be using the simple Alloy application we
saw earlier.
>
git
clone
h=ps://github.com/joliva/ShadowTest.git
Run the Alloy compiler first for Alloy applications
>
alloy
compile
-‐c
plaOorm=ios
Perform a full build and deploy of the application
bundle
>
9shadow
run
Consider using aliases for commands...
Let’s do it ....
NYC Titanium User’s Group
Thursday, October 24, 13
11
12. Update
&
Deploy
Applica9on
Bundle
Using aliases:
alias
ac=’alloy
compile
-‐c
plaOorm=ios‘
//
required
for
Alloy
apps
alias
act=’ac
&&
9shadow
run‘
//
full
build
and
deploy
alias
actu=’ac
&&
9shadow
run
-‐u‘
//
incr
build
and
deploy
Update 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 ....
NYC Titanium User’s Group
Thursday, October 24, 13
12
13. Configura9on,
Logs,
House
Keeping
Don’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
NYC Titanium User’s Group
Thursday, October 24, 13
13
14. Customizing
the
TiShadow
App
The 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 ....
NYC Titanium User’s Group
Thursday, October 24, 13
14
15. Crea9ng
an
Appified
App
What 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 directory
Decide which TiShadow server and room (optional)
Create the appified app:
>
9shadow
appify
-‐d
<dest_directory>
-‐o
<host>
-‐p
<port>
-‐r
<room>
NYC Titanium User’s Group
Thursday, October 24, 13
15
16. Crea9ng
an
Appified
App
(cont)
The appified app should have now been created in
the specified destination directory
If using Titanium Studio, import the application
Build and deploy to target devices, simulators, etc.
using the conventional process for Titanium apps.
Let’s do it ....
NYC Titanium User’s Group
Thursday, October 24, 13
16
17. Using
the
Appified
App
Start up the appified app and it should immediately
load and execute the embedded application bundle
and connect to the TiShadow server
Usage from the CLI is identical (REPL, log, etc.), but
any updates sent are retained - nice
With 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 ....
NYC Titanium User’s Group
Thursday, October 24, 13
17
18. Things
We
Didn’t
Cover
Dynamic Localization
Automatically updating application bundles when
the source changes
Hosting TiShadow server in the cloud
More detailed use of the REPL
Using spies to inspect/modify objects
Jasmine based testing
Check out the TiShadow series on my blog:
olivalabs.com.
NYC Titanium User’s Group
Thursday, October 24, 13
18
19. Resources
1. ShadowTest
test
applica9on:
h=ps://github.com/joliva/ShadowTest
2. TiShadow
blog
series:
h=p://olivalabs.com/?p=182
3. TiShadow
on
GitHub:
h=ps://github.com/dbankier/TiShadow
4. TiShadow
website:
h=p://9shadow.yydigital.com
5. 9caster
hosted
service:
h=ps://www.9caster.io
NYC Titanium User’s Group
Thursday, October 24, 13
19
20. Contact Info
NYC Titanium User’s Group
John Oliva
Organizer for NYC Titanium User’s Group
Certified Titanium Developer & Titanium Titan
e-mail:
cell:
twitter:
linkedin:
website:
NYC Titanium User’s Group
Thursday, October 24, 13
joliva63@gmail.com
(908) 812-3667
@joliva
http://bit.ly/joliva63
http://olivalabs.com
20