-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
280 changed files
with
7,693 additions
and
10,722 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.DS_Store | ||
node_modules | ||
tmp | ||
debug.log | ||
.idea | ||
node_modules/ | ||
tmp/ | ||
*.log | ||
.idea/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
{ | ||
"proto": true, | ||
"eqnull": true, | ||
"expr": true, | ||
"indent": 2, | ||
"node": true, | ||
"trailing": true, | ||
"quotmark": "single" | ||
"quotmark": "single", | ||
"undef": true, | ||
"unused": "vars", | ||
"globals": { | ||
"Promise": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
test/ | ||
tmp | ||
debug.log | ||
tmp/ | ||
coverage/ | ||
*.log | ||
.jshintrc | ||
.travis.yml | ||
gulpfile.js | ||
.idea/ | ||
appveyor.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
language: node_js | ||
|
||
node_js: | ||
- "0.10" | ||
- "0.11" | ||
before_script: | ||
- npm install -g gulp | ||
|
||
script: | ||
- npm test | ||
|
||
after_script: | ||
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js | ||
- cat ./coverage/lcov.info | ./node_modules/codeclimate-test-reporter/bin/codeclimate.js | ||
|
||
addons: | ||
code_climate: | ||
repo_token: 161a304c89a989fd09844b22ad0b3af84a930cea8915350b82ecd8fa12c92985 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Based on https://github.com/gruntjs/grunt/blob/master/appveyor.yml | ||
# http://www.appveyor.com/docs/appveyor-yml | ||
|
||
# Fix line endings in Windows. (runs before repo cloning) | ||
init: | ||
- git config --global core.autocrlf input | ||
|
||
# Test against these versions of Node.js. | ||
environment: | ||
matrix: | ||
- nodejs_version: "0.10" | ||
- nodejs_version: "0.11" | ||
|
||
# Install scripts. (runs after repo cloning) | ||
install: | ||
# Get the latest stable version of Node 0.STABLE.latest | ||
- ps: Install-Product node $env:nodejs_version | ||
# Typical npm stuff. | ||
- npm install | ||
|
||
# Post-install test scripts. | ||
test_script: | ||
# Output useful info for debugging. | ||
- node --version | ||
- npm --version | ||
# We test multiple Windows shells because of prior stdout buffering issues | ||
# filed against Grunt. https://github.com/joyent/node/issues/3584 | ||
- ps: "npm test # PowerShell" # Pass comment to PS for easier debugging | ||
- cmd: npm test | ||
|
||
# Don't actually build. | ||
build: off | ||
|
||
# Set build version format here instead of in the admin panel. | ||
version: "{build}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.DS_Store | ||
Thumbs.db | ||
db.json | ||
debug.log | ||
*.log | ||
node_modules/ | ||
public/ | ||
.deploy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
var args = require('minimist')(process.argv.slice(2)), | ||
fs = require('graceful-fs'), | ||
path = require('path'), | ||
async = require('async'), | ||
init = require('../lib/init'), | ||
cwd = process.cwd(), | ||
lastCwd = cwd; | ||
var args = require('minimist')(process.argv.slice(2)); | ||
|
||
// Find Hexo folder recursively | ||
async.doUntil( | ||
function(next){ | ||
var configFile = path.join(cwd, '_config.yml'); | ||
|
||
fs.exists(configFile, function(exist){ | ||
if (exist){ | ||
init(cwd, args); | ||
} else { | ||
lastCwd = cwd; | ||
cwd = path.dirname(cwd); | ||
next(); | ||
} | ||
}); | ||
}, | ||
function(){ | ||
return cwd === lastCwd; | ||
}, | ||
function(){ | ||
init(process.cwd(), args); | ||
} | ||
); | ||
require('../lib/cli/init')(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,48 @@ | ||
var fs = require('graceful-fs'), | ||
_ = require('lodash'), | ||
util = require('../util'), | ||
file = util.file2; | ||
var fs = require('hexo-fs'); | ||
|
||
/** | ||
* The file object of the Box class. | ||
* | ||
* @class File | ||
* @param {Box} box | ||
* @param {String} source The full path of the file. | ||
* @param {String} path The relative path of the file. | ||
* @param {String} type | ||
* @param {Object} params | ||
* @constructor | ||
* @namespace Box | ||
* @module hexo | ||
*/ | ||
var File = module.exports = function File(box, source, path, type, params){ | ||
this.box = box; | ||
this.source = source; | ||
this.path = path; | ||
this.type = type; | ||
this.params = params; | ||
}; | ||
function File(data){ | ||
this.source = data.source; | ||
this.path = data.path; | ||
this.type = data.type; | ||
this.params = data.params; | ||
|
||
if (this._context){ | ||
this._render = this._context.render; | ||
} | ||
} | ||
|
||
/** | ||
* Reads the file. | ||
* | ||
* @method read | ||
* @param {Object} [options] | ||
* @param {Function} [callback] | ||
* @async | ||
*/ | ||
File.prototype.read = function(options, callback){ | ||
if (!callback){ | ||
if (typeof options === 'function'){ | ||
callback = options; | ||
options = {}; | ||
} else { | ||
callback = function(){}; | ||
} | ||
if (!callback && typeof options === 'function'){ | ||
callback = options; | ||
options = {}; | ||
} | ||
|
||
file.readFile(this.source, options, callback); | ||
return fs.readFile(this.source, options).nodeify(callback); | ||
}; | ||
|
||
/** | ||
* Reads the file synchronizedly. | ||
* | ||
* @method read | ||
* @param {Object} [options] | ||
* @return {String} | ||
*/ | ||
File.prototype.readSync = function(options){ | ||
return file.readFileSync(this.source, options); | ||
return fs.readFileSync(this.source, options); | ||
}; | ||
|
||
/** | ||
* Gets the file status. | ||
* | ||
* @method stat | ||
* @param {Function} callback | ||
* @async | ||
*/ | ||
File.prototype.stat = function(callback){ | ||
fs.stat(this.source, callback); | ||
return fs.stat(this.source).nodeify(callback); | ||
}; | ||
|
||
/** | ||
* Gets the file status synchronizedly. | ||
* | ||
* @method statSync | ||
* @return {fs.Stats} | ||
*/ | ||
File.prototype.statSync = function(){ | ||
return fs.statSync(this.source); | ||
}; | ||
|
||
/** | ||
* Renders the file with renderers. | ||
* | ||
* @method render | ||
* @param {Object} [options] | ||
* @param {Function} [callback] | ||
* @async | ||
*/ | ||
File.prototype.render = function(options, callback){ | ||
if (!callback){ | ||
if (typeof options === 'function'){ | ||
callback = options; | ||
options = {}; | ||
} else { | ||
callback = function(){}; | ||
} | ||
if (!callback && typeof options === 'function'){ | ||
callback = options; | ||
options = {}; | ||
} | ||
|
||
hexo.render.render({path: this.source}, options, callback); | ||
return this._render.render({path: this.source}, options).nodeify(callback); | ||
}; | ||
|
||
/** | ||
* Renders the file with renderers synchronizedly. | ||
* | ||
* @method renderSync | ||
* @param {Object} [options] | ||
* @return {String} | ||
*/ | ||
File.prototype.renderSync = function(options){ | ||
return hexo.render.renderSync({path: this.source}, options); | ||
}; | ||
return this._render.renderSync({path: this.source}, options); | ||
}; | ||
|
||
module.exports = File; |
Oops, something went wrong.