Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert coffeescrpt to javascript using grunt #120

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/node_modules/
/lib/
/temp/
/index.js
/*.tgz
82 changes: 0 additions & 82 deletions Gruntfile.coffee

This file was deleted.

67 changes: 67 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
(function() {
module.exports = function(grunt) {
grunt.initConfig({
pkg: require('./package'),
clean: {
lib: {
src: 'lib'
},
index: {
src: 'index.js'
}
},
jshint: {
all: ['Gruntfile.js', 'index.js', 'src/**/*.js', 'test/**/*.js', 'tasks/**/*.js', 'bench/**/*.js']
},
jsonlint: {
packagejson: {
src: 'package.json'
}
},
watch: {
src: {
files: '<%= coffee.src.cwd %>/<%= coffee.src.src %>',
tasks: ['coffeelint:src', 'test']
},
index: {
files: '<%= coffee.index.src %>',
tasks: ['coffeelint:index', 'test']
},
test: {
files: '<%= coffeelint.test.src %>',
tasks: ['coffeelint:test', 'test']
},
gruntfile: {
files: '<%= coffeelint.gruntfile.src %>',
tasks: ['coffeelint:gruntfile']
},
packagejson: {
files: '<%= jsonlint.packagejson.src %>',
tasks: ['jsonlint:packagejson']
}
},
exec: {
mocha: {
options: ['--compilers coffee:coffee-script/register', '--reporter spec', '--colors', '--recursive'],
cmd: './node_modules/.bin/mocha <%= exec.mocha.options.join(" ") %>'
}
},
keycode: {
generate: {
dest: 'src/adb/keycode.coffee'
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsonlint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-exec');
grunt.loadTasks('./tasks');
grunt.registerTask('test', ['jsonlint', 'jshint', 'exec:mocha']);
// grunt.registerTask('build', ['coffee']);
return grunt.registerTask('default', ['test']);
};

}).call(this);
21 changes: 0 additions & 21 deletions bench/sync/pull.coffee

This file was deleted.

30 changes: 30 additions & 0 deletions bench/sync/pull.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var Adb, Bench, deviceId, spawn;

Bench = require('bench');

spawn = require('child_process').spawn;

Adb = require('../..');

deviceId = process.env.DEVICE_ID;

module.exports = {
compareCount: 3,
compare: {
"pull /dev/graphics/fb0 using ADB CLI": function(done) {
var proc;
proc = spawn('adb', ['-s', deviceId, 'pull', '/dev/graphics/fb0', '/dev/null']);
return proc.stdout.on('end', done);
},
"pull /dev/graphics/fb0 using client.pull()": function(done) {
var client;
client = Adb.createClient();
return client.pull(deviceId, '/dev/graphics/fb0', function(err, stream) {
stream.resume();
return stream.on('end', done);
});
}
}
};

Bench.runMain();
5 changes: 0 additions & 5 deletions index.coffee

This file was deleted.

15 changes: 15 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function() {
var Path;

Path = require('path');

module.exports = (function() {
switch (Path.extname(__filename)) {
case '.coffee':
return require('./src/adb');
default:
return require('./lib/adb');
}
})();

}).call(this);
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"scripts": {
"postpublish": "grunt clean",
"prepublish": "grunt test coffee",
"prepublish": "grunt test",
"test": "grunt test"
},
"dependencies": {
Expand All @@ -43,20 +43,17 @@
"devDependencies": {
"bench": "~0.3.5",
"chai": "~2.2.0",
"coffee-script": "~1.9.1",
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
"grunt-coffeelint": "0.0.13",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-coffee": "~0.13.0",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-exec": "~0.4.3",
"grunt-jsonlint": "~1.0.4",
"grunt-notify": "~0.4.1",
"mocha": "~2.2.1",
"sinon": "~1.14.1",
"sinon-chai": "~2.7.0",
"coffeelint": "~1.9.3"
"sinon-chai": "~2.7.0"
},
"engines": {
"node": ">= 0.10.4"
Expand Down
15 changes: 0 additions & 15 deletions src/adb.coffee

This file was deleted.

29 changes: 29 additions & 0 deletions src/adb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var Adb, Client, Keycode, util;

Client = require('./adb/client');

Keycode = require('./adb/keycode');

util = require('./adb/util');

Adb = (function() {
function Adb() {}

Adb.createClient = function(options) {
if (options == null) {
options = {};
}
options.host || (options.host = process.env.ADB_HOST);
options.port || (options.port = process.env.ADB_PORT);
return new Client(options);
};

return Adb;

})();

Adb.Keycode = Keycode;

Adb.util = util;

module.exports = Adb;
82 changes: 0 additions & 82 deletions src/adb/auth.coffee

This file was deleted.

Loading