memerize 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/README.md +1 -0
- data/Rakefile +17 -0
- data/bin/memerize +4 -0
- data/lib/images/cao_base.jpg +0 -0
- data/lib/images/facebookgirl_base.jpg +0 -0
- data/lib/images/falone_base.jpg +0 -0
- data/lib/images/fry_base.jpg +0 -0
- data/lib/images/successkid_base.jpg +0 -0
- data/lib/images/yuno_base.jpg +0 -0
- data/lib/memerize.rb +42 -0
- data/memerize.gemspec +37 -0
- data/test/test_memerize.rb +10 -0
- metadata +92 -0
data/.gitignore
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Memerize is a ordinary gem for generate meme images and have fun!
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
desc 'Default: run unit tests.'
|
2
|
+
task :default => [:test, :clear]
|
3
|
+
|
4
|
+
def run(*cmd)
|
5
|
+
system(*cmd)
|
6
|
+
raise "Command #{cmd.inspect} failed!" unless $?.success?
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'Run the unit tests.'
|
10
|
+
task :test do
|
11
|
+
run "turn test/test_*.rb"
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'Delete images generated in lib/'
|
15
|
+
task :clear do
|
16
|
+
run "rm lib/*.jpg"
|
17
|
+
end
|
data/bin/memerize
ADDED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/memerize.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'RMagick'
|
3
|
+
include Magick
|
4
|
+
|
5
|
+
class Memerize
|
6
|
+
attr_accessor :memes, :meme_name, :text_top, :text_footer
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
self.memes = {
|
10
|
+
:cao => "/cao_base.jpg",
|
11
|
+
:fry => "/fry_base.jpg",
|
12
|
+
:yuno => "/yuno_base.jpg",
|
13
|
+
:falone => "/falone_base.jpg",
|
14
|
+
:successkid => "/successkid_base.jpg",
|
15
|
+
:facebookgirl => "/facebookgirl_base.jpg"
|
16
|
+
}
|
17
|
+
self.meme_name = ARGV[0]
|
18
|
+
self.text_top = ARGV[1]
|
19
|
+
self.text_footer = ARGV[2]
|
20
|
+
create_meme()
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_meme()
|
24
|
+
dir_images = File.expand_path(File.dirname(__FILE__) + '/../lib/images')
|
25
|
+
image = ImageList.new(dir_images + @memes[@meme_name.to_sym])
|
26
|
+
text = Draw.new
|
27
|
+
text.pointsize = 46
|
28
|
+
text.stroke = "black"
|
29
|
+
text.stroke_width = 2
|
30
|
+
text.fill = "white"
|
31
|
+
text.font_family = "Impact-Normal"
|
32
|
+
text.font_weight = BoldWeight
|
33
|
+
|
34
|
+
text.annotate(image, 0, 0, 0, 9, self.text_top) {
|
35
|
+
self.gravity = NorthGravity
|
36
|
+
}
|
37
|
+
text.annotate(image, 0, 0, 0, 9, self.text_footer) {
|
38
|
+
self.gravity = SouthGravity
|
39
|
+
}
|
40
|
+
image.write("#{self.meme_name}.jpg")
|
41
|
+
end
|
42
|
+
end
|
data/memerize.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- enconding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "memerize"
|
5
|
+
s.version = "0.2"
|
6
|
+
s.authors = ["Salviano Ludgerio"]
|
7
|
+
s.email = ["salviano.lfg@gmail.com"]
|
8
|
+
|
9
|
+
s.default_executable = %q{memerize}
|
10
|
+
s.executables = ["memerize"]
|
11
|
+
|
12
|
+
s.files = [
|
13
|
+
".gitignore",
|
14
|
+
"Rakefile",
|
15
|
+
"README.md",
|
16
|
+
"bin/memerize",
|
17
|
+
"lib/memerize.rb",
|
18
|
+
"test/test_memerize.rb",
|
19
|
+
"memerize.gemspec",
|
20
|
+
"lib/images/cao_base.jpg",
|
21
|
+
"lib/images/facebookgirl_base.jpg",
|
22
|
+
"lib/images/fry_base.jpg",
|
23
|
+
"lib/images/yuno_base.jpg",
|
24
|
+
"lib/images/falone_base.jpg",
|
25
|
+
"lib/images/successkid_base.jpg"
|
26
|
+
]
|
27
|
+
|
28
|
+
s.summary = %q{Gem for generate meme images and have fun.}
|
29
|
+
s.description = %q{Memerize is a ordinary Gem for generate meme images and have fun.}
|
30
|
+
|
31
|
+
s.homepage = %q{http://github.com/salvianoo/memerize}
|
32
|
+
|
33
|
+
s.add_dependency "rmagick"
|
34
|
+
|
35
|
+
s.add_development_dependency "minitest"
|
36
|
+
s.add_development_dependency "turn"
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: memerize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.2'
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Salviano Ludgerio
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rmagick
|
16
|
+
requirement: &2152479560 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2152479560
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: minitest
|
27
|
+
requirement: &2152479000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2152479000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: turn
|
38
|
+
requirement: &2152478560 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152478560
|
47
|
+
description: Memerize is a ordinary Gem for generate meme images and have fun.
|
48
|
+
email:
|
49
|
+
- salviano.lfg@gmail.com
|
50
|
+
executables:
|
51
|
+
- memerize
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files: []
|
54
|
+
files:
|
55
|
+
- .gitignore
|
56
|
+
- Rakefile
|
57
|
+
- README.md
|
58
|
+
- bin/memerize
|
59
|
+
- lib/memerize.rb
|
60
|
+
- test/test_memerize.rb
|
61
|
+
- memerize.gemspec
|
62
|
+
- lib/images/cao_base.jpg
|
63
|
+
- lib/images/facebookgirl_base.jpg
|
64
|
+
- lib/images/fry_base.jpg
|
65
|
+
- lib/images/yuno_base.jpg
|
66
|
+
- lib/images/falone_base.jpg
|
67
|
+
- lib/images/successkid_base.jpg
|
68
|
+
homepage: http://github.com/salvianoo/memerize
|
69
|
+
licenses: []
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 1.8.12
|
89
|
+
signing_key:
|
90
|
+
specification_version: 3
|
91
|
+
summary: Gem for generate meme images and have fun.
|
92
|
+
test_files: []
|