Skip to content

Commit

Permalink
updated to gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
calidion committed Mar 14, 2016
1 parent 498384c commit 213d43d
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 162 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
15 changes: 0 additions & 15 deletions .jshintrc

This file was deleted.

10 changes: 2 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
sudo: false
language: node_js
node_js:
- '5.0'
- '4.2'
- '4.1'
- '4.0'
- v5
- v4
- '0.12'
- '0.10'

script: "npm run-script test-travis"
after_script: "npm install coveralls && cat ./coverage/lcov.info | coveralls"
3 changes: 0 additions & 3 deletions .yo-rc.json

This file was deleted.

48 changes: 0 additions & 48 deletions Gruntfile.js

This file was deleted.

13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2016 calidion <calidion@gmail.com> (calidion.github.io)

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.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coveralls Status][coveralls-image]][coveralls-url]
# node-weixin-request [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
>
> Requests for weixin apis

## Install
## Installation

```sh
$ npm install --save node-weixin-request
```


## Usage


```js
var nodeWeixinRequest = require('node-weixin-request');

Expand Down Expand Up @@ -55,10 +53,17 @@ var ssl = {

//ssl格式2
var ssl = {
pkcs12: file, //全局文件名
pfx: 'p12文件的base64',
pfxKey: 'sodosodf'
};

// 已经废弃
// ssl格式3
// var ssl = {
// pkcs12: file, //全局文件名
// pfxKey: 'sodosodf'
// };

var reply = "<xml><data>aodsosfd</data></xml>";

nodeWeixinRequest.xmlssl(url, '<xml></xml>', ssl, function (error, json) {
Expand All @@ -80,10 +85,9 @@ nodeWeixinRequest.download(url, {hel:'sdfsfd'}, file, function (error, json) {

```


## License

MIT © [node-weixin](blog.3gcnbeta.com)
Apache-2.0 © [calidion](calidion.github.io)


[npm-image]: https://badge.fury.io/js/node-weixin-request.svg
Expand All @@ -92,5 +96,5 @@ MIT © [node-weixin](blog.3gcnbeta.com)
[travis-url]: https://travis-ci.org/node-weixin/node-weixin-request
[daviddm-image]: https://david-dm.org/node-weixin/node-weixin-request.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/node-weixin/node-weixin-request
[coveralls-image]: https://coveralls.io/repos/node-weixin/node-weixin-request/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/node-weixin/node-weixin-request?branch=master
[coveralls-image]: https://coveralls.io/repos/node-weixin/node-weixin-request/badge.svg
[coveralls-url]: https://coveralls.io/r/node-weixin/node-weixin-request
62 changes: 62 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';
var path = require('path');
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var excludeGitignore = require('gulp-exclude-gitignore');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var nsp = require('gulp-nsp');
var plumber = require('gulp-plumber');
var coveralls = require('gulp-coveralls');

gulp.task('static', function () {
return gulp.src('**/*.js')
.pipe(excludeGitignore())
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('nsp', function (cb) {
nsp({package: path.resolve('package.json')}, cb);
});

gulp.task('pre-test', function () {
return gulp.src('lib/**/*.js')
.pipe(excludeGitignore())
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});

gulp.task('test', ['pre-test'], function (cb) {
var mochaErr;

gulp.src('test/**/*.js')
.pipe(plumber())
.pipe(mocha({reporter: 'spec'}))
.on('error', function (err) {
mochaErr = err;
})
.pipe(istanbul.writeReports())
.on('end', function () {
cb(mochaErr);
});
});

gulp.task('watch', function () {
gulp.watch(['lib/**/*.js', 'test/**'], ['test']);
});

gulp.task('coveralls', ['test'], function () {
if (!process.env.CI) {
return;
}

gulp.src(path.join(__dirname, 'coverage/lcov.info'))
.pipe(coveralls());
});

gulp.task('prepublish', ['nsp']);
gulp.task('default', ['static', 'test', 'coveralls']);
Loading

0 comments on commit 213d43d

Please sign in to comment.