GithubHelp home page GithubHelp logo

generator-marionette's Introduction

generator-marionette

Yeoman generator for Express, Marionette and Backbone with AMD

Stack

Directory structure

  • app/ --> client side files

    • /bower_components --> bower installs

    • /images

    • /scripts

      • /vendor --> 3rd party scripts
      • /models
      • /collections
      • /controllers
      • /routers
      • /regions
      • /views
        • /item
        • /collection
        • /composite
        • /layout
      • init.js --> require configuration
      • main.js --> application starting point
      • application.js --> application file
    • /styles --> scss files

    • /templates --> handlebar templates

  • server/ --> node server files

  • test/ --> unittesting

    • /spec --> individual spec files

Install

First make sure you have MongoDB, Node, Npm, Yeoman, Bower and Grunt installed.

Install mongoDB with:

$ brew install mongodb 

Or visit http://www.mongodb.org/

Visit nodejs.org to install node and NPM

Install phantomJS with:

$ brew install phantomjs

Or visit http://phantomjs.org/

To install Yeoman, Bower and Grunt run:

$ npm install -g yo grunt-cli bower

Install mocha-phantomjs:

$ npm install -g mocha-phantomjs

Install mocha generator:

$ npm install (-g) generator-mocha-amd

Install marionette generator

$ npm install (-g) generator-marionette

Bootstrap project

To bootstrap a new project simply run:

$ yo marionette

You have option to include the full express server OR just the marionette generators with a minimal server to develop and run test. No SASS/CSS in the latter.

To start the app run:

$ grunt

Unit testing generation

The biggest change in this release is the automatic unit test generation as part of the marionette-generator. The Marionette generator calls upon the mocha-amd generator. The default grunt task will automatically run all unit test files via phantom JS. You can also use the browser at localhost:1234/test. Test file generation looks something like the following:

  • yo marionette:collection sizes --model size --create-all // run collection generator
  • create app/scripts/collections/sizes.js
  • invoke marionette:model
  • create app/scripts/models/size.js
  • invoke mocha-amd:unitTest
  • create test/spec/models/size.js // unit test for size model
  • force test/spec/testSuite.js
  • invoke mocha-amd:unitTest
  • create test/spec/collections/sizes.js // unit test for sizes collection
  • force test/spec/testSuite.js // testSuite file which lists all test to run

Recommends

The generator is most useful using the --create-all flag. In the example:

$ yo marionette:compositeview peopleview --itemview personview --create-all

You will get the following files:

  • create app/scripts/views/composite/people.js
  • invoke marionette:itemview
  • create app/scripts/views/item/person.js
  • invoke marionette:tmpl
  • create app/templates/item/person_tmpl.hbs
  • invoke marionette:tmpl
  • create app/templates/composite/people_tmpl.hbs

Create routers

You can generate routers too with

$ yo marionette:router router-name

Create model

To add a Backbone model to the project use the model generator like this

$ yo marionette:model model-name

Or to inherit from an existing model

$ yo marionette:model model-name --inherit model-name

Create collection

To add a Backbone collection to the project use collection generator

$ yo marionette:collection collection-name

You can link the collection with an existent model

$ yo marionette:collection collection-name model-name

Or may be you want to create both, model and collection on one step

$ yo marionette:collection collection-name --model model-name --create-all

Or you may want to inherit from another collection

$ yo marionette:collection collection-name --model model-name --inherit collection-name --create-all

Create views

Backbone works with view definitions, to create one use this command. It is recommended to use Marionette views instead of the standard Backbone view

$ yo marionette:view view-name

Create item views

Create a Marionette ItemView and link to an existing template at location templates/[template-location]

$ yo marionette:itemview view-name 

You may want to inherit from another itemview

$ yo marionette:itemview view-name --inherit view-name

Or maybe you want to create both, itemView and template on one step

$ yo marionette:itemview view-name --create-all

Create collection views

Create a Marionette CollectionView that is associated to an existing itemview

$ yo marionette:collectionview view-name --itemview itemview-name

Or inherit from another collectionview

$ yo marionette:collectionview view-name --itemview itemview-name --inherit view-name

Or maybe you want to create both, itemview (with template) and collectionview.

$ yo  marionette:collectionview view-name --itemview itemview-name --create-all

Create composite views

Create a Marionette CompositeView

$ yo marionette:compositeview view-name --itemview itemview-name

