meme_generator 1.5 → 1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +22 -0
  3. data/lib/meme.rb +32 -21
  4. metadata +4 -4
  5. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,25 @@
1
+ === 1.6 / 2011-03-17
2
+
3
+ * Minor enhancements
4
+ * <tt>meme --list</tt> is now sorted.
5
+ * +meme+ now accepts multiple lines. Not every generator accepts multiple
6
+ lines so use with care. Pull Request #18 by Arthur Chiu.
7
+ * Added Anteater. Pull Request #14 by Aaron Patterson.
8
+ * Added Cool Story House. Pull Request #16 by Dean Strelau.
9
+ * Added Creeper. Pull Request #15 by Aaron Patterson.
10
+ * Added Futurama Fry. Pull Request #16 by Dean Strelau.
11
+ * Added High Expectations Asian Father. Pull Request #18 by Arthur Chiu.
12
+ * Added Inception. Pull Request #18 by Arthur Chiu.
13
+ * Added Keanu. Pull Request #16 by Dean Strelau.
14
+ * Added Minecraft. Pull Request #15 by Aaron Patterson.
15
+ * Added ORLY Owl. Pull Request #18 by Arthur Chiu.
16
+ * Added Spiderman. Pull Request #18 by Arthur Chiu.
17
+ * Added Uncle Sam Points. Pull Request #13 by Aaron Patteron.
18
+ * Added Unicorn Boy. Pull Request #19 by Aaron Patterson.
19
+ * Added Victory Baby. Pull Request #16 by Dean Strelau.
20
+ * GENERATORS hash additions are now aligned. Pull Request #16 by Dean
21
+ Strelau.
22
+
1
23
  === 1.5 / 2011-03-16
2
24
 
3
25
  * Minor enhancement
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.5'
19
+ VERSION = '1.6'
20
20
 
21
21
  ##
22
22
  # For statistics!
@@ -32,26 +32,39 @@ class Meme
32
32
 
33
33
  # keep generators in alphabetical order
34
34
 
35
+ GENERATORS['ANTEATER'] = [41191, 'anteater']
35
36
  GENERATORS['A_DODSON'] = [106375, 'Antoine-Dodson']
36
37
  GENERATORS['A_DOG'] = [940, 'Advice-Dog']
37
- GENERATORS['BUTTHURT_DWELLER'] = [1438, 'Butthurt-Dweller']
38
+ GENERATORS['A_FATHER'] = [1436, 'High-Expectations-Asian-Father']
39
+ GENERATORS['BUTTHURT_DWELLER'] = [1438, 'Butthurt-Dweller']
38
40
  GENERATORS['B_FROG'] = [1211, 'Foul-Bachelorette-Frog']
39
41
  GENERATORS['B_FROG2'] = [1045, 'Foul-Bachelor-Frog']
42
+ GENERATORS['COOL_STORY_HOUSE'] = [16948, 'cool-story-bro-house']
43
+ GENERATORS['CREEPER'] = [173501, 'Minecraft-Creeper']
40
44
  GENERATORS['C_WOLF'] = [931, 'Courage-Wolf']
45
+ GENERATORS['F_FRY'] = [84688, 'Futurama-Fry']
41
46
  GENERATORS['G_GRANDPA'] = [185650, 'Grumpy-Grandpa']
42
47
  GENERATORS['H_MERMAID'] = [405224, 'Hipster-Mermaid']
43
48
  GENERATORS['I_DONT_ALWAYS'] = [38926, 'The-Most-Interesting-Man-in-the-World']
44
49
  GENERATORS['I_WOLF'] = [926, 'Insanity-Wolf']
50
+ GENERATORS['INCEPTION'] = [107949, 'Inception']
45
51
  GENERATORS['J_DUCREUX'] = [1356, 'Joseph-Ducreux']
52
+ GENERATORS['KEANU'] = [47718, 'Keanu-reeves']
53
+ GENERATORS['MINECRAFT'] = [122309, 'Minecraft']
54
+ GENERATORS['O-RLY-OWL'] = [117041, 'O-RLY-OWL', 'ORLY???']
46
55
  GENERATORS['OBAMA'] = [1332, 'Obama-']
47
56
  GENERATORS['PHILOSORAPTOR'] = [984, 'Philosoraptor']
