envone / ember-runner

EmberJS preview and build tool for Node.JS
MIT License
50 stars 6 forks source link

Walkthrough for first time users #17

Closed rvega closed 12 years ago

rvega commented 12 years ago

I'm not a node.js programmer and I'm having a hard time understanding how to use ember-runner. I've created the directory structure for my project, added the ember.js, index, and other required files, installed node, npm and ember-runner and when I call ember-runner preview I keep getting errors about ember packages or jquery not being found. A simple walkthrough for non node people would be really appreciated. Thanks for sharing this :)

rvega commented 12 years ago

I finally got rid of the Package error messages but now when I run ember-runner preview it just displays the following and quits, the devel server is not left open. Some advise please?:

[rafaelvega@arch-rafa ember-runner]$ ember-runner preview [task:checkConfig] Started [task:configure] Started [task:clean] Started [vendors] Started [apps] Started [task:checkPackages] Started [task:walk] Started [build] Started [Build] Package: jquery [WARN] [UNUSED FILE] [Level: 0] jquery/media/Data/Projects/Active/Sicor/sandbox/ember-runner/vendors/jquery/jquery-1.6.2.min

envone commented 12 years ago

Great @rvega, is a good start, now ember.js doesn't include jquery anymore as a package, so we need to add to our index.html manually, this is how we can do:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.6.2.min.js"%3E%3C/script%3E'))</script>
<script type="text/javascript" src="libraries/ember.js"></script>
...

Just before ember.js, and then you add after above:

<script type="text/javascript" src="apps/myapp/myapp_templates.js"></script>
<script type="text/javascript" src="apps/myapp/myapp.js"></script>

Sorry for all the steps, this is the idea of the generators, so we can build a template from scratch.

Hope you run, you can find me in the emberjs's irc channel juan77

paynerc commented 12 years ago

@envone I'm having some difficulty in getting things running here and am hoping that you might be able to set me straight. We are new relatively new to ember.js and are evaluating using it for a new web facing product that integrates with our iOS and Mac apps. We have extensive experience with MVC development for Cocoa/CocoaTouch as well as with RoR.

What I would like to do is be able to use a hierarchical folder structure, sort of along the lines of what emberjs/ember-rails suggests:

controllers/
helpers/
models/
routes/
templates/
views/

I have a real simple test application with three controllers and three views. I can view it in Safari and all is well. I then attempt to use ember-runner and I don't ever see anything. Looking in the console, there are no warnings or anything that looks out of the ordinary.

I went back and removed my folder structure. In fact, I went as far as going back and putting all of the ember code into a main.js file and still am not getting anything.

So I guess my questions are:

  1. How do I go about adding support for the organizational structure listed above?
  2. Do you have any pointers on how to get a simple application set up and running? I'd be willing to send you over a copy of my project structure if that might help you figure out what I am screwing up?

I am looking for you on the the emberjs irc channel, but haven't seen you. I am paynerc on freenode.

Thanks for your help,

Ryan

envone commented 12 years ago

@paynerc wel, we can make a small sample as a base to follow... please give some hours and I show you for comments. keep in touch.

paynerc commented 12 years ago

@envone That'd be great. Continuing to play around with this, it seems like the ember app is working under the covers. When I inspect the DOM, it appears that the templates that I would expect to be loaded, are indeed loaded. But the view in the DOM inspector appears that it is just taking the template as text and its not rendering it at all? Have you ever seen that happen before?

envone commented 12 years ago

It never happened to me, but don;t worry, please give some gits about what are you trying to do, maybe I can figure out, I think that is a ember think... instead of ember-runner...

paynerc commented 12 years ago

You might be right. I was just wondering if you had seen the issue before. When I have the handlebars templates in the index.html file, it works fine. When they are in external files and included in the my_app_templates.js file, that's when all heck breaks loose.

envone commented 12 years ago

to be sure, you load my_app_templates.js before my_app.js in your index.html? you can check the Em.TEMPLATES to see if your templates are loaded or not.

paynerc commented 12 years ago
<script type="text/javascript" charset="utf-8" src="vendor/handlebars/handlebars-1.0.0.beta.6.js"></script>
<script type="text/javascript" charset="utf-8" src="libraries/ember.js"></script>
<script type="text/javascript" charset="utf-8" src="apps/my_app/my_app_templates.js"></script>
<script type="text/javascript" charset="utf-8" src="apps/my_app/my_app.js"></script>

Ember.TEMPLATES has the three templates, application, home and somethingElse.

envone commented 12 years ago

hi, maybe you forgot to add the handlebars script in your index.hmtl like...:

<script type="text/x-handlebars">
   {{view templateName="home"}} 
</script>
envone commented 12 years ago

@paynerc I have uploaded an initial working sample to show you how to load templates... this is an initial upload that solves your doubt hope this helps.

paynerc commented 12 years ago

My issue turns out to be related to the fact that I had Githubissues.

  • Githubissues is a development platform for aggregating issues.