<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>MIT-LICENSE</filename>
    </added>
    <added>
      <filename>README.rdoc</filename>
    </added>
    <added>
      <filename>lib/image_temp_file.rb</filename>
    </added>
    <added>
      <filename>mini_magick.gemspec</filename>
    </added>
    <added>
      <filename>test/command_builder_test.rb</filename>
    </added>
    <added>
      <filename>test/image_temp_file_test.rb</filename>
    </added>
    <added>
      <filename>test/image_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,40 @@
-require 'config/requirements'
-require 'config/hoe' # setup Hoe + all gem configuration
-
-Dir['tasks/**/*.rake'].each { |rake| load rake }
\ No newline at end of file
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+$:.unshift(File.dirname(__FILE__) + &quot;/lib&quot;)
+require 'mini_magick'
+
+desc 'Default: run unit tests.'
+task :default =&gt; :test
+
+desc 'Clean generated files.'
+task :clean =&gt; :clobber_rdoc do
+  rm FileList['test/output/*.png']
+end
+
+desc 'Test the mini_magick plugin.'
+Rake::TestTask.new(:test) do |t|
+  t.libs &lt;&lt; 'lib'
+  t.pattern = 'test/**/*_test.rb'
+  t.verbose = true
+end
+
+desc 'Generate documentation for the mini_magick plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+  rdoc.rdoc_dir = 'rdoc'
+  rdoc.title    = 'MiniMagick'
+  rdoc.options &lt;&lt; '--line-numbers'
+  rdoc.options &lt;&lt; '--inline-source'
+  rdoc.rdoc_files.include('README.rdoc')
+  rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+desc 'Update gemspec.'
+task :update_gemspec =&gt; :clean do
+  files = `git-ls-files`.split
+  data = File.read('mini_magick.gemspec')
+  data.sub!(/^  s.version = .*$/, &quot;  s.version = #{MiniMagick::VERSION.inspect}&quot;)
+  data.sub!(/^  s.files = .*$/, &quot;  s.files = %w(#{files.join(' ')})&quot;)
+  open('mini_magick.gemspec', 'w'){|f| f.write(data)}
+end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,178 @@
-$:.unshift File.dirname(__FILE__)
+require &quot;open-uri&quot;
+require &quot;stringio&quot;
+require &quot;fileutils&quot;
+require &quot;open3&quot;
 
-require 'mini_magick/mini_magick'
\ No newline at end of file
+require File.join(File.dirname(__FILE__), '/image_temp_file')
+
+module MiniMagick
+  class MiniMagickError &lt; RuntimeError; end
+
+  VERSION = '1.2.5'
+
+  class Image
+    attr :path
+    attr :tempfile
+    attr :output
+
+    # Class Methods
+    # -------------
+    class &lt;&lt; self
+      def from_blob(blob, ext = nil)
+        begin
+          tempfile = ImageTempFile.new(ext)
+          tempfile.binmode
+          tempfile.write(blob)
+        ensure
+          tempfile.close if tempfile
+        end
+
+        return self.new(tempfile.path, tempfile)
+      end
+
+      # Use this if you don't want to overwrite the image file
+      def open(image_path)
+        File.open(image_path, &quot;rb&quot;) do |f|
+          self.from_blob(f.read, File.extname(image_path))
+        end
+      end
+      alias_method :from_file, :open
+    end
+
+    # Instance Methods
+    # ----------------
+    def initialize(input_path, tempfile=nil)
+      @path = input_path
+      @tempfile = tempfile # ensures that the tempfile will stick around until this image is garbage collected.
+
+      # Ensure that the file is an image
+      run_command(&quot;identify&quot;, @path)
+    end
+
+    # For reference see http://www.imagemagick.org/script/command-line-options.php#format
+    def [](value)
+      # Why do I go to the trouble of putting in newlines? Because otherwise animated gifs screw everything up
+      case value.to_s
+      when &quot;format&quot;
+        run_command(&quot;identify&quot;, &quot;-format&quot;, format_option(&quot;%m&quot;), @path).split(&quot;\n&quot;)[0]
+      when &quot;height&quot;
+        run_command(&quot;identify&quot;, &quot;-format&quot;, format_option(&quot;%h&quot;), @path).split(&quot;\n&quot;)[0].to_i
+      when &quot;width&quot;
+        run_command(&quot;identify&quot;, &quot;-format&quot;, format_option(&quot;%w&quot;), @path).split(&quot;\n&quot;)[0].to_i
+      when &quot;dimensions&quot;
+        run_command(&quot;identify&quot;, &quot;-format&quot;, format_option(&quot;%w %h&quot;), @path).split(&quot;\n&quot;)[0].split.map{|v|v.to_i}
+      when &quot;size&quot;
+        File.size(@path) # Do this because calling identify -format &quot;%b&quot; on an animated gif fails!
+      when &quot;original_at&quot;
+        # Get the EXIF original capture as a Time object
+        Time.local(*self[&quot;EXIF:DateTimeOriginal&quot;].split(/:|\s+/)) rescue nil
+      when /^EXIF\:/i
+        run_command('identify', '-format', &quot;\&quot;%[#{value}]\&quot;&quot;, @path).chop
+      else
+        run_command('identify', '-format', &quot;\&quot;#{value}\&quot;&quot;, @path).split(&quot;\n&quot;)[0]
+      end
+    end
+
+    # Sends raw commands to imagemagick's mogrify command. The image path is automatically appended to the command
+    def &lt;&lt;(*args)
+      run_command(&quot;mogrify&quot;, *args &lt;&lt; @path)
+    end
+
+    # This is a 'special' command because it needs to change @path to reflect the new extension
+    # Formatting an animation into a non-animated type will result in ImageMagick creating multiple
+    # pages (starting with 0).  You can choose which page you want to manipulate.  We default to the
+    # first page.
+    def format(format, page=0)
+      run_command(&quot;mogrify&quot;, &quot;-format&quot;, format, @path)
+
+      old_path = @path.dup
+      @path.sub!(/(\.\w+)?$/, &quot;.#{format}&quot;)
+      File.unlink(old_path) unless old_path == @path
+
+      unless File.exists?(@path)
+        begin
+          FileUtils.copy_file(@path.sub(&quot;.#{format}&quot;, &quot;-#{page}.#{format}&quot;), @path)
+        rescue =&gt; ex
+          raise MiniMagickError, &quot;Unable to format to #{format}; #{ex}&quot; unless File.exist?(@path)
+        end
+      end
+    ensure
+      Dir[@path.sub(/(\.\w+)?$/, &quot;-[0-9]*.#{format}&quot;)].each do |fname|
+        File.unlink(fname)
+      end
+    end
+
+    # Writes the temporary image that we are using for processing to the output path
+    def write(output_path)
+      FileUtils.copy_file @path, output_path
+      run_command &quot;identify&quot;, output_path # Verify that we have a good image
+    end
+
+    # Give you raw data back
+    def to_blob
+      f = File.new @path
+      f.binmode
+      f.read
+    ensure
+      f.close if f
+    end
+
+    # If an unknown method is called then it is sent through the morgrify program
+    # Look here to find all the commands (http://www.imagemagick.org/script/mogrify.php)
+    def method_missing(symbol, *args)
+      args.push(@path) # push the path onto the end
+      run_command(&quot;mogrify&quot;, &quot;-#{symbol}&quot;, *args)
+      self
+    end
+
+    # You can use multiple commands together using this method
+    def combine_options(&amp;block)
+      c = CommandBuilder.new
+      block.call c
+      run_command(&quot;mogrify&quot;, *c.args &lt;&lt; @path)
+    end
+
+    # Check to see if we are running on win32 -- we need to escape things differently
+    def windows?
+      !(RUBY_PLATFORM =~ /win32/).nil?
+    end
+
+    # Outputs a carriage-return delimited format string for Unix and Windows
+    def format_option(format)
+      windows? ? &quot;#{format}\\n&quot; : &quot;#{format}\\\\n&quot;
+    end
+
+    def run_command(command, *args)
+      args.collect! do |arg|
+        # values quoted because they can contain characters like '&gt;', but don't quote switches
+        arg =~ /^\+|\-/) ? %|&quot;#{arg}&quot;| : arg.to_s
+      end
+
+      command = &quot;#{command} #{args.join(' ')}&quot;
+      output = `#{command} 2&gt;&amp;1`
+
+      if $?.exitstatus != 0
+        raise MiniMagickError, &quot;ImageMagick command (#{command.inspect}) failed: #{{:status_code =&gt; $?, :output =&gt; output}.inspect}&quot;
+      else
+        output
+      end
+    end
+  end
+
+  class CommandBuilder
+    attr :args
+
+    def initialize
+      @args = []
+    end
+
+    def method_missing(symbol, *args)
+      @args &lt;&lt; &quot;-#{symbol}&quot;
+      @args += args
+    end
+
+    def +(value)
+      @args &lt;&lt; &quot;+#{value}&quot;
+    end
+  end
+end</diff>
      <filename>lib/mini_magick.rb</filename>
    </modified>
    <modified>
      <filename>test/animation.gif</filename>
    </modified>
    <modified>
      <filename>test/leaves.tiff</filename>
    </modified>
    <modified>
      <filename>test/not_an_image.php</filename>
    </modified>
    <modified>
      <filename>test/simple.gif</filename>
    </modified>
    <modified>
      <filename>test/trogdor.jpg</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>History.txt</filename>
    </removed>
    <removed>
      <filename>License.txt</filename>
    </removed>
    <removed>
      <filename>Manifest.txt</filename>
    </removed>
    <removed>
      <filename>README.txt</filename>
    </removed>
    <removed>
      <filename>config/hoe.rb</filename>
    </removed>
    <removed>
      <filename>config/requirements.rb</filename>
    </removed>
    <removed>
      <filename>lib/mini_magick/image_temp_file.rb</filename>
    </removed>
    <removed>
      <filename>lib/mini_magick/mini_magick.rb</filename>
    </removed>
    <removed>
      <filename>lib/mini_magick/version.rb</filename>
    </removed>
    <removed>
      <filename>log/debug.log</filename>
    </removed>
    <removed>
      <filename>script/destroy</filename>
    </removed>
    <removed>
      <filename>script/generate</filename>
    </removed>
    <removed>
      <filename>script/txt2html</filename>
    </removed>
    <removed>
      <filename>setup.rb</filename>
    </removed>
    <removed>
      <filename>tasks/deployment.rake</filename>
    </removed>
    <removed>
      <filename>tasks/environment.rake</filename>
    </removed>
    <removed>
      <filename>tasks/website.rake</filename>
    </removed>
    <removed>
      <filename>test/test_helper.rb</filename>
    </removed>
    <removed>
      <filename>test/test_image_temp_file.rb</filename>
    </removed>
    <removed>
      <filename>test/test_mini_magick.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>56a476171eaddaeb9e35d730d5a6310e9e2a3f81</id>
    </parent>
  </parents>
  <author>
    <name>Corey Johnson</name>
    <email>probablycorey@gmail.com</email>
  </author>
  <url>http://github.com/probablycorey/mini_magick/commit/88f03280d0f499b3cd3437c99b964e72b3801882</url>
  <id>88f03280d0f499b3cd3437c99b964e72b3801882</id>
  <committed-date>2009-05-26T18:04:57-07:00</committed-date>
  <authored-date>2009-05-26T18:04:57-07:00</authored-date>
  <message>gobbled up a bunch of remvees patches</message>
  <tree>1332d32f779483eb764c2047611fd64ec17af2dc</tree>
  <committer>
    <name>Corey Johnson</name>
    <email>probablycorey@gmail.com</email>
  </committer>
</commit>