Or inherit from another CompositeView

$ yo marionette:compositeview view-name --itemview itemview-name --inherit view-name

Or maybe you want to create all, itemview and compositeview and both templates.

$ yo marionette:compositeview view-name --itemview itemview-name --create-all

Create regions

Create a Marionette Region

$ yo marionette:region region-name

Or inherit from another Region

$ yo marionette:region region-name --inherit region-name

Create layouts

Create a Marionette Layout and link to an existing template at location templates/[template-location]

$ yo marionette:layout layout-name

Or inherit from another layout

$ yo marionette:layout layout-name --inherit layout-name

Or maybe you want to create both, Layout and template on one step

$ yo marionette:layout layout-name --create-all

Create controller

Create a Marionette Controller

$ yo marionette:controller controller-name

Or inherit from another Controller

$ yo marionette:controller controller-name --inherit controller-name

Create templates

Create a handle bars tmpl

$ yo marionette:tmpl tmpl-name --tmplLocation tmpl-location

generator-marionette's People

Contributors

jrmlstf avatar juliomenendez avatar karlpurk avatar mortonfox avatar mrichard avatar passy avatar shreyasubale avatar sindresorhus avatar soswow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-marionette's Issues

Consider Brian Mann style AppModules and folder layout in the generator

On my last project I used this generator as a basis to parse out and follow Brian Mann's proposed Marionette app structure from his elegant-but-huge Rdio app (vid) (slides) that is now featured on Marionette's homepage. _Be prepared for the thought bomb._ Much is only covered in the audio.

The main difference from what we have here and over on this generator fork that adds modules is that his Marionette components are laid out and scoped by AppModules.
As Brian Mann says, individual AppModules and isolated (Bower or otherwise) Components are the gateways to essentially all internal app interaction.

Here was my fairly successful folder structure:

app/
  scripts/
    apps/ - app modules container folder

      first-app-module/
        app-first-app-module.js - the AppModule definition and an initializer for the router, controllers, and a primary layout.
          => see fork elycruz/generator-marionette for this generated file. Name can begin with "app-"
        first-app-module-new.js - the first verb-oriented controller
        first-app-module-list.js - the second verb-oriented controller
        first-app-module.js - the single marionette router for this app module
        composite/ - Marionette CompositeViews for this AppModule
        collection/ - Marionette CollectionViews
        item/ - Marionette ItemViews
        layout/ - Marionette LayoutView including the default one
          first-app-module-layout.js  - default subregions for the AppModule
          another-controllers-layout.js

      second-app-module/
        app-second-app-module.js - the AppModule definition with an initializer for the router, controllers, and layout. Name begins with "app-"
          => see fork elycruz/generator-marionette. Name can begin with "app-"
        second-app-module-new.js - the first verb-oriented controller
        second-app-module.js - the single Marionette router for this app module
        composite/ - Marionette CompositeViews for this AppModule
        collection/ - Marionette CollectionViews
        item/ - Marionette ItemViews
        layout/ - Marionette LayoutView including the default one
          second-app-module-layout.js - default subregions for the AppModule
          another-controllers-layout.js

    entities/ - model and collection definitions
    application.js - primary app with highest level region creation and an initializer for 
    communicator.js - boilerplate messaging bus definition for requiring as needed.
    init.js - grunt generated bower_component includes and other custom theme_component requirejs definitions
    regionManager.js
    main.js - App.start()

  styles/ - SASS or LESS stylesheets
  templates/ -- hbs or jade templates 
  theme_components/ - manually managed components
  bower_components/ - automatic components

server/
  app.js -

test/
  SpecRunner.js - the test framework's own init.js
  spec/
    apps/
      first-app-module/ - AppModule structure is more explicitly separated in generated test folder
        controllers/
        routers/
        views/
          layout/
          item/
      second-app-module/
        controllers/
        routers/
        views/
    entities/

_Any comments? Is this a decent way to implement scoped AppModules productively that we could consider implementing in the mainline generator?_

I feel like Brian Mann's pattern reflects the best thinking from Ember.js and other parts of the javascript/rails ecosystem and it is nice to work with that within Marionette.

(We used this structure with a standard backbone backend PaaS API implemented with Kinvey rather than Rails as BM advocates.)

Brian Mann's outer structure:
The big structure

Brian Mann's inner structure:
The detail structure

