Slide 1

Slide 1 text

CHATOPS IN RUBY WITH LITA @jimmycuadra

Slide 2

Slide 2 text

ChatOps: Operations via group chat

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

IRC

Slide 5

Slide 5 text

C.A.M.S. (Culture, automation, measurement, sharing)

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

$ gem install lita

Slide 8

Slide 8 text

$ lita new create lita create lita/Gemfile create lita/lita_config.rb

Slide 9

Slide 9 text

source "https://rubygems.org" gem "lita" gem “lita-slack” gem "lita-google-images" gem "lita-karma"

Slide 10

Slide 10 text

You: Lita, image pug Lita: http://upload.wikimedia.org/ wikipedia/commons/7/7f/Pug_portrait.jpg

Slide 11

Slide 11 text

$ lita handler hello Do you want to test your plugin on Travis CI? y Do you want to generate code coverage information with SimpleCov and Coveralls.io? y ———> create lita-hello/lib/lita/handlers/hello.rb create lita-hello/lib/lita-hello.rb ———> create lita-hello/spec/lita/handlers/hello_spec.rb create lita-hello/spec/spec_helper.rb create lita-hello/locales/en.yml create lita-hello/Gemfile create lita-hello/lita-hello.gemspec create lita-hello/.gitignore ———> create lita-hello/.travis.yml create lita-hello/Rakefile create lita-hello/README.md

Slide 12

Slide 12 text

describe Lita::Handlers::Hello, lita_handler: true do end

Slide 13

Slide 13 text

describe Lita::Handlers::Hello, lita_handler: true do it { is_expected.to route_command("hello").to(:greet) } it "greets the user who said hello" do send_command("hello") expect(replies.first).to eq("Hello, Test User!") end end

Slide 14

Slide 14 text

module Lita module Handlers class Hello < Handler end Lita.register_handler(Hello) end end

Slide 15

Slide 15 text

module Lita module Handlers class Hello < Handler route /hello/, :greet, command: true def greet(response) response.reply "Hello, #{response.user.name}!" end end Lita.register_handler(Hello) end end

Slide 16

Slide 16 text

You: Lita, hello Lita: Hello, Jimmy!

Slide 17

Slide 17 text

lita-digitalocean You: Lita, do droplets list Lita: ID: 123, Name: image1, IP: 1.2.3.4 Lita: ID: 456, Name: image2, IP: 5.6.7.8

Slide 18

Slide 18 text

lita-pagerduty You: Lita, pager ack ABC123 Lita: ABC123: Incident acknowledged

Slide 19

Slide 19 text

lita-retro You: Lita, retro :( too many rollbacks Lita: Bad topic added! You: Lita, retro list Lita: Bad topic from Jimmy: too many rollbacks

Slide 20

Slide 20 text

www.lita.io @litachatbot / @jimmycuadra