Skip to content

Commit

Permalink
Switch to gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed May 11, 2014
1 parent 3ee367c commit 5b780bf
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 10,751 deletions.
66 changes: 0 additions & 66 deletions Gruntfile.js

This file was deleted.

12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install
Generate:

``` bash
$ grunt
$ gulp
$ hexo generate
```

Expand All @@ -33,14 +33,8 @@ $ hexo server
$ npm install hexo -g
```
- [YUIDoc](http://yui.github.io/yuidoc/)
- [Gulp](http://gulpjs.com/)
``` bash
$ npm install yuidocjs -g
```
- [Grunt](http://gruntjs.com/)
``` bash
$ npm install grunt-cli -g
$ npm install gulp -g
```
52 changes: 52 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
var gulp = require('gulp'),
yuidoc = require('gulp-yuidoc'),
clean = require('gulp-clean'),
shell = require('gulp-shell'),
rename = require('gulp-rename');

gulp.task('clean-hexo', function(){
return gulp.src('tmp/hexo/', {read: false})
.pipe(clean());
});

gulp.task('clean-warehouse', function(){
return gulp.src('tmp/warehouse/', {read: false})
.pipe(clean());
});

gulp.task('clean-yuidoc', function(){
return gulp.src('source/_yuidoc/', {read: false})
.pipe(clean());
});

gulp.task('clean', ['clean-hexo', 'clean-warehouse', 'clean-yuidoc']);

gulp.task('clone-hexo', ['clean-hexo'], shell.task(['git clone https://github.com/tommy351/hexo.git -b dev tmp/hexo']));

gulp.task('clone-warehouse', ['clean-warehouse'], shell.task(['git clone https://github.com/tommy351/warehouse.git -b develop tmp/warehouse']));

gulp.task('clone', ['clone-hexo', 'clone-warehouse']);

gulp.task('yuidoc-hexo', ['clone-hexo'], function(){
return gulp.src('tmp/hexo/lib/**/*.js')
.pipe(yuidoc.parser({
project: require('./tmp/hexo/package.json')
}))
.pipe(rename('index.json'))
.pipe(gulp.dest('source/_yuidoc/'));
});

gulp.task('yuidoc-warehouse', ['clone-warehouse'], function(){
return gulp.src('tmp/warehouse/lib/**/*.js')
.pipe(yuidoc.parser({
project: require('./tmp/warehouse/package.json')
}))
.pipe(rename('warehouse.json'))
.pipe(gulp.dest('source/_yuidoc/'));
});

gulp.task('yuidoc', ['yuidoc-hexo', 'yuidoc-warehouse']);

gulp.task('default', ['yuidoc'], function(){
return gulp.start('clean-hexo', 'clean-warehouse');
});
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{
"name": "hexo",
"version": "2.5.6",
"version": "2.5.7",
"private": true,
"dependencies": {
"hexo-renderer-jade": "0.0.2",
"hexo-yuidoc": "0.0.3",
"hexo-generator-sitemap": "0.1.1"
"hexo-renderer-ejs": "^0.1.0",
"hexo-renderer-marked": "^0.1.0",
"hexo-renderer-stylus": "^0.1.0",
"hexo-renderer-jade": "^0.1.0",
"hexo-yuidoc": "^0.1.0",
"hexo-generator-sitemap": "^0.1.2"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-git": "~0.2.2",
"load-grunt-tasks": "~0.2.0",
"grunt-contrib-yuidoc": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.4.1"
"gulp": "^3.6.2",
"gulp-clean": "^0.2.4",
"gulp-yuidoc": "^0.1.2",
"gulp-shell": "^0.2.4",
"gulp-rename": "^1.2.0"
}
}
9 changes: 4 additions & 5 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ var links = {
warehouse: 'https://github.com/tommy351/warehouse'
};

var rTmpDir = /^tmp\/(\w+)\//;

hexo.extend.helper.register('github_link', function(data){
var name = data.file.match(rTmpDir)[1];
var match = data.file.match(/(\w+)\/lib\/(.+)/),
name = match[1],
path = 'lib/' + match[2];

if (name === 'hexo') name = 'index';

var path = data.file.replace(rTmpDir, ''),
line = data.line,
var line = data.line,
version = this.site.yuidoc.findByName(name).project.version || 'master';

return '<a href="' + links[name] + '/blob/' + version + '/' + path + '#L' + line + '">' + path + ':' + line + '</a>';
Expand Down
Loading

0 comments on commit 5b780bf

Please sign in to comment.