Support for marionette modules?

So I can have this app structure:

app/
    account/
        models/
        collections/
        views/
        templates/
    product/
        models/
        collections/
        views/
        templates/

Tabs Vs. Spaces

When using the generator I often get a mix of spaces and tabs in generated files. Is there anyway to only get spaces or only tabs? I prefer spaces. Let me know if I can help in anyway.

Marionette 2.1 support

Hi Michel,
Thanks for amazing generator.

Is there any plans to update it for 2.1 support.
Generate Behaviors, Objects and so on.
One more point - i found a differences in file structure described in README and actual structure i receive on project init, especially regionManager file.

exec:mocha fails on mocha.useColors

Hi Everyone.

I cannot seem to run any tests. I get the following output on exec:mocha

TypeError: 'undefined' is not a function (evaluating 'mocha.useColors(config.useColors)')

   at phantomjs://webpage.evaluate():5
   at phantomjs://webpage.evaluate():13
   at phantomjs://webpage.evaluate():13

Any help will be appreciated.

exec:mocha failed when following setup guide.

I performed the following from the install instructions:

$ sudo npm install -g yo grunt-cli bower
$ sudo npm install -g mocha-phantomjs
$ npm install generator-mocha-amd
$ npm install generator-marionette
$ yo marionette
$ grunt
Y for express
N for mongo
Y for socket.io
N for baucis
$ grunt

Everything runs ok up until:

Running "exec:mocha" (exec) task
>> 
>> events.js:72
>>         throw er; // Unhandled 'error' event
>>               ^
>> Error: spawn ENOENT
>>     at errnoException (child_process.js:980:11)
>>     at Process.ChildProcess._handle.onexit (child_process.js:771:34)
>> Exited with code: 8.
Warning: Task "exec:mocha" failed. Used --force, continuing.

When I navigating to http://localhost:1234/test I see the output of the test runner.

Thanks!
Dave

Some questions on the generated app architecture

Hi,

I have a few questions on the app architecture:

  1. Why exactly do you do the root.define stuff and not a straight define call?

    E.g.

    (function() {
    'use strict';
    
    var root = this;
    
    root.define([], function(){});
    }).call( this );

    In other words, why do you deem it necessary to wrap them in a module pattern?

  2. How is the Communicator->RegionManager to be used? Like this?

    //create region
    function(communicator){
        communicator.reqres.request("RM:addRegion", 'foo', '#bar');
    } 
    //use region
    function(communicator, SomeFantasticView){
        var region = communicator.reqres.request("RM:getRegion", 'foo');
        region.show(new SomeFantasticView());
    } 

    Is this to allow a complete decouplement of views and regions?

  3. I guess I'm mainly wondering when to use what part of the communicator, which is probably something I should ask at the Marionette repo...

Handlebars task error

I have an issue:

On grunt build this happens:

Running "handlebars:compile" (handlebars) task

Destination not written because compiled files were empty.

Testing

Hi,

When i run mocha at project directory it gives the error below:

0 passing
(13ms)

1 failing

  1. Backbone AMD generator test "before each" hook:
    Uncaught Error: You don't seem to have a generator with the name backbone-amd:app installed.

You can see available generators with npm search yeoman-generator and then install them with npm install [name]

To see the 6 registered generators run yo with the --help option.

  at Environment.create (/home/codio/workspace/node_modules/yeoman-generator/lib/env.js:341:7)                                          
  at Object.helpers.createGenerator (/home/codio/workspace/node_modules/yeoman-generator/lib/test/helpers.js:214:23)
  at /home/codio/workspace/test/tests.js:27:26                   
  at /home/codio/workspace/node_modules/yeoman-generator/lib/test/helpers.js:158:5
 at CB (/home/codio/workspace/node_modules/yeoman-generator/node_modules/rimraf/rimraf.js:42:5)                                        
  at /home/codio/workspace/node_modules/yeoman-generator/node_modules/rimraf/rimraf.js:118:7
  at Object.oncomplete (fs.js:107:15)

But i have backbone-amd:app generator installed. What might be the issue?

Wrong path in Gruntfile.js, when you don't want to use express

In the grunt file there is a section named requirejs.dist.options.paths.templates this path prefixed with '../../' this make sense when accept to use express, but when you don't it points some directory which doesn't located in project's structure.

Could someone explain how the filename version revving works please?

