From 3c2f197a43bcbb8bfca4b153813ef5e76ec8673e Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Mon, 12 May 2014 22:10:13 -0300 Subject: [PATCH 1/9] Regenerating Yeoman work dir. Added newest AngularJS & Karma. --- .bowerrc | 2 +- .editorconfig | 2 +- .gitignore | 7 +- .jshintrc | 1 - .travis.yml | 10 +- Gruntfile.js | 530 +++++++++++++----- app/index.html | 65 ++- app/index.html_old | 10 + app/scripts/app.js | 18 +- app/scripts/app.js_old | 3 + build/angular-d3.js | 10 +- component.json | 9 - examples/wordcloud/index.html | 10 +- examples/wordcloud/scripts/app.js | 2 +- .../wordcloud/scripts/controllers/main.js | 2 +- package.json | 57 +- test/runner.html_old | 10 + testacular.conf.js | 52 -- 18 files changed, 533 insertions(+), 267 deletions(-) create mode 100644 app/index.html_old create mode 100644 app/scripts/app.js_old delete mode 100644 component.json create mode 100644 test/runner.html_old delete mode 100644 testacular.conf.js diff --git a/.bowerrc b/.bowerrc index f594df7..ba0accc 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ { - "directory": "app/components" + "directory": "app/bower_components" } diff --git a/.editorconfig b/.editorconfig index 8a80734..c2cdfb8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ root = true # Change these settings to your own preference indent_style = space -indent_size = 4 +indent_size = 2 # We recommend you to keep these unchanged end_of_line = lf diff --git a/.gitignore b/.gitignore index 90d7bbc..7911b28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ node_modules -.idea -*.iml - -#build +dist .tmp .sass-cache -app/components +app/bower_components diff --git a/.jshintrc b/.jshintrc index 64b7ce8..40377ba 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,7 +1,6 @@ { "node": true, "browser": true, - "es5": true, "esnext": true, "bitwise": true, "camelcase": true, diff --git a/.travis.yml b/.travis.yml index 3fd065b..83f4e22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,7 @@ language: node_js node_js: - - 0.8 - + - '0.8' + - '0.10' before_script: - - npm install -g grunt-cli - -script: - - grunt test \ No newline at end of file + - 'npm install -g bower grunt-cli' + - 'bower install' diff --git a/Gruntfile.js b/Gruntfile.js index e18dc25..4c332f1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,163 +1,395 @@ +// Generated on 2014-05-13 using generator-angular 0.8.0 'use strict'; -var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; -var mountFolder = function (connect, dir) { - return connect.static(require('path').resolve(dir)); -}; +// # Globbing +// for performance reasons we're only matching one level down: +// 'test/spec/{,*/}*.js' +// use this if you want to recursively match all subfolders: +// 'test/spec/**/*.js' module.exports = function (grunt) { - // load all grunt tasks - require('matchdep').filterDev('grunt-*').concat(['gruntacular']).forEach(grunt.loadNpmTasks); - - // configurable paths - var yeomanConfig = { - app: 'app', - dist: 'build', - name: "angular-d3" - }; - - try { - yeomanConfig.app = require('./component.json').appPath || yeomanConfig.app; - } catch (e) { - } - grunt.initConfig({ - yeoman: yeomanConfig, - clean: { - dist: ['.tmp', '<%= yeoman.dist %>/*'], - server: '.tmp' + // Load grunt tasks automatically + require('load-grunt-tasks')(grunt); + + // Time how long tasks take. Can help when optimizing build times + require('time-grunt')(grunt); + + // Define the configuration for all the tasks + grunt.initConfig({ + + // Project settings + yeoman: { + // configurable paths + app: require('./bower.json').appPath || 'app', + dist: 'dist' + }, + + // Watches files for changes and runs tasks based on the changed files + watch: { + bower: { + files: ['bower.json'], + tasks: ['bowerInstall'] + }, + js: { + files: ['<%= yeoman.app %>/scripts/{,*/}*.js'], + tasks: ['newer:jshint:all'], + options: { + livereload: true + } + }, + jsTest: { + files: ['test/spec/{,*/}*.js'], + tasks: ['newer:jshint:test', 'karma'] + }, + styles: { + files: ['<%= yeoman.app %>/styles/{,*/}*.css'], + tasks: ['newer:copy:styles', 'autoprefixer'] + }, + gruntfile: { + files: ['Gruntfile.js'] + }, + livereload: { + options: { + livereload: '<%= connect.options.livereload %>' }, - jshint: { - options: { - jshintrc: '.jshintrc' - }, - all: [ - 'Gruntfile.js', - '<%= yeoman.app %>/scripts/{,*/}*.js' - ] + files: [ + '<%= yeoman.app %>/{,*/}*.html', + '.tmp/styles/{,*/}*.css', + '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' + ] + } + }, + + // The actual grunt server settings + connect: { + options: { + port: 9000, + // Change this to '0.0.0.0' to access the server from outside. + hostname: 'localhost', + livereload: 35729 + }, + livereload: { + options: { + open: true, + base: [ + '.tmp', + '<%= yeoman.app %>' + ] + } + }, + test: { + options: { + port: 9001, + base: [ + '.tmp', + 'test', + '<%= yeoman.app %>' + ] + } + }, + dist: { + options: { + base: '<%= yeoman.dist %>' + } + } + }, + + // Make sure code styles are up to par and there are no obvious mistakes + jshint: { + options: { + jshintrc: '.jshintrc', + reporter: require('jshint-stylish') + }, + all: [ + 'Gruntfile.js', + '<%= yeoman.app %>/scripts/{,*/}*.js' + ], + test: { + options: { + jshintrc: 'test/.jshintrc' }, - connect: { - livereload: { - options: { - port: 9000, - // Change this to '0.0.0.0' to access the server from outside. - hostname: 'localhost', - middleware: function (connect) { - return [ - lrSnippet, - mountFolder(connect, '.tmp'), - mountFolder(connect, yeomanConfig.app) - ]; - } - } + src: ['test/spec/{,*/}*.js'] + } + }, + + // Empties folders to start fresh + clean: { + dist: { + files: [{ + dot: true, + src: [ + '.tmp', + '<%= yeoman.dist %>/*', + '!<%= yeoman.dist %>/.git*' + ] + }] + }, + server: '.tmp' + }, + + // Add vendor prefixed styles + autoprefixer: { + options: { + browsers: ['last 1 version'] + }, + dist: { + files: [{ + expand: true, + cwd: '.tmp/styles/', + src: '{,*/}*.css', + dest: '.tmp/styles/' + }] + } + }, + + // Automatically inject Bower components into the app + bowerInstall: { + app: { + src: ['<%= yeoman.app %>/index.html'], + ignorePath: '<%= yeoman.app %>/' + } + }, + + // Renames files for browser caching purposes + rev: { + dist: { + files: { + src: [ + '<%= yeoman.dist %>/scripts/{,*/}*.js', + '<%= yeoman.dist %>/styles/{,*/}*.css', + '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', + '<%= yeoman.dist %>/styles/fonts/*' + ] + } + } + }, + + // Reads HTML for usemin blocks to enable smart builds that automatically + // concat, minify and revision files. Creates configurations in memory so + // additional tasks can operate on them + useminPrepare: { + html: '<%= yeoman.app %>/index.html', + options: { + dest: '<%= yeoman.dist %>', + flow: { + html: { + steps: { + js: ['concat', 'uglifyjs'], + css: ['cssmin'] }, - test: { - options: { - port: 9000, - middleware: function (connect) { - return [ - mountFolder(connect, '.tmp'), - mountFolder(connect, 'test') - ]; - } - } - } - }, - testacular: { - unit: { - configFile: 'testacular.conf.js', - singleRun: true - } - }, - concat: { - // Done via index.html for correct order - }, - useminPrepare: { - html: '<%= yeoman.app %>/index.html', - options: { - dest: '<%= yeoman.dist %>' - } - }, - usemin: { - js: ['<%= yeoman.dist %>/{,*/}*.js'], - css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], - options: { - dirs: ['<%= yeoman.dist %>'] - } - }, - cdnify: { - dist: { - html: ['<%= yeoman.dist %>/*.html'] - } - }, - ngmin: { - dist: { - files: [ - { - expand: true, - cwd: '<%= yeoman.dist %>', - src: '*.js', - dest: '<%= yeoman.dist %>' - } - ] - } - }, - uglify: { - dist: { - files: { - '<%= yeoman.dist %>/<%= yeoman.name %>.min.js': [ - '<%= yeoman.dist %>/<%= yeoman.name %>.js' - ] - } - } - }, - copy: { - dist: { - files: [ - { - expand: true, - dot: true, - cwd: '<%= yeoman.app %>', - dest: '<%= yeoman.dist %>', - src: [ - '*.{txt}' - ] - } - ] - } + post: {} + } } - }); - - grunt.renameTask('regarde', 'watch'); - // remove when mincss task is renamed - grunt.renameTask('mincss', 'cssmin'); - - grunt.registerTask('server', [ - 'clean:server', - 'coffee:dist', - 'compass:server', - 'livereload-start', - 'connect:livereload', - 'open', - 'watch' - ]); + } + }, - grunt.registerTask('test', [ - 'clean:server', - 'connect:test', - 'testacular' - ]); + // Performs rewrites based on rev and the useminPrepare configuration + usemin: { + html: ['<%= yeoman.dist %>/{,*/}*.html'], + css: ['<%= yeoman.dist %>/styles/{,*/}*.css'], + options: { + assetsDirs: ['<%= yeoman.dist %>'] + } + }, + + // The following *-min tasks produce minified files in the dist folder + cssmin: { + options: { + root: '<%= yeoman.app %>' + } + }, + + imagemin: { + dist: { + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/images', + src: '{,*/}*.{png,jpg,jpeg,gif}', + dest: '<%= yeoman.dist %>/images' + }] + } + }, + + svgmin: { + dist: { + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/images', + src: '{,*/}*.svg', + dest: '<%= yeoman.dist %>/images' + }] + } + }, + + htmlmin: { + dist: { + options: { + collapseWhitespace: true, + collapseBooleanAttributes: true, + removeCommentsFromCDATA: true, + removeOptionalTags: true + }, + files: [{ + expand: true, + cwd: '<%= yeoman.dist %>', + src: ['*.html', 'views/{,*/}*.html'], + dest: '<%= yeoman.dist %>' + }] + } + }, + + // ngmin tries to make the code safe for minification automatically by + // using the Angular long form for dependency injection. It doesn't work on + // things like resolve or inject so those have to be done manually. + ngmin: { + dist: { + files: [{ + expand: true, + cwd: '.tmp/concat/scripts', + src: '*.js', + dest: '.tmp/concat/scripts' + }] + } + }, + + // Replace Google CDN references + cdnify: { + dist: { + html: ['<%= yeoman.dist %>/*.html'] + } + }, - grunt.registerTask('build', [ - 'clean:dist', - 'useminPrepare', - 'concat', - 'copy', - 'cdnify', - 'usemin', - 'ngmin' - //'uglify' + // Copies remaining files to places other tasks can use + copy: { + dist: { + files: [{ + expand: true, + dot: true, + cwd: '<%= yeoman.app %>', + dest: '<%= yeoman.dist %>', + src: [ + '*.{ico,png,txt}', + '.htaccess', + '*.html', + 'views/{,*/}*.html', + 'images/{,*/}*.{webp}', + 'fonts/*' + ] + }, { + expand: true, + cwd: '.tmp/images', + dest: '<%= yeoman.dist %>/images', + src: ['generated/*'] + }] + }, + styles: { + expand: true, + cwd: '<%= yeoman.app %>/styles', + dest: '.tmp/styles/', + src: '{,*/}*.css' + } + }, + + // Run some tasks in parallel to speed up the build process + concurrent: { + server: [ + 'copy:styles' + ], + test: [ + 'copy:styles' + ], + dist: [ + 'copy:styles', + 'imagemin', + 'svgmin' + ] + }, + + // By default, your `index.html`'s will take care of + // minification. These next options are pre-configured if you do not wish + // to use the Usemin blocks. + // cssmin: { + // dist: { + // files: { + // '<%= yeoman.dist %>/styles/main.css': [ + // '.tmp/styles/{,*/}*.css', + // '<%= yeoman.app %>/styles/{,*/}*.css' + // ] + // } + // } + // }, + // uglify: { + // dist: { + // files: { + // '<%= yeoman.dist %>/scripts/scripts.js': [ + // '<%= yeoman.dist %>/scripts/scripts.js' + // ] + // } + // } + // }, + // concat: { + // dist: {} + // }, + + // Test settings + karma: { + unit: { + configFile: 'karma.conf.js', + singleRun: true + } + } + }); + + + grunt.registerTask('serve', function (target) { + if (target === 'dist') { + return grunt.task.run(['build', 'connect:dist:keepalive']); + } + + grunt.task.run([ + 'clean:server', + 'bowerInstall', + 'concurrent:server', + 'autoprefixer', + 'connect:livereload', + 'watch' ]); + }); + + grunt.registerTask('server', function (target) { + grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); + grunt.task.run(['serve:' + target]); + }); + + grunt.registerTask('test', [ + 'clean:server', + 'concurrent:test', + 'autoprefixer', + 'connect:test', + 'karma' + ]); + + grunt.registerTask('build', [ + 'clean:dist', + 'bowerInstall', + 'useminPrepare', + 'concurrent:dist', + 'autoprefixer', + 'concat', + 'ngmin', + 'copy:dist', + 'cdnify', + 'cssmin', + 'uglify', + 'rev', + 'usemin', + 'htmlmin' + ]); - grunt.registerTask('default', ['build']); + grunt.registerTask('default', [ + 'newer:jshint', + 'test', + 'build' + ]); }; diff --git a/app/index.html b/app/index.html index 8af702d..bf56232 100644 --- a/app/index.html +++ b/app/index.html @@ -1,10 +1,59 @@ - - - + + + + + + + + + + + + + + + + + + + + + - - + +
- - - + + + + + + + + + + + + + + + + + + + + + diff --git a/app/index.html_old b/app/index.html_old new file mode 100644 index 0000000..8af702d --- /dev/null +++ b/app/index.html_old @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/scripts/app.js b/app/scripts/app.js index bddae55..a014db1 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -1,3 +1,19 @@ 'use strict'; -angular.module('d3', []); +angular + .module('d3App', [ + 'ngCookies', + 'ngResource', + 'ngSanitize', + 'ngRoute' + ]) + .config(function ($routeProvider) { + $routeProvider + .when('/', { + templateUrl: 'views/main.html', + controller: 'MainCtrl' + }) + .otherwise({ + redirectTo: '/' + }); + }); diff --git a/app/scripts/app.js_old b/app/scripts/app.js_old new file mode 100644 index 0000000..bddae55 --- /dev/null +++ b/app/scripts/app.js_old @@ -0,0 +1,3 @@ +'use strict'; + +angular.module('d3', []); diff --git a/build/angular-d3.js b/build/angular-d3.js index 1b2852a..15efac1 100644 --- a/build/angular-d3.js +++ b/build/angular-d3.js @@ -1,6 +1,6 @@ 'use strict'; angular.module('d3', []); -'use strict'; + angular.module('d3').factory('d3', [function () { var d3; var π = Math.PI, ε = 0.000001, d3 = { version: '3.0.8' }, d3_radians = π / 180, d3_degrees = 180 / π, d3_document = document, d3_window = window; @@ -9127,7 +9127,7 @@ angular.module('d3').factory('d3', [function () { }; return d3; }]); -'use strict'; +; angular.module('d3').config([ '$provide', function ($provide) { @@ -9493,7 +9493,7 @@ angular.module('d3').config([ $provide.decorator('d3', d3WorldCloudDecorator); } ]); -'use strict'; +; angular.module('d3').directive('wordcloud', [ 'd3', function (d3) { @@ -9586,7 +9586,7 @@ angular.module('d3').directive('wordcloud', [ }; } ]); -'use strict'; +; angular.module('d3').config([ '$provide', function ($provide) { @@ -9754,7 +9754,7 @@ angular.module('d3').config([ $provide.decorator('d3', d3HorizonChartDecorator); } ]); -'use strict'; +; angular.module('d3').directive('horizonChart', [ 'd3', function (d3) { diff --git a/component.json b/component.json deleted file mode 100644 index 8ff8610..0000000 --- a/component.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "angular-d3", - "version": "0.0.1", - "dependencies": { - "angular": "~1.0.5" - }, - "devDependencies": { - } -} diff --git a/examples/wordcloud/index.html b/examples/wordcloud/index.html index acb5229..dc7e29a 100644 --- a/examples/wordcloud/index.html +++ b/examples/wordcloud/index.html @@ -29,11 +29,15 @@

Simple Words Subelements

- + + + + + - - + + diff --git a/examples/wordcloud/scripts/app.js b/examples/wordcloud/scripts/app.js index dd60d04..152e1bb 100644 --- a/examples/wordcloud/scripts/app.js +++ b/examples/wordcloud/scripts/app.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('examplesApp', ['d3']) +angular.module('examplesApp',[]) .config(['$routeProvider',function ($routeProvider) { $routeProvider .when('/', { diff --git a/examples/wordcloud/scripts/controllers/main.js b/examples/wordcloud/scripts/controllers/main.js index b80c5be..e8ef3ee 100644 --- a/examples/wordcloud/scripts/controllers/main.js +++ b/examples/wordcloud/scripts/controllers/main.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('examplesApp') +angular.module('examplesApp',['ngRoute', 'd3']) .controller('MainCtrl', ['$scope',function ($scope) { $scope.words = ["Hallo","Test","Lorem","Ipsum","Lorem","ipsum","dolor","sit","amet,","consetetur","sadipscing","elitr,","sed","diam","nonumy","eirmod","tempor","invidunt","ut","labore","et","dolore","magna","aliquyam","erat,","sed","diam"]; diff --git a/package.json b/package.json index 4c06cfd..b9d3cb4 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,40 @@ { - "name": "angular-d3", - "version": "0.0.1", + "name": "d3", + "version": "0.0.0", "dependencies": {}, "devDependencies": { - "grunt": "0.4.0rc7", - "grunt-contrib-copy": "0.4.0rc7", - "grunt-contrib-concat": "0.1.2rc6", - "grunt-contrib-coffee": "0.4.0rc7", - "grunt-contrib-uglify": "0.1.1rc6", - "grunt-contrib-compass": "0.1.1rc8", - "grunt-contrib-jshint": "0.1.1rc6", - "grunt-contrib-mincss": "0.4.0rc7", - "grunt-contrib-connect": "0.1.1rc6", - "grunt-contrib-clean": "0.4.0rc6", - "grunt-contrib-htmlmin": "0.1.1rc7", - "grunt-contrib-imagemin": "0.1.1rc8", - "grunt-contrib-livereload": "0.1.0rc8", - "grunt-bower-hooks": "~0.2.0", - "grunt-usemin": "~0.1.7", - "grunt-regarde": "~0.1.1", - "gruntacular": "~0.1.1", - "grunt-open": "~0.1.0", - "matchdep": "~0.1.1", - "grunt-google-cdn": "~0.1.0", - "grunt-ngmin": "~0.0.1" + "grunt": "~0.4.1", + "grunt-autoprefixer": "~0.4.0", + "grunt-bower-install": "~1.0.0", + "grunt-concurrent": "~0.5.0", + "grunt-contrib-clean": "~0.5.0", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-connect": "~0.5.0", + "grunt-contrib-copy": "~0.4.1", + "grunt-contrib-cssmin": "~0.7.0", + "grunt-contrib-htmlmin": "~0.1.3", + "grunt-contrib-imagemin": "^0.7.0", + "grunt-contrib-jshint": "~0.7.1", + "grunt-contrib-uglify": "~0.2.0", + "grunt-contrib-watch": "~0.5.2", + "grunt-google-cdn": "~0.2.0", + "grunt-karma": "^0.8.3", + "grunt-newer": "~0.6.1", + "grunt-ngmin": "~0.0.2", + "grunt-rev": "~0.1.0", + "grunt-svgmin": "~0.2.0", + "grunt-usemin": "~2.0.0", + "jshint-stylish": "~0.1.3", + "karma": "^0.12.16", + "karma-ng-html2js-preprocessor": "^0.1.0", + "karma-ng-scenario": "^0.1.0", + "load-grunt-tasks": "~0.4.0", + "time-grunt": "~0.2.1" }, "engines": { - "node": ">=0.8.0" + "node": ">=0.10.0" + }, + "scripts": { + "test": "grunt test" } } diff --git a/test/runner.html_old b/test/runner.html_old new file mode 100644 index 0000000..f4a00a1 --- /dev/null +++ b/test/runner.html_old @@ -0,0 +1,10 @@ + + + + End2end Test Runner + + + + + + \ No newline at end of file diff --git a/testacular.conf.js b/testacular.conf.js deleted file mode 100644 index 4a0fff8..0000000 --- a/testacular.conf.js +++ /dev/null @@ -1,52 +0,0 @@ -// Testacular configuration - -// base path, that will be used to resolve files and exclude -basePath = ''; - -// list of files / patterns to load in the browser -files = [ - JASMINE, - JASMINE_ADAPTER, - 'app/components/angular/angular.js', - 'app/components/angular-mocks/angular-mocks.js', - 'app/scripts/*.js', - 'app/scripts/**/*.js', - 'test/mock/**/*.js', - 'test/spec/**/*.js' -]; - -// list of files to exclude -exclude = []; - -// test results reporter to use -// possible values: dots || progress -reporter = 'progress'; - -// web server port -port = 8080; - -// cli runner port -runnerPort = 9100; - -// enable / disable colors in the output (reporters and logs) -colors = true; - -// level of logging -// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG -logLevel = LOG_INFO; - -// enable / disable watching file and executing tests whenever any file changes -autoWatch = false; - -// Start these browsers, currently available: -// - Chrome -// - ChromeCanary -// - Firefox -// - Opera -// - Safari -// - PhantomJS -browsers = ['Chrome',"Safari"]; - -// Continuous Integration mode -// if true, it capture browsers, run tests and exit -singleRun = false; From edc10ca492c51a5609ab56f3543a1407c734bc3b Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Sun, 25 May 2014 21:34:51 -0300 Subject: [PATCH 2/9] Add last yeoman and inject ng-route --- .editorconfig | 2 +- .gitignore | 2 ++ app/scripts/app.js | 18 +--------- app/scripts/app.js_old | 3 -- bower.json | 17 ++++++++++ examples/wordcloud/scripts/app.js | 2 +- karma-e2e.conf.js | 54 +++++++++++++++++++++++++++++ karma.conf.js | 56 +++++++++++++++++++++++++++++++ test/.jshintrc | 36 ++++++++++++++++++++ 9 files changed, 168 insertions(+), 22 deletions(-) delete mode 100644 app/scripts/app.js_old create mode 100644 bower.json create mode 100644 karma-e2e.conf.js create mode 100644 karma.conf.js create mode 100644 test/.jshintrc diff --git a/.editorconfig b/.editorconfig index c2cdfb8..8a80734 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,7 +9,7 @@ root = true # Change these settings to your own preference indent_style = space -indent_size = 2 +indent_size = 4 # We recommend you to keep these unchanged end_of_line = lf diff --git a/.gitignore b/.gitignore index 7911b28..69d4bfe 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ dist .tmp .sass-cache app/bower_components +/.project +/.settings diff --git a/app/scripts/app.js b/app/scripts/app.js index a014db1..bddae55 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -1,19 +1,3 @@ 'use strict'; -angular - .module('d3App', [ - 'ngCookies', - 'ngResource', - 'ngSanitize', - 'ngRoute' - ]) - .config(function ($routeProvider) { - $routeProvider - .when('/', { - templateUrl: 'views/main.html', - controller: 'MainCtrl' - }) - .otherwise({ - redirectTo: '/' - }); - }); +angular.module('d3', []); diff --git a/app/scripts/app.js_old b/app/scripts/app.js_old deleted file mode 100644 index bddae55..0000000 --- a/app/scripts/app.js_old +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -angular.module('d3', []); diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..1646719 --- /dev/null +++ b/bower.json @@ -0,0 +1,17 @@ +{ + "name": "d3", + "version": "0.0.0", + "dependencies": { + "angular": "1.2.15", + "json3": "~3.2.6", + "es5-shim": "~2.1.0", + "angular-resource": "1.2.15", + "angular-cookies": "1.2.15", + "angular-sanitize": "1.2.15", + "angular-route": "1.2.15" + }, + "devDependencies": { + "angular-mocks": "1.2.15", + "angular-scenario": "1.2.15" + } +} diff --git a/examples/wordcloud/scripts/app.js b/examples/wordcloud/scripts/app.js index 152e1bb..dd60d04 100644 --- a/examples/wordcloud/scripts/app.js +++ b/examples/wordcloud/scripts/app.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('examplesApp',[]) +angular.module('examplesApp', ['d3']) .config(['$routeProvider',function ($routeProvider) { $routeProvider .when('/', { diff --git a/karma-e2e.conf.js b/karma-e2e.conf.js new file mode 100644 index 0000000..fa01484 --- /dev/null +++ b/karma-e2e.conf.js @@ -0,0 +1,54 @@ +// Karma configuration +// http://karma-runner.github.io/0.10/config/configuration-file.html + +module.exports = function(config) { + config.set({ + // base path, that will be used to resolve files and exclude + basePath: '', + + // testing framework to use (jasmine/mocha/qunit/...) + frameworks: ['ng-scenario'], + + // list of files / patterns to load in the browser + files: [ + 'test/e2e/**/*.js' + ], + + // list of files / patterns to exclude + exclude: [], + + // web server port + port: 8080, + + // level of logging + // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera + // - Safari (only Mac) + // - PhantomJS + // - IE (only Windows) + browsers: ['Chrome'], + + + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: false + + // Uncomment the following lines if you are using grunt's server to run the tests + // proxies: { + // '/': 'http://localhost:9000/' + // }, + // URL root prevent conflicts with the site root + // urlRoot: '_karma_' + }); +}; diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 0000000..bc0e168 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,56 @@ +// Karma configuration +// http://karma-runner.github.io/0.10/config/configuration-file.html + +module.exports = function(config) { + config.set({ + // base path, that will be used to resolve files and exclude + basePath: '', + + // testing framework to use (jasmine/mocha/qunit/...) + frameworks: ['jasmine'], + + // list of files / patterns to load in the browser + files: [ + 'app/bower_components/angular/angular.js', + 'app/bower_components/angular-mocks/angular-mocks.js', + 'app/bower_components/angular-resource/angular-resource.js', + 'app/bower_components/angular-cookies/angular-cookies.js', + 'app/bower_components/angular-sanitize/angular-sanitize.js', + 'app/bower_components/angular-route/angular-route.js', + 'app/scripts/*.js', + 'app/scripts/**/*.js', + 'test/mock/**/*.js', + 'test/spec/**/*.js' + ], + + // list of files / patterns to exclude + exclude: [], + + // web server port + port: 8080, + + // level of logging + // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera + // - Safari (only Mac) + // - PhantomJS + // - IE (only Windows) + browsers: ['Chrome'], + + + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun: false + }); +}; diff --git a/test/.jshintrc b/test/.jshintrc new file mode 100644 index 0000000..b1be025 --- /dev/null +++ b/test/.jshintrc @@ -0,0 +1,36 @@ +{ + "node": true, + "browser": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 2, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "regexp": true, + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, + "globals": { + "after": false, + "afterEach": false, + "angular": false, + "before": false, + "beforeEach": false, + "browser": false, + "describe": false, + "expect": false, + "inject": false, + "it": false, + "jasmine": false, + "spyOn": false + } +} + From 35bb30270c0390c3b4e4238fa4c326c87c071ad0 Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Sun, 1 Jun 2014 19:44:04 -0300 Subject: [PATCH 3/9] Add last Karma, Grunt & Bower versions --- karma.conf.js | 1 + package.json | 2 ++ 2 files changed, 3 insertions(+) diff --git a/karma.conf.js b/karma.conf.js index bc0e168..b582709 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -48,6 +48,7 @@ module.exports = function(config) { // - IE (only Windows) browsers: ['Chrome'], + plugins: ['karma-jasmine', 'karma-chrome-launcher'], // Continuous Integration mode // if true, it capture browsers, run tests and exit diff --git a/package.json b/package.json index b9d3cb4..3b81645 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,8 @@ "grunt-usemin": "~2.0.0", "jshint-stylish": "~0.1.3", "karma": "^0.12.16", + "karma-chrome-launcher": "^0.1.4", + "karma-jasmine": "^0.1.5", "karma-ng-html2js-preprocessor": "^0.1.0", "karma-ng-scenario": "^0.1.0", "load-grunt-tasks": "~0.4.0", From 1742593a3ff8d8c7e31515af9e90ae34d19ee2ef Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Mon, 2 Jun 2014 09:43:29 -0300 Subject: [PATCH 4/9] Rolling back autogenerated package changes and ngRoute mistake. --- app/index.html | 5 ----- examples/wordcloud/index.html | 4 ---- examples/wordcloud/scripts/controllers/main.js | 2 +- package.json | 4 ++-- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/index.html b/app/index.html index bf56232..9d6cd24 100644 --- a/app/index.html +++ b/app/index.html @@ -44,16 +44,11 @@ - - - - - diff --git a/examples/wordcloud/index.html b/examples/wordcloud/index.html index dc7e29a..da7c871 100644 --- a/examples/wordcloud/index.html +++ b/examples/wordcloud/index.html @@ -30,10 +30,6 @@

Simple Words Subelements

- - - - diff --git a/examples/wordcloud/scripts/controllers/main.js b/examples/wordcloud/scripts/controllers/main.js index e8ef3ee..badfcda 100644 --- a/examples/wordcloud/scripts/controllers/main.js +++ b/examples/wordcloud/scripts/controllers/main.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('examplesApp',['ngRoute', 'd3']) +angular.module('examplesApp',['d3']) .controller('MainCtrl', ['$scope',function ($scope) { $scope.words = ["Hallo","Test","Lorem","Ipsum","Lorem","ipsum","dolor","sit","amet,","consetetur","sadipscing","elitr,","sed","diam","nonumy","eirmod","tempor","invidunt","ut","labore","et","dolore","magna","aliquyam","erat,","sed","diam"]; diff --git a/package.json b/package.json index 3b81645..5ce75f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "d3", - "version": "0.0.0", + "name": "angular-d3", + "version": "0.0.1", "dependencies": {}, "devDependencies": { "grunt": "~0.4.1", From 80b9d5f4d0c7d3044cd139c09208d87319781800 Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Mon, 2 Jun 2014 10:53:31 -0300 Subject: [PATCH 5/9] Fix CI configuration --- .travis.yml | 2 ++ karma-e2e.conf.js | 5 +++-- karma.conf.js | 6 +++--- package.json | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83f4e22..eeeb7d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,7 @@ node_js: - '0.8' - '0.10' before_script: + - 'export DISPLAY=:99.0' + - 'sh -e /etc/init.d/xvfb start' - 'npm install -g bower grunt-cli' - 'bower install' diff --git a/karma-e2e.conf.js b/karma-e2e.conf.js index fa01484..f838127 100644 --- a/karma-e2e.conf.js +++ b/karma-e2e.conf.js @@ -37,9 +37,10 @@ module.exports = function(config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers: ['Chrome'], - + browsers: ['Firefox'], + plugins: ['karma-jasmine', 'karma-firefox-launcher'], + // Continuous Integration mode // if true, it capture browsers, run tests and exit singleRun: false diff --git a/karma.conf.js b/karma.conf.js index b582709..862b710 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -46,12 +46,12 @@ module.exports = function(config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers: ['Chrome'], + browsers: ['Firefox'], - plugins: ['karma-jasmine', 'karma-chrome-launcher'], + plugins: ['karma-jasmine', 'karma-firefox-launcher'], // Continuous Integration mode // if true, it capture browsers, run tests and exit - singleRun: false + singleRun: true }); }; diff --git a/package.json b/package.json index 5ce75f3..0087c01 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "jshint-stylish": "~0.1.3", "karma": "^0.12.16", "karma-chrome-launcher": "^0.1.4", + "karma-firefox-launcher": "^0.1.3", "karma-jasmine": "^0.1.5", "karma-ng-html2js-preprocessor": "^0.1.0", "karma-ng-scenario": "^0.1.0", From 217900c1c5f9f1d7d7a6bfe2302d4f756a343abf Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Mon, 2 Jun 2014 22:20:39 -0300 Subject: [PATCH 6/9] Add Travis build message to README. Until npm 0.8 is updated for the CI virtual machines, remove the support for 0.8 builds. Delete unused post property from Gruntfile.js --- .travis.yml | 1 - Gruntfile.js | 3 +-- README.md | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index eeeb7d2..f2fb457 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: node_js node_js: - - '0.8' - '0.10' before_script: - 'export DISPLAY=:99.0' diff --git a/Gruntfile.js b/Gruntfile.js index 4c332f1..95ffc8c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -177,8 +177,7 @@ module.exports = function (grunt) { steps: { js: ['concat', 'uglifyjs'], css: ['cssmin'] - }, - post: {} + } } } } diff --git a/README.md b/README.md index 8d08b89..e204496 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ angular-d3 ================== +[![Build Status](https://travis-ci.org/robinboehm/angular-d3-directives.svg?branch=master)](https://travis-ci.org/robinboehm/angular-d3-directives) + Blogpost about this project: http://spiiice.net/using-angularjs-and-d3-to-create-a-wordcloud-directive Create [directives](http://docs.angularjs.org/guide/directive) to enable even more easy usage of [d3](http://d3js.org/) by [Mike Bostock](https://github.com/mbostock/d3)! From 089b3077fed613db5a64eaad47e5d26f74f05257 Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Sat, 14 Jun 2014 21:40:25 -0300 Subject: [PATCH 7/9] Add d3 as a Bower dependency. --- app/index.html | 1 + bower.json | 2 +- examples/wordcloud/index.html | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/index.html b/app/index.html index 9d6cd24..5e57555 100644 --- a/app/index.html +++ b/app/index.html @@ -44,6 +44,7 @@ + diff --git a/bower.json b/bower.json index 1646719..a27124c 100644 --- a/bower.json +++ b/bower.json @@ -1,5 +1,5 @@ { - "name": "d3", + "name": "angular-d3", "version": "0.0.0", "dependencies": { "angular": "1.2.15", diff --git a/examples/wordcloud/index.html b/examples/wordcloud/index.html index da7c871..6303176 100644 --- a/examples/wordcloud/index.html +++ b/examples/wordcloud/index.html @@ -30,6 +30,7 @@

Simple Words Subelements

+ From cf58a6321364a67c029d4cf21c092855ae0c294e Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Sun, 22 Jun 2014 15:29:08 -0300 Subject: [PATCH 8/9] Fix travis error for 0.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0087c01..761740b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "grunt-contrib-copy": "~0.4.1", "grunt-contrib-cssmin": "~0.7.0", "grunt-contrib-htmlmin": "~0.1.3", - "grunt-contrib-imagemin": "^0.7.0", + "grunt-contrib-imagemin": "0.7.0", "grunt-contrib-jshint": "~0.7.1", "grunt-contrib-uglify": "~0.2.0", "grunt-contrib-watch": "~0.5.2", From 7eb0859303935455ea64a98c796f132289bc0656 Mon Sep 17 00:00:00 2001 From: Mathias Rodriguez Date: Sun, 22 Jun 2014 15:36:48 -0300 Subject: [PATCH 9/9] Restore core app load --- app/index.html | 16 +++++++++++++--- app/index.html_old | 10 ---------- 2 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 app/index.html_old diff --git a/app/index.html b/app/index.html index 5e57555..d955e13 100644 --- a/app/index.html +++ b/app/index.html @@ -14,10 +14,10 @@ - + - + @@ -44,12 +44,22 @@ - + + + + + + + + + + + diff --git a/app/index.html_old b/app/index.html_old deleted file mode 100644 index 8af702d..0000000 --- a/app/index.html_old +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - -