lita-garfield 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/lita/handlers/garfield.rb +20 -20
- data/lita-garfield.gemspec +1 -1
- data/spec/lita/handlers/garfield_spec.rb +27 -27
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b0e991cac33fbb85cdcb0cab2df78cf001dafb7
|
4
|
+
data.tar.gz: 815a937b11a23d189359a850aa0548cdc1408ca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75dc8cc838cda255ac34cbad7a288fbe3628080ce1d923b4cea36f64eb17ed2b80d646c46b984d4ded7c459e9328359626b0a88415ede87464842ed6aee512ec
|
7
|
+
data.tar.gz: d783dea5c42136e8b6190a4f052c9f0b25ac7210958770a2c1dc147c16cf43e7c018db560e4a60286bad7e8f74a10bdc14b6971dbe6765be3924b2cd9e08542d
|
data/README.md
CHANGED
@@ -17,14 +17,23 @@ gem 'lita-garfield'
|
|
17
17
|
## Usage
|
18
18
|
|
19
19
|
!garfield random - Get a random garfield comic.
|
20
|
+
|
20
21
|
!garfield - Get today's garfield, or a random one if you've already seen today's.*
|
22
|
+
|
21
23
|
!garfield 1/1/1980 - Get a garfield for a m/d/y date.
|
24
|
+
|
22
25
|
!garfield 1980-1-1 - Get a garfield for a y-m-d date.
|
26
|
+
|
23
27
|
!garfield 1-1-1980 - Get a garfield for a m-d-y date.
|
28
|
+
|
24
29
|
!garfield first - Get the first garfield comic.
|
30
|
+
|
25
31
|
!garfield last - Get the last garfield comic.
|
32
|
+
|
26
33
|
!garfield today - Get today's garfield comic.
|
34
|
+
|
27
35
|
!garfield prev - Get the previous day's comic based on the last one you displayed.
|
36
|
+
|
28
37
|
!garfield next - Get the next day's comic based on the last on you displayed.
|
29
38
|
|
30
|
-
|
39
|
+
\* Coming soon to a Lita handler near you.
|
@@ -1,26 +1,26 @@
|
|
1
1
|
module Lita
|
2
2
|
module Handlers
|
3
3
|
class Garfield < Handler
|
4
|
-
route(
|
5
|
-
help: { '
|
6
|
-
route(
|
7
|
-
help: { '
|
8
|
-
route(
|
9
|
-
help: { '
|
10
|
-
route(
|
11
|
-
help: { '
|
12
|
-
route(
|
13
|
-
help: { '
|
14
|
-
route(
|
15
|
-
help: { '
|
16
|
-
route(
|
17
|
-
help: { '
|
18
|
-
route(
|
19
|
-
help: { '
|
20
|
-
route(
|
21
|
-
help: { '
|
22
|
-
route(
|
23
|
-
help: { '
|
4
|
+
route(/^garfield random$/i, :handle_random_garfield,
|
5
|
+
help: { 'garfield random' => 'Get a random garfield comic.'})
|
6
|
+
route(/^garfield$/i, :handle_default_garfield,
|
7
|
+
help: { 'garfield' => 'Get today\'s garfield, or a random one if you\'ve already seen today\'s.'})
|
8
|
+
route(/^garfield (\d{1,2})-(\d{1,2})-(\d{2,4})$/i, :handle_mdy_garfield,
|
9
|
+
help: { 'garfield' => 'Get a garfield for a m/d/y date.'})
|
10
|
+
route(/^garfield (\d{2,4})-(\d{1,2})-(\d{1,2})$/i, :handle_ymd_garfield,
|
11
|
+
help: { 'garfield' => 'Get a garfield for a y-m-d date.'})
|
12
|
+
route(/^garfield (\d{1,2})\/(\d{1,2})\/(\d{2,4})$/i, :handle_mdy_garfield,
|
13
|
+
help: { 'garfield' => 'Get a garfield for a m-d-y date.'})
|
14
|
+
route(/^garfield first$/i, :handle_first_garfield,
|
15
|
+
help: { 'garfield first' => 'Get the first garfield comic.'})
|
16
|
+
route(/^garfield last$/i, :handle_today_garfield,
|
17
|
+
help: { 'garfield last' => 'Get the last garfield comic.'})
|
18
|
+
route(/^garfield today$/i, :handle_today_garfield,
|
19
|
+
help: { 'garfield today' => 'Get today\'s garfield comic.'})
|
20
|
+
route(/^garfield prev$/i, :handle_prev_garfield,
|
21
|
+
help: { 'garfield prev' => 'Get the previous garfield comic.'})
|
22
|
+
route(/^garfield next$/i, :handle_next_garfield,
|
23
|
+
help: { 'garfield next' => 'Get next garfield comic.'})
|
24
24
|
|
25
25
|
def get_garfield_for_today(username)
|
26
26
|
date = Date.today
|
data/lita-garfield.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Lita::Handlers::Garfield, lita_handler: true do
|
4
4
|
|
5
|
-
it { is_expected.to route('
|
6
|
-
it { is_expected.to route('
|
7
|
-
it { is_expected.to route('
|
8
|
-
it { is_expected.to route('
|
9
|
-
it { is_expected.to route('
|
10
|
-
it { is_expected.to route('
|
11
|
-
it { is_expected.to route('
|
12
|
-
it { is_expected.to route('
|
13
|
-
it { is_expected.to route('
|
14
|
-
it { is_expected.to route('
|
5
|
+
it { is_expected.to route('garfield') }
|
6
|
+
it { is_expected.to route('garfield random') }
|
7
|
+
it { is_expected.to route('garfield first') }
|
8
|
+
it { is_expected.to route('garfield last') }
|
9
|
+
it { is_expected.to route('garfield today') }
|
10
|
+
it { is_expected.to route('garfield 5/5/1998') }
|
11
|
+
it { is_expected.to route('garfield 5-5-1998') }
|
12
|
+
it { is_expected.to route('garfield 1998-5-5') }
|
13
|
+
it { is_expected.to route('garfield prev') }
|
14
|
+
it { is_expected.to route('garfield next') }
|
15
15
|
|
16
16
|
def zero_prefix(dat)
|
17
17
|
if dat.to_i < 10
|
@@ -27,54 +27,54 @@ describe Lita::Handlers::Garfield, lita_handler: true do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'will return a random garfield comic' do
|
30
|
-
send_message '
|
30
|
+
send_message 'garfield random'
|
31
31
|
expect(replies.last).to include('https://garfield.com/uploads/strips/')
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'will return a today\'s then a random garfield comic' do
|
35
|
-
send_message '
|
35
|
+
send_message 'garfield'
|
36
36
|
expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
|
37
|
-
send_message '
|
37
|
+
send_message 'garfield'
|
38
38
|
expect(replies.last).to include('https://garfield.com/uploads/strips/')
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'will return today\'s garfield comic' do
|
42
|
-
send_message '
|
42
|
+
send_message 'garfield today'
|
43
43
|
expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'will return today\'s garfield comic' do
|
47
|
-
send_message '
|
47
|
+
send_message 'garfield last'
|
48
48
|
expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'will return the first garfield comic' do
|
52
|
-
send_message '
|
52
|
+
send_message 'garfield first'
|
53
53
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'will return a garfield comic for a specific y-m-d date' do
|
57
|
-
send_message '
|
57
|
+
send_message 'garfield 1998-5-5'
|
58
58
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1998-05-05.jpg')
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'will return a garfield comic for a specific m-d-y date' do
|
62
|
-
send_message '
|
62
|
+
send_message 'garfield 5-5-1998'
|
63
63
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1998-05-05.jpg')
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'will return a garfield comic for a specific / date' do
|
67
|
-
send_message '
|
67
|
+
send_message 'garfield 5/5/1998'
|
68
68
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1998-05-05.jpg')
|
69
69
|
end
|
70
70
|
|
71
71
|
# Test the saved state of the last comic you requested.
|
72
72
|
it 'will return the first and then the next and then the previous garfield comic' do
|
73
|
-
send_message '
|
73
|
+
send_message 'garfield first'
|
74
74
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
|
75
|
-
send_message '
|
75
|
+
send_message 'garfield next'
|
76
76
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-20.jpg')
|
77
|
-
send_message '
|
77
|
+
send_message 'garfield prev'
|
78
78
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
|
79
79
|
end
|
80
80
|
|
@@ -84,13 +84,13 @@ describe Lita::Handlers::Garfield, lita_handler: true do
|
|
84
84
|
first = 'https://garfield.com/uploads/strips/1978-06-19.jpg'
|
85
85
|
last = "https://garfield.com/uploads/strips/#{today.year}-#{zero_prefix today.month}-#{zero_prefix today.day}.jpg"
|
86
86
|
|
87
|
-
send_message '
|
87
|
+
send_message 'garfield first'
|
88
88
|
expect(replies.last).to include(first)
|
89
|
-
send_message '
|
89
|
+
send_message 'garfield prev'
|
90
90
|
expect(replies.last).to include(first)
|
91
|
-
send_message '
|
91
|
+
send_message 'garfield last'
|
92
92
|
expect(replies.last).to include(last)
|
93
|
-
send_message '
|
93
|
+
send_message 'garfield next'
|
94
94
|
expect(replies.last).to include(last)
|
95
95
|
end
|
96
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-garfield
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kreps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|