48
57
  GENERATORS['P_OAK'] = [24321, 'Professor-Oak']
49
58
  GENERATORS['SCUMBAG'] = [364688, 'Scumbag-Steve']
50
59
  GENERATORS['SPARTA'] = [1013, 'sparta']
51
- GENERATORS['S_AWKWARD_PENGUIN'] = [983, 'Socially-Awkward-Penguin']
60
+ GENERATORS['SPIDERMAN'] = [1037, 'Question-Spiderman']
52
61
  GENERATORS['SWEDISH_CHEF'] = [186651, 'Swedish-Chef']
62
+ GENERATORS['S_AWKWARD_PENGUIN'] = [983, 'Socially-Awkward-Penguin']
53
63
  GENERATORS['TOWNCRIER'] = [434537, 'Towncrier']
54
64
  GENERATORS['TROLLFACE'] = [1030, 'Troll-Face']
65
+ GENERATORS['UNICORN_BOY'] = [57022, 'unicorn-boy']
66
+ GENERATORS['US_POINT'] = [131083, 'Uncle-Sam-Point', 'I WANT YOU']
67
+ GENERATORS['V_BABY'] = [11140, 'Victory-Baby']
55
68
  GENERATORS['XZIBIT'] = [3114, 'XZIBIT']
56
69
  GENERATORS['Y_U_NO'] = [165241, 'Y-U-NO', 'Y U NO']
57
70
 
@@ -77,20 +90,17 @@ class Meme
77
90
  if generator == '--list' then
78
91
  width = GENERATORS.keys.map { |command| command.length }.max
79
92
 
80
- GENERATORS.each do |command, (id, name, _)|
81
- puts "%-*s %s" % [width, command, name]
93
+ GENERATORS.sort.each do |command, (id, name, _)|
94
+ puts "%-*s %s" % [width, command, name]
82
95
  end
83
96
 
84
97
  exit
85
98
  end
86
99
 
87
- line1 = ARGV.shift
88
- line2 = ARGV.shift
89
-
90
- abort "#{$0} [GENERATOR|--list] LINE [LINE]" unless line1
100
+ abort "#{$0} [GENERATOR|--list] LINE [ADDITONAL_LINES]" if ARGV.empty?
91
101
 
92
102
  meme = new generator
93
- link = meme.generate line1, line2
103
+ link = meme.generate *ARGV
94
104
 
95
105
  meme.paste link
96
106
 
@@ -120,26 +130,27 @@ class Meme
120
130
  # have to supply one line because the first line is defaulted for you.
121
131
  # Isn't that great?
122
132
 
123
- def generate line1, line2 = nil
133
+ def generate *args
124
134
  url = URI.parse 'http://memegenerator.net/Instance/CreateOrEdit'
125
135
  res = nil
126
136
  location = nil
127
137
 
128
- unless line2 then
129
- line2 = line1
130
- line1 = @default_line
131
- end
138
+ # Put the default line in front unless theres more than 1 text input.
139
+ args.unshift(@default_line) unless args.size > 1
140
+
141
+ raise Error, "two lines are required for #{@generator_name}" unless args.size > 1
142
+
143
+ post_data = { 'templateType' => 'AdviceDogSpinoff',
144
+ 'templateID' => @template_id,
145
+ 'generatorName' => @generator_name }
132
146
 
133
- raise Error, "two lines are required for #{@generator_name}" unless line1
147
+ # go through each argument and add it back into the post data as textN
148
+ (0..args.size).map {|num| post_data.merge! "text#{num}" => args[num] }
134
149
 
135
150
  Net::HTTP.start url.host do |http|
136
151
  post = Net::HTTP::Post.new url.path
137
152
  post['User-Agent'] = USER_AGENT
138
- post.set_form_data('templateType' => 'AdviceDogSpinoff',
139
- 'text0' => line1,
140
- 'text1' => line2,
141
- 'templateID' => @template_id,
142
- 'generatorName' => @generator_name)
153
+ post.set_form_data post_data
143
154
 
144
155
  res = http.request post
145
156
 
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: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 5
9
- version: "1.5"
8
+ - 6
9
+ version: "1.6"
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-03-16 00:00:00 -07:00
38
+ date: 2011-03-17 00:00:00 -07:00
39
39
  default_executable:
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file