Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1639ca3

Browse files
committed
init project
0 parents  commit1639ca3

File tree

6 files changed

+321
-0
lines changed

6 files changed

+321
-0
lines changed

‎.gitignore‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.*.swp
2+
.*.swo
3+
._*
4+
.DS_Store
5+
/Debug/
6+
/ImgCache/
7+
/Backup_rar/
8+
/Debug/
9+
/debug/
10+
/upload/
11+
/avatar/
12+
/.idea/
13+
/.vagrant/
14+
Vagrantfile
15+
*.orig
16+
*.aps
17+
*.APS
18+
*.chm
19+
*.exp
20+
*.pdb
21+
*.rar
22+
.smbdelete*
23+
*.sublime*
24+
.sass-cache
25+
config.rb
26+
/node_modules/
27+
npm-debug.log
28+
config.json

‎Cakefile‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{print}=require'util'
2+
{spawn}=require'child_process'
3+
4+
build= ()->
5+
os=require'os'
6+
ifos.platform()=='win32'
7+
coffeeCmd='coffee.cmd'
8+
else
9+
coffeeCmd='coffee'
10+
coffee=spawn coffeeCmd, ['-c','-o','build','src']
11+
coffee.stderr.on'data', (data)->
12+
process.stderr.writedata.toString()
13+
coffee.stdout.on'data', (data)->
14+
printdata.toString()
15+
coffee.on'exit', (code)->
16+
if code!=0
17+
process.exit code
18+
19+
test= ()->
20+
os=require'os'
21+
coffee=spawn'node', ['test/index.js']
22+
coffee.stderr.on'data', (data)->
23+
process.stderr.writedata.toString()
24+
coffee.stdout.on'data', (data)->
25+
printdata.toString()
26+
coffee.on'exit', (code)->
27+
if code!=0
28+
process.exit code
29+
30+
task'build','Build ./ from src/',->
31+
build()
32+
33+
task'test','Run unit test',->
34+
test()

‎build/robot.js‎

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎config.json.sample‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"username": "",
3+
"password": "",
4+
5+
"repos": [
6+
{
7+
"user": "xxx",
8+
"name": "xxx",
9+
"labels": "xxx",
10+
"command": "xxx"
11+
}
12+
]
13+
}

‎package.json‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name":"deploy-robot",
3+
"version":"1.0.0",
4+
"description":"",
5+
"main":"build/robot.js",
6+
"scripts": {
7+
"test":"echo\"Error: no test specified\" && exit 1"
8+
},
9+
"author":"joyqi",
10+
"license":"MIT",
11+
"dependencies": {
12+
"github":"^0.2.3",
13+
"optimist":"^0.6.1",
14+
"winston":"^0.9.0"
15+
}
16+
}

‎src/robot.coffee‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
2+
fs=require'fs'
3+
ChildProcess=require'child_process'
4+
Github=require'github'
5+
winston=require'winston'
6+
argv=require'optimist'
7+
.default'c','config.json'
8+
.argv
9+
10+
logger=newwinston.Logger
11+
transports: [
12+
newwinston.transports.Console
13+
handleExceptions:yes
14+
level:'info'
15+
prettyPrint:yes
16+
colorize:yes
17+
timestamp:yes
18+
]
19+
exitOnError:no
20+
levels:
21+
info:0
22+
warn:1
23+
error:3
24+
colors:
25+
info:'green'
26+
warn:'yellow'
27+
error:'red'
28+
29+
ifnotfs.existsSyncargv.c
30+
process.exit1
31+
32+
config=JSON.parsefs.readFileSyncargv.c
33+
github=newGithubversion:'3.0.0'
34+
35+
github.authenticate
36+
username:config.username
37+
password:config.password
38+
type:'basic'
39+
40+
41+
# 处理条目
42+
processIssues= (issues,repo)->
43+
for issuein issues
44+
logger.info"found deploy issue#{repo.user}/#{repo.name}/issues/#{issue.number}"
45+
46+
logger.info"assigning to self(#{config.username})"
47+
github.issues.edit
48+
user:repo.user
49+
repo:repo.name
50+
number:issue.number
51+
assignee:config.username
52+
53+
logger.info"posting a comment"
54+
github.issues.createComment
55+
user:repo.user
56+
repo:repo.name
57+
number:issue.number
58+
body:'收到, 正在准备上线...'
59+
60+
ChildProcess.execrepo.command, (err,result,error)->
61+
body=''
62+
if err
63+
body+="上线过程遇到了错误, 请尝试修复它, 我将在五分钟后再次尝试上线一次\n\n"
64+
body+="## 控制台输出\n```\n#{result}\n```\n\n"ifresult.length>0
65+
body+="## 错误输出\n```\n#{error}\n```\n\n"iferror.length>0
66+
logger.error err
67+
else
68+
body+="上线成功\n\n"
69+
body+="## 控制台输出\n```\n#{result}\n```\n\n"ifresult.length>0
70+
71+
# 关闭issue
72+
github.issues.edit
73+
user:repo.user
74+
repo:repo.name
75+
number:issue.number
76+
state:'closed'
77+
78+
# 发布报告
79+
github.issues.createComment
80+
user:repo.user
81+
repo:repo.name
82+
number:issue.number
83+
body: body
84+
85+
86+
setInterval ()->
87+
for repoinconfig.repos
88+
do (repo)->
89+
logger.info"fetching repo#{repo.name}"
90+
github.issues.repoIssues
91+
user:repo.user
92+
repo:repo.name
93+
labels:repo.labels
94+
state:'open'
95+
assignee:'none'
96+
, (err,issues)->
97+
processIssues issues, repo
98+
,15000
99+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp