| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 | gulp = require 'gulp'$ = require('gulp-load-plugins') lazy: falseextend = require('util')._extendkarma = require('karma').serverkarmaConfig = require './karma.json'pkg = require './package.json'name = pkg.namepaths =  src: 'src'  dist: 'dist'  test: 'test'  docs: "./"server =  host: 'localhost'  port: 3000banner = """  /* ========================================================================   * <%= 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 "#{paths.src}/coffee/#{name}.coffee"  .pipe $.changed "#{paths.dist}/js"  .pipe $.coffeelint 'coffeelint.json'  .pipe $.coffeelint.reporter()  .pipe $.coffeelint.reporter("fail")  .pipe $.coffee()    .on 'error', $.util.log  .pipe $.header banner, pkg: pkg  .pipe gulp.dest "#{paths.dist}/js"  .pipe gulp.dest paths.test  .pipe $.uglify()  .pipe $.header banner, pkg: pkg  .pipe $.rename suffix: '.min'  .pipe gulp.dest "#{paths.dist}/js"gulp.task 'less-bootstrap2', ->  gulp  .src "#{paths.src}/less/bootstrap2/build.less"  .pipe $.changed "#{paths.dist}/css/bootstrap2"  .pipe $.less()    .on 'error', $.util.log  .pipe $.header banner, pkg: pkg  .pipe $.rename basename: name  .pipe gulp.dest "#{paths.dist}/css/bootstrap2"  .pipe $.less compress: true, cleancss: true  .pipe $.header banner, pkg: pkg  .pipe $.rename suffix: '.min'  .pipe gulp.dest "#{paths.dist}/css/bootstrap2"gulp.task 'less-bootstrap3', ->  gulp  .src "#{paths.src}/less/bootstrap3/build.less"  .pipe $.changed "#{paths.dist}/css/bootstrap3"  .pipe $.less()  .pipe $.header banner, pkg: pkg  .pipe $.rename basename: name  .pipe gulp.dest "#{paths.dist}/css/bootstrap3"  .pipe $.less compress: true, cleancss: true  .pipe $.header banner, pkg: pkg  .pipe $.rename suffix: '.min'  .pipe gulp.dest "#{paths.dist}/css/bootstrap3"gulp.task 'docs', ->  gulp  .src "#{paths.src}/docs/*.jade"  .pipe $.changed paths.docs  .pipe $.jade pretty: true  .pipe gulp.dest paths.docsgulp.task 'test-coffee', ['coffee'], ->  gulp  .src "#{paths.src}/coffee/#{name}.tests.coffee"  .pipe $.changed paths.test  .pipe $.coffeelint 'coffeelint.json'  .pipe $.coffeelint.reporter()    .on 'error', $.util.log  .pipe $.coffee()    .on 'error', $.util.log  .pipe gulp.dest paths.testgulp.task 'test-go', ['test-coffee'], (done) ->  karma.start extend(karmaConfig, singleRun: true), donegulp.task 'connect', ['docs'], ->  $.connect.server    root: [__dirname]    host: server.host    port: server.port    livereload: truegulp.task 'open', ['connect'], ->  gulp  .src 'index.html'  .pipe $.open '', url: "http://#{server.host}:#{server.port}"gulp.task 'watch', ['connect'], ->  gulp.watch "#{paths.src}/coffee/#{name}.coffee", ['coffee']  gulp.watch "#{paths.src}/less/bootstrap2/*.less", ['less-bootstrap2']  gulp.watch "#{paths.src}/less/bootstrap3/*.less", ['less-bootstrap3']  gulp.watch "#{paths.src}/docs/*.jade", ['docs']  gulp.watch [    "#{paths.dist}/js/**/*.js"    "#{paths.dist}/css/**/*.css"    '*.html'  ]  .on 'change', (event) ->    gulp.src event.path    .pipe $.connect.reload()gulp.task 'server', ['connect', 'open', 'watch']gulp.task 'less', ['less-bootstrap2', 'less-bootstrap3']gulp.task 'dist', ['coffee', 'less']gulp.task 'test', ['coffee', 'test-coffee', 'test-go']gulp.task 'default', ['dist', 'docs', 'server']
 |