lita-random 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c33b10fc27b89bc2ba196711f6cc2f98667a8ca3
4
+ data.tar.gz: 6c4b832b944f8dcb7c6e9745a7bdf09909c4157a
5
+ SHA512:
6
+ metadata.gz: 9e77ac2236e918063a8bcdb67dda1d810abdac540625964fe164a54fe3d71624354435afc3878d1245023a4e839529bd5bb165547563a034308d1a229aa3322b
7
+ data.tar.gz: e7ecb042f941d79fa51357b62f6330422e38765a0ae7a84589161cef85718785254520f6107826411569856937601aa4458c32524e3d07a56e40b1a2fde08ee2
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /vendor/bundle
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ /Gemfile.lock
31
+ /.ruby-version
32
+ /.ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ AllCops:
2
+ Exclude:
3
+ - vendor/**/*
4
+
5
+ Style/AndOr:
6
+ Enabled: false
data/.simplecov ADDED
@@ -0,0 +1,10 @@
1
+ require 'coveralls'
2
+
3
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter,
6
+ ]
7
+
8
+ SimpleCov.start do
9
+ add_filter '/spec/'
10
+ end
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.0.0
5
+
6
+ script: bundle exec rake
7
+
8
+ before_install:
9
+ - gem update --system
10
+
11
+ services:
12
+ - redis-server
data/.yardopts ADDED
@@ -0,0 +1,5 @@
1
+ --protected
2
+ --private
3
+ --markup markdown
4
+ -
5
+ LICENSE
data/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Change Log
2
+
3
+ ## [v0.1.0](https://github.com/braiden-vasco/lita-random/tree/v0.1.0) (2015-06-20)
4
+
5
+ **Merged pull requests:**
6
+
7
+ - Add instructions [\#11](https://github.com/braiden-vasco/lita-random/pull/11) ([braiden-vasco](https://github.com/braiden-vasco))
8
+
9
+ - Basic implementation [\#10](https://github.com/braiden-vasco/lita-random/pull/10) ([braiden-vasco](https://github.com/braiden-vasco))
10
+
11
+ - Initialize Lita handler [\#9](https://github.com/braiden-vasco/lita-random/pull/9) ([braiden-vasco](https://github.com/braiden-vasco))
12
+
13
+ - Add changelog generator [\#8](https://github.com/braiden-vasco/lita-random/pull/8) ([braiden-vasco](https://github.com/braiden-vasco))
14
+
15
+ - Use YARD [\#7](https://github.com/braiden-vasco/lita-random/pull/7) ([braiden-vasco](https://github.com/braiden-vasco))
16
+
17
+ - Configure Coveralls [\#6](https://github.com/braiden-vasco/lita-random/pull/6) ([braiden-vasco](https://github.com/braiden-vasco))
18
+
19
+ - Configure Travis CI [\#5](https://github.com/braiden-vasco/lita-random/pull/5) ([braiden-vasco](https://github.com/braiden-vasco))
20
+
21
+ - Add README [\#4](https://github.com/braiden-vasco/lita-random/pull/4) ([braiden-vasco](https://github.com/braiden-vasco))
22
+
23
+ - Configure testing [\#3](https://github.com/braiden-vasco/lita-random/pull/3) ([braiden-vasco](https://github.com/braiden-vasco))
24
+
25
+ - Configure linting [\#2](https://github.com/braiden-vasco/lita-random/pull/2) ([braiden-vasco](https://github.com/braiden-vasco))
26
+
27
+ - Initialize gem [\#1](https://github.com/braiden-vasco/lita-random/pull/1) ([braiden-vasco](https://github.com/braiden-vasco))
28
+
29
+
30
+
31
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lita-random.gemspec
4
+ gemspec
5
+
6
+ gem 'github_changelog_generator', '~> 1.6.1'
7
+
8
+ gem 'yard', '~> 0.8.7.6', require: false
9
+ gem 'redcarpet', require: false
10
+
11
+ gem 'rubocop', '~> 0.31.0', require: false
12
+
13
+ gem 'rspec', '~> 3.3.0'
14
+
15
+ gem 'simplecov', '~> 0.10.0', require: false
16
+ gem 'coveralls', require: false
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Braiden Vasco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ Lita::Handlers::Random
2
+ ======================
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/lita-random.svg)](http://badge.fury.io/rb/lita-random)
5
+ [![Build Status](https://travis-ci.org/braiden-vasco/lita-random.svg)](https://travis-ci.org/braiden-vasco/lita-random)
6
+ [![Coverage Status](https://coveralls.io/repos/braiden-vasco/lita-random/badge.svg)](https://coveralls.io/r/braiden-vasco/lita-random)
7
+
8
+ Generator of random numbers and strings for the Lita chat bot.
9
+
10
+ Usage
11
+ -----
12
+
13
+ At first, see the documentation for Lita: https://docs.lita.io/
14
+
15
+ ### Installation
16
+
17
+ Add **lita-random** to your Lita instance's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'lita-random', '~> 0.1.0'
21
+ ```
22
+
23
+ ### Commands
24
+
25
+ - `random` -
26
+ random float number, greater or equal to 0 and lesser than 1
27
+
28
+ - `random <to>` -
29
+ random integer number, greater or equal to 0 and lesser than `to`
30
+
31
+ - `random <from> <to>` -
32
+ random integer number, greater or equal to `from` and lesser than `to`
33
+
34
+ Command `random` has alias `rand`
35
+
36
+ ### Examples
37
+
38
+ ```
39
+ You: lita random
40
+ Lita: 0.52693215290866
41
+ You: lita rand
42
+ Lita: 0.8332672468501509
43
+ You: lita random 5
44
+ Lita: 2
45
+ You: lita rand 100
46
+ Lita: 24
47
+ You: lita random 5 10
48
+ Lita: 8
49
+ You: lita rand 1000 2000
50
+ Lita: 1240
51
+ ```
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ require 'rubygems'
2
+
3
+ gemspec = Gem::Specification.load('lita-random.gemspec')
4
+
5
+ github_user, github_project =
6
+ gemspec.homepage.scan(%r{^https://github\.com/([^/]+)/([^/]+)/?$})[0]
7
+
8
+ DEFAULT_EXCLUDE_LABELS = 'duplicate,question,invalid,wontfix'
9
+
10
+ require 'bundler/gem_tasks'
11
+
12
+ task default: [:spec, :lint]
13
+
14
+ require 'rspec/core/rake_task'
15
+ RSpec::Core::RakeTask.new
16
+
17
+ task lint: [:rubocop]
18
+
19
+ require 'rubocop/rake_task'
20
+ RuboCop::RakeTask.new
21
+
22
+ require 'yard'
23
+ YARD::Rake::YardocTask.new
24
+
25
+ desc 'Generate changelog'
26
+ task :changelog, [:token] do |_t, args|
27
+ cmd = 'github_changelog_generator'
28
+ cmd << " -u #{github_user}"
29
+ cmd << " -p #{github_project}"
30
+ cmd << " -t #{args[:token]}" if args[:token]
31
+ cmd << " --exclude-labels version,#{DEFAULT_EXCLUDE_LABELS}"
32
+
33
+ sh cmd
34
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'lita/random'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,31 @@
1
+ ##
2
+ # Lita module.
3
+ #
4
+ module Lita
5
+ ##
6
+ # Lita handlers module.
7
+ #
8
+ module Handlers
9
+ ##
10
+ # Generator of random numbers and strings for the Lita chat bot.
11
+ #
12
+ class Random < Handler
13
+ route(/^rand(om)?$/i, command: true) do |response|
14
+ response.reply(::Random.rand.to_s)
15
+ end
16
+
17
+ route(/^rand(om)?\s+(\d+)?$/i, command: true) do |response|
18
+ to = response.matches[0][1].to_i
19
+ response.reply(::Random.rand(to).to_s)
20
+ end
21
+
22
+ route(/^rand(om)?\s+(\d+)\s+(\d+)?$/i, command: true) do |response|
23
+ from = response.matches[0][1].to_i
24
+ to = response.matches[0][2].to_i
25
+ response.reply(::Random.rand(from...to).to_s)
26
+ end
27
+ end
28
+
29
+ Lita.register_handler(Random)
30
+ end
31
+ end
@@ -0,0 +1,13 @@
1
+ # rubocop:disable Style/FileName
2
+
3
+ require 'lita'
4
+
5
+ Lita.load_locales Dir[File.expand_path(
6
+ File.join('..', '..', 'locales', '*.yml'), __FILE__
7
+ )]
8
+
9
+ require 'lita/handlers/random'
10
+
11
+ Lita::Handlers::Random.template_root File.expand_path(
12
+ File.join('..', '..', 'templates'), __FILE__
13
+ )
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'lita-random'
5
+ spec.version = '0.1.0'
6
+ spec.authors = ['Braiden Vasco']
7
+ spec.email = ['braiden-vasco@mailtor.net']
8
+
9
+ spec.summary =
10
+ 'Generator of random numbers and strings for the Lita chat bot'
11
+ spec.description =
12
+ 'Generator of random numbers and strings for the Lita chat bot.'
13
+ spec.homepage = 'https://github.com/braiden-vasco/lita-random'
14
+ spec.license = 'MIT'
15
+
16
+ spec.respond_to?(:metadata) and
17
+ spec.metadata['lita_plugin_type'] = 'handler'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
+ f.match(%r{^(test|spec|features)/})
21
+ end
22
+
23
+ spec.bindir = 'exe'
24
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
+ spec.require_paths = ['lib']
26
+
27
+ spec.add_development_dependency 'bundler', '~> 1.7'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+
30
+ spec.add_runtime_dependency 'lita', '>= 4.4'
31
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,4 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ random:
File without changes
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-random
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Braiden Vasco
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lita
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '4.4'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '4.4'
55
+ description: Generator of random numbers and strings for the Lita chat bot.
56
+ email:
57
+ - braiden-vasco@mailtor.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - .rubocop.yml
65
+ - .simplecov
66
+ - .travis.yml
67
+ - .yardopts
68
+ - CHANGELOG.md
69
+ - Gemfile
70
+ - LICENSE
71
+ - README.md
72
+ - Rakefile
73
+ - bin/console
74
+ - bin/setup
75
+ - lib/lita-random.rb
76
+ - lib/lita/handlers/random.rb
77
+ - lita-random.gemspec
78
+ - locales/en.yml
79
+ - templates/.gitkeep
80
+ homepage: https://github.com/braiden-vasco/lita-random
81
+ licenses:
82
+ - MIT
83
+ metadata:
84
+ lita_plugin_type: handler
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.4.8
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Generator of random numbers and strings for the Lita chat bot
105
+ test_files: []
106
+ has_rdoc: