Explorar el Código

Merge branch 'refs/heads/master' into develop

Conflicts:
	coffeelint.json
	dist/js/bootstrap-switch.js
	dist/js/bootstrap-switch.min.js
	gulpfile.js
	package.json
	src/coffee/bootstrap-switch.coffee
Emanuele Marchi hace 11 años
padre
commit
5448b6e0fe
Se han modificado 6 ficheros con 261 adiciones y 145 borrados
  1. 7 1
      README.md
  2. 5 1
      bower.json
  3. 125 24
      coffeelint.json
  4. 115 0
      gulpfile.coffee
  5. 2 115
      gulpfile.js
  6. 7 4
      package.json

+ 7 - 1
README.md

@@ -2,6 +2,7 @@
 [![Dependency Status](https://david-dm.org/nostalgiaz/bootstrap-switch.svg?theme=shields.io)](https://david-dm.org/nostalgiaz/bootstrap-switch)
 [![Dependency Status](https://david-dm.org/nostalgiaz/bootstrap-switch.svg?theme=shields.io)](https://david-dm.org/nostalgiaz/bootstrap-switch)
 [![devDependency Status](https://david-dm.org/nostalgiaz/bootstrap-switch/dev-status.svg?theme=shields.io)](https://david-dm.org/nostalgiaz/bootstrap-switch#info=devDependencies)
 [![devDependency Status](https://david-dm.org/nostalgiaz/bootstrap-switch/dev-status.svg?theme=shields.io)](https://david-dm.org/nostalgiaz/bootstrap-switch#info=devDependencies)
 [![NPM Version](http://img.shields.io/npm/v/bootstrap-switch.svg)](https://www.npmjs.org/)
 [![NPM Version](http://img.shields.io/npm/v/bootstrap-switch.svg)](https://www.npmjs.org/)
+[![Gittip nostalgiaz](http://img.shields.io/gittip/nostalgiaz.svg)](https://www.gittip.com/nostalgiaz)
 [![Gittip LostCrew](http://img.shields.io/gittip/LostCrew.svg)](https://www.gittip.com/LostCrew)
 [![Gittip LostCrew](http://img.shields.io/gittip/LostCrew.svg)](https://www.gittip.com/LostCrew)
 
 
 Turn checkboxes and radio buttons in toggle switches.
 Turn checkboxes and radio buttons in toggle switches.
@@ -41,7 +42,12 @@ Enjoy.
 If you want to use your bootstrap variables, include `bootstrap-switch.less` in your compilation stack. You can even choose among Bootstrap versions 2.3.2 or 3.*.* compatible source.
 If you want to use your bootstrap variables, include `bootstrap-switch.less` in your compilation stack. You can even choose among Bootstrap versions 2.3.2 or 3.*.* compatible source.
 
 
 ## AngularJs
 ## AngularJs
-A custom directive is available [here](https://github.com/frapontillo/angular-bootstrap-switch)
+Two custom directives are available:
+- [angular-bootstrap-switch](https://github.com/frapontillo/angular-bootstrap-switch)
+- [angular-toggle-switch](https://github.com/JumpLink/angular-toggle-switch)
+
+## KnockoutJs
+A Knockout binding handler is available [here](https://github.com/pauloortins/knockout-bootstrap-switch)
 
 
 ## NuGet
 ## NuGet
 A NuGet package is available [here](https://github.com/blachniet/bootstrap-switch-nuget)
 A NuGet package is available [here](https://github.com/blachniet/bootstrap-switch-nuget)

+ 5 - 1
bower.json

@@ -9,11 +9,15 @@
   "ignore": [
   "ignore": [
     "docs",
     "docs",
     "test",
     "test",
+    "src",
     "CNAME",
     "CNAME",
+    "coffeelint.json",
     "composer.json",
     "composer.json",
     "CONTRIBUTING.md",
     "CONTRIBUTING.md",
+    "gulpfile.coffee",
     "gulpfile.js",
     "gulpfile.js",
-    "index.html"
+    "index.html",
+    "package.json"
   ],
   ],
   "dependencies": {
   "dependencies": {
     "jquery": ">=1.9.0"
     "jquery": ">=1.9.0"

+ 125 - 24
coffeelint.json

@@ -1,26 +1,127 @@
 {
 {
-  "indentation": {
-    "value": 2
-  },
-  "line_endings": {
-    "level": "warn"
-  },
-  "max_line_length": {
-    "value": 120
-  },
-  "newlines_after_classes": {
-    "level": "error"
-  },
-  "no_trailing_semicolons": {
-    "value": true
-  },
-  "no_trailing_whitespace": {
-    "value": true
-  },
-  "no_empty_param_list": {
-    "level": "error"
-  },
-  "no_unnecessary_fat_arrows": {
-    "level": "error"
-  }
+    "coffeescript_error": {
+        "level": "error"
+    },
+    "arrow_spacing": {
+        "name": "arrow_spacing",
+        "level": "ignore"
+    },
+    "no_tabs": {
+        "name": "no_tabs",
+        "level": "error"
+    },
+    "no_trailing_whitespace": {
+        "name": "no_trailing_whitespace",
+        "level": "error",
+        "allowed_in_comments": false,
+        "allowed_in_empty_lines": false
+    },
+    "max_line_length": {
+        "name": "max_line_length",
+        "value": 120,
+        "level": "error",
+        "limitComments": true
+    },
+    "line_endings": {
+        "name": "line_endings",
+        "level": "warn",
+        "value": "unix"
+    },
+    "no_trailing_semicolons": {
+        "name": "no_trailing_semicolons",
+        "level": "error"
+    },
+    "indentation": {
+        "name": "indentation",
+        "value": 2,
+        "level": "error"
+    },
+    "camel_case_classes": {
+        "name": "camel_case_classes",
+        "level": "error"
+    },
+    "colon_assignment_spacing": {
+        "name": "colon_assignment_spacing",
+        "level": "ignore",
+        "spacing": {
+            "left": 0,
+            "right": 0
+        }
+    },
+    "no_implicit_braces": {
+        "name": "no_implicit_braces",
+        "level": "ignore",
+        "strict": true
+    },
+    "no_plusplus": {
+        "name": "no_plusplus",
+        "level": "ignore"
+    },
+    "no_throwing_strings": {
+        "name": "no_throwing_strings",
+        "level": "error"
+    },
+    "no_backticks": {
+        "name": "no_backticks",
+        "level": "error"
+    },
+    "no_implicit_parens": {
+        "name": "no_implicit_parens",
+        "strict": true,
+        "level": "ignore"
+    },
+    "no_empty_param_list": {
+        "name": "no_empty_param_list",
+        "level": "error"
+    },
+    "no_stand_alone_at": {
+        "name": "no_stand_alone_at",
+        "level": "ignore"
+    },
+    "space_operators": {
+        "name": "space_operators",
+        "level": "ignore"
+    },
+    "duplicate_key": {
+        "name": "duplicate_key",
+        "level": "error"
+    },
+    "empty_constructor_needs_parens": {
+        "name": "empty_constructor_needs_parens",
+        "level": "ignore"
+    },
+    "cyclomatic_complexity": {
+        "name": "cyclomatic_complexity",
+        "value": 10,
+        "level": "ignore"
+    },
+    "newlines_after_classes": {
+        "name": "newlines_after_classes",
+        "value": 3,
+        "level": "error"
+    },
+    "no_unnecessary_fat_arrows": {
+        "name": "no_unnecessary_fat_arrows",
+        "level": "error"
+    },
+    "missing_fat_arrows": {
+        "name": "missing_fat_arrows",
+        "level": "ignore"
+    },
+    "non_empty_constructor_needs_parens": {
+        "name": "non_empty_constructor_needs_parens",
+        "level": "ignore"
+    },
+    "no_unnecessary_double_quotes": {
+        "name": "no_unnecessary_double_quotes",
+        "level": "error"
+    },
+    "no_debugger": {
+        "name": "no_debugger",
+        "level": "warn"
+    },
+    "no_interpolation_in_single_quotes": {
+        "name": "no_interpolation_in_single_quotes",
+        "level": "ignore"
+    }
 }
 }

+ 115 - 0
gulpfile.coffee

@@ -0,0 +1,115 @@
+gulp = require 'gulp'
+plugins = require('gulp-load-plugins')()
+pkg = require './package.json'
+name = pkg.name
+
+SOURCE_PATH = './src'
+DIST_PATH = './dist'
+DOCS_PATH = './docs'
+SERVER_HOST = 'localhost'
+SERVER_PORT = 3000
+BANNER = """
+  /* ========================================================================
+   * <%= pkg.name %> - v<%= pkg.version %>
+   * <%= pkg.homepage %>
+   * ========================================================================
+   * Copyright 2012-2013 <%= pkg.author.name %>
+   *
+   * ========================================================================
+   * Licensed under the Apache License, Version 2.0 (the "License");
+   * you may not use this file except in compliance with the License.
+   * You may obtain a copy of the License at
+   *
+   *     http://www.apache.org/licenses/LICENSE-2.0
+   *
+   * Unless required by applicable law or agreed to in writing, software
+   * distributed under the License is distributed on an "AS IS" BASIS,
+   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   * See the License for the specific language governing permissions and
+   * limitations under the License.
+   * ========================================================================
+   */
+
+
+  """
+
+gulp.task 'coffee', ->
+  gulp
+  .src "#{SOURCE_PATH}/coffee/#{name}.coffee"
+  .pipe plugins.changed "#{DIST_PATH}/js"
+  .pipe plugins.coffeelint './coffeelint.json'
+  .pipe plugins.coffeelint.reporter()
+    .on 'error', plugins.util.log
+  .pipe plugins.coffee()
+    .on 'error', plugins.util.log
+  .pipe plugins.header BANNER, pkg: pkg
+  .pipe gulp.dest "#{DIST_PATH}/js"
+  .pipe plugins.uglify()
+  .pipe plugins.header BANNER, pkg: pkg
+  .pipe plugins.rename suffix: '.min'
+  .pipe gulp.dest "#{DIST_PATH}/js"
+
+gulp.task 'less-bootstrap2', ->
+  gulp
+  .src "#{SOURCE_PATH}/less/bootstrap2/build.less"
+  .pipe plugins.changed "#{DIST_PATH}/css/bootstrap2"
+  .pipe plugins.less()
+    .on 'error', plugins.util.log
+  .pipe plugins.header BANNER, pkg: pkg
+  .pipe plugins.rename basename: name
+  .pipe gulp.dest "#{DIST_PATH}/css/bootstrap2"
+  .pipe plugins.less compress: true, cleancss: true
+  .pipe plugins.header BANNER, pkg: pkg
+  .pipe plugins.rename suffix: '.min'
+  .pipe gulp.dest "#{DIST_PATH}/css/bootstrap2"
+
+gulp.task 'less-bootstrap3', ->
+  gulp
+  .src "#{SOURCE_PATH}/less/bootstrap3/build.less"
+  .pipe plugins.changed "#{DIST_PATH}/css/bootstrap3"
+  .pipe plugins.less()
+  .pipe plugins.header BANNER, pkg: pkg
+  .pipe plugins.rename basename: name
+  .pipe gulp.dest "#{DIST_PATH}/css/bootstrap3"
+  .pipe plugins.less compress: true, cleancss: true
+  .pipe plugins.header BANNER, pkg: pkg
+  .pipe plugins.rename suffix: '.min'
+  .pipe gulp.dest "#{DIST_PATH}/css/bootstrap3"
+
+gulp.task 'docs', ->
+  gulp
+  .src "#{DOCS_PATH}/index.jade"
+  .pipe plugins.changed './'
+  .pipe plugins.jade pretty: true
+  .pipe gulp.dest './'
+
+gulp.task 'connect', ['docs'], ->
+  plugins.connect.server
+    root: [__dirname]
+    host: SERVER_HOST
+    port: SERVER_PORT
+    livereload: true
+
+gulp.task 'open', ['connect'], ->
+  gulp
+  .src './index.html'
+  .pipe plugins.open '', url: "http://#{SERVER_HOST}:#{SERVER_PORT}"
+
+gulp.task 'watch', ['connect'], ->
+  gulp.watch "#{SOURCE_PATH}/coffee/#{name}.coffee", ['coffee']
+  gulp.watch "#{SOURCE_PATH}/less/bootstrap2/*.less", ['less-bootstrap2']
+  gulp.watch "#{SOURCE_PATH}/less/bootstrap3/*.less", ['less-bootstrap3']
+  gulp.watch "#{DOCS_PATH}/index.jade", ['docs']
+  gulp.watch [
+    "#{DIST_PATH}/js/**/*.js"
+    "#{DIST_PATH}/css/**/*.css"
+    './index.html'
+  ]
+  .on 'change', (event) ->
+    gulp.src event.path
+    .pipe plugins.connect.reload()
+
+gulp.task 'server', ['connect', 'open', 'watch']
+gulp.task 'less', ['less-bootstrap2', 'less-bootstrap3']
+gulp.task 'dist', ['coffee', 'less']
+gulp.task 'default', ['dist', 'docs', 'server']

+ 2 - 115
gulpfile.js

@@ -1,115 +1,2 @@
-var gulp = require('gulp');
-var plugins = require('gulp-load-plugins')();
-var pkg = require('./package.json');
-var name = pkg.name;
-var banner = [
-  '/* ========================================================================',
-  ' * <%= pkg.name %> - v<%= pkg.version %>',
-  ' * <%= pkg.homepage %>',
-  ' * ========================================================================',
-  ' * Copyright 2012-2013 <%= pkg.author.name %>',
-  ' *',
-  ' * ========================================================================',
-  ' * Licensed under the Apache License, Version 2.0 (the \"License\");',
-  ' * you may not use this file except in compliance with the License.',
-  ' * You may obtain a copy of the License at',
-  ' *',
-  ' *     http://www.apache.org/licenses/LICENSE-2.0',
-  ' *',
-  ' * Unless required by applicable law or agreed to in writing, software',
-  ' * distributed under the License is distributed on an \"AS IS\" BASIS,',
-  ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
-  ' * See the License for the specific language governing permissions and',
-  ' * limitations under the License.',
-  ' * ========================================================================',
-  ' */',
-  '',
-  ''].join('\n');
-
-var SERVER_HOST = 'localhost';
-var SERVER_PORT = 3000;
-
-gulp.task('coffee', function(done) {
-  gulp.src('./src/coffee/' + name + '.coffee')
-    .pipe(plugins.coffeelint('./coffeelint.json'))
-    .pipe(plugins.coffeelint.reporter())
-    .pipe(plugins.coffee()).on('error', plugins.util.log)
-    .pipe(plugins.header(banner, { pkg: pkg }))
-    .pipe(gulp.dest('./dist/js'))
-    .pipe(plugins.uglify())
-    .pipe(plugins.header(banner, { pkg: pkg }))
-    .pipe(plugins.rename({ suffix: '.min' }))
-    .pipe(gulp.dest('./dist/js'))
-    .on('end', done);
-});
-
-gulp.task('less-bootstrap2', function(done) {
-  gulp.src('./src/less/bootstrap2/build.less')
-    .pipe(plugins.less())
-    .pipe(plugins.header(banner, { pkg: pkg }))
-    .pipe(plugins.rename({ basename: name }))
-    .pipe(gulp.dest('./dist/css/bootstrap2'))
-    .pipe(plugins.less({
-      compress: true,
-      cleancss: true
-    }))
-    .pipe(plugins.header(banner, { pkg: pkg }))
-    .pipe(plugins.rename({ suffix: '.min' }))
-    .pipe(gulp.dest('./dist/css/bootstrap2'))
-    .on('end', done);
-});
-
-gulp.task('less-bootstrap3', function(done) {
-  gulp.src('./src/less/bootstrap3/build.less')
-    .pipe(plugins.less())
-    .pipe(plugins.header(banner, { pkg: pkg }))
-    .pipe(plugins.rename({ basename: name }))
-    .pipe(gulp.dest('./dist/css/bootstrap3'))
-    .pipe(plugins.less({
-      compress: true,
-      cleancss: true
-    }))
-    .pipe(plugins.header(banner, { pkg: pkg }))
-    .pipe(plugins.rename({ suffix: '.min' }))
-    .pipe(gulp.dest('./dist/css/bootstrap3'))
-    .on('end', done);
-});
-
-gulp.task('docs', function(done) {
-  gulp.src('./docs/index.jade')
-    .pipe(plugins.jade({ pretty: true }))
-    .pipe(gulp.dest('./'))
-    .on('end', done);
-});
-
-gulp.task('open', ['connect'], function(done) {
-  gulp.src('./index.html')
-    .pipe(plugins.open('', { url: 'http://' + SERVER_HOST + ':' + SERVER_PORT }))
-    .on('end', done);
-});
-
-gulp.task('connect', function(done) {
-  plugins.connect.server({
-    root: [__dirname],
-    host: SERVER_HOST,
-    port: SERVER_PORT,
-    livereload: true
-  });
-  done();
-});
-
-gulp.task('watch', ['connect'], function() {
-  var change = function(data) {
-    gulp.src(data.path).pipe(plugins.connect.reload());
-  };
-
-  gulp.watch('./src/coffee/' + name + '.coffee', ['coffee']).on('change', change);
-  gulp.watch('./src/less/bootstrap2/*.less', ['less-bootstrap2']).on('change', change);
-  gulp.watch('./src/less/bootstrap3/*.less', ['less-bootstrap3']).on('change', change);
-  gulp.watch('./docs/index.jade', ['docs']).on('change', change);
-});
-
-gulp.task('server', ['connect', 'open']);
-gulp.task('less', ['less-bootstrap2', 'less-bootstrap3']);
-gulp.task('build', ['coffee', 'less']);
-gulp.task('default', ['server', 'build', 'docs', 'watch']);
+require('coffee-script/register');
+require('./gulpfile.coffee');

+ 7 - 4
package.json

@@ -37,17 +37,20 @@
   "license": "Apache Version 2",
   "license": "Apache Version 2",
   "readmeFilename": "README.md",
   "readmeFilename": "README.md",
   "devDependencies": {
   "devDependencies": {
-    "gulp-coffee": "~1.4.1",
+    "gulp-coffee": "~1.4.2",
     "gulp-util": "~2.2.14",
     "gulp-util": "~2.2.14",
     "gulp-header": "~1.0.2",
     "gulp-header": "~1.0.2",
     "gulp-uglify": "~0.2.1",
     "gulp-uglify": "~0.2.1",
     "gulp-coffeelint": "~0.3.2",
     "gulp-coffeelint": "~0.3.2",
-    "gulp": "~3.6.2",
+    "gulp": "~3.6.1",
     "gulp-less": "~1.2.3",
     "gulp-less": "~1.2.3",
     "gulp-rename": "~1.2.0",
     "gulp-rename": "~1.2.0",
     "gulp-open": "~0.2.8",
     "gulp-open": "~0.2.8",
     "gulp-load-plugins": "~0.5.0",
     "gulp-load-plugins": "~0.5.0",
-    "gulp-jade": "~0.4.2",
-    "gulp-connect": "~2.0.4"
+    "gulp-jade": "~0.5.0",
+    "run-sequence": "~0.3.6",
+    "gulp-connect": "~2.0.5",
+    "coffee-script": "~1.7.1",
+    "gulp-changed": "~0.3.0"
   }
   }
 }
 }