Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
srvpro
Commits
0f0b09bd
Commit
0f0b09bd
authored
Jun 24, 2018
by
mercury233
Committed by
GitHub
Jun 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update util: make log since commit
parent
575a2076
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
ygopro-update.js
ygopro-update.js
+9
-4
No files found.
ygopro-update.js
View file @
0f0b09bd
...
...
@@ -158,12 +158,16 @@ var fetchDatas = function() {
});
}
var
updateChangelogs
=
function
(
message
)
{
var
updateChangelogs
=
function
(
dir
,
message
)
{
message
=
message
.
split
(
"
!换行符!
"
).
join
(
"
\n
"
);
change_log
=
{};
change_log
.
title
=
"
服务器更新
"
;
change_log
.
date
=
moment
().
format
(
"
YYYY-MM-DD
"
);
change_log
.
text
=
message
;
var
prc_git_rev
=
spawnSync
(
"
git
"
,
[
"
rev-parse
"
,
"
HEAD
"
],
{
"
cwd
"
:
dir
});
if
(
prc_git_rev
.
stdout
)
{
change_log
.
commit
=
prc_git_rev
.
stdout
.
toString
().
split
(
/
\n
/
)[
0
];
}
changelog
.
unshift
(
change_log
);
fileContent
=
JSON
.
stringify
({
changelog
:
changelog
},
null
,
2
);
fs
.
writeFileSync
(
config
.
html_path
+
config
.
changelog_filename
,
fileContent
);
...
...
@@ -173,7 +177,7 @@ var updateChangelogs = function(message) {
var
pushHTMLs
=
function
()
{
try
{
execSync
(
'
git add
'
+
config
.
changelog_filename
,
{
cwd
:
config
.
git_html_path
,
env
:
process
.
env
});
//
execSync('git commit -m update-auto', { cwd: config.git_html_path, env: process.env });
execSync
(
'
git commit -m update-auto
'
,
{
cwd
:
config
.
git_html_path
,
env
:
process
.
env
});
}
catch
(
error
)
{
sendResponse
(
"
git error:
"
+
error
.
stdout
);
}
...
...
@@ -242,7 +246,8 @@ http.createServer(function (req, res) {
res
.
writeHead
(
200
);
var
date
=
moment
(
changelog
[
0
].
date
).
add
(
1
,
'
days
'
).
format
(
"
YYYY-MM-DD
"
);
res
.
end
(
u
.
query
.
callback
+
'
({"message":"开始生成
'
+
date
+
'
以来的更新记录:"});
'
);
makeChangelogs
(
config
.
script_path
,
"
--since=
"
+
date
);
var
since
=
changelog
[
0
].
commit
?
(
changelog
[
0
].
commit
+
"
..
"
)
:
(
"
--since=
"
+
date
);
makeChangelogs
(
config
.
script_path
,
since
);
}
else
if
(
u
.
pathname
===
'
/api/make_more_changelog
'
)
{
res
.
writeHead
(
200
);
...
...
@@ -252,7 +257,7 @@ http.createServer(function (req, res) {
else
if
(
u
.
pathname
===
'
/api/update_changelog
'
)
{
res
.
writeHead
(
200
);
res
.
end
(
u
.
query
.
callback
+
'
({"message":"开始写入更新记录。"});
'
);
updateChangelogs
(
u
.
query
.
message
);
updateChangelogs
(
config
.
script_path
,
u
.
query
.
message
);
}
else
if
(
u
.
pathname
===
'
/api/push_datas
'
)
{
res
.
writeHead
(
200
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment