Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add gemspec. Fix stuff

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

0 notes on commit ea8db75

Please sign in to comment.
Something went wrong with that request. Please try again.