<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>config.yaml.example</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,3 @@
 index.html
 template.haml
+config.yaml</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -8,8 +8,9 @@ ruby, rake, RMagick, haml
 ## Usage
 
 1. Copy `template.haml.example` to `template.haml`
-2. Put a bunch of images into the `i` directory
-3. Run `rake` from the command line
+2. Copy `config.yaml.example` to `config.yaml`
+3. Put a bunch of images into the `i` directory
+4. Run `rake` from the command line
 
 You will now have a bunch of thumbnails in the `t` directory, plus an `index.html` file containing the thumbnails.
 
@@ -17,7 +18,7 @@ If you add new images to `i`, just run `rake` again &amp; it will add them.
 
 ## Configuration
 
-There are a few configuraion options you may want to play around with in `Rakefile`; including image &amp; thumbnail directories, template &amp; output filenames, and maximum thumbnail width &amp; height. Should be pretty self explanatory.
+There are a few configuraion options you may want to play around with in `config.yaml`; including image &amp; thumbnail directories, template &amp; output filenames, and maximum thumbnail width &amp; height. Should be pretty self explanatory.
 
 ## Other tasks
 
@@ -28,6 +29,5 @@ There are a few configuraion options you may want to play around with in `Rakefi
 
 ## TODO
 
-- Put config stuff in a YAML file or something
 - Pagination
 - Make large image lightboxes linkable</diff>
      <filename>README.md</filename>
    </modified>
    <modified>
      <diff>@@ -2,18 +2,14 @@
 require 'rake/clean'
 require 'RMagick'
 require 'haml'
+require 'yaml'
 
 task :default =&gt; [:convert_images, :build_template]
 
-IMAGE_DIRECTORY = 'i'
-THUMBNAIL_DIRECTORY = 't'
-TEMPLATE_FILE = 'template.haml'
-OUTPUT_FILE = 'index.html'
-MAX_THUMBNAIL_WIDTH = 150
-MAX_THUMBNAIL_HEIGHT = 150
+@config = YAML.load_file('config.yaml')
 
-CLEAN.include(&quot;#{THUMBNAIL_DIRECTORY}/*.*&quot;, OUTPUT_FILE)
-CLOBBER.include(&quot;#{IMAGE_DIRECTORY}/*.*&quot;)
+CLEAN.include(&quot;#{@config[:thumbnail_directory]}/*.*&quot;, @config[:output_file])
+CLOBBER.include(&quot;#{@config[:image_directory]}/*.*&quot;)
 
 def convert_images src_glob, target_directory, parent_task
     FileList[src_glob].each do |f|
@@ -22,7 +18,7 @@ def convert_images src_glob, target_directory, parent_task
 	    puts 'convert '+f + ' &gt; ' + target
 
 	    img = Magick::Image::read(f).first
-	    thumb = img.resize_to_fit(MAX_THUMBNAIL_WIDTH, MAX_THUMBNAIL_HEIGHT)	    
+	    thumb = img.resize_to_fit(@config[:max_thumbnail_width], @config[:max_thumbnail_height])	    
 	    thumb.write target
 
 	end
@@ -30,24 +26,22 @@ def convert_images src_glob, target_directory, parent_task
     end
 end
 
-convert_images File.join(IMAGE_DIRECTORY, '*'), THUMBNAIL_DIRECTORY, :convert_images
+convert_images File.join(@config[:image_directory], '*'), @config[:thumbnail_directory], :convert_images
 
 task :build_template do |t|
-    puts &quot;haml #{TEMPLATE_FILE} &gt; #{OUTPUT_FILE}&quot;
-
-    config = {:max_thumbnail_width =&gt; MAX_THUMBNAIL_WIDTH, :max_thumbnail_height =&gt; MAX_THUMBNAIL_HEIGHT}
+    puts &quot;haml #{@config[:template_file]} &gt; #{@config[:output_file]}&quot;
 
     images = []
 
-    FileList[File.join(THUMBNAIL_DIRECTORY, '*')].each do |thumbnail|
-	full_image = File.join IMAGE_DIRECTORY, File.basename(thumbnail)
+    FileList[File.join(@config[:thumbnail_directory], '*')].each do |thumbnail|
+	full_image = File.join @config[:image_directory], File.basename(thumbnail)
 	images &lt;&lt; {:thumbnail =&gt; thumbnail, :image =&gt; full_image}
     end
 
-    template = File.read(TEMPLATE_FILE)
+    template = File.read(@config[:template_file])
     engine = Haml::Engine.new(template, {:format =&gt; :html5, :attr_wrapper =&gt; '&quot;'})
-    output = engine.render(Object.new, :config =&gt; config, :images =&gt; images)
-    fd = File.open(OUTPUT_FILE, 'w')
+    output = engine.render(Object.new, :@config =&gt; @config, :images =&gt; images)
+    fd = File.open(@config[:output_file], 'w')
     fd.write(output)
     fd.close
 </diff>
      <filename>Rakefile</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>090c29ca6a59b79031a6bb2a3904efdfead90fa5</id>
    </parent>
  </parents>
  <author>
    <name>Lindsay Evans</name>
    <email>linz@linz.id.au</email>
  </author>
  <url>http://github.com/lindsayevans/galleRy/commit/b67a2ec2576618d134bbfd2f3ca67af7fc27bc47</url>
  <id>b67a2ec2576618d134bbfd2f3ca67af7fc27bc47</id>
  <committed-date>2009-11-04T00:43:00-08:00</committed-date>
  <authored-date>2009-11-04T00:43:00-08:00</authored-date>
  <message>Splitting config out into a YAML file</message>
  <tree>2e2af63da5976edb8430084fcf73917b49d9a050</tree>
  <committer>
    <name>Lindsay Evans</name>
    <email>linz@linz.id.au</email>
  </committer>
</commit>
