Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitPublish
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
felix
gitPublish
Commits
0b69d61f
Commit
0b69d61f
authored
May 21, 2018
by
felix
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
229949be
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
23 deletions
+37
-23
cmd.js
+7
-11
config.js
+10
-0
sh/checkoutTag.sh
+2
-2
sh/pull.sh
+2
-1
yarn-error.log
+16
-9
No files found.
cmd.js
View file @
0b69d61f
...
@@ -13,15 +13,9 @@ const rl = readline.createInterface({
...
@@ -13,15 +13,9 @@ const rl = readline.createInterface({
let
json
=
{
let
json
=
{
'shPath'
:
'/data/sh'
,
'shPath'
:
'/data/sh'
,
'basePath'
:
'/data'
,
'basePath'
:
'/data'
'product'
:{
'sample'
:{
git
:
'git@116.62.143.3:sample/server-app.git'
,
path
:
'/nserver/app/sample'
}
}
}
}
json
=
Object
.
assign
(
json
,
require
(
'./config'
))
let
defaultArgs
=
[];
let
defaultArgs
=
[];
defaultArgs
.
push
(
'exec'
)
defaultArgs
.
push
(
'exec'
)
defaultArgs
.
push
(
'-i'
)
defaultArgs
.
push
(
'-i'
)
...
@@ -68,7 +62,7 @@ async function rollbackProcess(productName){
...
@@ -68,7 +62,7 @@ async function rollbackProcess(productName){
args
.
push
(
`
${
json
.
shPath
}
/checkoutTag.sh`
)
args
.
push
(
`
${
json
.
shPath
}
/checkoutTag.sh`
)
args
.
push
(
json
.
basePath
)
args
.
push
(
json
.
basePath
)
args
=
formatArgs
(
productName
,
args
)
args
=
formatArgs
(
productName
,
args
,
false
,
true
)
let
tagName
=
await
makeQuestion
(
'请选择要切换的tag(直接回车切换到最新的tag)'
)
let
tagName
=
await
makeQuestion
(
'请选择要切换的tag(直接回车切换到最新的tag)'
)
args
.
push
(
tagName
)
args
.
push
(
tagName
)
exec
(
defaultArgs
.
concat
(
args
))
exec
(
defaultArgs
.
concat
(
args
))
...
@@ -79,7 +73,7 @@ async function publishProcess(productName){
...
@@ -79,7 +73,7 @@ async function publishProcess(productName){
let
args
=
[]
let
args
=
[]
args
.
push
(
`
${
json
.
shPath
}
/pull.sh`
)
args
.
push
(
`
${
json
.
shPath
}
/pull.sh`
)
args
.
push
(
json
.
basePath
)
args
.
push
(
json
.
basePath
)
args
=
formatArgs
(
productName
,
args
)
args
=
formatArgs
(
productName
,
args
,
false
,
true
)
exec
(
defaultArgs
.
concat
(
args
))
exec
(
defaultArgs
.
concat
(
args
))
}
}
...
@@ -105,11 +99,13 @@ async function cloneProcess(productName){
...
@@ -105,11 +99,13 @@ async function cloneProcess(productName){
exec
(
defaultArgs
.
concat
(
args
))
exec
(
defaultArgs
.
concat
(
args
))
}
}
function
formatArgs
(
productName
,
args
,
needGit
=
false
){
function
formatArgs
(
productName
,
args
,
needGit
=
false
,
needPM2
=
false
){
let
info
=
json
.
product
[
productName
];
let
info
=
json
.
product
[
productName
];
if
(
needGit
)
if
(
needGit
)
args
.
push
(
info
.
git
)
args
.
push
(
info
.
git
)
args
.
push
(
json
.
basePath
+
info
.
path
)
args
.
push
(
json
.
basePath
+
info
.
path
)
if
(
needPM2
)
args
.
push
(
info
.
pm2
)
return
args
;
return
args
;
}
}
...
...
config.js
0 → 100644
View file @
0b69d61f
module
.
exports
=
{
'basePath'
:
'/data'
,
'product'
:{
'sample'
:{
git
:
'git@116.62.143.3:sample/server-app.git'
,
path
:
'/nserver/app/sample'
,
pm2
:
'sample'
}
}
}
sh/checkoutTag.sh
View file @
0b69d61f
...
@@ -4,5 +4,5 @@ set -e
...
@@ -4,5 +4,5 @@ set -e
base_path
=
"
$1
"
base_path
=
"
$1
"
cd
$base_path
cd
$base_path
cd
$2
cd
$2
git checkout
$
3
git checkout
$
4
pm2 reload
$
2
pm2 reload
$
3
sh/pull.sh
View file @
0b69d61f
...
@@ -4,5 +4,6 @@ set -e
...
@@ -4,5 +4,6 @@ set -e
base_path
=
"
$1
"
base_path
=
"
$1
"
cd
$base_path
cd
$base_path
cd
$2
cd
$2
git checkout release
git pull
git pull
pm2 reload
$
2
pm2 reload
$
3
yarn-error.log
View file @
0b69d61f
Arguments:
Arguments:
/usr/local/bin/node /usr/local/Cellar/yarn/1.5.1_1/libexec/bin/yarn.js run p
r
/usr/local/bin/node /usr/local/Cellar/yarn/1.5.1_1/libexec/bin/yarn.js run p
d
PATH:
PATH:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/felix/Library/Android/sdk/tools:/Users/felix/Library/Android/sdk/platform-tools:/Users/felix/Library/Android/sdk/tools:/Users/felix/Library/Android/sdk/platform-tools
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/felix/Library/Android/sdk/tools:/Users/felix/Library/Android/sdk/platform-tools:/Users/felix/Library/Android/sdk/tools:/Users/felix/Library/Android/sdk/platform-tools
...
@@ -24,7 +24,7 @@ npm manifest:
...
@@ -24,7 +24,7 @@ npm manifest:
"scripts": {
"scripts": {
"pr": "node cmd.js test",
"pr": "node cmd.js test",
"pd": "node cmd.js test"
"pd": "node cmd.js test"
}
,
}
}
}
yarn manifest:
yarn manifest:
...
@@ -34,10 +34,17 @@ Lockfile:
...
@@ -34,10 +34,17 @@ Lockfile:
No lockfile
No lockfile
Trace:
Trace:
SyntaxError: /Users/felix/Desktop/ugengit/node/gitPublish/package.json: Unexpected token } in JSON at position 261
Error: Command failed.
at JSON.parse (<anonymous>)
Exit code: 1
at /usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:1036:59
Command: sh
at Generator.next (<anonymous>)
Arguments: -c node cmd.js test
at step (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:98:30)
Directory: /Users/felix/Desktop/ugengit/node/gitPublish
at /usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:109:13
Output:
at <anonymous>
at ProcessTermError.MessageError (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:186:110)
at new ProcessTermError (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:226:113)
at ChildProcess.<anonymous> (/usr/local/Cellar/yarn/1.5.1_1/libexec/lib/cli.js:30281:17)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
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