diff --git a/.travis.yml b/.travis.yml index 23ed7be..ac0b8c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,23 @@ language: ruby +env: + global: + - "JRUBY_OPTS=-Xcext.enabled=true" rvm: - - 1.9.2 + - 2.1.0 + - 2.0.0 - 1.9.3 + - 1.9.2 + - 1.8.7 + - jruby-18mode + - jruby-19mode + - ruby-head + - jruby-head + - ree +matrix: + allow_failures: + - rvm: 1.8.7 + - rvm: ree + - rvm: jruby-18mode + - rvm: jruby-19mode + - rvm: jruby-head + fast_finish: true diff --git a/cinch-simplecalc.gemspec b/cinch-simplecalc.gemspec index 1495117..9e663de 100644 --- a/cinch-simplecalc.gemspec +++ b/cinch-simplecalc.gemspec @@ -8,23 +8,21 @@ Gem::Specification.new do |gem| gem.version = Cinch::Plugins::Simplecalc::VERSION gem.authors = ['Brian Haberer'] gem.email = ['bhaberer@gmail.com'] - gem.description = %q{Cinch Plugin that passes simple numeric math propblems to the Calc gem} - gem.summary = %q{Cinch Plugin to do simple math} + gem.description = %q(Cinch Plugin that passes simple numeric math propblems to the Calc gem) + gem.summary = %q(Cinch Plugin to do simple math) gem.homepage = 'https://github.com/bhaberer/cinch-simplecalc' gem.license = 'MIT' - gem.files = `git ls-files`.split($/) - gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } - gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.executables = gem.files.grep(/^bin\//).map { |f| File.basename(f) } + gem.test_files = gem.files.grep(/^(test|spec|features)\//) gem.require_paths = ['lib'] - gem.add_development_dependency 'rake' - gem.add_development_dependency 'rspec' - gem.add_development_dependency 'coveralls' - gem.add_development_dependency 'cinch-test' - - gem.add_dependency 'cinch', '~> 2.0.12' - gem.add_dependency 'cinch-toolbox', '~> 1.1.0' - gem.add_dependency 'cinch-cooldown', '~> 1.1.1' - gem.add_dependency 'calc', '~> 1.0.0' + gem.add_development_dependency 'rake', '~> 10' + gem.add_development_dependency 'rspec', '~> 3' + gem.add_development_dependency 'coveralls', '~> 0.7' + gem.add_development_dependency 'cinch-test', '~> 0.1', '>= 0.1.0' + gem.add_dependency 'cinch', '~> 2' + gem.add_dependency 'cinch-cooldown', '~> 1.1', '>= 1.1.1' + gem.add_dependency 'cinch-toolbox', '~> 1.1' + gem.add_dependency 'calc', '~> 1' end diff --git a/lib/cinch/plugins/simplecalc.rb b/lib/cinch/plugins/simplecalc.rb index 7dc58ee..001860c 100644 --- a/lib/cinch/plugins/simplecalc.rb +++ b/lib/cinch/plugins/simplecalc.rb @@ -3,29 +3,31 @@ require 'cinch' require 'cinch/cooldown' -module Cinch::Plugins - # Simple Plugin to do quick math - class SimpleCalc - include Cinch::Plugin +module Cinch + module Plugins + # Simple Plugin to do quick math + class SimpleCalc + include Cinch::Plugin - enforce_cooldown + enforce_cooldown - self.help = 'Use .math to do math. (i.e. .math 2 + 2)' + self.help = 'Use .math to do math. (i.e. .math 2 + 2)' - match /math (.+)/ + match(/math (.+)/) - def execute(m, problem) - m.reply calc(problem), true - end + def execute(m, problem) + m.reply calc(problem), true + end - private + private - def calc(problem) - answer = Calc.evaluate(problem) - answer unless answer == problem - rescue ZeroDivisionError - # Rescue against people being cute. - "I'm sorry, Dave, I'm afraid I can't do that." + def calc(problem) + answer = Calc.evaluate(problem) + answer unless answer == problem + rescue ZeroDivisionError + # Rescue against people being cute. + "I'm sorry, Dave, I'm afraid I can't do that." + end end end end diff --git a/lib/cinch/plugins/simplecalc/version.rb b/lib/cinch/plugins/simplecalc/version.rb index 36fd002..f21b79c 100644 --- a/lib/cinch/plugins/simplecalc/version.rb +++ b/lib/cinch/plugins/simplecalc/version.rb @@ -3,7 +3,7 @@ module Cinch module Plugins # Versioning Info class Simplecalc - VERSION = '1.0.2' + VERSION = '1.0.3' end end end diff --git a/spec/cinch-simplecalc_spec.rb b/spec/cinch-simplecalc_spec.rb index 223fd66..af4e04b 100644 --- a/spec/cinch-simplecalc_spec.rb +++ b/spec/cinch-simplecalc_spec.rb @@ -10,19 +10,17 @@ it 'should allow users to perform simple math' do msg = make_message(@bot, '!math 2 + 2') - get_replies(msg).last.text - .should == 'test: 4' + expect(get_replies(msg).last.text).to eq('test: 4') end it 'should strip all non numeric information from the string' do msg = make_message(@bot, '!math cos 2') - get_replies(msg).last.text - .should == 'test: 2' + expect(get_replies(msg).last.text).to eq('test: 2') end it 'should crack wise if asked to do the impossible' do msg = make_message(@bot, '!math 1 / 0') - get_replies(msg).last.text - .should == 'test: I\'m sorry, Dave, I\'m afraid I can\'t do that.' + expect(get_replies(msg).last.text) + .to eq('test: I\'m sorry, Dave, I\'m afraid I can\'t do that.') end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2387467..a175e9d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,11 @@ require 'coveralls' -Coveralls.wear! +require 'simplecov' + +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.start + require 'cinch-simplecalc' require 'cinch/test' -