memegen 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,11 +6,12 @@ An RMagick-based two-caption meme generator.
6
6
 
7
7
  ## Install
8
8
 
9
- You'll need [ImageMagick](http://www.imagemagick.org/script/index.php) installed.
9
+ You'll need [ImageMagick](http://www.imagemagick.org/script/index.php) and [ghostscript](http://www.ghostscript.com/) installed.
10
10
  The easiest way is to use [Homebrew](https://github.com/mxcl/homebrew).
11
11
 
12
- brew install imagemagick
13
-
12
+ brew install ghostscript
13
+ brew install --build-from-source imagemagick
14
+
14
15
  Then install the gem!
15
16
 
16
17
  gem install memegen
@@ -23,13 +24,13 @@ To see a list of available images:
23
24
  a_dog
24
25
  p_obama
25
26
  ...
26
-
27
+
27
28
  To generate an image:
28
29
 
29
30
  $ memegen a_dog "Eat Crayons" "Poop Rainbows"
30
31
  /tmp/meme-1234567890.jpg
31
- $
32
-
32
+ $
33
+
33
34
  You only have to supply one piece of text:
34
35
 
35
36
  $ memegen a_dog "" "AWESOME"
@@ -41,20 +42,20 @@ You can also use URLs for one time use memes:
41
42
  $ memegen http://example.com/stupid.jpg "Generated" "From a URL"
42
43
  /tmp/meme-1234567890.jpg
43
44
  $
44
-
45
+
45
46
  ## Adding your own images
46
47
 
47
48
  You can add images to your local `~/.memegen` folder:
48
49
 
49
50
  $ ls ~/.memegen
50
51
  my_custom_image.png
51
-
52
+
52
53
  ## Upload to Campfire
53
54
 
54
55
  If you have a [Campfire](http://campfirenow.com/) account and token, you can automatically upload your image:
55
56
 
56
57
  $ memegen a_dog "Hello" "Campfire world" --campfire
57
-
58
+
58
59
  It will prompt you for your subdomain, token, and room name the first time.
59
60
 
60
61
  ## Upload to GroupMe
@@ -62,9 +63,9 @@ It will prompt you for your subdomain, token, and room name the first time.
62
63
  If you have a [GroupMe](http://groupme.com/) account and token, you can automatically upload your image:
63
64
 
64
65
  $ memegen a_dog "Hello" "GroupMe world" --groupme
65
-
66
+
66
67
  It will prompt you for your phone number, password, and group id the first time. (your password will NOT be stored in plain text).
67
-
68
+
68
69
  ## Bash completion
69
70
 
70
71
  Source or copy `script/autocomplete.sh` inside `~/.bashrc` to get image name autocompletion.
@@ -2,12 +2,32 @@ require "RMagick"
2
2
  require "fileutils"
3
3
 
4
4
  class MemeGenerator
5
- VERSION = "1.0.8"
5
+ VERSION = "1.0.9"
6
6
 
7
7
  class << self
8
+
9
+ # @return [Array<String>] Returns a list of short names for memes
10
+ # available locally on disk.
11
+ def memes
12
+ meme_paths.keys
13
+ end
14
+
15
+ # @return [Hash] Returns a hash of of available memes. Hash keys are
16
+ # the short names for the memes and the values are paths to the meme
17
+ # image on disk.
18
+ def meme_paths
19
+ local_image_path = File.expand_path("~/.memegen")
20
+ base = File.join(File.dirname(__FILE__), "..", "generators")
21
+ files = Dir.glob(["#{base}/*", "#{local_image_path}/*.*"])
22
+ files.inject({}) do |images,path|
23
+ name = path.split('/').last.sub(/\.jpg$/, '')
24
+ images.merge(name => path)
25
+ end
26
+ end
27
+
8
28
  def generate(path, top, bottom)
9
- top = top.upcase
10
- bottom = bottom.upcase
29
+ top = (top || '').upcase
30
+ bottom = (bottom || '').upcase
11
31
 
12
32
  canvas = Magick::ImageList.new(path)
13
33
  image = canvas.first
@@ -1,7 +1,5 @@
1
1
  def images
2
- local_image_path = File.expand_path("~/.memegen")
3
- base = File.join(File.dirname(__FILE__), "..", "..", "generators")
4
- Dir.glob(["#{base}/*", "#{local_image_path}/*.*"])
2
+ MemeGenerator.meme_paths.values
5
3
  end
6
4
 
7
5
  def usage
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memegen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-11 00:00:00.000000000 Z
12
+ date: 2012-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rmagick
16
- requirement: &70143249364640 !ruby/object:Gem::Requirement
16
+ requirement: &70180072379800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70143249364640
24
+ version_requirements: *70180072379800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: tinder
27
- requirement: &70143249364100 !ruby/object:Gem::Requirement
27
+ requirement: &70180072379260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - =
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.4.4
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70143249364100
35
+ version_requirements: *70180072379260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multipart-post
38
- requirement: &70143249363680 !ruby/object:Gem::Requirement
38
+ requirement: &70180072378840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70143249363680
46
+ version_requirements: *70180072378840
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: highlight
49
- requirement: &70143249363220 !ruby/object:Gem::Requirement
49
+ requirement: &70180072378380 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70143249363220
57
+ version_requirements: *70180072378380
58
58
  description: Locally generate two-caption 'Advice Dog'-style meme images
59
59
  email:
60
60
  - bkeene@gmail.com