I am sorry this is not an issue with the code but I am struggling to find out how the 'build' task managed to force the browser to reload all the JavaScript and CSS files each time you run it? It does it perfectly but I couldn't find out how (I already looked through the .htaccess file but it only says "if you are not using the build script, then consider cachebusting") .

I have used cachebusting before but this is all over my head =.=

Any help would be really appreciated!

Richard

Gruntfile

Hello.
I have few questions:

  1. What is a role of the connect:testserver task? I think that express task execute the same role.
  2. Maybe will be better to use connect-livereload package instead of changing index.html.
  3. Express server doesn't provide static files from the dist folder, only app, .tmp. Who will be provide static files in production, maybe nginx?

Bootstrapping throws TypeError

Got this error while following the README instructions:

$ yo marionette

TypeError: Cannot read property 'bold' of undefined
    at Object.<anonymous> (/Users/eevenson/Downloads/temp2/node_modules/generator-marionette/node_modules/yeoman-generator/lib/util/common.js:5:56)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/eevenson/Downloads/temp2/node_modules/generator-marionette/node_modules/yeoman-generator/lib/base.js:101:26)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

testSuite.js generation overwrites paths to refactored JS-Files

Example: a collection named Test is generated by yo marionette:collection Test which makes the path spec/collections/Test.js appear within testSuite.js.

Now the collection and its test file are refactored (say Test2.js) and the path is adjusted accordingly (spec/collections/Test2.js).

Then, if any other generation takes place and testSuite.js is overwritten, the old path spec/collections/Test.js will appear again.

Can you help me? Thanks in advance

Niels

--inherit does not seem to work

The documented

$ yo marionette:model model-name --inherit model-name

does not seem to work. It always extends from Backbone.Model.

Looking at the code (model/index.js), 'inherit' is a positional argument, not an option?
If I grok the code with the NamedBase correctly, it means that the generator takes three positional arguments: name, model and inherit.
Testing this with the command

$ yo marionette:model bar dummy foo

I finally get an app/scripts/models/bar.js that extends from models/foo as Foo.

How to prepare for deployment to production

I don't see a reference in the readme that explicitly describes building a production ready project. That is, concatenating and uglifying js and css files, and otherwise copying all project files such that /dist can be zipped up and deployed to a production server.

