Skip to content

Commit

Permalink
Prepped for v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ifandelse committed Jun 11, 2014
2 parents 8dd466c + fda167d commit 0cffebb
Show file tree
Hide file tree
Showing 19 changed files with 460 additions and 435 deletions.
2 changes: 1 addition & 1 deletion .bowerrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"directory": "bower"
}
}
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
"onevar" : false, //allows only one `var` statement per function
"passfail" : false, //makes JSHint stop on the first error or warning
"white" : false //make JSHint check your source code against Douglas Crockford's JavaScript coding style
}
}
369 changes: 196 additions & 173 deletions README.md

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name": "riveter",
"version": "0.1.1",
"description": "Mix-in, inheritance and constructor extend behavior for your JavaScript enjoyment.",
"homepage": "https://github.com/a2labs/riveter",
"keywords": [
"mixin",
"mix-in",
"inherit",
"extend",
"constructor"
],
"author": "Jim Cowart <[email protected]>",
"repository": {
"type": "git",
"url": "git://github.com/a2labs/riveter.git"
},
"main": [
"lib/riveter.js",
"lib/riveter.min.js"
],
"dependencies": {
"underscore": "~1.5.2"
},
"devDependencies": {
"jquery": "~1.10.2",
"bootstrap": "~3.0.3",
"expect": "0.1.2",
"mocha": "~1.17.0",
"requirejs": "~2.1.10",
"postal.diagnostics": "~0.7.0"
}
}
"name": "riveter",
"version": "0.2.0",
"description": "Mix-in, inheritance and constructor extend behavior for your JavaScript enjoyment.",
"homepage": "https://github.com/a2labs/riveter",
"keywords": [
"mixin",
"mix-in",
"inherit",
"extend",
"constructor"
],
"author": "Jim Cowart <[email protected]>",
"repository": {
"type": "git",
"url": "git://github.com/a2labs/riveter.git"
},
"main": [
"lib/riveter.js",
"lib/riveter.min.js"
],
"dependencies": {
"lodash": "~2.4.1"
},
"devDependencies": {
"jquery": "~1.10.2",
"bootstrap": "~3.0.3",
"expect": "0.1.2",
"mocha": "~1.17.0",
"requirejs": "~2.1.10",
"lodash": "~2.4.1"
}
}
12 changes: 6 additions & 6 deletions component.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "riveter",
"version": "0.1.1",
"main": ["lib/riveter.min.js", "lib/riveter.js"],
"dependencies": {
"underscore": "~1.4.0"
}
"name": "riveter",
"version": "0.2.0",
"main": ["lib/riveter.min.js", "lib/riveter.js"],
"dependencies": {
"lodash": "~2.4.1"
}
}
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ gulp.task("server", function() {
servers = createServer(port);
}
open("http://localhost:" + port + "/index.html");
});
});
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ <h1>riveter</h1>
</div>
</div>
</body>
</html>
</html>
43 changes: 21 additions & 22 deletions lib/riveter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@
* riveter - Mix-in, inheritance and constructor extend behavior for your JavaScript enjoyment.
* © 2012 - Copyright appendTo, LLC
* Author(s): Jim Cowart, Nicholas Cloud, Doug Neiner
* Version: v0.1.1
* Version: v0.2.0
* Url: https://github.com/a2labs/riveter
* License(s): MIT, GPL
*/
/* global: riveter */
(function (root, factory) {
if (typeof module === "object" && module.exports) {
// Node, or CommonJS-Like environments
module.exports = factory(require("underscore"));
module.exports = factory(require("lodash"));
} else if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["underscore"], function (_) {
define(["lodash"], function (_) {
return factory(_, root);
});
} else {
// Browser globals
root.riveter = factory(root._, root);
}
}(this, function (_, global, undefined) {
var slice = Array.prototype.slice;
var riveter = function () {
var args = slice.call(arguments, 0);
while (args.length) {
riveter.rivet(args.shift());
}
};
function getActualType(val) {
if (_.isArray(val)) {
return "array";
Expand Down Expand Up @@ -59,38 +65,31 @@
});
return obj;
}
var slice = Array.prototype.slice;
var riveter = function () {
var args = slice.call(arguments, 0);
while (args.length) {
riveter.rivet(args.shift());
}
};
riveter.rivet = function (fn) {
if (!fn.hasOwnProperty('extend')) {
if (!fn.hasOwnProperty("extend")) {
fn.extend = function (props, ctorProps, options) {
return riveter.extend(fn, props, ctorProps, options);
};
}
if (!fn.hasOwnProperty('compose')) {
if (!fn.hasOwnProperty("compose")) {
fn.compose = function () {
return riveter.compose.apply(this, [fn].concat(slice.call(arguments, 0)));
};
}
if (!fn.hasOwnProperty('inherits')) {
if (!fn.hasOwnProperty("inherits")) {
fn.inherits = function (parent, ctorProps, options) {
return riveter.inherits(fn, parent, ctorProps, options);
}
};
}
if (!fn.hasOwnProperty('mixin')) {
if (!fn.hasOwnProperty("mixin")) {
fn.mixin = function () {
return riveter.mixin.apply(this, ([fn].concat(slice.call(arguments, 0))));
}
};
}
if (!fn.hasOwnProperty('punch')) {
if (!fn.hasOwnProperty("punch")) {
fn.punch = function () {
return riveter.punch.apply(this, ([fn].concat(slice.call(arguments, 0))));
}
};
}
};
riveter.inherits = function (child, parent, ctorProps, options) {
Expand All @@ -100,8 +99,8 @@
var Child = function () {
parent.apply(this, arguments);
};
if (typeof child === 'object') {
if (child.hasOwnProperty('constructor')) {
if (typeof child === "object") {
if (child.hasOwnProperty("constructor")) {
Child = child.constructor;
}
childProto = child;
Expand Down Expand Up @@ -154,7 +153,7 @@
postInit: []
});
var res = ctor.extend({
constructor: function (options) {
constructor: function () {
var args = slice.call(arguments, 0);
_.each(mixin.preInit, function (initializer) {
initializer.apply(this, args);
Expand Down
4 changes: 2 additions & 2 deletions lib/riveter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 15 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "riveter",
"description": "Mix-in, inheritance and constructor extend behavior for your JavaScript enjoyment.",
"version": "0.1.1",
"version": "0.2.0",
"homepage": "https://github.com/a2labs/riveter",
"repository": {
"type": "git",
Expand All @@ -16,6 +16,10 @@
"name": "Nicholas Cloud",
"email": "[email protected]",
"url": "http://nicholascloud.com"
}, {
"name": "Doug Neiner",
"email": "[email protected]",
"url": "http://dougneiner.com/"
}],
"keywords": [
"mixin",
Expand All @@ -36,24 +40,25 @@
"node": ">=0.4.0"
},
"dependencies": {
"underscore": ">=1.4.0"
"lodash": "^2.4.1"
},
"devDependencies": {
"bower": "~1.2.8",
"gulp-util": "~2.2.9",
"expect.js": "~0.2.0",
"express": "~3.4.7",
"gulp": "~3.3.1",
"gulp-imports": "~0.0.1",
"gulp-beautify": "~1.0.3",
"gulp-header": "~1.0.2",
"gulp-hint-not": "~0.0.3",
"gulp-uglify": "~0.1.0",
"gulp-rename": "~0.2.1",
"gulp-imports": "~0.0.1",
"gulp-plato": "~0.1.0",
"gulp-beautify": "~1.0.3",
"tiny-lr": "0.0.5",
"express": "~3.4.7",
"gulp-rename": "~0.2.1",
"gulp-rimraf": "0.0.8",
"gulp-uglify": "~0.1.0",
"gulp-util": "~2.2.9",
"lodash": "^2.4.1",
"open": "~0.0.4",
"expect.js": "~0.2.0"
"tiny-lr": "0.0.5"
},
"scripts": {
"test": "mocha ./spec/*.js",
Expand Down
2 changes: 1 addition & 1 deletion spec/compose.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,4 @@ describe("riveter - constructor.compose", function() {
});
});

});
});
19 changes: 9 additions & 10 deletions spec/extend.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* */
/*global riveter,describe,it,beforeEach*/

// Support running tests directly via mocha
if (typeof riveter === "undefined") {
var riveter = typeof window === "undefined" ? require("../lib/riveter.js") : window.riveter;
var expect = typeof window === "undefined" ? require("expect.js") : window.expect;
var _ = typeof window === "undefined" ? require("underscore") : window._;
}

console.log(riveter);
Expand Down Expand Up @@ -56,28 +55,28 @@ describe("riveter - constructor.extend", function() {
beforeEach(function() {
worker = new Employee("Bugs", "Bunny", 100000);
});
it('should produce a new constructor function', function() {
it("should produce a new constructor function", function() {
expect(Employee !== Person).to.be(true);
expect(Employee.prototype.constructor).to.be(Employee);
expect(Employee.__super.prototype).to.be(Person.prototype);
expect(Employee.__super).to.be(Person);
expect(Employee.__super__).to.be(Person.prototype);
});
it('should apply shared/constructor methods', function() {
it("should apply shared/constructor methods", function() {
expect(Employee.hasOwnProperty("mixin")).to.be(true);
expect(Employee.hasOwnProperty("extend")).to.be(true);
expect(Employee.hasOwnProperty("inherits")).to.be(true);
expect(Employee.hasOwnProperty("compose")).to.be(true);
expect(Employee.hasOwnProperty("getInstance")).to.be(true);
expect(Employee.getInstance("Test", "Tester", 100) instanceof Employee).to.be(true);
});
it('should produce expected instance when used to instantiate new object', function() {
it("should produce expected instance when used to instantiate new object", function() {
expect(worker.name).to.be("Bugs");
expect(worker.title).to.be("Bunny");
expect(worker.salary).to.be(100000);
expect(worker.greet()).to.be("Hi, Bugs");
});
it('should properly construct the instance prototype', function() {
it("should properly construct the instance prototype", function() {
expect(worker.hasOwnProperty("name")).to.be(true);
expect(worker.hasOwnProperty("title")).to.be(true);
expect(worker.hasOwnProperty("salary")).to.be(true);
Expand All @@ -93,28 +92,28 @@ describe("riveter - constructor.extend", function() {
beforeEach(function() {
ceo = new CEO("Byron Whitefield", "CEO", 1000000000, true);
});
it('should produce a new constructor function', function() {
it("should produce a new constructor function", function() {
expect(CEO !== Employee).to.be(true);
expect(CEO.__super.prototype).to.be(Employee.prototype);
expect(CEO.__super).to.be(Employee);
expect(CEO.__super__).to.be(Employee.prototype);
});
it('should apply shared/constructor methods', function() {
it("should apply shared/constructor methods", function() {
expect(CEO.hasOwnProperty("mixin")).to.be(true);
expect(CEO.hasOwnProperty("extend")).to.be(true);
expect(CEO.hasOwnProperty("inherits")).to.be(true);
expect(CEO.hasOwnProperty("compose")).to.be(true);
expect(CEO.hasOwnProperty("getInstance")).to.be(true);
expect(CEO.getInstance("Test", "Tester", 100) instanceof Employee).to.be(true);
});
it('should produce expected instance when used to instantiate new object', function() {
it("should produce expected instance when used to instantiate new object", function() {
expect(ceo.name).to.be("Byron Whitefield");
expect(ceo.title).to.be("CEO");
expect(ceo.salary).to.be(1000000000);
expect(ceo.shouldExpectFbiRaid).to.be(true);
expect(ceo.greet()).to.be("Hi, Byron Whitefield");
});
it('should properly construct the instance prototype', function() {
it("should properly construct the instance prototype", function() {
expect(ceo.hasOwnProperty("name")).to.be(true);
expect(ceo.hasOwnProperty("title")).to.be(true);
expect(ceo.hasOwnProperty("salary")).to.be(true);
Expand Down
2 changes: 1 addition & 1 deletion spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<body>
<div id="mocha"></div>
<script src="../bower/jquery/jquery.js"></script>
<script src="../bower/underscore/underscore.js"></script>
<script src="../bower/lodash/dist/lodash.js"></script>
<script src="../bower/expect/expect.js"></script>
<script src="../bower/mocha/mocha.js"></script>
<script type="text/javascript">
Expand Down
Loading

0 comments on commit 0cffebb

Please sign in to comment.