Skip to content

Commit

Permalink
Merge pull request #2511 from jasonLaster/metal
Browse files Browse the repository at this point in the history
Backbone Metal 🤘
  • Loading branch information
ahumphreys87 committed Apr 29, 2015
2 parents 8b32480 + 286fa2d commit cb01b74
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"jQuery" : true,
"_" : true,
"Backbone" : true,
"Metal" : true,
"Marionette" : true
},

Expand Down
6 changes: 6 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module.exports = function(grunt) {
' *\n' +
' * Includes Radio\n' +
' * https://github.com/marionettejs/backbone.radio/\n' +
' * Includes Metal\n' +
' * https://github.com/marionettejs/backbone-metal/\n' +
' */\n\n\n'
},

Expand Down Expand Up @@ -250,6 +252,10 @@ module.exports = function(grunt) {
radio: {
src: './node_modules/backbone.radio/build/backbone.radio.js',
dest: './tmp/backbone.radio.bare.js'
},
metal: {
src: './node_modules/backbone-metal/dist/backbone-metal.js',
dest: './tmp/backbone.metal.bare.js'
}
}
});
Expand Down
2 changes: 2 additions & 0 deletions SpecRunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
<script src="node_modules/backbone/backbone.js"></script>
<script src="node_modules/backbone.babysitter/lib/backbone.babysitter.js"></script>
<script src="node_modules/backbone.radio/build/backbone.radio.js"></script>
<script src="node_modules/backbone-metal/dist/backbone-metal.js"></script>


<script>
window.Marionette = Backbone.Marionette = {};
window.slice = Array.prototype.slice;
</script>
<script src="src/metal.js"></script>
<script src="src/trigger-method.js"></script>
<script src="src/bind-entity-events.js"></script>
<script src="src/radio-helpers.js"></script>
Expand Down
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"underscore": "1.4.4 - 1.6.0",
"backbone.babysitter": "^0.1.0",
"backbone.radio": "^0.9.0",
"backbone-metal": "^0.5.0",
"jquery": "^1.8.0 || ^2.0.0"
}
}
1 change: 1 addition & 0 deletions component.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dependencies": {
"marionettejs/backbone.babysitter": "*",
"marionettejs/backbone.radio": "*",
"marionettejs/backbone-metal": "*",
"jashkenas/backbone": "*",
"jashkenas/underscore": "*"
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"backbone.babysitter": "^0.1.0",
"backbone.radio": "^0.9.0",
"backbone": "1.0.0 - 1.1.2",
"backbone-metal": "^0.5.0",
"underscore": "1.4.4 - 1.6.0"
},
"devDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions src/build/bundled.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/* istanbul ignore next */
// @include ../../tmp/backbone.radio.bare.js

/* istanbul ignore next */
// @include ../../tmp/backbone.metal.bare.js

var previousMarionette = root.Marionette;
var previousMn = root.Mn;

Expand All @@ -43,6 +46,8 @@
// @include ../radio-helpers.js

// @include ../error.js
// @include ../metal.js

// @include ../object.js
// @include ../region.js
// @include ../region-manager.js
Expand Down
5 changes: 4 additions & 1 deletion src/build/core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function(root, factory) {

if (typeof define === 'function' && define.amd) {
define(['backbone', 'underscore','backbone.radio', 'backbone.babysitter'],
define(['backbone', 'underscore','backbone.radio', 'backbone.babysitter','backbone-metal'],
function(Backbone, _) {
return (root.Marionette = root.Mn = factory(root, Backbone, _));
});
Expand All @@ -10,6 +10,7 @@
var _ = require('underscore');
var BabySitter = require('backbone.babysitter');
var Radio = require('backbone.radio');
var Metal = require('backbone-metal');
module.exports = factory(root, Backbone, _);
} else {
root.Marionette = root.Mn = factory(root, root.Backbone, root._);
Expand Down Expand Up @@ -39,6 +40,8 @@
// @include ../radio-helpers.js

// @include ../error.js
// @include ../metal.js

// @include ../object.js
// @include ../region.js
// @include ../region-manager.js
Expand Down
3 changes: 3 additions & 0 deletions src/metal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Add Backbone.Metal extensions here
// 1. Marionette.Class
// 2. Marionette.Error and Marionette.Deprecate
2 changes: 2 additions & 0 deletions test/unit/setup/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ global.$ = global.jQuery = require('jquery');
global._ = require('underscore');
global.Backbone = require('backbone');
global.Backbone.$ = global.$;
global.Metal = require('backbone-metal');
global.Marionette = Backbone.Marionette = {};
require('backbone.babysitter');
require('backbone.radio');
Expand All @@ -41,6 +42,7 @@ requireHelper('radio-helpers');
requireHelper('trigger-method');
requireHelper('helpers');
requireHelper('dom-refresh');
requireHelper('metal');
requireHelper('object');
requireHelper('app-router');
requireHelper('application');
Expand Down
8 changes: 4 additions & 4 deletions test/unit/trigger-method.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ describe('trigger event and method name', function() {

describe('when the context does not have triggerMethod defined', function() {
beforeEach(function() {
this.view = new Backbone.View();
this.view.onFoo = this.methodHandler;
this.view.on('foo', this.eventHandler);
this.obj = _.extend({}, Backbone.Events);
this.obj.onFoo = this.methodHandler;
this.obj.on('foo', this.eventHandler);
this.triggerMethodSpy = this.sinon.spy(Marionette, 'triggerMethod');

Marionette.triggerMethodOn(this.view, 'foo');
Marionette.triggerMethodOn(this.obj, 'foo');
});

it('should trigger the event', function() {
Expand Down

0 comments on commit cb01b74

Please sign in to comment.