TiShadow Express and Appyfy for both iOS a Android Alloy apps recipe help!

658 views
Skip to first unread message

Antonio Calanducci

unread,
Jan 24, 2014, 2:23:14 PM1/24/14
to tish...@googlegroups.com
Hi David,

first of all, a huge thanks for this big present you are giving out to the tidevs community. we are saving tons of time with tishadow!

As I would love to use TiShadow during our titanium classes, since you released the express feature, it would be much more easy to set it up and explain to users that should not understand what is going on behind the scene.

Following your latest replies on twitter, I realized that on TiShadow 2.5.0 you have included the support for simultaneous platform deployment even with alloy.
Moreover, I have already installed the latest commits from the master branch, to try the --appify hook to the titanium cli.

Unfortunately, I am not still able to get live reload of code.
What I do is the following:

1) ti build -p ios --shadow
2) ti build -p android -C GalaxyNexus43 --appify

where GalaxyNexus43 is the ID of a running instance of a GenyMotion emulator.

Everything seems fine: both ios and android sim/emu loads the app fine (I am using a very basic alloy app with a window and two labels), but when I edit some code and save it, only the ios instance get refreshed.

Looking at the tishadow web interface and repl, I see that both ios and android sims are connected (I could even send a alert("TiShadow and David rule!) and it's working properly, but NO updates if I change the code.

So I stopped the second ti build (2) and run this:

> ts @ run -u

(while still having the process (1) in place) and the code is refreshed:

[INFO] Beginning Build Process
[INFO] Compiling Alloy for android
[INFO] Compiling Alloy for ios
[INFO] Compiling Alloy for mobileweb
[INFO] 81 file(s) bundled.
[INFO] BUNDLE sent.

But doing a second code change I got a crash:

[DEBUG] changed: /Users/acaland/projects/apps/secondoAlloy/app/views/index.xml
[INFO] Beginning Build Process
[INFO] Compiling Alloy for android
[INFO] Compiling Alloy for ios
[INFO] Compiling Alloy for mobileweb

fs.js:684
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/Users/acaland/projects/apps/secondoAlloy/build/tishadow/last_updated_android_ios_mobileweb'
    at Object.fs.statSync (fs.js:684:18)
    at beginCompile (/usr/local/lib/node_modules/tishadow/cli/support/compiler.js:133:24)
    at /usr/local/lib/node_modules/tishadow/cli/support/compiler.js:121:9
    at /usr/local/lib/node_modules/tishadow/node_modules/async/lib/async.js:332:13
    at /usr/local/lib/node_modules/tishadow/node_modules/async/lib/async.js:142:25
    at /usr/local/lib/node_modules/tishadow/node_modules/async/lib/async.js:328:21
    at ChildProcess.<anonymous> (/usr/local/lib/node_modules/tishadow/cli/support/compiler.js:105:11)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:789:12)

What I am doing wrong? Any hints to understand why only (1) is refreshing code?

thanks a lot for the past and in advance
Antonio

David Bankier

unread,
Jan 25, 2014, 6:26:55 PM1/25/14
to Antonio Calanducci, tish...@googlegroups.com
Ok I see the issue.

To explain, using the `—express` flag does does the following:
1. starts the server
2. appifies and deploys to the platform.
3. starts: `tishadow @ run -u` to push changes, but it also uses that `—platform` flag to target the platform you are building.

So if you want to build to multiple platforms.
Start the ts server, ti build --appify for each platform, `ts @ run -u`. Since there are grunt plugins for tishadow, you can put together a grunt plugin that does all that for you in one command.
(I’d prefer at this stage not to create hooks for every scenario.)
If I get the time I’ll share a gist.  
(You will want to use my fork of the grunt-tishadow plugin since @astronaughts hasn’t merged my PR yet.)

David

Antonio Calanducci

unread,
Jan 25, 2014, 6:42:35 PM1/25/14
to tish...@googlegroups.com
Ok thanks, i will give grunt a try. Anyway if in the future you will find a simpler way for newbies, it will be great.

Anyway, have you noticed a strange behaviour in the repl? Prompt doesn't appear immediately....it's a bit annoying....

Antonio Calanducci

unread,
Jan 26, 2014, 11:42:54 AM1/26/14
to tish...@googlegroups.com
Hi David,

your suggested workflow works pretty well.
Anyway, I have looked at the hooks/shadow.js and changed this line:

//commands.startWatch(logger, build.cli.argv.platform, ip_address);

with 

commands.startWatch(logger, "ios,android", ip_address);


and so every change will push both to io and android. 
Anyway I have still to launch the ti build -p android --appify manually.

I am wondering if we can spawn a ti build process within a hook. Anyway it will be a dirty solution, grunt will fit better, but I am always thinking to the newbie scenario, that just need to use a single command (with grunt he need to install plugin and create a gruntfile, right?)
....unless that (this is a proposal) grunt, some gruntfiles and plugins will be installed as dependencies while installing tishadow and one could just run something like:
tishadow-express -p ios,android  :)
and the server will start, two appified apps will be deployed (with ti build) and watch will start :)

What do you think? maybe it's time to start to contribute to tishadow :) can you give me some help in case?

best
Antonio
Reply all
Reply to author
Forward
0 new messages