Skip to content

Commit e8cea9b

Browse files
committed
Added travis for CI
1 parent dd0e0eb commit e8cea9b

File tree

5 files changed

+169
-27
lines changed

5 files changed

+169
-27
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.DS_Store
3+
sauce_connect.log

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: node_js
2+
node_js:
3+
- 0.8
4+
notifications:
5+
email: false
6+
7+
env:
8+
global:
9+
- secure: "B7pAZwdmje6ZzZNF6KZzmG0YfWAcr+yMB0GE2Dv4PWQXqhbfCV9MtzHXGWjR\nlWfIl4+iUEABvtqm7YUKfG9XRx6qMF1WViDNToRXZWBn+ntDE70RnsN8SaIp\nV8qGPOR4lSf7a0d8kmnGTgJONc778LEqbHGL2csgJtMX3D70PlQ="
10+
- secure: "Na8Ro6OJrTuxLJjnQuBPz1+Rfsub7cH7d5MyBUE08lfU0JQYhRwTK6gNV9Hq\nSrOm9vygY6EKExbp/1gBL+nS0PkJj6dKbTGPCbNlGXdWI78giF769UQNww+O\nujbppzUZfaWcxHw/tSQojB1QOJXnLfLInC9WCkO0P/YL00hFwZ4="

grunt.js

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
/* global module:false */
2+
module.exports = function(grunt){
3+
// Project configuration.
4+
var saucekey = null;
5+
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_SECURE_ENV_VARS) {
6+
saucekey = process.env.saucekey;
7+
}
8+
grunt.initConfig({
9+
pkg: '<json:package.json>',
10+
meta: {
11+
banner: '/*! <%= pkg.name %> */'
12+
},
13+
lint: {
14+
files: ['grunt.js', 'src/**/*.js', 'test/**/*.js']
15+
},
16+
17+
server: {
18+
base: '.',
19+
port: 9999
20+
},
21+
22+
qunit: {
23+
all: ['http://localhost:9999/test/index.html']
24+
},
25+
26+
'saucelabs-qunit': {
27+
all: {
28+
username: 'indexeddbshim',
29+
key: saucekey,
30+
testname: 'jquery-indexeddb',
31+
tags: ['master'],
32+
urls: ['http://127.0.0.1:9999/test/index.html'],
33+
browsers: [{
34+
browserName: 'firefox'
35+
}, {
36+
browserName: 'chrome'
37+
}]
38+
}
39+
},
40+
41+
jshint: {
42+
options: {
43+
camelcase: true,
44+
nonew: true,
45+
curly: true,// require { }
46+
eqeqeq: true,// === instead of ==
47+
immed: true,// wrap IIFE in parentheses
48+
latedef: true,// variable declared before usage
49+
newcap: true,// capitalize class names
50+
undef: true,// checks for undefined variables
51+
regexp: true,
52+
evil: true,
53+
eqnull: true,// == allowed for undefined/null checking
54+
expr: true,// allow foo && foo()
55+
browser: true
56+
// browser environment
57+
},
58+
globals: {
59+
DEBUG: true,
60+
console: true,
61+
require: true,
62+
63+
// Tests.
64+
_: true,
65+
asyncTest: true,
66+
DB: true,
67+
dbVersion: true,
68+
deepEqual: true,
69+
equal: true,
70+
expect: true,
71+
fail: true,
72+
module: true,
73+
nextTest: true,
74+
notEqual: true,
75+
ok: true,
76+
sample: true,
77+
start: true,
78+
stop: true,
79+
queuedAsyncTest: true,
80+
queuedModule: true,
81+
unescape: true,
82+
process: true
83+
}
84+
},
85+
uglify: {}
86+
});
87+
88+
// Default task.
89+
grunt.loadNpmTasks('grunt-saucelabs-qunit');
90+
grunt.registerTask('build', 'lint');
91+
92+
grunt.registerTask("publish", function(){
93+
var done = this.async();
94+
console.log("Running publish action");
95+
var request = require("request");
96+
request("https://api.travis-ci.org/repos/axemclion/jquery-indexeddb/builds.json", function(err, res, body){
97+
var commit = JSON.parse(body)[0];
98+
var commitMessage = ["Commit from Travis Build #", commit.number, "\nBuild - https://travis-ci.org/axemclion/jquery-indexeddb/builds/", commit.id, "\nBranch : ", commit.branch, "@ ", commit.commit];
99+
console.log("Got Travis Build details");
100+
request({
101+
url: "https://api.github.com/repos/axemclion/jquery-indexeddb/merges?access_token=" + process.env.githubtoken,
102+
method: "POST",
103+
body: JSON.stringify({
104+
"base": "gh-pages",
105+
"head": "master",
106+
"commit_message": commitMessage.join("")
107+
})
108+
}, function(err, response, body){
109+
console.log(body);
110+
done(!err);
111+
});
112+
});
113+
});
114+
115+
var testJobs = ["build", "server"];
116+
if (saucekey !== null) {
117+
testJobs.push("saucelabs-qunit");
118+
}
119+
if (process.env.CI && process.env.TRAVIS) {
120+
testJobs.push("publish");
121+
}
122+
123+
grunt.registerTask('test', testJobs.join(" "));
124+
125+
grunt.registerTask('default', 'build');
126+
};

