build-reporter
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -16,3 +16,11 @@ module.exports = function(grunt) { | ||
port: 8000, | ||
base: '_site' | ||
base: '_site', | ||
//keepalive: true, | ||
middleware: function(connect, options) { | ||
return [ | ||
require('connect-livereload')(), | ||
connect.static(options.base), | ||
connect.directory(options.base) | ||
]; | ||
} | ||
} | ||
@@ -32,2 +40,3 @@ } | ||
grunt.registerTask('default', ['connect', 'watch']); | ||
}; | ||
}; | ||
@@ -5,2 +5,8 @@ # History | ||
## 0.1.3 | ||
- 修复读取其他月日期的错误 | ||
- livereload 脚本自动插入 | ||
- 按月报表日期错 | ||
## 0.1.2 | ||
@@ -7,0 +13,0 @@ |
@@ -120,5 +120,3 @@ var path = require('path'); | ||
function createMonth() { | ||
var data = { | ||
day_rate: [] | ||
}; | ||
var months = _(ls(dataDir + '/*.json')).groupBy(function(item) { | ||
@@ -129,7 +127,12 @@ var m = item.match(/\/(\d{4}-\d{2}-\d{2})\.json$/); | ||
if (!key) return; | ||
var h = _.map(item, function(o) { | ||
var h = _(item).filter(function(item) { | ||
return new RegExp(key).test(item); | ||
}).map(function(o) { | ||
return o.match(/-(\d{2})\.json$/)[1]; | ||
}); | ||
var data = { | ||
day_rate: [] | ||
}; | ||
_() | ||
@@ -143,2 +146,3 @@ .range(lastDayOfMonth(key)) | ||
} | ||
data['day_rate'].push({ | ||
@@ -145,0 +149,0 @@ type: item, |
@@ -10,2 +10,3 @@ var path = require('path'); | ||
var monthTemplate = jade.compile(fs.readFileSync(path.join(templateDir, 'month.jade'))); | ||
var homePage = fs.readFileSync(path.join(templateDir, 'index.html')); | ||
@@ -19,3 +20,3 @@ module.exports = function(src, dest) { | ||
// 临时解决根目录不能为空的问题 | ||
fs.writeFileSync(path.join(dest, 'temp'), 'temp'); | ||
fs.writeFileSync(path.join(dest, 'index.html'), homePage); | ||
@@ -29,2 +30,3 @@ var days = ls(dataDir + '/*.json') | ||
var d = parseDest(dest, item); | ||
var currentMonth = item.split('-')[1]; | ||
@@ -38,3 +40,4 @@ // copy index.html | ||
dates: days.map(function(item) { | ||
return item.split('-')[2]; | ||
var m = item.split('-'); | ||
return currentMonth === m[1] ? m[2] : ''; | ||
}).filter(function(item) { | ||
@@ -41,0 +44,0 @@ return item; |
{ | ||
"family": "site", | ||
"name": "build-reporter", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "", | ||
@@ -17,3 +17,5 @@ "dependencies": { | ||
"grunt": "*", | ||
"grunt-contrib-watch": "*" | ||
"grunt-contrib-connect": "*", | ||
"grunt-contrib-watch": "*", | ||
"connect-livereload": "*" | ||
}, | ||
@@ -20,0 +22,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
828
25750
4