Permalink
Browse files

Updates tasks and tests

  • Loading branch information...
1 parent 6c0bbcc commit f38b05cf9578bd3feaf1a3cf11b8c3aac59a5820 @kennethormandy kennethormandy committed Oct 29, 2015
Showing with 37 additions and 43 deletions.
  1. +18 −3 gulpfile.js
  2. +6 −27 index.js
  3. +6 −2 package.json
  4. +1 −0 test/fixtures/gulp-test-1.surge.sh/index.html
  5. +6 −11 test/test.js
View
@@ -1,11 +1,26 @@
var gulp = require('gulp')
var surge = require('./')
+var mocha = require('gulp-mocha')
+var standard = require('gulp-standard')
-gulp.task('default', ['deploy'])
+gulp.task('default', ['test', 'deploy', 'lint'])
+
+gulp.task('test', function () {
+ return gulp.src('./test/**/*.js', { read: false })
+ .pipe(mocha({ timeout: 1000 }))
+})
gulp.task('deploy', [], function () {
return surge({
- project: './www',
- domain: 'gulp-test-11.surge.sh'
+ project: './test/fixtures/gulp-test-1.surge.sh',
+ domain: 'gulp-test-1.surge.sh'
})
})
+
+gulp.task('lint', [], function () {
+ return gulp.src(['./index.js', './test/**/*.js'])
+ .pipe(standard())
+ .pipe(standard.reporter('default', {
+ breakOnError: false
+ }))
+})
View
@@ -1,32 +1,11 @@
-var gulp = require('gulp')
+'use strict'
+
+// var gutil = require('gulp-util')
var spawn = require('child_process').spawn
-var gutil = require('gulp-util')
var path = require('path')
// var surge = require('surge')
-var surgeBin = path.resolve(path.dirname(require.resolve('surge')), '../../.bin/surge' + (process.platform === 'win32' ? '.cmd' : ''))
-
-module.exports = function(options) {
-
- // Merge the default options with task specific ones
- // var opts = options({
- // project: '',
- // domain: ''
- // })
-
- var surge = spawn(surgeBin, [options.project, options.domain])
-
- surge.stdout.on('data', function (data) {
- console.log(data + '')
- })
-
- surge.stderr.on('data', function (data) {
- gutil.log('stderr: ' + data)
- })
-
- surge.on('close', function (code) {
- if (code !== 0) {
- gutil.log('process exited with code ' + code)
- }
- })
+var surge = path.resolve(path.dirname(require.resolve('surge')), '../../.bin/surge' + (process.platform === 'win32' ? '.cmd' : ''))
+module.exports = function (options) {
+ return spawn(surge, [options.project, options.domain], { stdio: 'inherit' })
}
View
@@ -9,10 +9,14 @@
},
"devDependencies": {
"chai": "1.10.0",
+ "gulp-mocha": "2.1.3",
+ "gulp-standard": "5.2.2",
"mocha": "2.3.3",
- "standard": "5.3.1"
+ "should": "7.1.1"
},
"scripts": {
- "test": "mocha test"
+ "test": "gulp test",
+ "start": "gulp",
+ "lint": "gulp lint"
}
}
@@ -0,0 +1 @@
+<h1>Gulp test 1</h1>
View
@@ -1,21 +1,16 @@
-var fs = require('fs')
-var chai = require('chai')
-var es = require('event-stream')
-var gutil = require('gulp-util')
+/* global it, describe */
+
var surge = require('../')
-var expect = chai.expect
+var should = require('should')
describe('gulp-surge', function () {
- this.timeout(10000)
-
describe('basic', function () {
-
it('should be cool', function (done) {
done()
})
-
- it('should publish a project', function (done) {
-
+ it('should exist', function (done) {
+ should(surge).exist
+ done()
})
})
})

0 comments on commit f38b05c

Please sign in to comment.