I have been able to get js copied to /dist and uglified by editing /Gruntfile.js and setting:

       options: {
                    // `name` and `out` is set by grunt-usemin
                    baseUrl: 'app/scripts',
                    optimize: 'uglify',
                    dir: 'dist',
                    paths: {
                        'templates': '../../.tmp/scripts/templates'
                    },

Then running

grunt requirejs:dist

The result is that all js files are copied (not concatenated) to /dist and uglified, but no other application files are copied to the /dist folder.

What am I missing?

Grunt build fails with a Mismatched anonymous define() error

Looks like there is a build problem related to mismatched anonymous defines. Hopefully I'm not missing something obvious this time... Ran this right after yo marionette and getting a successful "congrats" page.

$ grunt build
Running "createDefaultTemplate" task

Running "handlebars:compile" (handlebars) task
>> Destination not written because compiled files were empty.

Running "compass:dist" (compass) task
directory .tmp/styles/ 
   create .tmp/styles/main.css 

Running "useminPrepare:html" (useminPrepare) task
Going through app/index.html to update the config
Looking for build script HTML comment blocks

Found a block:
        <!-- build:js scripts/vendor/modernizr.js -->
        <script src="bower_components/modernizr/modernizr.js"></script>
        <!-- endbuild -->
Updating config with the following assets:
    - app/bower_components/modernizr/modernizr.js

Found a block:
        <!-- build:js scripts/main.js -->
        <script data-main="scripts/init" src="bower_components/requirejs/require.js"></script>
        <!-- endbuild -->
Updating config with the following assets:
    - dist/scripts/main.js

Configuration is now:

  cssmin:
  { dist: 
   { files: 
      { '<%= yeoman.dist %>/styles/main.css': 
         [ '.tmp/styles/{,*/}*.css',
           'app/styles/{,*/}*.css' ] } } }

  concat:
  { 'dist/scripts/vendor/modernizr.js': [ 'app/bower_components/modernizr/modernizr.js' ],
  'dist/scripts/main.js': [ 'dist/scripts/main.js' ] }

  uglify:
  { 'dist/scripts/vendor/modernizr.js': 'dist/scripts/vendor/modernizr.js',
  'dist/scripts/main.js': 'dist/scripts/main.js',
  'dist/bower_components/requirejs/require.js': 'app/bower_components/requirejs/require.js' }

  requirejs:
  { dist: 
   { options: 
      { baseUrl: 'app/scripts',
        optimize: 'none',
        paths: { templates: '../../.tmp/scripts/templates' },
        preserveLicenseComments: false,
        useStrict: true,
        wrap: true,
        pragmasOnSave: 
         { excludeHbsParser: true,
           excludeHbs: true,
           excludeAfterBuild: true },
        name: 'init',
        out: 'dist/scripts/main.js',
        mainConfigFile: 'app/scripts/init.js' } } }

Running "requirejs:dist" (requirejs) task
>> Error: Mismatched anonymous define() module: function (){
>>     return Handlebars;
>> }
>> http://requirejs.org/docs/errors.html#mismatch
Warning: Task "requirejs:dist" failed. Use --force to continue.

Aborted due to warnings.

Running `grunt` after `yo marionette` results in connection error

Here is the transcript:

$ grunt
Running "default" task

Running "clean:server" (clean) task

Running "compass:server" (compass) task
directory .tmp/styles/ 
   create .tmp/styles/main.css 

Running "connect:testserver" (connect) task
Started connect web server on localhost:1234.

Running "express:dev" (express) task
Starting background Express server
connection error: [Error: failed to connect to [localhost:27017]]

grunt-requirejs error

[email protected] postinstall C:\Winginx\home\test\node_modules\grunt-requirejs\node_modules\grunt-lodashbuild
er
node ./bin/post-install.js

module.js:340
throw err;
^
Error: Cannot find module '../node_modules/lodash/vendor/tar/tar.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at C:\Winginx\home\test\node_modules\grunt-requirejs\node_modules\grunt-lodashbuilder\bin\post-install.js:14:13
at Object. (C:\Winginx\home\test\node_modules\grunt-requirejs\node_modules\grunt-lodashbuilder\bin\post-i
nstall.js:166:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Winginx\home\test\node_modules\grunt-requirejs\node_modules\grun
t-jquerybuilder\node_modules\jquery-builder\jquery\node_modules\grunt\node_modules\underscore.string'
npm ERR! error rolling back [email protected] { [Error: ENOTEMPTY, rmdir 'C:\Winginx\home\test\node_modules\grunt-r
equirejs\node_modules\grunt-jquerybuilder\node_modules\jquery-builder\jquery\node_modules\grunt\node_modules\underscore.
string']
npm ERR! error rolling back errno: 53,
npm ERR! error rolling back code: 'ENOTEMPTY',
npm ERR! error rolling back path: 'C:\Winginx\home\test\node_modules\grunt-requirejs\node_modules\grunt-jqueryb
uilder\node_modules\jquery-builder\jquery\node_modules\grunt\node_modules\underscore.string' }
npm ERR! weird error 8
npm ERR! not ok code 0

I was trying to use yo marionette while answering yes on all questions and got this error.
I am not sure what generates the package.json file but the row that causes this problem inside package.json is

"grunt-requirejs": "~0.3.5",

according to asciidisco/grunt-requirejs#74 it should be changed to version 0.4.0 to fix this problem, and so it did.

"grunt-requirejs": "~0.4.0",

Error when running generator

Whenever I run "yo marionette" I get this error:

TypeError: Cannot read property 'bold' of undefined
    at Object.<anonymous> (/usr/lib/node_modules/generator-marionette/node_modules/yeoman-generator/lib/util/common.js:5:56)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/lib/node_modules/generator-marionette/node_modules/yeoman-generator/lib/base.js:101:26)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

No compass files or grunt task when generating a client only app.

If you select "No" to the server app questions like this:

[?] Would you like to install the full express app or simply the marionette generators? No
[?] Would you like to include MongoDB for storage? No
[?] Would you like to include Socket IO for real time communication? No
[?] Would you like to include Baucis for REST? No

this is the project structure created:

total 40
-rw-r--r--   1 julio  staff  7291 Jul 31 14:52 Gruntfile.js
-rw-r--r--   1 julio  staff   563 Jul 24 08:13 bower.json
drwxr-xr-x  19 julio  staff   646 Jul 31 14:52 bower_components
-rw-r--r--   1 julio  staff  1225 Jul 31 14:52 index.html
drwxr-xr-x  28 julio  staff   952 Jul 31 14:52 node_modules
-rw-r--r--   1 julio  staff   959 Jul 31 14:52 package.json
drwxr-xr-x   8 julio  staff   272 Jul 31 14:52 scripts
drwxr-xr-x   3 julio  staff   102 Jul 31 14:52 templates
drwxr-xr-x   5 julio  staff   170 Jul 31 14:52 test

As you can see there isn't a styles folder nor compass grunt task so it doesn't work:

Running "createDefaultTemplate" task

Running "handlebars:compile" (handlebars) task
>> Destination not written because compiled files were empty.

Running "compass:dist" (compass) task
Verifying property compass.dist exists in config...ERROR
>> Unable to process task.
Warning: Required config property "compass.dist" missing. Use --force to continue.

Aborted due to warnings.

Marionette version getting a bit outdated

marionette is currently on 1.4.1 but this generator installs 1.0.2. It caused me to stumble around for a few hours โ€“ the AppRouter constructor functionality described in the current marionette docs doesnt work in 1.0.2.

a bunch of other dependencies have also made significant version advancements over what this generator installs: underscore, backbone, require-handlebars-plugin, modernizr, and some of the testing libs.

I've since manually upgraded to more recent version of everything but this may cause confusion for others.

Thanks for the great generator, I'm really loving it.

jasmine $httpBackend giving error

describe("ChartApp Factory Tests", function () {
var $root={};
beforeEach(module('chartApp'));

         it("expects GET http calls and returns mock data", inject(function ($http, $httpBackend,$rootScope,$controller) {
                var url = 'RNASequenceDataServlet?country=scatterplot',
                    successCallback = jasmine.createSpy();

                $scope = $rootScope.$new();
                $root=$rootScope;

                ctrl = $controller('chartCtrl', {
                    $scope : $scope

                });
                // Create expectation

                $httpBackend.expectGET(url).respond(200, 'mock data');

                // Call http service
                $http.get(url).success(successCallback);

                // callback called only after flush
                expect(successCallback).not.toHaveBeenCalled();

                // flush response
                $httpBackend.flush();

                // Verify expectations
                // Actual response is  [ 'mock data', 200, Function, { method : 'GET', url : '/path/to/resource' } ]
                expect(successCallback.mostRecentCall.args).toContain('mock data');
                expect(successCallback.mostRecentCall.args[1]).toBe(200);
                expect(url).toEqual('RNASequenceDataServlet?country=scatterplot');
                $root.$apply();
                console.log($scope.scatterplotdata);
            }));



});

Error:-Unexpected request: GET ReadingExistingComment Expected GET RNASequenceDataServlet?country=scatterplot

It is redirecting to  ReadingExistingComment servlet,though I have not given  that path in url.

Getting started

Hi,

First of all, thank you all for provinding and helping building such nice project. It's community power!

I'm new kid on the block for SPA development and I'm looking for good references to getting started with backbone + marionette for doing line of business apps.

I thought that maybe you could have some references of OS projects, examples end-to-end, tutorials, videos and so on that could be shared with me to get started.

Any OS sample projects using generator-marionette???

Thanks in advance!

Best regards,
Gabriel Marquez

Support for coffeescript ?

I plan to add coffeescript support for the generator, at least for the webapp part? Anybody is working on this?

For the express part I can do it but it is not on my top priority list.

++

enhancement for non-amd?

wanted to know if this would be an amicable pre-configure option. I prefer using marionette modules instead of AMD.

Is this project being mantained ?

Hello all, just wanted to ask if this project is being maintained at all. If now, we might move it to some other repo. Original author ? Please comment( you did a great job btw )

jasmine?

We use Jasmine for testing, rather than Mocha. Any chance of supporting both options?

Connect server not working with no express app build

Full app with express the default grunt task server is working fine. The no express app build does not throw error, but when opens in browser, the server is not working

Tried updating grunt-contrib-connect, porting in config from projects where connect server is working, setting up new connect task...

baucis

If I say 'no' to baucis on the generator question, the 'grunt' command won't work due to the following error: "ReferenceError: baucis is not defined".

Also, the first question is unclear -- not a 'yes/no', but more of an 'either/or'.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.