-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.coffee
29 lines (28 loc) · 1.16 KB
/
bot.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
git = require("gift")
fs = require("fs")
repo = git("jsuc3m.github.com.wiki/.")
console.log("JSUC3Mbot is working. Relax while I make your popcorn.")
repo.remote_fetch "origin", (err) ->
console.log "Fetched!"
throw err if err isnt null
repo.checkout "master", (err) ->
console.log "Checked out!"
throw err if err isnt null
repo.git "rebase", (err) ->
console.log "Rebased!"
throw err if err isnt null
fs.readFile "jsuc3m.github.com.wiki/Prueba-Bot.md", (err, contents) ->
contents = "" if err
contents = contents + "\n\nHola mundo! " + Date()
fs.writeFile "jsuc3m.github.com.wiki/Prueba-Bot.md", contents, (err) ->
console.log "File written!"
repo.add "Prueba-Bot.md", (err) ->
console.log "File added!"
repo.commit "JSUC3MBot en accion! (" + Date() + ")",
all: true
author: "\"JSUC3Mbot <[email protected]>\"", (err) ->
console.log "Change commited!"
throw err if err isnt null
repo.git "push", (err) ->
console.log "aand change pushed!"
throw err if err isnt null