From 84c4b2f309c029c927b4c1e26d0dd1a9c8162611 Mon Sep 17 00:00:00 2001 From: ziscloud Date: Thu, 25 Sep 2014 17:40:00 +0800 Subject: [PATCH] Subject: replace grunt with gulp What Happened: - replace grunt with gulp - add gulp and boilerplate-gulp to dev dependencies - add gulp configuration file - update jshint configuration file - rename demo folder to example --- .gitignore | 4 +- .jshintrc | 32 +++++----- dist/angular-footable.js | 1 - dist/angular-footable.min.js | 1 - {demo => example}/index.html | 0 {demo => example}/main.js | 0 gruntfile.js | 112 ----------------------------------- gulpfile.js | 6 ++ package.json | 71 +++++++++------------- src/angular-footable.js | 2 + src/angular-footable.spec.js | 2 + test/karma.conf.js | 2 +- 12 files changed, 56 insertions(+), 177 deletions(-) delete mode 100644 dist/angular-footable.js delete mode 100644 dist/angular-footable.min.js rename {demo => example}/index.html (100%) rename {demo => example}/main.js (100%) delete mode 100644 gruntfile.js create mode 100644 gulpfile.js diff --git a/.gitignore b/.gitignore index 9d35c71..23afbe3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,8 @@ lib-cov # Coverage directory used by tools like istanbul coverage -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt +# Generated reports (testing, coverage, complexity) +reports # Compiled binary addons (http://nodejs.org/api/addons.html) build/Release diff --git a/.jshintrc b/.jshintrc index adb41c3..a2a4b75 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,21 +1,17 @@ { - "globals": { - /* Jasmine >> */ - "jasmine": true, - "describe": true, - "it": true, - "expect": true, - "beforeEach": true, - "afterEach": true, - /* ngMock >> */ - "module": true, - "inject": true, - "$controller": true, - "$compile": true, - /* << ngMock */ - /* << Jasmine */ - "angular": true - }, + "predef": [ + "jasmine", + "describe", + "it", + "expect", + "beforeEach", + "afterEach", + "module", + "inject", + "$controller", + "$compile", + "angular" + ], "regexdash": true, "browser": true, "sub": true, @@ -55,4 +51,4 @@ "white": false, "laxbreak": true, "validthis": true -} \ No newline at end of file +} diff --git a/dist/angular-footable.js b/dist/angular-footable.js deleted file mode 100644 index d053c85..0000000 --- a/dist/angular-footable.js +++ /dev/null @@ -1 +0,0 @@ -angular.module("angular-footable",[]).factory("example",["$rootScope",function(a){return function(){return a.example=!0,!0}}]); \ No newline at end of file diff --git a/dist/angular-footable.min.js b/dist/angular-footable.min.js deleted file mode 100644 index d053c85..0000000 --- a/dist/angular-footable.min.js +++ /dev/null @@ -1 +0,0 @@ -angular.module("angular-footable",[]).factory("example",["$rootScope",function(a){return function(){return a.example=!0,!0}}]); \ No newline at end of file diff --git a/demo/index.html b/example/index.html similarity index 100% rename from demo/index.html rename to example/index.html diff --git a/demo/main.js b/example/main.js similarity index 100% rename from demo/main.js rename to example/main.js diff --git a/gruntfile.js b/gruntfile.js deleted file mode 100644 index 0daefa6..0000000 --- a/gruntfile.js +++ /dev/null @@ -1,112 +0,0 @@ -module.exports = function (grunt) { - - grunt.registerTask('default', [ 'dev' ]); - grunt.registerTask('dev', [ 'jshint', 'build:dev', 'http-server:dev', 'watch:demo' ]); - grunt.registerTask('dist', [ 'jshint', 'build:dist' ]); - grunt.registerMultiTask('build', simpleMultiTaskRunner); - grunt.registerTask('test', [ 'build:dist', 'karma:unit', 'watch:test' ]); - - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - config: { - demo: 'demo', - dist: 'dist', - src: { - js: [ 'src/**/*.js', '!src/**/*.spec.js' ] - }, - spec: 'src/**/*.spec.js' - }, - clean: { - dist: [ '<%= config.dist %>/*' ] - }, - karma: { - unit: { - options: { - configFile: 'test/karma.conf.js' - } - } - }, - build: { - dev: [ 'clean:dist', 'concat:all' ], - dist: [ 'clean:dist', 'concat:all', 'ngAnnotate:release', 'uglify:release' ] - }, - concat:{ - all: { - options: { - process: function(src, filepath) { - var filename = /\/([^\/]+$)/.exec(filepath)[1]; - - return [ - '// ### ' + filename + ' >>', - src, - '// ### << ' + filename, - '\n' - ].join('\n\n'); - } - }, - src: '<%= config.src.js %>', - dest: '<%= config.dist %>/<%= pkg.name %>.js' - } - }, - ngAnnotate: { - options: { - singleQuotes: true - }, - release: { - files: [{ - src: '<%= config.dist %>/<%= pkg.name %>.js', - dest: '<%= config.dist %>/<%= pkg.name %>.js' - }] - } - }, - uglify: { - options: { - compress: true - }, - release: { - src: '<%= config.dist %>/<%= pkg.name %>.js', - dest: '<%= config.dist %>/<%= pkg.name %>.min.js' - } - }, - watch:{ - demo: { - options: { - livereload: true - }, - files: [ '<%= config.src.js %>', '<%= config.demo %>/**' ], - tasks: [ 'jshint', 'build:dev' ] - }, - test: { - files: [ '<%= config.src.js %>', '<%= config.spec %>' ], - tasks: [ 'build:dist', 'test' ] - } - }, - jshint:{ - files: [ - 'gruntfile.js', - '<%= config.spec %>', - '<%= config.src.js %>' - ] - }, - 'http-server': { - dev: { - root: '.', - port: 8080, - host: '127.0.0.1', - cache: 0, - showDir : true, - autoIndex: true, - defaultExt: 'html', - runInBackground: true - } - } - }); - - require('load-grunt-tasks')(grunt); - - - function simpleMultiTaskRunner() { - grunt.task.run(this.data); - } - -}; \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..768756d --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,6 @@ +var gulp = require('gulp'), + boilerplate = require('boilerplate-gulp'); +boilerplate(gulp, { + pkg: require('./package.json'), + jsMain: './src/angular-footable.js' +}); diff --git a/package.json b/package.json index 58c09a8..9f8e83b 100644 --- a/package.json +++ b/package.json @@ -1,44 +1,31 @@ { - "name": "angular-footable", - "version": "0.0.1", - "description": "Angular library/reusable module seed", - "main": "gruntfile.js", - "directories": { - "test": "test" - }, - "scripts": { - "test": "grunt test" - }, - "repository": { - "type": "git", - "url": "https://github.com/ziscloud/angular-footable.git" - }, - "keywords": [ - "angular", - "library", - "seed" - ], - "author": "Eryk NapieraƂa", - "license": "MIT", - "bugs": { - "url": "https://github.com/ziscloud/angular-footable/issues" - }, - "homepage": "https://github.com/ziscloud/angular-footable", - "devDependencies": { - "grunt": "~0.4", - "grunt-contrib-clean": "~0.5", - "grunt-contrib-concat": "~0.4", - "grunt-contrib-jshint": "~0.10", - "grunt-contrib-uglify": "~0.5", - "grunt-contrib-watch": "~0.6", - "grunt-http-server": "0.0.5", - "grunt-karma": "~0.8", - "grunt-ng-annotate": "^0.2.2", - "karma": "~0.12", - "karma-jasmine": "~0.2", - "karma-phantomjs-launcher": "~0.1", - "load-grunt-tasks": "~0.5", - "ng-annotate": "^0.9.6", - "phantomjs": "~1.9" - } + "name": "angular-footable", + "version": "0.0.1", + "description": "Angular derictive for FooTable", + "main": "gruntfile.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "gulp test" + }, + "repository": { + "type": "git", + "url": "https://github.com/ziscloud/angular-footable.git" + }, + "keywords": [ + "angular", + "library", + "seed" + ], + "author": "Tony Wang", + "license": "MIT", + "bugs": { + "url": "https://github.com/ziscloud/angular-footable/issues" + }, + "homepage": "https://github.com/ziscloud/angular-footable", + "devDependencies": { + "gulp": "~3.8.0", + "boilerplate-gulp": "~0.2.0" + } } diff --git a/src/angular-footable.js b/src/angular-footable.js index fd9ae64..8b02078 100644 --- a/src/angular-footable.js +++ b/src/angular-footable.js @@ -1,3 +1,5 @@ +'use strict'; + angular .module('angular-footable', [ ]) .factory('example', function($rootScope) { diff --git a/src/angular-footable.spec.js b/src/angular-footable.spec.js index c8076e7..f170bc3 100644 --- a/src/angular-footable.spec.js +++ b/src/angular-footable.spec.js @@ -1,3 +1,5 @@ +'use strict'; + describe('example service - module test', function() { beforeEach(angular.mock.module('angular-footable')); diff --git a/test/karma.conf.js b/test/karma.conf.js index b0368bd..6ac9b59 100644 --- a/test/karma.conf.js +++ b/test/karma.conf.js @@ -8,7 +8,7 @@ module.exports = function (config) { 'bower_components/jquery/dist/jquery.js', 'bower_components/angular/angular.js', 'bower_components/angular-mocks/angular-mocks.js', - 'dist/angular-footable.js', + 'src/angular-footable.js', 'src/**/*.spec.js', 'test/main.js' ],