lita-inspirebot 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/README.md +24 -0
- data/Rakefile +6 -0
- data/lib/lita-inspirebot.rb +7 -0
- data/lib/lita/handlers/inspirebot.rb +113 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1d50a48134909ac9d9e6a5a74635af748c97052
|
4
|
+
data.tar.gz: 43213b9361cfe307c4ac2d59a1ab9d606346ef31
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 314fc87b3819e695f60d0ad5465d435ecf10ae89617605077253b4b24318831659372537771e3bb787c711ba0163eca48ce5b23d0812bf75977366b1f00e5672
|
7
|
+
data.tar.gz: 6cfcdf4390f8319ae825d8bfc68dacb8a442c06737906c091425f6ddcf10c061047117d960a97b5c32e0566e8b2935de57ba64f3b8b96b63e5ac0a27161bb299
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Inspirebot (for Lita)
|
2
|
+
|
3
|
+
Inspirational quotes from Steve Jobs, Richard Branson, and others.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add lita-inspirebot to your Lita instance's Gemfile:
|
8
|
+
|
9
|
+
``` ruby
|
10
|
+
gem "lita-inspirebot"
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
```
|
16
|
+
You > quote jobs!
|
17
|
+
Lita > My favorite things in life don't cost any money. It's really clear that the most precious resource we all have is time.
|
18
|
+
```
|
19
|
+
|
20
|
+
## License
|
21
|
+
|
22
|
+
Inspirebot for Lita is available under an MIT-style license. See [LICENSE.txt](LICENSE.txt) for details.
|
23
|
+
|
24
|
+
Inspirebot for Lita © 2016 by [John Wang](https://github.com/grokify)
|
data/Rakefile
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
module Inspirebot
|
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
|
+
"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.",
|
32
|
+
"Sometimes when you innovate, you make mistakes. It is best to admit them quickly, and get on with improving your other innovations.",
|
33
|
+
"Be a yardstick of quality. Some people aren't used to an environment where excellence is expected.",
|
34
|
+
"Innovation distinguishes between a leader and a follower.",
|
35
|
+
"Design is not just what it looks like and feels like. Design is how it works.",
|
36
|
+
"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.",
|
37
|
+
"I want to put a ding in the universe.",
|
38
|
+
"Sometimes life is going to hit you in the head with a brick. Don't lose faith.",
|
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
|
+
"Things don't have to change the world to be important."
|
41
|
+
]
|
42
|
+
},
|
43
|
+
tesla: {
|
44
|
+
name: 'Nikola Tesla',
|
45
|
+
quotes: [
|
46
|
+
"If you want to find the secrets of the universe, think in terms of energy, frequency and vibration.",
|
47
|
+
"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.",
|
48
|
+
"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.",
|
49
|
+
"Our virtues and our failings are inseparable, like force and matter. When they separate, man is no more.",
|
50
|
+
"The present is theirs; the future, for which I really worked, is mine.",
|
51
|
+
"I do not think you can name many great inventions that have been made by married men.",
|
52
|
+
"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."
|
53
|
+
]
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
58
|
+
def get_quote(name=nil)
|
59
|
+
if name.nil?
|
60
|
+
name = @authors.sample
|
61
|
+
else
|
62
|
+
name = name.to_sym unless name.is_a?(Symbol)
|
63
|
+
end
|
64
|
+
name = name.to_s.gsub(/\W/, '').downcase.to_sym
|
65
|
+
|
66
|
+
quote = ''
|
67
|
+
|
68
|
+
if @quotes.key? name
|
69
|
+
collection = @quotes[name]
|
70
|
+
display = collection[:name]
|
71
|
+
quote = collection[:quotes].sample
|
72
|
+
quote += ' - ' + display if @add_attribution
|
73
|
+
else
|
74
|
+
authors = authors_string
|
75
|
+
quote = "I'm sorry, I could not found quotes for #{name}. I know about the following authors #{authors}"
|
76
|
+
end
|
77
|
+
return quote
|
78
|
+
end
|
79
|
+
|
80
|
+
def authors_string
|
81
|
+
@authors.sort.join(', ')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
module Lita
|
87
|
+
module Handlers
|
88
|
+
class Inspirebot < Handler
|
89
|
+
is_command = false
|
90
|
+
route(/^authors\s*$/i, :authors, command: is_command, help: { "echo TEXT" => "Replies back with TEXT." })
|
91
|
+
route(/^inspire!?\s*$/i, :quote, command: is_command, help: { "echo TEXT" => "Replies back with TEXT." })
|
92
|
+
route(/^quote\s+([A-Za-z]+)!?\s*/i, :quote, command: is_command, help: { "echo TEXT" => "Replies back with TEXT." })
|
93
|
+
route(/^help\s*$/i, :menu, command: is_command, help: { "echo TEXT" => "Replies back with TEXT." })
|
94
|
+
|
95
|
+
def authors(response)
|
96
|
+
@quotes = ::Inspirebot::Quotes.new
|
97
|
+
authors = @quotes.authors_string
|
98
|
+
response.reply "I know about the following authors: #{authors}. To hear quotes, type QUOTE {AUTHOR}"
|
99
|
+
end
|
100
|
+
|
101
|
+
def quote(response)
|
102
|
+
@quotes = ::Inspirebot::Quotes.new
|
103
|
+
response.reply @quotes.get_quote(response.match_data[1].downcase)
|
104
|
+
end
|
105
|
+
|
106
|
+
def menu(response)
|
107
|
+
help = 'use AUTHORS to get a list of authors. use QUOTE {AUTHOR} to get a random quote from the author'
|
108
|
+
response.reply @quotes.get_quote(help)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
Lita.register_handler(Lita::Handlers::Inspirebot)
|
113
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-inspirebot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Wang
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-23 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.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
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: rake
|
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: pretty_table
|
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: uuid
|
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'
|
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'
|
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
|
+
- johncwang@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- Gemfile
|
133
|
+
- README.md
|
134
|
+
- Rakefile
|
135
|
+
- lib/lita-inspirebot.rb
|
136
|
+
- lib/lita/handlers/inspirebot.rb
|
137
|
+
homepage: https://github.com/grokify/lita-inspirebot
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata:
|
141
|
+
lita_plugin_type: handler
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.5.1
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: A Lita handler for inspirational quotes.
|
162
|
+
test_files: []
|