Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
webdestroya committed Aug 23, 2013
0 parents commit 29d0402
Show file tree
Hide file tree
Showing 12 changed files with 160 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
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.0
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: ruby
rvm:
- 2.0.0
script: bundle exec rspec
before_install:
- gem update --system
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
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2013 Mitch Dempsey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# lita-eightball

[![Build Status](https://travis-ci.org/webdestroya/lita-eightball.png)](https://travis-ci.org/webdestroya/lita-eightball)
[![Code Climate](https://codeclimate.com/github/webdestroya/lita-eightball.png)](https://codeclimate.com/github/webdestroya/lita-eightball)
[![Coverage Status](https://coveralls.io/repos/webdestroya/lita-eightball/badge.png)](https://coveralls.io/r/webdestroya/lita-eightball)

**lita-eightball** is a handler for [Lita](https://github.com/jimmycuadra/lita) that allows you to roll an eight-ball

## Installation

Add lita-eightball to your Lita instance's Gemfile:

``` ruby
gem "lita-eightball"
```

## Usage

To roll the eightball, do any of these commands:

Lita: 8ball
Lita: eightball

## License

[MIT](http://opensource.org/licenses/MIT)
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require "bundler/gem_tasks"
1 change: 1 addition & 0 deletions lib/lita-eightball.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require "lita/handlers/eightball"
42 changes: 42 additions & 0 deletions lib/lita/handlers/eightball.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
require "lita"

module Lita
module Handlers
class Eightball < Handler

RESPONSES = [
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes – definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Signs point to yes",
"Yes",
"Reply hazy, try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
]

route %r{8ball|eightball}i, :shake, command: true

route %r{!8ball}i, :shake

def shake(response)
response.reply RESPONSES.shuffle.first
end

end

Lita.register_handler(Eightball)
end
end
23 changes: 23 additions & 0 deletions lita-eightball.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Gem::Specification.new do |spec|
spec.name = "lita-eightball"
spec.version = "1.0.0"
spec.authors = ["Mitch Dempsey"]
spec.email = ["mitch@mitchdempsey.com"]
spec.description = %q{A Lita handler for shaking an eightball.}
spec.summary = %q{A Lita handler for shaking an eightball.}
spec.homepage = "https://github.com/webdestroya/lita-eightball"
spec.license = "MIT"

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", "~> 2.0"

spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", "~> 2.14"
spec.add_development_dependency "simplecov"
spec.add_development_dependency "coveralls"
end
11 changes: 11 additions & 0 deletions spec/lita/handlers/eightball_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "spec_helper"

describe Lita::Handlers::Eightball, lita_handler: true do
it { routes_command("Y U NO BLAH").to(:meme_y_u_no) }

it "sets the username and password to nil by default" do
expect(Lita.config.handlers.memegen.username).to be_nil
expect(Lita.config.handlers.memegen.password).to be_nil
end

end
10 changes: 10 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require "simplecov"
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start { add_filter "/spec/" }

require "lita-memegen"
require "lita/rspec"

0 comments on commit 29d0402

Please sign in to comment.