Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Initial commit of gophers
Browse files Browse the repository at this point in the history
  • Loading branch information
miketheman committed May 5, 2015
0 parents commit b7065d9
Show file tree
Hide file tree
Showing 13 changed files with 197 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: ruby
sudo: false
cache: bundler

services:
- redis-server

rvm:
- 2.0
- 2.2

before_install:
- gem update --system

script: bundle exec rake
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gemspec
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.

29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# lita-goforit

[![Build Status](https://travis-ci.org/miketheman/lita-goforit.png?branch=master)](https://travis-ci.org/miketheman/lita-goforit)
[![Coverage Status](https://coveralls.io/repos/miketheman/lita-goforit/badge.png)](https://coveralls.io/r/miketheman/lita-goforit)

Lighten the mood with a gopher!

Gladly accepting pull requests with new gopher URLs.
See `lib/lita/handlers/goforit.rb` for the right place to put new ones.

## Installation

Add `lita-goforit` to your Lita instance's Gemfile:

``` ruby
gem 'lita-goforit'
```

## Configuration

None

## Usage

Saying terms like 'go for it' and 'went for it' will respond with an image or video.

## Prior Art

Leans heavily on the concept from [Hubot scripts](https://github.com/github/hubot-scripts/blob/master/src/scripts/go-for-it.coffee).
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task default: :spec
12 changes: 12 additions & 0 deletions lib/lita-goforit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'lita'

Lita.load_locales Dir[File.expand_path(
File.join('..', '..', 'locales', '*.yml'), __FILE__
)]

require 'lita/handlers/goforit'

Lita::Handlers::GoForIt.template_root File.expand_path(
File.join('..', '..', 'templates'),
__FILE__
)
38 changes: 38 additions & 0 deletions lib/lita/handlers/goforit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module Lita
module Handlers
class GoForIt < Handler
route(%r{(went|go(ing|es)?) for it}i, :gopher)

def gopher(response)
response.reply GOPHERS.sample
end

# Add any good gopher url to this list
GOPHERS = %w(
http://25.media.tumblr.com/tumblr_m6k6iluYFU1qa4vxjo1_500.jpg
http://blogs.citypages.com/gimmenoise/Gophers_Call_Me.jpg
http://cdn.cutestpaw.com/wp-content/uploads/2012/06/l-Gopher-greeting.jpg
http://colourlovers.com.s3.amazonaws.com/blog/wp-content/uploads/2008/09/cg/Gopher-Broke.jpg
http://dailypicksandflicks.com/wp-content/uploads/2012/01/stand-back-i-got-this-gopher.jpg
http://farm3.staticflickr.com/2268/1992861119_88028372b1_o.jpg
http://funnyasduck.net/wp-content/uploads/2012/12/funny-fat-squirrel-gopher-groundhog-egg-atop-burger-dont-mind-if-do-pics.jpg
http://i.huffpost.com/gen/1365387/thumbs/n-BILL-MURRAY-CADDYSHACK-large570.jpg
http://i395.photobucket.com/albums/pp33/GalenSwyers/armed_gopher.jpg
http://notalwaysrelated.com/wp-content/uploads/2012/11/3r7hje.jpeg
http://upload.wikimedia.org/wikipedia/commons/thumb/7/76/Urocitellus_columbianus_Alberta_Martybugs.jpg/220px-Urocitellus_columbianus_Alberta_Martybugs.jpg
http://weknowmemes.com/generator/uploads/generated/g1381159009196981166.jpg
http://www.bakingdom.com/wp-content/uploads/2010/09/caddyshack-gopher.jpg
http://www.lawlz.org/wp-content/uploads/2012/07/gopher-tech-support-have-you-tried-chewing-on-the-cable-computer-meme.jpg
http://www.quickmeme.com/img/6f/6f8cb22cc6aff2709fc3d760b85b84f6fdbcb4aca0285bd40d8c5a7f74280f9b.jpg
http://www.quickmeme.com/img/8e/8eb558b54f0a0522520d05f4c990536b646e63b1d42d8984fbc42ff082a05ee1.jpg
http://www.sixprizes.com/wp-content/uploads/gopher_caddyshack.jpg
http://www.tnt-audio.com/jpeg/gopher.jpg
http://www.youtube.com/watch?v=y8Kyi0WNg40
http://www.zerotocruising.com/wp-content/uploads/2013/04/groundhog.jpg
https://i.chzbgr.com/maxW500/1415148288/hF21C98D1/
)
end

Lita.register_handler(GoForIt)
end
end
26 changes: 26 additions & 0 deletions lita-goforit.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Gem::Specification.new do |spec|
spec.name = 'lita-goforit'
spec.version = '0.1.0'
spec.authors = ['Mike Fiedler']
spec.email = ['[email protected]']
spec.description = 'Lighten the mood with a gopher'
spec.summary = 'Respond to messages with an image'
spec.homepage = 'https://github.com/miketheman/lita-goforit'
spec.license = 'WTFPL'
spec.metadata = { 'lita_plugin_type' => 'handler' }

spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']

spec.add_runtime_dependency 'lita', '>= 4.3'

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'pry-byebug'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rack-test'
spec.add_development_dependency 'rspec', '>= 3.0.0'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'coveralls'
end
4 changes: 4 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
en:
lita:
handlers:
goforit:
19 changes: 19 additions & 0 deletions spec/lita/handlers/goforit_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

describe Lita::Handlers::GoForIt, lita_handler: true do
it 'listens for messages and routes them' do
expect(subject).to route('go for it').to :gopher
expect(subject).to route('goes for it').to :gopher
expect(subject).to route('going for it').to :gopher
expect(subject).to route('went for it').to :gopher
end

it 'does not route another plugin message' do
expect(subject).to_not route('sandwich')
end

it 'replies with a URL' do
send_message('go for it')
expect(replies.last).to match(/http/)
end
end
14 changes: 14 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start { add_filter '/spec/' }

require 'lita-goforit'
require 'lita/rspec'

# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
# was generated with Lita 4, the compatibility mode should be left disabled.
Lita.version_3_compatibility_mode = false
Empty file added templates/.gitkeep
Empty file.

0 comments on commit b7065d9

Please sign in to comment.