le_meme 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +90 -0
- data/Rakefile +2 -0
- data/bin/meme +38 -0
- data/fonts/Impact.ttf +0 -0
- data/le_meme.gemspec +28 -0
- data/lib/le_meme/version.rb +3 -0
- data/lib/le_meme.rb +175 -0
- data/memes/10guy.jpg +0 -0
- data/memes/aaduck.jpg +0 -0
- data/memes/aliens.jpg +0 -0
- data/memes/allthethings.jpg +0 -0
- data/memes/ariel.jpg +0 -0
- data/memes/bad.jpg +0 -0
- data/memes/bcat.jpg +0 -0
- data/memes/blb.jpg +0 -0
- data/memes/bpuffin.jpg +0 -0
- data/memes/brace.jpg +0 -0
- data/memes/bravebear.jpg +0 -0
- data/memes/bsm.jpg +0 -0
- data/memes/bush.jpg +0 -0
- data/memes/butthurt.jpg +0 -0
- data/memes/bwolf.jpg +0 -0
- data/memes/cash.jpg +0 -0
- data/memes/catte.jpg +0 -0
- data/memes/comrade.jpg +0 -0
- data/memes/costanza.jpg +0 -0
- data/memes/cpthind.jpg +0 -0
- data/memes/dank.jpg +0 -0
- data/memes/doge.jpg +0 -0
- data/memes/everywhere.jpg +0 -0
- data/memes/fedora.jpg +0 -0
- data/memes/feels.jpg +0 -0
- data/memes/fem.jpg +0 -0
- data/memes/fry.jpg +0 -0
- data/memes/fwp.jpg +0 -0
- data/memes/gator.jpg +0 -0
- data/memes/gears.jpg +0 -0
- data/memes/ggg.jpg +0 -0
- data/memes/goat.jpg +0 -0
- data/memes/god.jpg +0 -0
- data/memes/grandma.jpg +0 -0
- data/memes/grumpycat.jpg +0 -0
- data/memes/hartmann.jpg +0 -0
- data/memes/hitler.jpg +0 -0
- data/memes/hogscalder.jpg +0 -0
- data/memes/impossibru.jpg +0 -0
- data/memes/interesting.jpg +0 -0
- data/memes/iwolf.jpg +0 -0
- data/memes/jducreux.jpg +0 -0
- data/memes/jimmies.jpg +0 -0
- data/memes/jobs.jpg +0 -0
- data/memes/johnny.jpg +0 -0
- data/memes/keanu.jpg +0 -0
- data/memes/limes.jpg +0 -0
- data/memes/maymay.jpg +0 -0
- data/memes/mayonnaise.jpg +0 -0
- data/memes/menswarehouse.jpg +0 -0
- data/memes/money.jpg +0 -0
- data/memes/mordor.jpg +0 -0
- data/memes/morpheus.jpg +0 -0
- data/memes/neckbear.jpg +0 -0
- data/memes/oag.jpg +0 -0
- data/memes/obama.jpg +0 -0
- data/memes/ogre.jpg +0 -0
- data/memes/onlyone.jpg +0 -0
- data/memes/philo.jpg +0 -0
- data/memes/picard.jpg +0 -0
- data/memes/picard2.jpg +0 -0
- data/memes/rent.jpg +0 -0
- data/memes/s3kid.jpg +0 -0
- data/memes/santa.jpg +0 -0
- data/memes/sap.jpg +0 -0
- data/memes/seal.jpg +0 -0
- data/memes/sexyfry.jpg +0 -0
- data/memes/sfr.jpg +0 -0
- data/memes/shotweb.jpg +0 -0
- data/memes/shrek.jpg +0 -0
- data/memes/skid.jpg +0 -0
- data/memes/skid2.jpg +0 -0
- data/memes/smg.jpg +0 -0
- data/memes/smugbob.jpg +0 -0
- data/memes/spoderman.jpg +0 -0
- data/memes/steve.jpg +0 -0
- data/memes/ugly.jpg +0 -0
- data/memes/unclesam.jpg +0 -0
- data/memes/wonka.jpg +0 -0
- data/memes/yee.jpg +0 -0
- data/memes/yuno.jpg +0 -0
- data/open +1 -0
- metadata +223 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a37048d79db1bc49c2f90a2325bf1c696f103013
|
|
4
|
+
data.tar.gz: 990910b83fb8ca6025eafd3c15666d059d09e2e8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b610b1a33a8b072658fb95cf9f7f9503271933cfebfe2762aa5c2bff1920a77afed3670b9bc237f6e8336b4d1d33b6eee391907709ed80721d06e5314f56f5d4
|
|
7
|
+
data.tar.gz: 5ed9b698eeb24c2ccd31db10952012a6a9bd0a42a264e574d6fd48f446fc72a4fec800b5b77c2489fd31df75b3d55d59d83296d2768a3ac522038b037ade0bfd
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2015 Jeff Sandberg
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Le Meme
|
|
2
|
+
|
|
3
|
+
A tool for making dank memes!
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'le_meme'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install lememe
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### I WANT A MEME NOW!
|
|
24
|
+
Use the command-line tool, `meme`:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
meme 'i want a' 'dank meme'
|
|
28
|
+
```
|
|
29
|
+
<image goes here>
|
|
30
|
+
|
|
31
|
+
### I want to see the command line options
|
|
32
|
+
You can do most meme-ish things from the command-line. It has interactive help at `meme -h`.
|
|
33
|
+
Should be straightforward enough for even the dankest memer.
|
|
34
|
+
|
|
35
|
+
### I want to make memes in my ruby application
|
|
36
|
+
Easy enough!
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
require 'le_meme'
|
|
40
|
+
|
|
41
|
+
meme = LeMeme.new
|
|
42
|
+
|
|
43
|
+
meme.m(top: 'dank memes!', bottom: 'bottom text')
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
See the [docs]() for all the shrektastic details
|
|
47
|
+
|
|
48
|
+
## Contributing
|
|
49
|
+
|
|
50
|
+
1. Fork it ( https://github.com/paradox460/lememe/fork )
|
|
51
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
52
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
53
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
54
|
+
5. Create a new Pull Request
|
|
55
|
+
|
|
56
|
+
## WHY?
|
|
57
|
+
Because the world needs more dank memes!
|
|
58
|
+
|
|
59
|
+
Actually, because I wanted to take some time and clean up the core of [memebot](http://github.com/paradox460/memebot), and figured making the essential meme generation a gem was the best way to do it. Now I can spam my coworkers with memes in hipchat as well.
|
|
60
|
+
|
|
61
|
+
## TODO
|
|
62
|
+
- [ ] Test suite
|
|
63
|
+
- [ ] Accept non-tmp dir meme generation paths
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
Copyright (c) 2015 Jeff Sandberg
|
|
69
|
+
|
|
70
|
+
MIT License
|
|
71
|
+
|
|
72
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
73
|
+
a copy of this software and associated documentation files (the
|
|
74
|
+
"Software"), to deal in the Software without restriction, including
|
|
75
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
76
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
77
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
78
|
+
the following conditions:
|
|
79
|
+
|
|
80
|
+
The above copyright notice and this permission notice shall be
|
|
81
|
+
included in all copies or substantial portions of the Software.
|
|
82
|
+
|
|
83
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
84
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
85
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
86
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
87
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
88
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
89
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
90
|
+
```
|
data/Rakefile
ADDED
data/bin/meme
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'le_meme'
|
|
4
|
+
require 'pry'
|
|
5
|
+
|
|
6
|
+
memegen = LeMeme.new
|
|
7
|
+
|
|
8
|
+
opts = Slop.parse!(strict: true, help: true) do
|
|
9
|
+
banner <<-HEREDOC
|
|
10
|
+
Usage: meme [options] [top-text] [bottom-text]
|
|
11
|
+
|
|
12
|
+
Top and bottom may be set by the last 2 unprefixed arguments, or by their respective flags.
|
|
13
|
+
If you don't specify a meme, either via image path or by template, we'll pick one for you.
|
|
14
|
+
HEREDOC
|
|
15
|
+
separator '---'
|
|
16
|
+
|
|
17
|
+
on 't', 'top=', 'top text'
|
|
18
|
+
on 'b', 'bottom=', 'bottom text.'
|
|
19
|
+
on 'm', 'meme=', 'meme template you want to use, see --templates'
|
|
20
|
+
on 'p', 'path=', 'path to an image to use for the meme'
|
|
21
|
+
on 'w', 'watermark=', 'text to watermark the image'
|
|
22
|
+
|
|
23
|
+
on 'templates', 'list all the meme templates' do
|
|
24
|
+
puts memegen.memes.keys.join("\n")
|
|
25
|
+
exit
|
|
26
|
+
end
|
|
27
|
+
on 'v', 'version', 'display the current version' do
|
|
28
|
+
$stdout.puts LeMeme::VERSION
|
|
29
|
+
exit
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
top = opts[:top] || ARGV[0]
|
|
35
|
+
bottom = opts[:bottom] || ARGV[1]
|
|
36
|
+
|
|
37
|
+
$stdout.puts memegen.fast_meme(name: opts[:meme], top: top, bottom: bottom, watermark: opts[:watermark])
|
|
38
|
+
exit
|
data/fonts/Impact.ttf
ADDED
|
Binary file
|
data/le_meme.gemspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'le_meme/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "le_meme"
|
|
8
|
+
spec.version = LeMeme::VERSION
|
|
9
|
+
spec.authors = ["Jeff Sandberg"]
|
|
10
|
+
spec.email = ["paradox460@gmail.com"]
|
|
11
|
+
spec.summary = %q{Dank memes, in gem form}
|
|
12
|
+
spec.description = %q{A gem that generates memes. Can be used as a library or command-line executable.}
|
|
13
|
+
spec.homepage = "http://github.com/paradox460/lememe"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
23
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
|
24
|
+
|
|
25
|
+
spec.add_runtime_dependency 'rmagick', '~> 2.13'
|
|
26
|
+
spec.add_runtime_dependency 'word_wrapper', '~> 0.5.0'
|
|
27
|
+
spec.add_runtime_dependency 'slop', '~> 3.6'
|
|
28
|
+
end
|
data/lib/le_meme.rb
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
require 'le_meme/version'
|
|
2
|
+
require 'rmagick'
|
|
3
|
+
require 'word_wrapper'
|
|
4
|
+
|
|
5
|
+
# Create some dank memes
|
|
6
|
+
#
|
|
7
|
+
# @author Jeff Sandberg <paradox460@gmail.com>
|
|
8
|
+
class LeMeme
|
|
9
|
+
VALID_IMAGE_EXTENSIONS = /\.(jp[e]?g|png|gif)$/i
|
|
10
|
+
|
|
11
|
+
attr_reader :memes
|
|
12
|
+
|
|
13
|
+
# Create a new instance of LeMeme, for generating memes.
|
|
14
|
+
#
|
|
15
|
+
# @param [Array] Directories of images you want the gem to know about. Scrapes images in said directory
|
|
16
|
+
# @return [String] description of returned object
|
|
17
|
+
def initialize(*dirs)
|
|
18
|
+
@memes = {}
|
|
19
|
+
load_directory!
|
|
20
|
+
dirs.each do |dir|
|
|
21
|
+
load_directory!(dir)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Create a meme with the given text
|
|
26
|
+
#
|
|
27
|
+
# @param path [String] The path to the image file you want to annotate.
|
|
28
|
+
# @param top [String] The text you want to appear on the top of the meme.
|
|
29
|
+
# @param bottom [String] The text you want to appear on the bottom of the meme.
|
|
30
|
+
# @param watermark [String] The watermark text. If nil it is omitted
|
|
31
|
+
# @return [String] Path to the generated meme
|
|
32
|
+
def generate(path:, top: nil, bottom: nil, watermark: nil)
|
|
33
|
+
top = (top || '').upcase
|
|
34
|
+
bottom = (bottom || '').upcase
|
|
35
|
+
|
|
36
|
+
path = Pathname.new(path).realpath
|
|
37
|
+
|
|
38
|
+
canvas = Magick::ImageList.new(path)
|
|
39
|
+
|
|
40
|
+
caption_meme(top, Magick::NorthGravity, canvas) unless top.empty?
|
|
41
|
+
caption_meme(bottom, Magick::SouthGravity, canvas) unless bottom.empty?
|
|
42
|
+
|
|
43
|
+
# Draw the watermark
|
|
44
|
+
unless watermark.nil?
|
|
45
|
+
watermark_draw = Magick::Draw.new
|
|
46
|
+
watermark_draw.annotate(canvas, 0, 0, 0, 0, " #{watermark}") do
|
|
47
|
+
self.font = 'Helvetica'
|
|
48
|
+
self.fill = 'white'
|
|
49
|
+
self.text_antialias(false)
|
|
50
|
+
self.font_weight = 100
|
|
51
|
+
self.gravity = Magick::SouthEastGravity
|
|
52
|
+
self.pointsize = 10
|
|
53
|
+
self.undercolor = 'hsla(0,0,0,.5)'
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
output_path = "/tmp/meme-#{Time.now.to_i}#{path.extname}"
|
|
58
|
+
canvas.write(output_path)
|
|
59
|
+
output_path
|
|
60
|
+
end
|
|
61
|
+
alias_method :meme, :generate
|
|
62
|
+
|
|
63
|
+
# Create a meme, using the pre-loaded templates.
|
|
64
|
+
# If no template is specified, randomly picks one
|
|
65
|
+
#
|
|
66
|
+
# @param name [String] Name of the template to use. See #memes
|
|
67
|
+
# @param top [String] The text you want to appear on the top of the meme.
|
|
68
|
+
# @param bottom [String] The text you want to appear on the bottom of the meme.
|
|
69
|
+
# @param watermark [String] The watermark text. If nil it is omitted
|
|
70
|
+
# @return [String] Path to the generated meme
|
|
71
|
+
def fast_meme(name: nil, top: nil, bottom: nil, watermark: nil)
|
|
72
|
+
if name.nil?
|
|
73
|
+
path = @memes[@memes.keys.sample]
|
|
74
|
+
elsif @memes[name].nil?
|
|
75
|
+
fail ArgumentError, "#{name} is not a pre-loaded meme"
|
|
76
|
+
else
|
|
77
|
+
path = @memes[name]
|
|
78
|
+
end
|
|
79
|
+
generate(path: path, top: top, bottom: bottom, watermark: watermark)
|
|
80
|
+
end
|
|
81
|
+
alias_method :m, :fast_meme
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
# Load all images in a directory as memes.
|
|
86
|
+
# Last loaded directory overrides first, if there are name conflicts.
|
|
87
|
+
#
|
|
88
|
+
# @param directory [String] Directory to scrape.
|
|
89
|
+
def load_directory!(directory = nil)
|
|
90
|
+
directory = directory.nil? ? "#{File.join(File.dirname(File.expand_path(__FILE__)), '../memes')}/*.jpg" : "#{directory}/*"
|
|
91
|
+
paths = Dir.glob(directory).select do |path|
|
|
92
|
+
path =~ VALID_IMAGE_EXTENSIONS
|
|
93
|
+
end
|
|
94
|
+
@memes.merge!(paths.reduce({}) do |images, path|
|
|
95
|
+
path = Pathname.new(path).realpath
|
|
96
|
+
name = path.split.last.sub(VALID_IMAGE_EXTENSIONS, '').to_s
|
|
97
|
+
images.merge(name => path)
|
|
98
|
+
end)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Caption a canvas
|
|
102
|
+
#
|
|
103
|
+
# @param text [String] The text to put on as a caption
|
|
104
|
+
# @param gravity [Grav] RMagick Gravity Constant
|
|
105
|
+
# @param canvas [Magick::ImageList] ImageList/Canvas to compose the text onto
|
|
106
|
+
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
107
|
+
def caption_meme(text, gravity, canvas)
|
|
108
|
+
text.gsub!('\\', '\\\\\\')
|
|
109
|
+
|
|
110
|
+
# 28 is the biggest pointsize memes dont look like shit on
|
|
111
|
+
min_pointsize = 28
|
|
112
|
+
max_pointsize = 128
|
|
113
|
+
current_pointsize = min_pointsize
|
|
114
|
+
current_stroke = current_pointsize / 30.0
|
|
115
|
+
|
|
116
|
+
max_width = canvas.columns - 20
|
|
117
|
+
max_height = (canvas.rows / 2) - 20
|
|
118
|
+
|
|
119
|
+
draw = Magick::Draw.new
|
|
120
|
+
draw.font = File.join(File.dirname(File.expand_path(__FILE__)), '..', 'fonts', 'Impact.ttf')
|
|
121
|
+
draw.font_weight = Magick::BoldWeight
|
|
122
|
+
metrics = nil
|
|
123
|
+
|
|
124
|
+
# Non-ragged word-wrap
|
|
125
|
+
text = word_wrap(text)
|
|
126
|
+
|
|
127
|
+
# Calculate out the largest pointsize that will fit
|
|
128
|
+
loop do
|
|
129
|
+
draw.pointsize = current_pointsize
|
|
130
|
+
last_metrics = metrics
|
|
131
|
+
metrics = draw.get_multiline_type_metrics(text)
|
|
132
|
+
|
|
133
|
+
if metrics.width + current_stroke > max_width ||
|
|
134
|
+
metrics.height + current_stroke > max_height ||
|
|
135
|
+
current_pointsize > max_pointsize
|
|
136
|
+
if current_pointsize > min_pointsize
|
|
137
|
+
current_pointsize -= 1
|
|
138
|
+
current_stroke = current_pointsize / 30.0
|
|
139
|
+
metrics = last_metrics
|
|
140
|
+
end
|
|
141
|
+
break
|
|
142
|
+
else
|
|
143
|
+
current_pointsize += 1
|
|
144
|
+
current_stroke = current_pointsize / 30.0
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
# rubocop:disable Style/RedundantSelf
|
|
148
|
+
draw.annotate(canvas, canvas.columns, canvas.rows - 10, 0, 0, text) do
|
|
149
|
+
self.interline_spacing = -(current_pointsize / 5)
|
|
150
|
+
self.stroke_antialias(true)
|
|
151
|
+
self.stroke = 'black'
|
|
152
|
+
self.fill = 'white'
|
|
153
|
+
self.gravity = gravity
|
|
154
|
+
self.stroke_width = current_stroke
|
|
155
|
+
self.pointsize = current_pointsize
|
|
156
|
+
end
|
|
157
|
+
# rubocop:enable Style/RedundantSelf
|
|
158
|
+
end
|
|
159
|
+
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
|
|
160
|
+
|
|
161
|
+
# Wrap the text to fit on a meme
|
|
162
|
+
# This basically uses the wordwrapper library, and then does some calculations to split super-long strings
|
|
163
|
+
#
|
|
164
|
+
# @param text [String] The text string to word-wrap.
|
|
165
|
+
# @param col [Fixnum] The number of "columns" to wrap at
|
|
166
|
+
# @return [String] The text, with the
|
|
167
|
+
def word_wrap(text, col: 24)
|
|
168
|
+
text.strip.gsub(/\n\r/, '\s')
|
|
169
|
+
text = WordWrapper::MinimumRaggedness.new(col, text).wrap
|
|
170
|
+
text = text.split("\n").map do |line|
|
|
171
|
+
line.length > col ? line.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/, "\\1\\3\n").strip : line
|
|
172
|
+
end * "\n"
|
|
173
|
+
text.strip
|
|
174
|
+
end
|
|
175
|
+
end
|
data/memes/10guy.jpg
ADDED
|
Binary file
|
data/memes/aaduck.jpg
ADDED
|
Binary file
|
data/memes/aliens.jpg
ADDED
|
Binary file
|
|
Binary file
|
data/memes/ariel.jpg
ADDED
|
Binary file
|
data/memes/bad.jpg
ADDED
|
Binary file
|
data/memes/bcat.jpg
ADDED
|
Binary file
|
data/memes/blb.jpg
ADDED
|
Binary file
|
data/memes/bpuffin.jpg
ADDED
|
Binary file
|
data/memes/brace.jpg
ADDED
|
Binary file
|
data/memes/bravebear.jpg
ADDED
|
Binary file
|
data/memes/bsm.jpg
ADDED
|
Binary file
|
data/memes/bush.jpg
ADDED
|
Binary file
|
data/memes/butthurt.jpg
ADDED
|
Binary file
|
data/memes/bwolf.jpg
ADDED
|
Binary file
|
data/memes/cash.jpg
ADDED
|
Binary file
|
data/memes/catte.jpg
ADDED
|
Binary file
|
data/memes/comrade.jpg
ADDED
|
Binary file
|
data/memes/costanza.jpg
ADDED
|
Binary file
|
data/memes/cpthind.jpg
ADDED
|
Binary file
|
data/memes/dank.jpg
ADDED
|
Binary file
|
data/memes/doge.jpg
ADDED
|
Binary file
|
|
Binary file
|
data/memes/fedora.jpg
ADDED
|
Binary file
|
data/memes/feels.jpg
ADDED
|
Binary file
|
data/memes/fem.jpg
ADDED
|
Binary file
|
data/memes/fry.jpg
ADDED
|
Binary file
|
data/memes/fwp.jpg
ADDED
|
Binary file
|
data/memes/gator.jpg
ADDED
|
Binary file
|
data/memes/gears.jpg
ADDED
|
Binary file
|
data/memes/ggg.jpg
ADDED
|
Binary file
|
data/memes/goat.jpg
ADDED
|
Binary file
|
data/memes/god.jpg
ADDED
|
Binary file
|
data/memes/grandma.jpg
ADDED
|
Binary file
|
data/memes/grumpycat.jpg
ADDED
|
Binary file
|
data/memes/hartmann.jpg
ADDED
|
Binary file
|
data/memes/hitler.jpg
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/memes/iwolf.jpg
ADDED
|
Binary file
|
data/memes/jducreux.jpg
ADDED
|
Binary file
|
data/memes/jimmies.jpg
ADDED
|
Binary file
|
data/memes/jobs.jpg
ADDED
|
Binary file
|
data/memes/johnny.jpg
ADDED
|
Binary file
|
data/memes/keanu.jpg
ADDED
|
Binary file
|
data/memes/limes.jpg
ADDED
|
Binary file
|
data/memes/maymay.jpg
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/memes/money.jpg
ADDED
|
Binary file
|
data/memes/mordor.jpg
ADDED
|
Binary file
|
data/memes/morpheus.jpg
ADDED
|
Binary file
|
data/memes/neckbear.jpg
ADDED
|
Binary file
|
data/memes/oag.jpg
ADDED
|
Binary file
|
data/memes/obama.jpg
ADDED
|
Binary file
|
data/memes/ogre.jpg
ADDED
|
Binary file
|
data/memes/onlyone.jpg
ADDED
|
Binary file
|
data/memes/philo.jpg
ADDED
|
Binary file
|
data/memes/picard.jpg
ADDED
|
Binary file
|
data/memes/picard2.jpg
ADDED
|
Binary file
|
data/memes/rent.jpg
ADDED
|
Binary file
|
data/memes/s3kid.jpg
ADDED
|
Binary file
|
data/memes/santa.jpg
ADDED
|
Binary file
|
data/memes/sap.jpg
ADDED
|
Binary file
|
data/memes/seal.jpg
ADDED
|
Binary file
|
data/memes/sexyfry.jpg
ADDED
|
Binary file
|
data/memes/sfr.jpg
ADDED
|
Binary file
|
data/memes/shotweb.jpg
ADDED
|
Binary file
|
data/memes/shrek.jpg
ADDED
|
Binary file
|
data/memes/skid.jpg
ADDED
|
Binary file
|
data/memes/skid2.jpg
ADDED
|
Binary file
|
data/memes/smg.jpg
ADDED
|
Binary file
|
data/memes/smugbob.jpg
ADDED
|
Binary file
|
data/memes/spoderman.jpg
ADDED
|
Binary file
|
data/memes/steve.jpg
ADDED
|
Binary file
|
data/memes/ugly.jpg
ADDED
|
Binary file
|
data/memes/unclesam.jpg
ADDED
|
Binary file
|
data/memes/wonka.jpg
ADDED
|
Binary file
|
data/memes/yee.jpg
ADDED
|
Binary file
|
data/memes/yuno.jpg
ADDED
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: le_meme
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jeff Sandberg
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.7'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.7'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pry
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0.10'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0.10'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rmagick
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.13'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '2.13'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: word_wrapper
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 0.5.0
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.5.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: slop
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '3.6'
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '3.6'
|
|
97
|
+
description: A gem that generates memes. Can be used as a library or command-line
|
|
98
|
+
executable.
|
|
99
|
+
email:
|
|
100
|
+
- paradox460@gmail.com
|
|
101
|
+
executables:
|
|
102
|
+
- meme
|
|
103
|
+
extensions: []
|
|
104
|
+
extra_rdoc_files: []
|
|
105
|
+
files:
|
|
106
|
+
- ".gitignore"
|
|
107
|
+
- Gemfile
|
|
108
|
+
- LICENSE.txt
|
|
109
|
+
- README.md
|
|
110
|
+
- Rakefile
|
|
111
|
+
- bin/meme
|
|
112
|
+
- fonts/Impact.ttf
|
|
113
|
+
- le_meme.gemspec
|
|
114
|
+
- lib/le_meme.rb
|
|
115
|
+
- lib/le_meme/version.rb
|
|
116
|
+
- memes/10guy.jpg
|
|
117
|
+
- memes/aaduck.jpg
|
|
118
|
+
- memes/aliens.jpg
|
|
119
|
+
- memes/allthethings.jpg
|
|
120
|
+
- memes/ariel.jpg
|
|
121
|
+
- memes/bad.jpg
|
|
122
|
+
- memes/bcat.jpg
|
|
123
|
+
- memes/blb.jpg
|
|
124
|
+
- memes/bpuffin.jpg
|
|
125
|
+
- memes/brace.jpg
|
|
126
|
+
- memes/bravebear.jpg
|
|
127
|
+
- memes/bsm.jpg
|
|
128
|
+
- memes/bush.jpg
|
|
129
|
+
- memes/butthurt.jpg
|
|
130
|
+
- memes/bwolf.jpg
|
|
131
|
+
- memes/cash.jpg
|
|
132
|
+
- memes/catte.jpg
|
|
133
|
+
- memes/comrade.jpg
|
|
134
|
+
- memes/costanza.jpg
|
|
135
|
+
- memes/cpthind.jpg
|
|
136
|
+
- memes/dank.jpg
|
|
137
|
+
- memes/doge.jpg
|
|
138
|
+
- memes/everywhere.jpg
|
|
139
|
+
- memes/fedora.jpg
|
|
140
|
+
- memes/feels.jpg
|
|
141
|
+
- memes/fem.jpg
|
|
142
|
+
- memes/fry.jpg
|
|
143
|
+
- memes/fwp.jpg
|
|
144
|
+
- memes/gator.jpg
|
|
145
|
+
- memes/gears.jpg
|
|
146
|
+
- memes/ggg.jpg
|
|
147
|
+
- memes/goat.jpg
|
|
148
|
+
- memes/god.jpg
|
|
149
|
+
- memes/grandma.jpg
|
|
150
|
+
- memes/grumpycat.jpg
|
|
151
|
+
- memes/hartmann.jpg
|
|
152
|
+
- memes/hitler.jpg
|
|
153
|
+
- memes/hogscalder.jpg
|
|
154
|
+
- memes/impossibru.jpg
|
|
155
|
+
- memes/interesting.jpg
|
|
156
|
+
- memes/iwolf.jpg
|
|
157
|
+
- memes/jducreux.jpg
|
|
158
|
+
- memes/jimmies.jpg
|
|
159
|
+
- memes/jobs.jpg
|
|
160
|
+
- memes/johnny.jpg
|
|
161
|
+
- memes/keanu.jpg
|
|
162
|
+
- memes/limes.jpg
|
|
163
|
+
- memes/maymay.jpg
|
|
164
|
+
- memes/mayonnaise.jpg
|
|
165
|
+
- memes/menswarehouse.jpg
|
|
166
|
+
- memes/money.jpg
|
|
167
|
+
- memes/mordor.jpg
|
|
168
|
+
- memes/morpheus.jpg
|
|
169
|
+
- memes/neckbear.jpg
|
|
170
|
+
- memes/oag.jpg
|
|
171
|
+
- memes/obama.jpg
|
|
172
|
+
- memes/ogre.jpg
|
|
173
|
+
- memes/onlyone.jpg
|
|
174
|
+
- memes/philo.jpg
|
|
175
|
+
- memes/picard.jpg
|
|
176
|
+
- memes/picard2.jpg
|
|
177
|
+
- memes/rent.jpg
|
|
178
|
+
- memes/s3kid.jpg
|
|
179
|
+
- memes/santa.jpg
|
|
180
|
+
- memes/sap.jpg
|
|
181
|
+
- memes/seal.jpg
|
|
182
|
+
- memes/sexyfry.jpg
|
|
183
|
+
- memes/sfr.jpg
|
|
184
|
+
- memes/shotweb.jpg
|
|
185
|
+
- memes/shrek.jpg
|
|
186
|
+
- memes/skid.jpg
|
|
187
|
+
- memes/skid2.jpg
|
|
188
|
+
- memes/smg.jpg
|
|
189
|
+
- memes/smugbob.jpg
|
|
190
|
+
- memes/spoderman.jpg
|
|
191
|
+
- memes/steve.jpg
|
|
192
|
+
- memes/ugly.jpg
|
|
193
|
+
- memes/unclesam.jpg
|
|
194
|
+
- memes/wonka.jpg
|
|
195
|
+
- memes/yee.jpg
|
|
196
|
+
- memes/yuno.jpg
|
|
197
|
+
- open
|
|
198
|
+
homepage: http://github.com/paradox460/lememe
|
|
199
|
+
licenses:
|
|
200
|
+
- MIT
|
|
201
|
+
metadata: {}
|
|
202
|
+
post_install_message:
|
|
203
|
+
rdoc_options: []
|
|
204
|
+
require_paths:
|
|
205
|
+
- lib
|
|
206
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
|
+
requirements:
|
|
208
|
+
- - ">="
|
|
209
|
+
- !ruby/object:Gem::Version
|
|
210
|
+
version: '0'
|
|
211
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
|
+
requirements:
|
|
213
|
+
- - ">="
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: '0'
|
|
216
|
+
requirements: []
|
|
217
|
+
rubyforge_project:
|
|
218
|
+
rubygems_version: 2.4.5
|
|
219
|
+
signing_key:
|
|
220
|
+
specification_version: 4
|
|
221
|
+
summary: Dank memes, in gem form
|
|
222
|
+
test_files: []
|
|
223
|
+
has_rdoc:
|