Upload
vinicius-carvalho
View
57
Download
5
Embed Size (px)
Citation preview
Ferramentas em produção Slack e HUBOT
Vinicius Carvalho
iOS and Ruby developer | Integrador local CocoaHeads Fortaleza
Você pode me achar nas redes sociais:@viniciusc70
Você usa Slack?
1.TODA COMUNIDADE E SEUS TIMES EM UM SÓ LUGAR.
São alguns exemplos…iosdevbr.slack.comandroiddevbr.slack.comruby-talk.slack.com
Razões para usar Slack
2.INTEGRAÇÕES COM OUTRAS FERRAMENTAS.
3.FERRAMENTA DE BUSCA.
4.COMPARTILHAR ARQUIVOS.
5.CODE SNIPPETS.
6.GRUPOS PRIVADOS.
7.ACESSÍVEL EM MULTI PLATAFORMAS.
1.Instalação Hubot2.Visão do Coffescript3.Hubot Overview4.APIs
BIG INSTALAÇÃO
1. Instalação Node & Redis( brew install node redis )
2. Seguir as instruções do brew’s para rodar o redis3. Install Hubot
( npm install -g hubot )
Encontre uma bela casa para Hubotcd em seu diretório “projects"
run hubot -c airbot para gerar o boilerplatecd airbotnpm install
Hello Worldrun bin/hubot
escreva hubot ping e aperte enter
CREDITS
Uma pequena introdução ao Coffescript :˜
introMessage = (user) -> if user?.name? and user?.hobby? "hello, I am #{response.name}, " + "a #{response.hobby}ist." else message = "Please tell me more about yourself."
message
me = name: "Chiquim" hobby: "Hubot curation"
console.log introMessage(me)
#hello, I am Chiquim, a Hubot curationist
Hubot Structure• Procfile (Heroku startup script)• README.md• bin/ (contains hubot executable)• external-scripts.json (list of packages from npm)• hubot-scripts.json (list of packages from hubot-scripts)• package.json (node package manager metainformation)• scripts/ (custom hubot script directory)
Exemplo Hubot Scriptcreate and edit scripts/goodbye.coffee
module.exports = (robot) ->
robot.hear /(bye | later),?\s(.*)/i, (msg) ->
if root.name.toLowerCase() == msg.match[2].toLowerCase() byeMessage = goodbye(msg.message.user.name) msg.send(byeMessage)
goodbyes = [ "Bye, {name}.", "Later, {name}.", "Take care, {name}."]
goodbye = (name) -> index = parseInt(Math.random() * goodbyes.length) message = goodbyes[index] message.replace(/{name}/, name);
hubot persistanceUm armazenamento simples através do hubot.brain
carregado por redis-brain, mongo-brain, etc.(Você pode encontrar estes em hubot-scripts ou escrever o SEU! )
# you may want to wait until the brain has been initialized# and there is a database connectionrobot.brain.on 'loaded', -> robot.brain.lastAccessed = new Date() robot.brain.seagulls = 12 robot.brain.flowers = { pansies: true, daffodils: false }
# hubot brain runs on events robot.brain.emit 'save'
Deploy
99,526,124 vezes
Você provavelmente fará o deploy no Heroku, não é?
hubot -c criado o Heroku Procfile para você
run Heroku create
deploy com git push heroku masterinicie com heroku ps:scale web=1
(Você deverá rodar o ps:scale somente por uma vez)
Case de sucesso!
RDSTATION
THE CAPYBOT
Place your screenshot here
LINKS INTERESSANTES
1) Criação do seu próprio bot - http://blog.pandorabots.com/putting-your-bot-on-slack/
Integrando IA no seu hubot - https://developer.pandorabots.com/
2 ) Nove ferramentas que não podemos viver sem no Slack - https://keen.io/blog/105456820166/9-slack-hacks-we-couldnt-live-without
3) deploy automático com hubot em Travis CI - http://purevirtual.eu/2015/02/18/deploy-githubs-hubot-for-slack-automatically-with-travis-ci-and-cloudfoundry-part-1/
Obrigado!