lita-onewheel-snowcrash 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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/onewheel_snowcrash'
8
+
9
+ # Lita::Handlers::OnewheelSnowcrash.template_root File.expand_path(
10
+ # File.join('..', '..', 'templates'),
11
+ # __FILE__
12
+ # )
@@ -0,0 +1,30 @@
1
+ require 'marky_markov'
2
+
3
+ module Lita
4
+ module Handlers
5
+ class OnewheelSnowcrash < Handler
6
+ route /^snowcrash$/i,
7
+ :generate_random,
8
+ command: true
9
+ route /^snowcrash (\d+)$/i,
10
+ :generate_by_number,
11
+ command: true
12
+
13
+ def generate_random(response)
14
+ response.reply return_chain(Random::rand(20))
15
+ end
16
+
17
+ def generate_by_number(response)
18
+ response.reply return_chain(response.matches[0][0])
19
+ end
20
+
21
+ def return_chain(number)
22
+ puts "Generating #{number} words."
23
+ markov = MarkyMarkov::Dictionary.new('dict/snowcrash') # Saves/opens dictionary.mmd
24
+ markov.generate_n_words(number.to_i)
25
+ end
26
+
27
+ Lita.register_handler(self)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'lita-onewheel-snowcrash'
3
+ spec.version = '0.0.0'
4
+ spec.authors = ['Andrew Kreps']
5
+ spec.email = ['andrew.kreps@gmail.com']
6
+ spec.description = %q{Markov generation from a Snow Crash corpus.}
7
+ spec.summary = %q{See above.}
8
+ spec.homepage = 'https://github.com/onewheelskyward/lita-onewheel-showcrash'
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.7'
18
+ spec.add_runtime_dependency 'rest-client', '~> 1.8'
19
+ spec.add_runtime_dependency 'marky_markov', '~> 0.3'
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ # spec.add_development_dependency 'pry-byebug', '~> 3.1'
23
+ spec.add_development_dependency 'rake', '~> 10.4'
24
+ spec.add_development_dependency 'rack-test', '~> 0.6'
25
+ spec.add_development_dependency 'rspec', '~> 3.0'
26
+ spec.add_development_dependency 'simplecov', '~> 0.10'
27
+ spec.add_development_dependency 'coveralls', '~> 0.8'
28
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Lita::Handlers::OnewheelSnowcrash, lita_handler: true do
4
+ it { is_expected.to route_command('snowcrash') }
5
+ it { is_expected.to route_command('snowcrash 22') }
6
+
7
+ it 'will generate a random-len chain' do
8
+ send_command 'snowcrash'
9
+ expect(replies.last).not_to be nil
10
+ end
11
+
12
+ it 'will generate a six-word chain' do
13
+ send_command 'snowcrash 6'
14
+ expect(replies.last).not_to be nil
15
+ expect(replies.last.split(' ').count).to be(6)
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ SimpleCov.formatters = [
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter
6
+ ]
7
+ SimpleCov.start { add_filter '/spec/' }
8
+
9
+ require 'lita-onewheel-snowcrash'
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
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-onewheel-snowcrash
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Kreps
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-28 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.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: marky_markov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rack-test
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.6'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
125
+ - !ruby/object:Gem::Dependency
126
+ name: coveralls
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.8'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.8'
139
+ description: Markov generation from a Snow Crash corpus.
140
+ email:
141
+ - andrew.kreps@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - README.md
150
+ - Rakefile
151
+ - cli.rb
152
+ - dict/snowcrash.mmd
153
+ - dict/snowcrash.txt
154
+ - lib/lita-onewheel-snowcrash.rb
155
+ - lib/lita/handlers/onewheel_snowcrash.rb
156
+ - lita-onewheel-template.gemspec
157
+ - spec/lita/handlers/onewheel_template_spec.rb
158
+ - spec/spec_helper.rb
159
+ homepage: https://github.com/onewheelskyward/lita-onewheel-showcrash
160
+ licenses:
161
+ - MIT
162
+ metadata:
163
+ lita_plugin_type: handler
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.5.1
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: See above.
184
+ test_files:
185
+ - spec/lita/handlers/onewheel_template_spec.rb
186
+ - spec/spec_helper.rb