lita-inspirebot-test-selly 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/README.md +22 -0
- data/Rakefile +6 -0
- data/lib/lita/handlers/inspirebot_test_selly.rb +121 -0
- data/lib/lita-inspirebot-test-selly.rb +12 -0
- data/lita-inspirebot-test-selly.gemspec +26 -0
- data/locales/en.yml +4 -0
- data/spec/lita/handlers/inspirebot_test_selly_spec.rb +10 -0
- data/spec/spec_helper.rb +14 -0
- data/templates/.gitkeep +0 -0
- metadata +170 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9acf2eaecc191c909ff8cd587de87a5f78131a062c0df4301bc0fb4fb263407d
|
4
|
+
data.tar.gz: 42c96b99fd5f9f4adce87d8dca6ba50b7133cc25f9b19008341f64fcb31f347f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 31d4b605f79497818baae87800f14346b1f4ff1d7e37b33a1f3a431760d3499f416465025bff1d037f39aade0babccaee2ef026717fcb00b9681b4aa10cb8eb1
|
7
|
+
data.tar.gz: acbb8469fa50f686443f9bab50bb9a9bc254acfef06affef7fa237b2e01ee8e7a33d0c437dbdb24d06ecd9f2f52c84ef117eb75427c7878d7c1d09ce231bae5e
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# lita-inspirebot-test-selly
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/sellykartika19/lita-inspirebot-test-selly.png?branch=master)](https://travis-ci.org/sellykartika19/lita-inspirebot-test-selly)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/sellykartika19/lita-inspirebot-test-selly/badge.png)](https://coveralls.io/r/sellykartika19/lita-inspirebot-test-selly)
|
5
|
+
|
6
|
+
TODO: Add a description of the plugin.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add lita-inspirebot-test-selly to your Lita instance's Gemfile:
|
11
|
+
|
12
|
+
``` ruby
|
13
|
+
gem "lita-inspirebot-test-selly"
|
14
|
+
```
|
15
|
+
|
16
|
+
## Configuration
|
17
|
+
|
18
|
+
TODO: Describe any configuration attributes the plugin exposes.
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
TODO: Describe the plugin's features and how to use them.
|
data/Rakefile
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
module InspirebotTestSelly
|
2
|
+
class Quotes
|
3
|
+
attr_accessor :add_attribution
|
4
|
+
attr_accessor :authors
|
5
|
+
|
6
|
+
def initialize()
|
7
|
+
init_quotes
|
8
|
+
@authors = @quotes.keys
|
9
|
+
@add_attribution = false
|
10
|
+
end
|
11
|
+
|
12
|
+
def init_quotes
|
13
|
+
@quotes = {
|
14
|
+
branson: {
|
15
|
+
name: 'Richard Branson',
|
16
|
+
quotes: [
|
17
|
+
"You don't learn to walk by following rules. You learn by doing, and by falling over.",
|
18
|
+
"Business opportunities are like buses, there’s always another one coming.",
|
19
|
+
"A business has to be involving, it has to be fun, and it has to exercise your creative instincts.",
|
20
|
+
"Do not be embarrassed by your failures, learn from them and start again.",
|
21
|
+
"One thing is certain in business. You and everyone around you will make mistakes.",
|
22
|
+
"My general attitude to life is to enjoy every minute of every day. I never do anything with a feeling of, ’Oh God, I’ve got to do this today.’",
|
23
|
+
"I cannot remember a moment in my life when I have not felt the love of my family. We were a family that would have killed for each other - and we still are.",
|
24
|
+
"I never get the accountants in before I start up a business. It's done on gut feeling, especially if I can see that they are taking the mickey out of the consumer.",
|
25
|
+
"I love the freedom of movement that my phone gives me. That has definitely transformed my life."
|
26
|
+
],
|
27
|
+
},
|
28
|
+
jobs: {
|
29
|
+
name: 'Steve Jobs',
|
30
|
+
quotes: [
|
31
|
+
"Be a yardstick of quality. Some people aren't used to an environment where excellence is expected.",
|
32
|
+
"Being the richest man in the cemetery doesn't matter to me. Going to bed at night saying we've done something wonderful, that's what matters to me.",
|
33
|
+
"Design is not just what it looks like and feels like. Design is how it works.",
|
34
|
+
"Do you want to spend the rest of your life selling sugared water or do you want a chance to change the world?",
|
35
|
+
"Don’t let the noise of others’ opinions drown out your own inner voice.",
|
36
|
+
"I want to put a ding in the universe.",
|
37
|
+
"Innovation distinguishes between a leader and a follower.",
|
38
|
+
"It's really hard to design products by focus groups. A lot of times, people don't know what they want until you show it to them.",
|
39
|
+
"My favorite things in life don't cost any money. It's really clear that the most precious resource we all have is time.",
|
40
|
+
"Quality is more important than quantity. One home run is much better than two doubles.",
|
41
|
+
"Sometimes life is going to hit you in the head with a brick. Don't lose faith.",
|
42
|
+
"Sometimes when you innovate, you make mistakes. It is best to admit them quickly, and get on with improving your other innovations.",
|
43
|
+
"Things don't have to change the world to be important.",
|
44
|
+
"Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do."
|
45
|
+
]
|
46
|
+
},
|
47
|
+
tesla: {
|
48
|
+
name: 'Nikola Tesla',
|
49
|
+
quotes: [
|
50
|
+
"If you want to find the secrets of the universe, think in terms of energy, frequency and vibration.",
|
51
|
+
"The day science begins to study non-physical phenomena, it will make more progress in one decade than in all the previous centuries of its existence.",
|
52
|
+
"The scientists of today think deeply instead of clearly. One must be sane to think clearly, but one can think deeply and be quite insane.",
|
53
|
+
"Our virtues and our failings are inseparable, like force and matter. When they separate, man is no more.",
|
54
|
+
"The present is theirs; the future, for which I really worked, is mine.",
|
55
|
+
"I do not think you can name many great inventions that have been made by married men.",
|
56
|
+
"The spread of civilisation may be likened to a fire; first, a feeble spark, next a flickering flame, then a mighty blaze, ever increasing in speed and power."
|
57
|
+
]
|
58
|
+
}
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def get_quote(name=nil)
|
63
|
+
if name.nil?
|
64
|
+
name = @authors.sample
|
65
|
+
else
|
66
|
+
name = name.to_sym unless name.is_a?(Symbol)
|
67
|
+
end
|
68
|
+
name = name.to_s.gsub(/\W/, '').downcase.to_sym
|
69
|
+
|
70
|
+
quote = ''
|
71
|
+
|
72
|
+
if @quotes.key? name
|
73
|
+
collection = @quotes[name]
|
74
|
+
display = collection[:name]
|
75
|
+
quote = collection[:quotes].sample
|
76
|
+
quote += ' - ' + display if @add_attribution
|
77
|
+
else
|
78
|
+
authors = authors_string
|
79
|
+
quote = "I'm sorry, I could not found quotes for #{name}. To get a list of authors, type QUOTE AUTHORS"
|
80
|
+
end
|
81
|
+
return quote
|
82
|
+
end
|
83
|
+
|
84
|
+
def authors_string
|
85
|
+
@authors.sort.join(', ')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
module Lita
|
91
|
+
module Handlers
|
92
|
+
class InspirebotTestSelly < Handler
|
93
|
+
route(/^(?:Test SMS usng a RingCentral Developer account - )?inspire me!?\s*$/i, :quote, command: false, help: { 'inspire me!' => 'Returns a random quote' })
|
94
|
+
route(/^(?:Test SMS usng a RingCentral Developer account - )?authors\s*$/i, :authors, command: false, help: { 'quote authors' => 'Returns a list of known authors.' })
|
95
|
+
route(/^(?:Test SMS usng a RingCentral Developer account - )?quote\s+([A-Za-z0-9]+)!?\s*/i, :quote, command: false, help: { 'quote <AUTHOR>' => 'Replies with random AUTHOR quote.' })
|
96
|
+
|
97
|
+
def authors(response)
|
98
|
+
@quotes = ::InspirebotTestSelly::Quotes.new
|
99
|
+
authors = @quotes.authors_string.upcase
|
100
|
+
response.reply "I know about the following authors: #{authors}. To hear quotes, type QUOTE {AUTHOR}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def quote(response)
|
104
|
+
@quotes = ::InspirebotTestSelly::Quotes.new
|
105
|
+
author = response.match_data[1].downcase
|
106
|
+
if author.downcase == 'authors'
|
107
|
+
authors = @quotes.authors_string.upcase
|
108
|
+
response.reply "I know about the following authors: #{authors}. To hear quotes, type QUOTE {AUTHOR}"
|
109
|
+
else
|
110
|
+
response.reply @quotes.get_quote(author)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def menu(response)
|
115
|
+
help = 'use QUOTE AUTHORS to get a list of authors. use QUOTE {AUTHOR} to get a random quote from the author'
|
116
|
+
response.reply @quotes.get_quote(help)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
Lita.register_handler(Lita::Handlers::InspirebotTestSelly)
|
121
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "lita"
|
2
|
+
|
3
|
+
Lita.load_locales Dir[File.expand_path(
|
4
|
+
File.join("..", "..", "locales", "*.yml"), __FILE__
|
5
|
+
)]
|
6
|
+
|
7
|
+
require "lita/handlers/inspirebot_test_selly"
|
8
|
+
|
9
|
+
Lita::Handlers::InspirebotTestSelly.template_root File.expand_path(
|
10
|
+
File.join("..", "..", "templates"),
|
11
|
+
__FILE__
|
12
|
+
)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "lita-inspirebot-test-selly"
|
3
|
+
spec.version = "0.1.0"
|
4
|
+
spec.authors = ["sellykartika19"]
|
5
|
+
spec.email = ["kartika.selly9@gmail.com"]
|
6
|
+
spec.description = "A Lita handler for inspirational quotes."
|
7
|
+
spec.summary = "A Lita handler for inspirational quotes."
|
8
|
+
spec.homepage = "https://github.com/sellykartika19/Inspirebot-test-selly.git"
|
9
|
+
spec.license = "MIT"
|
10
|
+
spec.metadata = { "lita_plugin_type" => "handler" }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($/)
|
13
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "lita", ">= 4.8"
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", ">= 1.3"
|
20
|
+
spec.add_development_dependency "pry-byebug"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "rack-test"
|
23
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
24
|
+
spec.add_development_dependency "simplecov"
|
25
|
+
spec.add_development_dependency "coveralls"
|
26
|
+
end
|
data/locales/en.yml
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Lita::Handlers::Inspirebot, lita_handler: true do
|
4
|
+
it { is_expected.to route('quote jobs!') }
|
5
|
+
|
6
|
+
it 'should response like inspirational leader' do
|
7
|
+
send_message('quote jobs!')
|
8
|
+
expect(replies.last).to be_a(String)
|
9
|
+
end
|
10
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "simplecov"
|
2
|
+
require "coveralls"
|
3
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
4
|
+
SimpleCov::Formatter::HTMLFormatter,
|
5
|
+
Coveralls::SimpleCov::Formatter
|
6
|
+
]
|
7
|
+
SimpleCov.start { add_filter "/spec/" }
|
8
|
+
|
9
|
+
require "lita-inspirebot-test-selly"
|
10
|
+
require "lita/rspec"
|
11
|
+
|
12
|
+
# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
|
13
|
+
# was generated with Lita 4, the compatibility mode should be left disabled.
|
14
|
+
Lita.version_3_compatibility_mode = false
|
data/templates/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-inspirebot-test-selly
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sellykartika19
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.8'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry-byebug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: coveralls
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: A Lita handler for inspirational quotes.
|
126
|
+
email:
|
127
|
+
- kartika.selly9@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- ".travis.yml"
|
134
|
+
- Gemfile
|
135
|
+
- README.md
|
136
|
+
- Rakefile
|
137
|
+
- lib/lita-inspirebot-test-selly.rb
|
138
|
+
- lib/lita/handlers/inspirebot_test_selly.rb
|
139
|
+
- lita-inspirebot-test-selly.gemspec
|
140
|
+
- locales/en.yml
|
141
|
+
- spec/lita/handlers/inspirebot_test_selly_spec.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
- templates/.gitkeep
|
144
|
+
homepage: https://github.com/sellykartika19/Inspirebot-test-selly.git
|
145
|
+
licenses:
|
146
|
+
- MIT
|
147
|
+
metadata:
|
148
|
+
lita_plugin_type: handler
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
require_paths:
|
152
|
+
- lib
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
requirements:
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
requirements: []
|
164
|
+
rubygems_version: 3.0.8
|
165
|
+
signing_key:
|
166
|
+
specification_version: 4
|
167
|
+
summary: A Lita handler for inspirational quotes.
|
168
|
+
test_files:
|
169
|
+
- spec/lita/handlers/inspirebot_test_selly_spec.rb
|
170
|
+
- spec/spec_helper.rb
|