lita-snoo 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: 37dd7d69dd2d6f535aa7a8be7eadda35bb75974d
4
+ data.tar.gz: 7dee58bfd840333cf06ebf12d5630e367a5d70d6
5
+ SHA512:
6
+ metadata.gz: ba0d4409a67456030bedfcc5916b9bd37d94035e7aad2a0ab2648edee8d02d091f37ed8d32c2bd463e40c0e096e045c4c6eaf937ea3e77d568edc834c4d95464
7
+ data.tar.gz: 569edf84721185f420aa13299694ca3608d244ffa6068ad71c3628e7dc7b00e83e865a9cf2c0721dfff57efdcca82af90522273773953a426bf9cdee0fb0b07e
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ script: bundle exec rake
5
+ before_install:
6
+ - gem update --system
7
+ services:
8
+ - redis-server
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2015 Tristan Chong
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # lita-snoo
2
+
3
+ [![Build Status](https://travis-ci.org/tristaneuan/lita-snoo.png?branch=master)](https://travis-ci.org/tristaneuan/lita-snoo)
4
+ [![Coverage Status](https://coveralls.io/repos/tristaneuan/lita-snoo/badge.png)](https://coveralls.io/r/tristaneuan/lita-snoo)
5
+
6
+ **lita-snoo** is a handler for [Lita](https://github.com/jimmycuadra/lita) that fetches posts from a given subreddit, and finds the original reddit posts for imgur (or custom) URLs it detects.
7
+
8
+ ## Installation
9
+
10
+ Add lita-snoo to your Lita instance's Gemfile:
11
+
12
+ ``` ruby
13
+ gem "lita-snoo"
14
+ ```
15
+
16
+ ## Configuration
17
+
18
+ ### Optional attributes
19
+
20
+ * `domains` (`Array` of `String`s) - An array of domains that, if matched by a detected URL, will return a corresponding reddit post. Default: `["imgur.com"]`
21
+
22
+ ``` ruby
23
+ Lita.configure do |config|
24
+ config.handlers.snoo.domains = ["imgur.com", "youtube.com"]
25
+ end
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ Lita will automatically detect links from imgur (or any domains you've defined in the config) and return the corresponding reddit post if it exists.
31
+ ```
32
+ <me> http://i.imgur.com/Eh3HkJ9.jpg
33
+ <lita> Looking down San Francisco's California Street towards the Bay Bridge. - zauzau on /r/pics, 2014-10-18 (4,927 points) http://redd.it/2jl5np
34
+ ```
35
+
36
+ You can also ask her to retrieve a reddit post for a given URL directly using the command `reddit` or `snoo`.
37
+ ```
38
+ <me> lita: reddit https://www.flickr.com/photos/walkingsf/4671581511
39
+ <lita> Where photos in San Francisco are taken by tourists (red) vs locals (blue) - hfutrell on /r/sanfrancisco, 2015-05-14 (267 points) http://redd.it/35yr3b
40
+ ```
41
+
42
+ Sending Lita a subreddit command will display a random post from the front page of that subreddit.
43
+ ```
44
+ <me> lita: /r/todayilearned
45
+ <lita> TIL Mozart had a "startling fondness" for poop jokes, which is preserved in his surviving letters. - DJDomTom on /r/todayilearned, 2015-05-23 (1,918 points) http://redd.it/36w2xp
46
+ ```
47
+
48
+ If you specify a numerical argument N, she will return the Nth post.
49
+ ```
50
+ <me> lita: /r/Fitness 1
51
+ <lita> New to Fittit? We saw you coming and have collected answers to your questions right here! - eric_twinge on /r/Fitness, 2014-05-08 (2,161 points) http://redd.it/2501op
52
+ ```
53
+
54
+ Specifying a string argument will search for that text within the given subreddit and return the top result.
55
+ ```
56
+ <me> lita: /r/sanfrancisco bart map
57
+ <lita> In all of our dreams...the BART map imagined in 1956 - magicgrl111 on /r/sanfrancisco, 2012-10-16 (320 points) http://redd.it/11lbe5
58
+ ```
59
+
60
+ ## License
61
+
62
+ [MIT](http://opensource.org/licenses/MIT)
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,111 @@
1
+ require "cgi"
2
+ require "uri"
3
+
4
+ module Lita
5
+ module Handlers
6
+ class Snoo < Handler
7
+ config :domains, type: Array, default: ["imgur.com"]
8
+
9
+ route(/(#{URI.regexp})/, :ambient_url, command: false)
10
+ route(/^(?:reddit|snoo)\s+(#{URI.regexp})/i, :url, command: true,
11
+ help: {t("help.snoo_url_key") => t("help.snoo_url_value")})
12
+ route(/^\/?r\/(\S+)\s*(.*)/i, :subreddit, command: true,
13
+ help: {t("help.snoo_sub_key") => t("help.snoo_sub_value")})
14
+
15
+ def ambient_url(response)
16
+ url = response.matches.first.first.split("#").first
17
+ if config.domains.any? { |d| URI.parse(url).hostname.include? d }
18
+ post = api_search("url:'#{url}'")
19
+ if response.message.command?
20
+ response.reply post ? post : "No reddit posts found for #{url}"
21
+ else
22
+ response.reply post if post
23
+ end
24
+ end
25
+ end
26
+
27
+ def url(response)
28
+ url = response.matches.first.first.split("#").first
29
+ unless config.domains.any? { |d| URI.parse(url).hostname.include? d }
30
+ post = api_search("url:'#{url}'")
31
+ response.reply post ? post : "No reddit posts found for #{url}"
32
+ end
33
+ end
34
+
35
+ def subreddit(response)
36
+ subreddit = response.matches.first.first
37
+ arg = response.matches.first[1]
38
+ if arg.length > 0
39
+ if /^\d+$/ =~ arg
40
+ n = arg.to_i
41
+ if n.between?(1, 25)
42
+ response.reply api_subreddit(subreddit, n)
43
+ else
44
+ response.reply "Please specify a number between 1 and 25"
45
+ end
46
+ else
47
+ response.reply api_subreddit_search(subreddit, arg)
48
+ end
49
+ else
50
+ response.reply api_subreddit(subreddit, rand(1..25))
51
+ end
52
+ end
53
+
54
+ private
55
+ def api_search(query)
56
+ http_response = http.get(
57
+ "https://www.reddit.com/search.json",
58
+ q: query,
59
+ sort: "top",
60
+ t: "all"
61
+ )
62
+ return nil if http_response.status != 200
63
+ posts = MultiJson.load(http_response.body)["data"]["children"]
64
+ return nil if posts.empty?
65
+ format_post(posts.first)
66
+ end
67
+
68
+ private
69
+ def api_subreddit(subreddit, n)
70
+ http_response = http.get("https://www.reddit.com/r/#{subreddit}.json")
71
+ return "/r/#{subreddit} is a private subreddit" if http_response.status == 403
72
+ return "/r/#{subreddit} is an invalid subreddit" if http_response.status != 200
73
+ posts = MultiJson.load(http_response.body)["data"]["children"]
74
+ return "No posts found under /r/#{subreddit}" if posts.empty?
75
+ return "/r/#{subreddit} doesn't have that many posts" if posts.length < n
76
+ format_post(posts[n-1])
77
+ end
78
+
79
+ private
80
+ def api_subreddit_search(subreddit, query)
81
+ http_response = http.get(
82
+ "https://www.reddit.com/r/#{subreddit}/search.json",
83
+ q: query,
84
+ restrict_sr: true,
85
+ sort: "relevance",
86
+ t: "all"
87
+ )
88
+ return "/r/#{subreddit} is a private subreddit" if http_response.status == 403
89
+ return "/r/#{subreddit} is an invalid subreddit" if http_response.status != 200
90
+ posts = MultiJson.load(http_response.body)["data"]["children"]
91
+ return "No posts found for '#{query}' in /r/#{subreddit}" if posts.empty?
92
+ format_post(posts.first)
93
+ end
94
+
95
+ private
96
+ def format_post(post)
97
+ title = CGI.unescapeHTML(post["data"]["title"])
98
+ author = post["data"]["author"]
99
+ subreddit = post["data"]["subreddit"]
100
+ date = Time.at(post["data"]["created"]).to_datetime.strftime("%F")
101
+ score = post["data"]["score"].to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
102
+ id = post["data"]["id"]
103
+ nsfw = post["data"]["over_18"] ? "[NSFW] " : ""
104
+ "#{nsfw}#{title} - #{author} on /r/#{subreddit}, #{date} (#{score} points) http://redd.it/#{id}"
105
+ end
106
+
107
+ end
108
+
109
+ Lita.register_handler(Snoo)
110
+ end
111
+ end
data/lib/lita-snoo.rb ADDED
@@ -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/snoo"
8
+
9
+ Lita::Handlers::Snoo.template_root File.expand_path(
10
+ File.join("..", "..", "templates"),
11
+ __FILE__
12
+ )
data/lita-snoo.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "lita-snoo"
3
+ spec.version = "0.1.0"
4
+ spec.authors = ["Tristan Chong"]
5
+ spec.email = ["ong@tristaneuan.ch"]
6
+ spec.description = "A Lita handler for reddit that can detect imgur (or custom) URLs and find their original posts"
7
+ spec.summary = "A Lita handler for reddit that can detect imgur (or custom) URLs and find their original posts"
8
+ spec.homepage = "https://github.com/tristaneuan/lita-snoo"
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.3"
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,9 @@
1
+ en:
2
+ lita:
3
+ handlers:
4
+ snoo:
5
+ help:
6
+ snoo_url_key: "reddit URL"
7
+ snoo_url_value: "Retrieve the original reddit post for URL."
8
+ snoo_sub_key: "/r/SUBREDDIT [N|QUERY]"
9
+ snoo_sub_value: "Display a random (or Nth) post from SUBREDDIT | Search for QUERY within SUBREDDIT."
@@ -0,0 +1,202 @@
1
+ require "spec_helper"
2
+
3
+ describe Lita::Handlers::Snoo, lita_handler: true do
4
+
5
+ it { is_expected.to route("http://i.imgur.com/Eh3HkJ9.jpg").to(:ambient_url) }
6
+ it { is_expected.to route("http://imgur.com/Eh3HkJ9").to(:ambient_url) }
7
+ it { is_expected.to route("http://imgur.com/gallery/jS4pO").to(:ambient_url) }
8
+ it { is_expected.to route("http://imgur.com/a/pAJJi").to(:ambient_url) }
9
+ it { is_expected.to route("https://www.flickr.com/photos/walkingsf/4671581511").to(:ambient_url) }
10
+
11
+ it { is_expected.to route_command("reddit http://accent.gmu.edu/").to(:url) }
12
+ it { is_expected.to route_command("SNOO http://accent.gmu.edu/").to(:url) }
13
+
14
+ it { is_expected.to route_command("/r/AskReddit").to(:subreddit) }
15
+ it { is_expected.to route_command("R/AskReddit 1").to(:subreddit) }
16
+ it { is_expected.to route_command("/r/linguistics lambda calculus").to(:subreddit) }
17
+
18
+ context "with the default config" do
19
+
20
+ describe "#ambient_url" do
21
+
22
+ it "returns the top reddit post for a detected imgur.com link" do
23
+ send_message "i hella miss the city yadadamean http://imgur.com/Eh3HkJ9"
24
+ expect(replies.count).to eq 1
25
+ expect(replies.first).to match(/^Looking down San Francisco's California Street towards the Bay Bridge\. - zauzau on \/r\/pics, 2014-10-17 \(\d{1,3},\d{3}\ points\) http:\/\/redd\.it\/2jl5np$/)
26
+ end
27
+
28
+ it "returns the top reddit post for a detected i.imgur.com link" do
29
+ send_message "http://i.imgur.com/Eh3HkJ9.jpg"
30
+ expect(replies.count).to eq 1
31
+ expect(replies.first).to match(/^Looking down San Francisco's California Street towards the Bay Bridge\. - zauzau on \/r\/pics, 2014-10-17 \(\d{1,3},\d{3}\ points\) http:\/\/redd\.it\/2jl5np$/)
32
+ end
33
+
34
+ it "does not return anything for a detected imgur link if it has not been submitted to reddit" do
35
+ send_message "http://imgur.com/noa9Jcb"
36
+ expect(replies.count).to eq 0
37
+ end
38
+
39
+ it "does not return anything for a detected non-imgur link" do
40
+ send_message "https://www.flickr.com/photos/walkingsf/4671581511"
41
+ expect(replies.count).to eq 0
42
+ end
43
+
44
+ it "marks NSFW posts" do
45
+ send_message "http://i.imgur.com/t15BFZh.jpg"
46
+ expect(replies.count).to eq 1
47
+ expect(replies.first).to start_with("[NSFW] ")
48
+ end
49
+
50
+ it "strips anything following # from URLs" do
51
+ send_message "http://i.imgur.com/Eh3HkJ9.jpg#.png"
52
+ expect(replies.count).to eq 1
53
+ expect(replies.first).to match(/^Looking down San Francisco's California Street towards the Bay Bridge\. - zauzau on \/r\/pics, 2014-10-17 \(\d{1,3},\d{3}\ points\) http:\/\/redd\.it\/2jl5np$/)
54
+ end
55
+
56
+ it "unescapes strings that have been HTML-escaped" do
57
+ send_message "http://i.imgur.com/HdIgRSq.jpg"
58
+ expect(replies.count).to eq 1
59
+ expect(replies.first).not_to match(/&amp;/)
60
+ end
61
+
62
+ end
63
+
64
+ describe "#url" do
65
+
66
+ it "returns the top reddit post for a given link" do
67
+ send_command "reddit http://i.imgur.com/Eh3HkJ9.jpg"
68
+ expect(replies.count).to eq 1
69
+ expect(replies.first).to match(/^Looking down San Francisco's California Street towards the Bay Bridge\. - zauzau on \/r\/pics, 2014-10-17 \(\d{1,3},\d{3}\ points\) http:\/\/redd\.it\/2jl5np$/)
70
+ end
71
+
72
+ it "returns an appropriate message for a given link if it has not been submitted to reddit" do
73
+ send_command "snoo http://imgur.com/noa9Jcb"
74
+ expect(replies.count).to eq 1
75
+ expect(replies.first).to match(/^No reddit posts found for http:\/\/imgur\.com\/noa9Jcb$/)
76
+ end
77
+
78
+ end
79
+
80
+ describe "#subreddit" do
81
+
82
+ it "returns a random post from the top 25 for a given subreddit" do
83
+ send_command "/r/askreddit"
84
+ expect(replies.count).to eq 1
85
+ expect(replies.first).to match(/^.+ - \S+ on \/r\/AskReddit, \d{4}-\d{2}-\d{2} \((?:\d|,)+ points\) http:\/\/redd\.it\/\w+$/)
86
+ end
87
+
88
+ it "returns the nth post for a given subreddit when n is specified" do
89
+ send_command "/r/AskReddit 2"
90
+ expect(replies.count).to eq 1
91
+ expect(replies.first).to match(/^.+ - \S+ on \/r\/AskReddit, \d{4}-\d{2}-\d{2} \((?:\d|,)+ points\) http:\/\/redd\.it\/\w+$/)
92
+ end
93
+
94
+ it "returns the most relevant result for a given subreddit-specific search query" do
95
+ send_command "/r/linguistics lambda calculus"
96
+ expect(replies.count).to eq 1
97
+ expect(replies.first).to match(/^Intro to lambda calculus \(for linguists!\) - leftoversalad on \/r\/linguistics, 2015-02-16 \(\d+ points\) http:\/\/redd\.it\/2w4ir4$/)
98
+ end
99
+
100
+ it "returns an appropriate message when no results can be found for a given subreddit-specific search query" do
101
+ send_command "/r/linguistics ChuqKmv8oRQdHqp7"
102
+ expect(replies.count).to eq 1
103
+ expect(replies.first).to match(/^No posts found for 'ChuqKmv8oRQdHqp7' in \/r\/linguistics$/)
104
+ end
105
+
106
+ it "returns an appropriate message when the subreddit in a given subreddit-specific search query does not exist" do
107
+ send_command "/r/ChuqKmv8oRQdHqp7 linguistics"
108
+ expect(replies.count).to eq 1
109
+ expect(replies.first).to match(/^\/r\/ChuqKmv8oRQdHqp7 is an invalid subreddit$/)
110
+ end
111
+
112
+ it "marks NSFW posts" do
113
+ send_command "/r/spacedicks"
114
+ expect(replies.count).to eq 1
115
+ expect(replies.first).to match(/^\[NSFW\] .+ - \S+ on \/r\/spacedicks, \d{4}-\d{2}-\d{2} \((?:\d|,)+ points\) http:\/\/redd\.it\/\w+$/)
116
+ end
117
+
118
+ it "returns an appropriate message when the given subreddit does not exist" do
119
+ send_command "/r/ChuqKmv8oRQdHqp7"
120
+ expect(replies.count).to eq 1
121
+ expect(replies.first).to match(/^\/r\/ChuqKmv8oRQdHqp7 is an invalid subreddit$/)
122
+ end
123
+
124
+ it "returns an appropriate message when the given subreddit is empty" do
125
+ send_command "/r/thingsjonsnowknows"
126
+ expect(replies.count).to eq 1
127
+ expect(replies.first).to match(/^No posts found under \/r\/thingsjonsnowknows$/)
128
+ end
129
+
130
+ it "returns an appropriate message when the given subreddit is private" do
131
+ send_command "/r/amaninacan"
132
+ expect(replies.count).to eq 1
133
+ expect(replies.first).to match(/^\/r\/amaninacan is a private subreddit$/)
134
+ end
135
+
136
+ it "returns an appropriate message when the given subreddit has fewer than n posts" do
137
+ send_command "/r/Onepostsubreddits 25"
138
+ expect(replies.count).to eq 1
139
+ expect(replies.first).to match(/^\/r\/Onepostsubreddits doesn't have that many posts$/)
140
+ end
141
+
142
+ it "returns an appropriate message when n is not between 1 and 25" do
143
+ send_command "/r/AskReddit 26"
144
+ expect(replies.count).to eq 1
145
+ expect(replies.first).to match(/^Please specify a number between 1 and 25$/)
146
+ end
147
+
148
+ end
149
+
150
+ end
151
+
152
+ context "with custom domains defined in the config" do
153
+
154
+ before(:each) do
155
+ registry.config.handlers.snoo.domains = ["flickr.com", "gmu.edu"]
156
+ end
157
+
158
+ describe "#ambient_url" do
159
+
160
+ it "returns the top reddit post for a detected link on a custom domain" do
161
+ send_message "https://www.flickr.com/photos/walkingsf/4671581511 not surprised about union square, trying to maneuver through all the tourists with their phones out gives me a bad case of irritable powell syndrome"
162
+ expect(replies.count).to eq 1
163
+ expect(replies.first).to match(/^Where photos in San Francisco are taken by tourists \(red\) vs locals \(blue\) - hfutrell on \/r\/sanfrancisco, 2015-05-14 \(\d{3} points\) http:\/\/redd\.it\/35yr3b$/)
164
+ end
165
+
166
+ it "returns the top reddit post for a detected link on a different custom domain" do
167
+ send_message "http://accent.gmu.edu/"
168
+ expect(replies.count).to eq 1
169
+ expect(replies.first).to match(/^Ever wonder what an Armenian accend sounds like\? How about a Swahili Accent\? This site has them all\. - topemo on \/r\/reddit\.com, 2006-04-03 \(\d{2} points\) http:\/\/redd\.it\/3udn$/)
170
+ end
171
+
172
+ it "does not return anything for a detected link on a custom domain if it has not been submitted to reddit" do
173
+ send_message "https://www.flickr.com/photos/apelad/2812456702"
174
+ expect(replies.count).to eq 0
175
+ end
176
+
177
+ it "does not return anything for an imgur link" do
178
+ send_message "http://i.imgur.com/Eh3HkJ9.jpg"
179
+ expect(replies.count).to eq 0
180
+ end
181
+
182
+ end
183
+
184
+ describe "#url" do
185
+
186
+ it "only returns one post when a given link is in the list of custom domains" do
187
+ send_command "snoo https://www.flickr.com/photos/walkingsf/4671581511"
188
+ expect(replies.count).to eq 1
189
+ expect(replies.first).to match(/^Where photos in San Francisco are taken by tourists \(red\) vs locals \(blue\) - hfutrell on \/r\/sanfrancisco, 2015-05-14 \(\d{3} points\) http:\/\/redd\.it\/35yr3b$/)
190
+ end
191
+
192
+ it "returns an appropriate message for a given link if it has not been submitted to reddit" do
193
+ send_command "snoo http://imgur.com/noa9Jcb"
194
+ expect(replies.count).to eq 1
195
+ expect(replies.first).to match(/^No reddit posts found for http:\/\/imgur\.com\/noa9Jcb$/)
196
+ end
197
+
198
+ end
199
+
200
+ end
201
+
202
+ end
@@ -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-snoo"
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
File without changes
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lita-snoo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tristan Chong
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-02 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.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.3'
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 reddit that can detect imgur (or custom) URLs and
126
+ find their original posts
127
+ email:
128
+ - ong@tristaneuan.ch
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - ".gitignore"
134
+ - ".travis.yml"
135
+ - Gemfile
136
+ - LICENSE
137
+ - README.md
138
+ - Rakefile
139
+ - lib/lita-snoo.rb
140
+ - lib/lita/handlers/snoo.rb
141
+ - lita-snoo.gemspec
142
+ - locales/en.yml
143
+ - spec/lita/handlers/snoo_spec.rb
144
+ - spec/spec_helper.rb
145
+ - templates/.gitkeep
146
+ homepage: https://github.com/tristaneuan/lita-snoo
147
+ licenses:
148
+ - MIT
149
+ metadata:
150
+ lita_plugin_type: handler
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ requirements: []
166
+ rubyforge_project:
167
+ rubygems_version: 2.2.2
168
+ signing_key:
169
+ specification_version: 4
170
+ summary: A Lita handler for reddit that can detect imgur (or custom) URLs and find
171
+ their original posts
172
+ test_files:
173
+ - spec/lita/handlers/snoo_spec.rb
174
+ - spec/spec_helper.rb