emberjs-addons / sproutcore-statechart

(Ember Only) Repository for the ported SproutCore Statechart package
www.sproutcore.com
50 stars 11 forks source link

require('sproutcore-statechart') doesn't work #1

Closed salomons closed 13 years ago

salomons commented 13 years ago

UPDATED 20 Sep!! ......................................................................................................... I can't get statecharts using bpm working. I get the following error.

syntax error
[Break On This Error] __evalFunc = function(a,b,c,d,e,f){var...efined)};return c.statePlugin=YES,c}} in file:///.../my_app/assets/bpm_libs.js
Line 6

I am using: spade (1.0.1) sproutcore-metal (2.0.beta.3) sproutcore-runtime (2.0.beta.3) jquery (1.6.2) sproutcore-views (2.0.beta.3) handlebars (1.0.0.beta.3) sproutcore-handlebars-format (2.0.beta.3.1) sproutcore-handlebars (2.0.beta.3) sproutcore (2.0.beta.3.1) sproutcore-utils (2.0.beta.3) sproutcore-statechart (2.0.beta.3)

Steps to reproduce error:

  1. bpm init my_app && cd my_app
  2. bpm add sproutcore --pre
  3. bpm add spade
  4. bpm add sproutcore-statechart -v 2.0.beta.3 --pre
  5. adding the following in index.html spade.require('my_app');
  6. Add following code in lib/main.js //main.js require('sproutcore'); require('sproutcore-statechart'); MyApp = SC.Application.create();

When I then start bpm preview and go to localhost:4020/index.html in the browser I encounter the error. If I comment out require('sproutcore-statechart') it works just fine.

ColinCampbell commented 13 years ago

@wagenet can you speak to this issue at all?

wagenet commented 13 years ago

@salomons, is there anything in the generated code that looks at all problematic? Also, if you just open the index.html locally (without bpm preview) does that work?

salomons commented 13 years ago

@wagenet, opening the index.html file locally doesn't work either. I get the same error: syntax error __evalFunc = function(a,b,c,d,e,f){var...efined)};return c.statePlugin=YES,c}}

I am using: bpm rc3 statechart beta 3

I Tryed to recreate the steps above with updated ruby (from p180 to p290) but I couldn't add sproutcore --pre anymore. Reverted the update to p180, but I still can't use --pre. Is --pre deprecated or is it still the way to go? Filed an issue at https://github.com/bpm/bpm/issues/56.

wagenet commented 13 years ago

@salomons, a couple of ideas:

  1. In your project JSON, remove the minifier line and replace it with "spade:format": "function". This will prevent your bpm_libs.js from being minified and will make spade register functions instead of strings. This should make it easier to track down where the error is coming from.
  2. Make a vendor directory and clone http://github.com/sproutcore/sproutcore-statechart.git into that directory. This will make BPM use that version instead of the package from getbpm.org. If this works, then it's possible there was a bug in beta3 that was causing problems.

Also, what browser and OS are you using?

salomons commented 13 years ago

@wagenet, I removed the minifier line and found out that the error occur using eval in the following function: Ep.evaluate = function(text, sandbox, filename) { return eval(text); };

When I replaced the line with "spade:format": "function" as you suggested it works perfectly! So there seems to be a bug somewhere.

I am using OS X 10.6 and I tried both firefox and safari. Thanks!

wagenet commented 13 years ago

What if you try vendoring sproutcore-statechart master and don't do "spade:format": "function"?

salomons commented 13 years ago

Hurray! Did the vendor thing and it used beta4 from local package and it worked using bpm preview. It also worked using a node server, which was my initial problem. Thanks a thousand for your help!

wagenet commented 13 years ago

My guess is that there's something in beta3 (possibly a debugger statement) that is causing problems in your environment.

ColinCampbell commented 13 years ago

Yeah, there was. It's fixed in beta4

salomons commented 13 years ago

Awesome! Now SC 2 is mature enough for me to start developing my app. Excellent work you have done in v 2.0!