Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16231] LiveView needs to be updated to use the new Titanium CLI 3.2.1 hook API

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2014-02-12T18:22:44.000+0000
Affected Version/sRelease 3.2.1
Fix Version/s2014 Sprint 02, 2014 Sprint 02 Tooling, Release 3.2.1, Release 3.3.0
ComponentsLiveView
Labelsmodule_liveview, qe-testadded
ReporterChris Barber
AssigneeChristian Sullivan
Created2014-01-17T22:57:37.000+0000
Updated2014-02-24T23:50:28.000+0000

Description

In Titanium CLI 3.2.1, the hooks API changed as apart of TIMOB-16153. The LiveView CLI plugin needs to be updated to be compatible.

Comments

  1. Christian Sullivan 2014-01-17

    [~cbarber] I updated liveview as you defined and every thing appears to work. When it hits the users app.js in the copy resources hook it changes the path of app.js and says it copies the liveview.js in place, but when I open the app.js copied to the build it is the user's original app.js still.
       [INFO]  Processing JavaScript files
       [ '/Users/euforic/test_cases/superagent/Resources/app.js',
         '/Users/euforic/test_cases/superagent/build/iphone/build/Debug-iphonesimulator/superagent.app/app.js' ]
       [DEBUG] Copying /var/folders/c9/m840_dk93szdhklfnp76znyc0000gn/T/liveview.js => /Users/euforic/test_cases/superagent/build/iphone/build/Debug-iphonesimulator/superagent.app/app.js
       
  2. Chris Barber 2014-01-17

    [~csullivan] I appreciate you looking into this, but I too have been working on updating the LiveView hook. Generally if someone has marked a ticket as "In Progress", that means they are actively working on the ticket. I'm unfortunately not able to get mine working and I'm currently working with QE to diagnose. I didn't see any pull requests, so what did you change?
  3. Chris Barber 2014-01-17

    Here's my changes:
       diff --git a/hook/lvhook.js b/hook/lvhook.js
       index faafb28..a1a02ea 100644
       --- a/hook/lvhook.js
       +++ b/hook/lvhook.js
       @@ -8,7 +8,7 @@ var debug = require('debug')('liveview:clihook'),
        
        // export min cli version
        
       -exports.cliVersion = '>=3.0.25';
       +exports.cliVersion = '>=3.2.1';
        
        
        /**
       @@ -58,7 +58,7 @@ exports.init = function(logger, config, cli) {
                                       data.args[0] = join(tempdir(), 'liveview.js');
                               }
                       }
       -               finished(data);
       +               finished(null, data);
               }
        
               function writeBuildManifest(data, finished) {
       @@ -66,7 +66,7 @@ exports.init = function(logger, config, cli) {
                       if (cli.argv.liveview) {
                               data.args[0].liveview = true;
                       }
       -               finished(data);
       +               finished(null, data);
               }
        
               cli.addHook('build.ios.copyResource', { pre: copyResource });
       
  4. Christian Sullivan 2014-01-18

    [~cbarber] I started working on it since you assigned it to me. I made the same changes as you did above, but did not put in a pr yet since liveview was not working with the changes implemented. I will merge the changes in liveview version 1.1.0 since it introduces breaking changes for older sdk versions.
  5. Chris Barber 2014-01-18

    [~csullivan] Hmm, maybe we do something like this:
       if (appc.version.gt(cli.version, '3.2.0')) {
           finished(null, data);
       } else {
           finished(data);
       }
       
  6. Christian Sullivan 2014-01-20

    [~cbarber] could you please link that ticket to this one. Also I took your advice, ignored my OCD and made things backwards compatible. Thanks for the help!
  7. Christian Sullivan 2014-01-20

    PR [MASTER] https://github.com/appcelerator/liveview/pull/71 [~mxia] The PR above resolves this issue, but there is still a bug with the cli that prevents liveview from working.
  8. Chris Barber 2014-01-20

    [~csullivan] What link are you referring to? What is the bug in the CLI that prevents LiveView from working?
  9. Christian Sullivan 2014-01-20

    [~cbarber] The bug where it says it copied the liveview.js to the app as app.js but the app.js is the user's original app.js and not the liveview.js.
  10. Chris Barber 2014-01-20

    [~csullivan] Doesn't ring a bell. I'll keep an eye out for it.
  11. Christian Sullivan 2014-01-20

    [~cbarber] see the first comment of this ticket.
  12. Michael Xia 2014-01-20

    [~csullivan] [~cbarber] So I tested the latest LiveView (1.0.2) with 3.2.0 CLI, and it works fine, but with 3.2.1 CLI, the app no longer updates. Looking at the build console output, LiveView doesn't appear to run at all, even though the flag is correctly passed in. Here is the command Studio runs:
        Process: "/usr/local/bin/titanium" "--no-colors" "--no-progress-bars" "--no-prompt" "build" "--platform" "ipad" "--sdk" "3.2.0.GA" "--log-level" "trace" "--target" "simulator" "--ios-version" "7.0.3" "--device-family" "ipad" "--sim-version" "7.0.3" "--sim-type" "ipad" "--device-id" "iPad" "--skip-js-minify" "--liveview" "--deploy-type" "development"
        
    This matches the behavior Christian is describing. Should I reopen this ticket, or is there an existing ticket that we could link to? If there isn't one, we probably should create one to investigate.
  13. Michael Xia 2014-01-21

    Worked with Chris and found the issue. Will push a PR.
  14. Michael Xia 2014-01-21

    Pushed the fix and merged to be included in the next Studio 3.2.1 build.
  15. Samuel Dowse 2014-01-28

    Verified fixed on: Mac OSX 10.9.1 Appcelerator Studio, build: 3.2.1.201401241158 Titanium SDK, build: 3.2.1.v20140124163734 CLI: 3.2.1-beta3 Alloy: 1.3.1-beta4 Xcode: 5.0.2 Android Device: Nexus 4 (4.2) iOS Device: iPhone 5c (7.0.4) Hook version is the expected version, and both classic and alloy apps build successfully to device and simulator. Also project rebuilds on code change as expected. Closing.
  16. Ingo Muschenetz 2014-02-12

    Updated title.

JSON Source