meme_generator 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +8 -2
- data/README.txt +9 -3
- data/lib/meme.rb +31 -6
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
=== 1.
|
1
|
+
=== 1.1 / 2011-02-09
|
2
2
|
|
3
|
-
*
|
3
|
+
* Minor enhancements
|
4
|
+
* Added 13 new templates. Pull Request #4 by Josep M. Bach.
|
5
|
+
* Meme::run now returns the link. Pull Request #2 by Josep M. Bach.
|
6
|
+
* Better template lookup. Patch by James Tucker.
|
4
7
|
|
8
|
+
=== 1.0 / 2011-02-08
|
9
|
+
|
10
|
+
* Major enhancements
|
5
11
|
* Birthday!
|
6
12
|
|
data/README.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= meme_generator
|
2
2
|
|
3
3
|
* http://github.com/drbrain/meme
|
4
4
|
* http://docs.seattlerb.org/meme_generator
|
@@ -9,12 +9,18 @@ Generate meme images using http://memegenerator.net! Save yourself some time!
|
|
9
9
|
|
10
10
|
== FEATURES/PROBLEMS:
|
11
11
|
|
12
|
-
* Only has a static list of
|
12
|
+
* Only has a static list of sixteen meme images
|
13
13
|
* No tests
|
14
14
|
|
15
15
|
== SYNOPSIS:
|
16
16
|
|
17
|
-
|
17
|
+
Generate a Y U NO meme:
|
18
|
+
|
19
|
+
$ meme Y_U_NO 'write tests?'
|
20
|
+
|
21
|
+
See a list of available generators
|
22
|
+
|
23
|
+
$ meme --list
|
18
24
|
|
19
25
|
You can also drive it like an API.
|
20
26
|
|
data/lib/meme.rb
CHANGED
@@ -16,7 +16,7 @@ class Meme
|
|
16
16
|
##
|
17
17
|
# Every meme generator needs a version
|
18
18
|
|
19
|
-
VERSION = '1.
|
19
|
+
VERSION = '1.1'
|
20
20
|
|
21
21
|
##
|
22
22
|
# For statistics!
|
@@ -30,9 +30,33 @@ class Meme
|
|
30
30
|
raise Error, "unknown generator #{k}"
|
31
31
|
end
|
32
32
|
|
33
|
-
GENERATORS['Y_U_NO']
|
34
|
-
GENERATORS['B_FROG']
|
35
|
-
GENERATORS['
|
33
|
+
GENERATORS['Y_U_NO'] = [165241, 'Y-U-NO', 'Y U NO']
|
34
|
+
GENERATORS['B_FROG'] = [1211, 'Foul-Bachelorette-Frog']
|
35
|
+
GENERATORS['B_FROG2'] = [1045, 'Foul-Bachelor-Frog']
|
36
|
+
GENERATORS['PHILOSORAPTOR'] = [984, 'Philosoraptor']
|
37
|
+
GENERATORS['I_WOLF'] = [926, 'Insanity-Wolf']
|
38
|
+
GENERATORS['G_GRANDPA'] = [185650, 'Grumpy-Grandpa']
|
39
|
+
GENERATORS['S_AWKWARD_PENGUIN'] = [983, 'Socially-Awkward-Penguin']
|
40
|
+
GENERATORS['A_DOG'] = [940, 'Advice-Dog']
|
41
|
+
GENERATORS['J_DUCREUX'] = [1356, 'Joseph-Ducreux']
|
42
|
+
GENERATORS['XZIBIT'] = [3114, 'XZIBIT']
|
43
|
+
GENERATORS['TROLLFACE'] = [1030, 'Troll-Face']
|
44
|
+
GENERATORS['A_DODSON'] = [106375, 'Antoine-Dodson']
|
45
|
+
GENERATORS['P_OAK'] = [24321, 'Professor-Oak']
|
46
|
+
GENERATORS['OBAMA'] = [1332, 'Obama-']
|
47
|
+
GENERATORS['SPARTA'] = [1013, 'sparta']
|
48
|
+
GENERATORS['TOWNCRIER'] = [434537, 'Towncrier']
|
49
|
+
|
50
|
+
##
|
51
|
+
# Looks up generator name
|
52
|
+
|
53
|
+
def GENERATORS.match(name)
|
54
|
+
# TODO meme Y U NO DEMETAPHONE?
|
55
|
+
return self[name] if has_key? name
|
56
|
+
matcher = Regexp.new(name, Regexp::IGNORECASE)
|
57
|
+
_, generator = find { |k,v| matcher =~ k || v.grep(matcher).any? }
|
58
|
+
generator || self[name] # raises the error if generator is nil
|
59
|
+
end
|
36
60
|
|
37
61
|
##
|
38
62
|
# Interface for the executable
|
@@ -53,7 +77,7 @@ class Meme
|
|
53
77
|
line1 = ARGV.shift
|
54
78
|
line2 = ARGV.shift
|
55
79
|
|
56
|
-
abort "#{$0} GENERATOR LINE [LINE]" unless line1
|
80
|
+
abort "#{$0} [GENERATOR|--list] LINE [LINE]" unless line1
|
57
81
|
|
58
82
|
meme = new generator
|
59
83
|
link = meme.generate line1, line2
|
@@ -61,13 +85,14 @@ class Meme
|
|
61
85
|
meme.paste link
|
62
86
|
|
63
87
|
puts link
|
88
|
+
link
|
64
89
|
end
|
65
90
|
|
66
91
|
##
|
67
92
|
# Generates links for +generator+
|
68
93
|
|
69
94
|
def initialize generator
|
70
|
-
@template_id, @generator_name, @default_line = GENERATORS
|
95
|
+
@template_id, @generator_name, @default_line = GENERATORS.match generator
|
71
96
|
end
|
72
97
|
|
73
98
|
##
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meme_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: "1.
|
8
|
+
- 1
|
9
|
+
version: "1.1"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Eric Hodel
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
x52qPcexcYZR7w==
|
36
36
|
-----END CERTIFICATE-----
|
37
37
|
|
38
|
-
date: 2011-02-
|
38
|
+
date: 2011-02-09 00:00:00 -08:00
|
39
39
|
default_executable:
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
metadata.gz.sig
CHANGED
Binary file
|