Permalink
Browse files

Add gemspec. Fix stuff

  • Loading branch information...
cmdrkeene committed May 7, 2011
1 parent 9758a5f commit ea8db75b3a71d7ed6ae3c06b85aa64e43b7bcad6
Showing with 72 additions and 5 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 Gemfile.lock
  3. +20 −0 LICENSE
  4. +7 −0 README.md
  5. +10 −0 Rakefile
  6. +2 −1 bin/memegen
  7. +9 −2 lib/meme_generator.rb
  8. +22 −0 memegen.gemspec
View
@@ -1 +1 @@
-tmp/*
+*.gem
View
@@ -7,4 +7,4 @@ PLATFORMS
ruby
DEPENDENCIES
- rmagick
+ rmagick ()
View
20 LICENSE
@@ -0,0 +1,20 @@
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -32,6 +32,13 @@ You only have to supply one piece of text:
/tmp/meme-1304797375.jpg
$
+## Adding your own generators
+
+You can add generators to your local `~/.memegen` folder:
+
+ $ ls ~/.memegen
+ my_custom_generator.png
+
## Contribute
Feel free to improve this and add your own generator images!
View
@@ -0,0 +1,10 @@
+$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
+require "meme_generator"
+
+task :build do
+ system "gem build memegen.gemspec"
+end
+
+task :release => :build do
+ system "gem push memegen-#{MemeGenerator::VERSION}.gem"
+end
View
@@ -1,5 +1,6 @@
#!/usr/bin/ruby
-require "lib/meme_generator"
+$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
+require "meme_generator"
MemeGenerator.run
View
@@ -1,7 +1,9 @@
require "rubygems"
+require "bundler/setup"
require "RMagick"
class MemeGenerator
+ VERSION = "0.0.1"
IMPACT_PATH = "fonts/Impact.ttf" # If you don't have OS X, fork me :)
class << self
@@ -11,7 +13,7 @@ def run(argv = ARGV)
return list_generators if generator == "--list"
return usage unless generator && (top || bottom)
- if path = Dir.glob("generators/#{generator}*").first
+ if path = generators.find { |p| p =~ generator}
generate(path, top, bottom)
exit 0
else
@@ -28,7 +30,7 @@ def usage
end
def list_generators
- Dir.glob("generators/*").sort.each do |path|
+ generators.each do |path|
puts File.basename(path).gsub(/\..*/, '')
end
exit 0
@@ -103,5 +105,10 @@ def scale_text(text)
end
[scale, text.strip]
end
+
+ def generators
+ home_dir = File.expand_path("~")
+ Dir.glob(["generators/*", home_dir]).sort
+ end
end
end
View
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib/', __FILE__)
+$:.unshift lib unless $:.include?(lib)
+
+require "meme_generator"
+
+Gem::Specification.new do |s|
+ s.name = "memegen"
+ s.version = MemeGenerator::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Brandon Keene"]
+ s.email = ["bkeene@gmail.com"]
+ s.homepage = "http://github.com/cmdrkeene/memegen"
+ s.summary = "Two-caption meme generator CLI"
+ s.description = "Generate two-caption, 'Advice Dog'-style meme images using the included generator library or use your own images."
+
+ s.required_rubygems_version = ">= 1.3.6"
+
+ s.files = Dir.glob("{bin,lib}/**/*") + %w(LICENSE README.md)
+ s.executables = ['memegen']
+ s.require_path = 'lib'
+end

0 comments on commit ea8db75

Please sign in to comment.