lita-garfield 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -11
- data/lib/lita/handlers/garfield.rb +20 -20
- data/lita-garfield.gemspec +1 -1
- data/spec/lita/handlers/garfield_spec.rb +26 -26
- 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: 1b68d094948c7b6dfcc907b31c2a20232563b336
|
4
|
+
data.tar.gz: 4e636c1e01099378c2057b27b3d08fa4d0df2ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9299ca4facb2ca37b555c786c2ceba05c86b10d6ab19b3f5263414f91e27a5a3ef642d82ee490dff5f5877e7b20f81c7f674c97bb7204b4502df416719823cf7
|
7
|
+
data.tar.gz: 120e74e8a2352b1ae6f027d0c78935d68428b972ae3e3d412d11c4e0370c9decf2cf08026ad6985e5e0fdd30f2bf90eeb51e7ff4b25f39cb04a6bea26146c201
|
data/README.md
CHANGED
@@ -14,26 +14,26 @@ Add lita-garfield to your Lita instance's Gemfile:
|
|
14
14
|
gem 'lita-garfield'
|
15
15
|
```
|
16
16
|
|
17
|
-
## Usage
|
17
|
+
## Usage, command mode (e.g. directed at bot or using config.robot.alias = '!'
|
18
18
|
|
19
|
-
|
19
|
+
garfield random - Get a random garfield comic.
|
20
20
|
|
21
|
-
|
21
|
+
garfield - Get today's garfield, or a random one if you've already seen today's.*
|
22
22
|
|
23
|
-
|
23
|
+
garfield 1/1/1980 - Get a garfield for a m/d/y date.
|
24
24
|
|
25
|
-
|
25
|
+
garfield 1980-1-1 - Get a garfield for a y-m-d date.
|
26
26
|
|
27
|
-
|
27
|
+
garfield 1-1-1980 - Get a garfield for a m-d-y date.
|
28
28
|
|
29
|
-
|
29
|
+
garfield first - Get the first garfield comic.
|
30
30
|
|
31
|
-
|
31
|
+
garfield last - Get the last garfield comic.
|
32
32
|
|
33
|
-
|
33
|
+
garfield today - Get today's garfield comic.
|
34
34
|
|
35
|
-
|
35
|
+
garfield prev - Get the previous day's comic based on the last one you displayed.
|
36
36
|
|
37
|
-
|
37
|
+
garfield next - Get the next day's comic based on the last on you displayed.
|
38
38
|
|
39
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(/^garfield random$/i, :handle_random_garfield,
|
5
|
-
|
6
|
-
route(/^garfield$/i, :handle_default_garfield,
|
7
|
-
|
8
|
-
route(/^garfield (\d{1,2})-(\d{1,2})-(\d{2,4})$/i, :handle_mdy_garfield,
|
9
|
-
|
10
|
-
route(/^garfield (\d{2,4})-(\d{1,2})-(\d{1,2})$/i, :handle_ymd_garfield,
|
11
|
-
|
12
|
-
route(/^garfield (\d{1,2})\/(\d{1,2})\/(\d{2,4})$/i, :handle_mdy_garfield,
|
13
|
-
|
14
|
-
route(/^garfield first$/i, :handle_first_garfield,
|
15
|
-
|
16
|
-
route(/^garfield last$/i, :handle_today_garfield,
|
17
|
-
|
18
|
-
route(/^garfield today$/i, :handle_today_garfield,
|
19
|
-
|
20
|
-
route(/^garfield prev$/i, :handle_prev_garfield,
|
21
|
-
|
22
|
-
route(/^garfield next$/i, :handle_next_garfield,
|
23
|
-
|
4
|
+
route(/^garfield random$/i, :handle_random_garfield, command: true,
|
5
|
+
help: { 'garfield random' => 'Get a random garfield comic.'})
|
6
|
+
route(/^garfield$/i, :handle_default_garfield, command: true,
|
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, command: true,
|
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, command: true,
|
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, command: true,
|
13
|
+
help: { 'garfield' => 'Get a garfield for a m-d-y date.'})
|
14
|
+
route(/^garfield first$/i, :handle_first_garfield, command: true,
|
15
|
+
help: { 'garfield first' => 'Get the first garfield comic.'})
|
16
|
+
route(/^garfield last$/i, :handle_today_garfield, command: true,
|
17
|
+
help: { 'garfield last' => 'Get the last garfield comic.'})
|
18
|
+
route(/^garfield today$/i, :handle_today_garfield, command: true,
|
19
|
+
help: { 'garfield today' => 'Get today\'s garfield comic.'})
|
20
|
+
route(/^garfield prev$/i, :handle_prev_garfield, command: true,
|
21
|
+
help: { 'garfield prev' => 'Get the previous garfield comic.'})
|
22
|
+
route(/^garfield next$/i, :handle_next_garfield, command: true,
|
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
@@ -2,16 +2,16 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Lita::Handlers::Garfield, lita_handler: true do
|
4
4
|
|
5
|
-
it { is_expected.to
|
6
|
-
it { is_expected.to
|
7
|
-
it { is_expected.to
|
8
|
-
it { is_expected.to
|
9
|
-
it { is_expected.to
|
10
|
-
it { is_expected.to
|
11
|
-
it { is_expected.to
|
12
|
-
it { is_expected.to
|
13
|
-
it { is_expected.to
|
14
|
-
it { is_expected.to
|
5
|
+
it { is_expected.to route_command('garfield') }
|
6
|
+
it { is_expected.to route_command('garfield random') }
|
7
|
+
it { is_expected.to route_command('garfield first') }
|
8
|
+
it { is_expected.to route_command('garfield last') }
|
9
|
+
it { is_expected.to route_command('garfield today') }
|
10
|
+
it { is_expected.to route_command('garfield 5/5/1998') }
|
11
|
+
it { is_expected.to route_command('garfield 5-5-1998') }
|
12
|
+
it { is_expected.to route_command('garfield 1998-5-5') }
|
13
|
+
it { is_expected.to route_command('garfield prev') }
|
14
|
+
it { is_expected.to route_command('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
|
-
|
30
|
+
send_command '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
|
-
|
35
|
+
send_command 'garfield'
|
36
36
|
expect(replies.last).to include("https://garfield.com/uploads/strips/#{get_todays_image_filename}.jpg")
|
37
|
-
|
37
|
+
send_command '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
|
-
|
42
|
+
send_command '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
|
-
|
47
|
+
send_command '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
|
-
|
52
|
+
send_command '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
|
-
|
57
|
+
send_command '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
|
-
|
62
|
+
send_command '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
|
-
|
67
|
+
send_command '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
|
-
|
73
|
+
send_command 'garfield first'
|
74
74
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-19.jpg')
|
75
|
-
|
75
|
+
send_command 'garfield next'
|
76
76
|
expect(replies.last).to include('https://garfield.com/uploads/strips/1978-06-20.jpg')
|
77
|
-
|
77
|
+
send_command '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
|
-
|
87
|
+
send_command 'garfield first'
|
88
88
|
expect(replies.last).to include(first)
|
89
|
-
|
89
|
+
send_command 'garfield prev'
|
90
90
|
expect(replies.last).to include(first)
|
91
|
-
|
91
|
+
send_command 'garfield last'
|
92
92
|
expect(replies.last).to include(last)
|
93
|
-
|
93
|
+
send_command '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.2
|
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-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|