-
Notifications
You must be signed in to change notification settings - Fork 79
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
7 changed files
with
76 additions
and
5 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
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
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
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
methods: { | ||
async deploy () { | ||
if (await this.isModified()) { | ||
this.commit('simple-git') | ||
this.commit('Commit at ' + this.dateFormat('yyyy-MM-dd HH:mm:ss', new Date())) | ||
} else { | ||
this.$notify({message: '资料库无变更', type: 'warning'}) | ||
} | ||
|
@@ -24,7 +24,9 @@ | |
async isModified () { | ||
try { | ||
let statusSummary = await this.git().status() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gaoyoubo
Author
Owner
|
||
return statusSummary.modified.length > 0 | ||
if (statusSummary.modified.length > 0) return true | ||
if (statusSummary.not_added.length > 0) return true | ||
return false | ||
} catch (e) { | ||
console.error(e) | ||
return false | ||
|
@@ -59,6 +61,27 @@ | |
workingDir () { | ||
let config = this.$store.state.Config.config | ||
return config.path | ||
}, | ||
dateFormat (fmt, date) { | ||
var o = { | ||
'M+': date.getMonth() + 1, | ||
'd+': date.getDate(), | ||
'h+': date.getHours(), | ||
'm+': date.getMinutes(), | ||
's+': date.getSeconds(), | ||
'q+': Math.floor((date.getMonth() + 3) / 3), | ||
'S': date.getMilliseconds() | ||
} | ||
if (/(y+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)) | ||
} | ||
for (var k in o) { | ||
if (new RegExp('(' + k + ')').test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) | ||
} | ||
} | ||
return fmt | ||
} | ||
} | ||
|
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
这里貌似用git做监测和发布?
为什么不直接用
hexo clean/g/d ?