Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Apresentação Guru-CE ( 20/06 ) - Slack e Hubot

Apresentação Guru-CE ( 20/06 ) - Slack e Hubot

Uma pequena introdução das ferramentas do Slack e como ele é eficaz em produção também. Possui várias integrações e também pode ser uma ferramenta de automatização de tarefas.

More Decks by Vinicius Carvalho Marques

Other Decks in Technology

Transcript

  1. Vinicius Carvalho iOS and Ruby developer | Integrador local CocoaHeads

    Fortaleza Você pode me achar nas redes sociais: @viniciusc70
  2. 1. TODA COMUNIDADE E SEUS TIMES EM UM SÓ LUGAR.

    São alguns exemplos… iosdevbr.slack.com androiddevbr.slack.com ruby-talk.slack.com Razões para usar Slack
  3. BIG INSTALAÇÃO 1. Instalação Node & Redis ( brew install

    node redis ) 2. Seguir as instruções do brew’s para rodar o redis 3. Install Hubot ( npm install -g hubot )
  4. Encontre uma bela casa para Hubot cd em seu diretório

    “projects" run hubot -c airbot para gerar o boilerplate cd airbot npm install
  5. 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
  6. 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)
  7. 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);
  8. hubot persistance Um 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! )
  9. # you may want to wait until the brain has

    been initialized # and there is a database connection robot.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'
  10. hubot -c criado o Heroku Procfile para você run Heroku

    create deploy com git push heroku master inicie com heroku ps:scale web=1 (Você deverá rodar o ps:scale somente por uma vez)
  11. 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/