diff --git a/.gitignore b/.gitignore index 6b382c9..eebebff 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .idea +.grunt +_SpecRunner.html *.iml node_modules public/js/vendors/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index a5f53b4..e8d704e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ +language: node_js +node_js: + - "0.8" + - "0.10" before_install: + - "npm install -g grunt-cli" - "npm install -g bower" - - "bower install" - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" -script: bundle exec rake \ No newline at end of file + - "bower install" \ No newline at end of file diff --git a/Gemfile b/Gemfile deleted file mode 100644 index f422b1f..0000000 --- a/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -gem 'jasmine' -gem 'rspec' -gem 'rake' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 9ddd7b9..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,39 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - childprocess (0.3.9) - ffi (~> 1.0, >= 1.0.11) - diff-lcs (1.2.4) - ffi (1.9.0) - jasmine (1.3.2) - jasmine-core (~> 1.3.1) - rack (~> 1.0) - rspec (>= 1.3.1) - selenium-webdriver (>= 0.1.3) - jasmine-core (1.3.1) - multi_json (1.8.0) - rack (1.5.2) - rake (10.1.0) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.5) - rspec-expectations (2.14.2) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.3) - rubyzip (0.9.9) - selenium-webdriver (2.35.1) - childprocess (>= 0.2.5) - multi_json (~> 1.0) - rubyzip (< 1.0.0) - websocket (~> 1.0.4) - websocket (1.0.7) - -PLATFORMS - ruby - -DEPENDENCIES - jasmine - rake - rspec diff --git a/Gruntfile.js b/Gruntfile.js index 71ecdf0..5c5baf0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,71 +1,99 @@ module.exports = function (grunt) { - grunt.initConfig({ - pkg:grunt.file.readJSON('package.json'), - banner:'/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + - '<%= grunt.template.today("yyyy-mm-dd") %>\n' + - '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + - '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; \n*/\n', + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + bower: grunt.file.readJSON('bower.json'), + banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + + '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; \n*/\n', - concat: { - options: { - separator: ';' - }, - dist: { - src: ['public/js/backbone-command/**/*.js'], - dest: '<%= pkg.name %>.js' - } - }, + concat: { + options: { + separator: ';' + }, + dist: { + src: ['public/js/backbone-command/**/*.js'], + dest: '<%= pkg.name %>.js' + } + }, - uglify: { - dist: { - files: { - '<%= pkg.name %>.min.js': '<%= pkg.name %>.js' - }, - options: { - banner:'<%= banner %>' - } - } - }, + uglify: { + dist: { + files: { + '<%= pkg.name %>.min.js': '<%= pkg.name %>.js' + }, + options: { + banner: '<%= banner %>' + } + } + }, - copy: { - backboneCommand: { - src: ['<%= pkg.name %>.js', '<%= pkg.name %>.min.js'], - dest: 'public/js/dist/' - } - }, + copy: { + backboneCommand: { + src: ['<%= pkg.name %>.js', '<%= pkg.name %>.min.js'], + dest: 'public/js/dist/' + } + }, - watch: { - files: ['public/js/*.js'], - tasks: ['concat:dist','uglify:dist', 'copy:backboneCommand'] - }, + watch: { + files: ['public/js/*.js'], + tasks: ['concat:dist', 'uglify:dist', 'copy:backboneCommand'] + }, - bump: { - options: { - files: ['package.json', 'bower.json'], - updateConfigs: ["pkg","banner"], - commit: true, - commitMessage: 'Release v%VERSION%', - commitFiles: ['package.json', 'bower.json', '<%= pkg.name %>.min.js', '<%= pkg.name %>.js', 'public/js/dist/<%= pkg.name %>.min.js', 'public/js/dist/<%= pkg.name %>.js'], // '-a' for all files - createTag: true, - tagName: 'v%VERSION%', - tagMessage: 'Version %VERSION%', - push: true, - pushTo: 'origin master', - gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe' - } - } - }); + bump: { + options: { + files: ['package.json', 'bower.json'], + updateConfigs: ["pkg", "banner"], + commit: true, + commitMessage: 'Release v%VERSION%', + commitFiles: ['package.json', 'bower.json', '<%= pkg.name %>.min.js', '<%= pkg.name %>.js', 'public/js/dist/<%= pkg.name %>.min.js', 'public/js/dist/<%= pkg.name %>.js'], // '-a' for all files + createTag: true, + tagName: 'v%VERSION%', + tagMessage: 'Version %VERSION%', + push: true, + pushTo: 'origin master', + gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe' + } + }, - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-bump'); + jasmine: { + components: { + src: [ + 'public/js/backbone-command/*js' + ], + options: { + specs: 'spec/*Spec.js', + keepRunner: true, + vendor: [ + 'public/js/vendors/jquery/jquery.min.js', + 'public/js/vendors/underscore/underscore-min.js', + 'public/js/vendors/backbone/backbone-min.js', + 'public/js/vendors/injector.js/injector-js.min.js' + ] + } + } + } + }); - grunt.registerTask('default', ['concat','uglify', 'copy']); + // plugins + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-jasmine'); + grunt.loadNpmTasks('grunt-bump'); - grunt.registerTask('release', ['default','bump-commit']); - grunt.registerTask('release:patch', ['bump-only:patch','release']); - grunt.registerTask('release:minor', ['bump-only:minor','release']); - grunt.registerTask('release:major', ['bump-only:major','release']); + // tasks + grunt.registerTask('default', ['concat', 'uglify', 'copy']); + + grunt.registerTask('release', ['default', 'bump-commit']); + grunt.registerTask('release:patch', ['bump-only:patch', 'release']); + grunt.registerTask('release:minor', ['bump-only:minor', 'release']); + grunt.registerTask('release:major', ['bump-only:major', 'release']); + + // travis! + grunt.registerTask('travis', 'Testing specs on Travis-CI', [ +// 'jshint', TODO maybe implement jshint for strict coding? + 'jasmine' + ]); }; \ No newline at end of file diff --git a/README.md b/README.md index df2b37e..d0062e8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# backbone-command [![Build Status](https://travis-ci.org/biggerboat/backbone-command.png)](https://travis-ci.org/biggerboat/backbone-command) +# backbone-command [![Build Status](https://travis-ci.org/inlet/backbone-command.png)](https://travis-ci.org/inlet/backbone-command) Execution of [commands](http://en.wikipedia.org/wiki/Command_pattern) upon event triggers. This is build for usage with [Backbone](https://github.com/jashkenas/backbone) and relies on [injector.js](https://github.com/biggerboat/injector.js) diff --git a/Rakefile b/Rakefile deleted file mode 100644 index a28fb63..0000000 --- a/Rakefile +++ /dev/null @@ -1,3 +0,0 @@ -load 'jasmine/tasks/jasmine.rake' - -task default: "jasmine:ci" \ No newline at end of file diff --git a/backbone-command.min.js b/backbone-command.min.js index d556f70..3e6ad9a 100644 --- a/backbone-command.min.js +++ b/backbone-command.min.js @@ -1,4 +1,4 @@ -/*! backbone-command - v0.1.2 - 2013-10-05 +/*! backbone-command - v0.1.2 - 2013-10-09 * Copyright (c) 2013 Paul Tondeur; */ (function(){Backbone.Command=function(n){this._configure(n||{})},_.extend(Backbone.Command.prototype,{injector:"inject",_configure:function(n){void 0!=n.injector&&n.injector.injectInto(this)},execute:function(){}}),Backbone.Command.extend=Backbone.Router.extend})(),function(){var n=Backbone.Router.prototype._bindRoutes;Backbone.CommandRouter=Backbone.Router.extend({injector:null,_bindRoutes:function(){this.injector=new injector.Injector,n()},bindCommand:function(n,o,e){n.on(o,this._executeCommand,{command:e,options:{injector:this.injector}})},_executeCommand:function(){var n=new this.command(this.options);n.execute(),n=null}})}(); \ No newline at end of file diff --git a/package.json b/package.json index eb2a35a..30e0982 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,29 @@ { - "name": "backbone-command", - "version": "0.1.2", - "author": { - "name": "Paul Tondeur", - "email": "paul@paultondeur.nl", - "url": "http://paultondeur.com" - }, - "description": "Small Backbone extension for command execution on model changes", - "repository": { - "type": "git", - "url": "https://github.com/PaulTondeur/backbone-command" - }, - "dependencies": { - "grunt": "~0.4.0", - "grunt-contrib-uglify": "~0.1.2", - "grunt-contrib-watch": "~0.3.1", - "grunt-contrib-copy": "~0.4.0", - "grunt-bump": "~0.0.11" - }, - "engines": { - "node": "0.8.x" - }, - "devDependencies": { - "grunt-contrib-concat": "~0.3.0" - } + "name": "backbone-command", + "version": "0.1.2", + "author": { + "name": "Paul Tondeur", + "email": "paul@paultondeur.nl", + "url": "http://paultondeur.com" + }, + "description": "Small Backbone extension for command execution on model changes", + "repository": { + "type": "git", + "url": "https://github.com/PaulTondeur/backbone-command" + }, + "engines": { + "node": "0.8.x" + }, + "scripts": { + "test": "grunt travis --verbose" + }, + "devDependencies": { + "grunt": "~0.4.0", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-uglify": "~0.1.2", + "grunt-contrib-watch": "~0.3.1", + "grunt-contrib-copy": "~0.4.0", + "grunt-contrib-jasmine": "~0.5.2", + "grunt-bump": "~0.0.11" + } } diff --git a/public/js/dist/backbone-command.min.js b/public/js/dist/backbone-command.min.js index d556f70..3e6ad9a 100644 --- a/public/js/dist/backbone-command.min.js +++ b/public/js/dist/backbone-command.min.js @@ -1,4 +1,4 @@ -/*! backbone-command - v0.1.2 - 2013-10-05 +/*! backbone-command - v0.1.2 - 2013-10-09 * Copyright (c) 2013 Paul Tondeur; */ (function(){Backbone.Command=function(n){this._configure(n||{})},_.extend(Backbone.Command.prototype,{injector:"inject",_configure:function(n){void 0!=n.injector&&n.injector.injectInto(this)},execute:function(){}}),Backbone.Command.extend=Backbone.Router.extend})(),function(){var n=Backbone.Router.prototype._bindRoutes;Backbone.CommandRouter=Backbone.Router.extend({injector:null,_bindRoutes:function(){this.injector=new injector.Injector,n()},bindCommand:function(n,o,e){n.on(o,this._executeCommand,{command:e,options:{injector:this.injector}})},_executeCommand:function(){var n=new this.command(this.options);n.execute(),n=null}})}(); \ No newline at end of file diff --git a/spec/javascripts/CommandRouterSpec.js b/spec/CommandRouterSpec.js similarity index 100% rename from spec/javascripts/CommandRouterSpec.js rename to spec/CommandRouterSpec.js diff --git a/spec/javascripts/CommandSpec.js b/spec/CommandSpec.js similarity index 100% rename from spec/javascripts/CommandSpec.js rename to spec/CommandSpec.js diff --git a/spec/javascripts/support/jasmine.yml b/spec/javascripts/support/jasmine.yml deleted file mode 100644 index 513d6cc..0000000 --- a/spec/javascripts/support/jasmine.yml +++ /dev/null @@ -1,92 +0,0 @@ -# src_files -# -# Return an array of filepaths relative to src_dir to include before jasmine specs. -# Default: [] -# -# EXAMPLE: -# -# src_files: -# - lib/source1.js -# - lib/source2.js -# - dist/**/*.js -# -src_files: - - js/vendors/jquery/jquery.js - - js/vendors/underscore/underscore.js - - js/vendors/backbone/backbone.js - - js/vendors/injector.js/injector-js.js - - js/backbone-command/**/*.js - -# stylesheets -# -# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs. -# Default: [] -# -# EXAMPLE: -# -# stylesheets: -# - css/style.css -# - stylesheets/*.css -# -stylesheets: - -# helpers -# -# Return an array of filepaths relative to spec_dir to include before jasmine specs. -# Default: ["helpers/**/*.js"] -# -# EXAMPLE: -# -# helpers: -# - helpers/**/*.js -# -helpers: - - 'helpers/**/*.js' -# spec_files -# -# Return an array of filepaths relative to spec_dir to include. -# Default: ["**/*[sS]pec.js"] -# -# EXAMPLE: -# -# spec_files: -# - **/*[sS]pec.js -# -spec_files: - - '**/*[sS]pec.js' - -# src_dir -# -# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank. -# Default: project root -# -# EXAMPLE: -# -# src_dir: public -# -src_dir: 'public' - -# spec_dir -# -# Spec directory path. Your spec_files must be returned relative to this path. -# Default: spec/javascripts -# -# EXAMPLE: -# -# spec_dir: spec/javascripts -# -spec_dir: 'spec' - -# spec_helper -# -# Ruby file that Jasmine server will require before starting. -# Returned relative to your root path -# Default spec/support/jasmine_helper.rb -# -# EXAMPLE: -# -# spec_helper: spec/support/jasmine_helper.rb -# -spec_helper: spec/support/jasmine_helper.rb - -