Skip to content

Commit

Permalink
Switch to Grunt for building
Browse files Browse the repository at this point in the history
* Update npm dependencies to install grunt deps
* Remove gear based build script
* Improved JSHint restrictions and corrected code to match
* Update Travis CI config file for new build
* Bump to 0.30.0
  • Loading branch information
brianjmiller committed Mar 28, 2014
1 parent 40b0734 commit 906f5e7
Show file tree
Hide file tree
Showing 28 changed files with 187 additions and 278 deletions.
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ src
test
doc
vendor
build.js
build/.empty
build/tincan-min.map
.travis.yml
yuidoc.json
bower.json
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
language: node_js
node_js:
- "0.10"
before_install: npm install -g grunt-cli
install: npm install
before_script: grunt build
113 changes: 113 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*global module:false*/
module.exports = function(grunt) {
"use strict";
var coreFileList = [
"vendor/cryptojs-v3.0.2/rollups/sha1.js",
"vendor/cryptojs-v3.0.2/components/enc-base64.js",
"src/TinCan.js",
"src/Utils.js",
"src/LRS.js",
"src/AgentAccount.js",
"src/Agent.js",
"src/Group.js",
"src/Verb.js",
"src/Result.js",
"src/Score.js",
"src/InteractionComponent.js",
"src/ActivityDefinition.js",
"src/Activity.js",
"src/ContextActivities.js",
"src/Context.js",
"src/StatementRef.js",
"src/SubStatement.js",
"src/Statement.js",
"src/StatementsResult.js",
"src/State.js",
"src/ActivityProfile.js",
"src/AgentProfile.js"
],
browserFileList = coreFileList.slice(),
nodeFileList = coreFileList.slice();

browserFileList.push(
"src/Environment/Browser.js"
);
nodeFileList.push(
"src/Environment/Node.js"
);

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),

watch: {
files: ["src/**/*.js"],
tasks: ["build"],
options: {
interrupt: true
}
},

jshint: {
all: ["Gruntfile.js", "src/**/*.js"],
options: {
bitwise: true,
es3: true, // must use ES3 syntax (support for IE6/7/8/9)
curly: true, // Always use curlys {}
eqeqeq: true, // No more == for you, === only
forin: true,
freeze: true,
immed: true, // prohibits the use of immediate function invocations without wrapping them in parentheses
indent: 4, // force tab width of 4 spaces
latedef: true, // no setting variables before they are defined
newcap: true, // Always call constructors with a Cap
noarg: true, // prohibits arguments.caller and arguments.callee
noempty: true, // prevent empty blocks
nonbsp: true,
nonew: true, // don't allow non-captured constructor use
plusplus: true, // prevent use of ++ and --
quotmark: "double", // require strings to be double quoted
undef: true, // prohibits the use of explicitly undeclared variables
unused: true, // Warns on unused variables
trailing: true, // Prohibits trailing whitespace
maxdepth: 6, // Max nesting of methods 6 layers deep
onevar: true,
strict: true,
globals: {
TinCan: true
}
}
},

concat: {
dist: {
files: {
"build/tincan.js": browserFileList,
"build/tincan-node.js": nodeFileList
},
nonull: true
}
},

uglify: {
dist: {
files: {
"build/tincan-min.js": ["build/tincan.js"]
},
options: {
sourceMap: true
}
}
}
});

// Load Tasks
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");

// Define tasks
grunt.registerTask("build", ["jshint", "concat", "uglify"]);
grunt.registerTask("default", "build");
};
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tincan",
"version": "0.22.2",
"version": "0.30.0",
"homepage": "http://rusticisoftware.github.com/TinCanJS/",
"authors": [
"Brian J. Miller <[email protected]>"
Expand Down
182 changes: 0 additions & 182 deletions build.js

This file was deleted.

Empty file removed build/.empty
Empty file.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tincanjs",
"description": "Tin Can API Library",
"version": "0.22.2",
"version": "0.30.0",
"private": false,
"main": "build/tincan-node.js",
"directories": {
Expand All @@ -27,8 +27,11 @@
"e-learning"
],
"devDependencies": {
"gear": "0.8.x",
"gear-lib": "0.8.x",
"grunt": "0.4.4",
"grunt-contrib-jshint": "0.9.2",
"grunt-contrib-watch": "0.6.1",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-uglify": "0.4.0",
"qunit": "0.5.16"
}
}
2 changes: 1 addition & 1 deletion src/Activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TinCan client library
/**
@property LOG_SRC
*/
LOG_SRC: 'Activity',
LOG_SRC: "Activity",

/**
@method log
Expand Down
6 changes: 2 additions & 4 deletions src/ActivityProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ TinCan client library
/**
@property LOG_SRC
*/
LOG_SRC: 'ActivityProfile',
LOG_SRC: "ActivityProfile",

/**
@method log
Expand All @@ -94,9 +94,7 @@ TinCan client library
"contents",
"etag",
"contentType"
],
val
;
];

cfg = cfg || {};

Expand Down
2 changes: 1 addition & 1 deletion src/Agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ TinCan client library
}
},

toString: function (lang) {
toString: function () {
this.log("toString");

if (this.name !== null) {
Expand Down
Loading

0 comments on commit 906f5e7

Please sign in to comment.