groupmeme 5.0.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/meme.rb +10 -57
  2. metadata +5 -5
@@ -3,55 +3,26 @@ require 'rubygems'
3
3
  require 'nokogiri'
4
4
  require 'cgi'
5
5
 
6
- ##
7
- # Generate memes using http://memegenerator.net
8
-
9
6
  class Meme
10
-
11
- ##
12
- # Sometimes your meme will have an error, fix it!
13
-
14
7
  class Error < RuntimeError; end
15
8
 
16
- ##
17
- # Every meme generator needs a version
18
-
19
- VERSION = '1.9.3'
20
-
21
- ##
22
- # For statistics!
23
-
9
+ VERSION = "6.0.0"
24
10
  USER_AGENT = "meme/#{VERSION} Ruby/#{RUBY_VERSION}"
25
-
26
- ##
27
- # We have some generators up-in-here
28
-
29
11
  GENERATORS = Hash.new do |_, k|
30
12
  raise Error, "unknown generator #{k}"
31
13
  end
32
14
 
33
- ##
34
- # For creating advice-dog type meme images.
35
- #
36
- # These can accept up to two lines of text
37
-
38
- def self.advice_dog name, id, template_name, first_line = nil
15
+ def self.advice_dog(name, id, template_name, first_line = nil)
39
16
  template = [id, 'AdviceDogSpinoff', template_name, first_line]
40
17
  template.compact
41
18
 
42
19
  GENERATORS[name] = template
43
20
  end
44
21
 
45
- ##
46
- # For creating vertical type meme images
47
- #
48
- # These can accept multiple lines of text
49
-
50
- def self.vertical name, id, template_name
22
+ def self.vertical(name, id, template_name)
51
23
  GENERATORS[name] = [id, 'Vertical', template_name]
52
24
  end
53
25
 
54
- # keep generators in alphabetical order
55
26
  advice_dog 'ANTEATER', 41191, 'anteater'
56
27
  advice_dog 'A_DODSON', 106375, 'Antoine-Dodson'
57
28
  advice_dog 'A_DOG', 940, 'Advice-Dog'
@@ -62,6 +33,7 @@ class Meme
62
33
  advice_dog 'B_FROG', 1211, 'Foul-Bachelorette-Frog'
63
34
  advice_dog 'B_FROG2', 1045, 'Foul-Bachelor-Frog'
64
35
  advice_dog 'BEIBER', 11809, 'Justin-Beiber'
36
+ advice_dog 'CAM', 625978, 'cameme'
65
37
  advice_dog 'CATHY', 622381, 'AckCathy'
66
38
  advice_dog 'CHALLENGE_ACCEPTED', 275025, 'Challenge-Accepted'
67
39
  advice_dog 'COOL_STORY_HOUSE', 16948, 'cool-story-bro-house'
@@ -90,6 +62,7 @@ class Meme
90
62
  advice_dog 'SCUMBAG', 364688, 'Scumbag-Steve'
91
63
  advice_dog 'SERIOUS_FISH', 6374627,'Spongebob-Serious-Fish'
92
64
  advice_dog 'SHEEN', 488762, 'Charlie-Sheen'
65
+ advice_dog 'SMART', 626097, 'smart'
93
66
  advice_dog 'SNOB', 2994, 'Snob'
94
67
  advice_dog 'SPARTA', 1013, 'sparta'
95
68
  advice_dog 'SPIDERMAN', 1037, 'Question-Spiderman'
@@ -110,11 +83,6 @@ class Meme
110
83
  vertical 'NEO', 173419, 'Neo'
111
84
  vertical 'THE_ROCK', 417195, 'The-Rock-driving'
112
85
 
113
- # keep generators in alphabetical order
114
-
115
- ##
116
- # Looks up generator name
117
-
118
86
  def GENERATORS.match(name)
119
87
  # TODO meme Y U NO DEMETAPHONE?
120
88
  return self[name] if has_key? name
@@ -123,10 +91,7 @@ class Meme
123
91
  generator || self[name] # raises the error if generator is nil
124
92
  end
125
93
 
126
- ##
127
- # Interface for the executable
128
-
129
- def self.run argv = ARGV
94
+ def self.run(argv = ARGV)
130
95
  generator = ARGV.shift
131
96
 
132
97
  if generator == '--list' then
@@ -160,19 +125,11 @@ class Meme
160
125
  abort "ERROR: #{e.message} (#{e.class})"
161
126
  end
162
127
 
163
- ##
164
- # Generates links for +generator+
165
-
166
- def initialize generator
128
+ def initialize(generator)
167
129
  @template_id, @template_type, @generator_name, @default_line = GENERATORS.match generator
168
130
  end
169
131
 
170
- ##
171
- # Generates a meme with +line1+ and +line2+. For some generators you only
172
- # have to supply one line because the first line is defaulted for you.
173
- # Isn't that great?
174
-
175
- def generate *args
132
+ def generate(*args)
176
133
  url = URI.parse 'http://memegenerator.net/Instance/CreateOrEdit'
177
134
  res = nil
178
135
  location = nil
@@ -210,7 +167,7 @@ class Meme
210
167
  doc.css("a[href=\"#{location}\"] img").first['src']
211
168
  end
212
169
 
213
- def fetch link
170
+ def fetch(link)
214
171
  url = URI.parse link
215
172
  res = nil
216
173
 
@@ -223,11 +180,7 @@ class Meme
223
180
  res.body
224
181
  end
225
182
 
226
- ##
227
- # Tries to find clipboard copy executable and if found puts +link+ in your
228
- # clipboard.
229
-
230
- def paste link
183
+ def paste(link)
231
184
  require 'pasteboard'
232
185
 
233
186
  clipboard = Pasteboard.new
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupmeme
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
5
- prerelease:
4
+ hash: 47
5
+ prerelease: false
6
6
  segments:
7
- - 5
7
+ - 6
8
8
  - 0
9
9
  - 0
10
- version: 5.0.0
10
+ version: 6.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - THE INTERNET
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements: []
65
65
 
66
66
  rubyforge_project:
67
- rubygems_version: 1.4.1
67
+ rubygems_version: 1.3.7
68
68
  signing_key:
69
69
  specification_version: 3
70
70
  summary: GroupMe fork of meme_generator