package.json

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
{
2-
"name" : "indexeddb",
3-
"version" : 1.0,
4-
"title" : "IndexedDB API Plugin",
5-
"description" : "An easy to use Jquery API over the HTML5 IndexedDB API with smart defaults and support for promises, ",
6-
"keywords" : "IndexedDB, storage, database, data",
7-
"homepage" : "http://nparashuram.com/jquery-indexeddb/",
8-
"docs" : "https://github.com/axemclion/jquery-indexeddb/blob/gh-pages/docs/README.md",
9-
"demo" : "http://nparashuram.com/jquery-indexeddb/example/index.html",
10-
"files" : "jquery.indexeddb.js"
11-
"author" : {
12-
"name" : "Parashuram Narasimhan",
13-
"email" : "contact@nparashuram.com",
14-
"url" : "http://nparashuram.com"
15-
},
16-
"licenses": [{
17-
"type": "GPLv2",
18-
"url": "http://www.gnu.org/copyleft/gpl.html"
19-
}, {
20-
"type" : "Apache License, Version 2.0",
21-
"url" : "http://www.apache.org/licenses/LICENSE-2.0"
22-
}],
23-
"dependencies" : {
24-
"jquery" : ">=1.5.x"
25-
}
2+
"name": "jquery-indexeddb",
3+
"preferGlobal": "false",
4+
"version": "0.1.0",
5+
"author": "Parashuram <code@nparashuram.com>",
6+
"description": "A Jquery plugin for the IndexedDB API",
7+
"scripts": {
8+
"start": "grunt",
9+
"test": "grunt test"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git://github.com/axemclion/jquery-indexeddb.git"
14+
},
15+
"bugs": {
16+
"url": "https://github.com/axemclion/jquery-indexeddb/issues"
17+
},
18+
"main": "grunt.js",
19+
"keywords": ["indexedDB", "database", "jquery"],
20+
"devDependencies": {
21+
"grunt": "~0.3.12",
22+
"grunt-saucelabs-qunit": "*",
23+
"request" : "*"
24+
},
25+
"bundleDependencies": [],
26+
"license": "MIT",
27+
"engines": {
28+
"node": ">=0.6"
29+
}
2630
}

test/sampleData.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ var sample = (function() {
1818
"Int" : this.integer(),
1919
"Float" : Math.random(),
2020
"Boolean" : true
21-
}
21+
};
2222
},
2323
integer : function(arg) {
2424
var res;
2525
do {
26-
console.log("Inside the loop")
27-
res = parseInt(Math.random() * (arg || 1000));
26+
res = parseInt(Math.random() * (arg || 1000), 10);
2827
} while (takenValues[res]);
2928
takenValues[res] = true;
3029
return res;

0 commit comments

Comments
 (0)