<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -102,12 +102,19 @@ module Synthesis
       @asset_path = ($asset_base_path ? &quot;#{$asset_base_path}/&quot; : &quot;#{RAILS_ROOT}/public/&quot;) +
           &quot;#{@asset_type}#{@target_dir.gsub(/^(.+)$/, '/\1')}&quot;
       @extension = get_extension
-      @match_regex = Regexp.new(&quot;\\A#{@target}_packaged.#{@extension}\\z&quot;)
+      @file_name = &quot;#{@target}_packaged.#{@extension}&quot;
+      @full_path = File.join(@asset_path, @file_name)
     end
   
+    def package_exists?
+      File.exists?(@full_path)
+    end
+
     def current_file
-      @target_dir.gsub(/^(.+)$/, '\1/') +
-          Dir.new(@asset_path).entries.delete_if { |x| ! (x =~ @match_regex) }.sort.reverse[0].chomp(&quot;.#{@extension}&quot;)
+      build unless package_exists?
+
+      path = @target_dir.gsub(/^(.+)$/, '\1/')
+      &quot;#{path}#{@target}_packaged&quot;
     end
 
     def build
@@ -116,9 +123,7 @@ module Synthesis
     end
 
     def delete_previous_build
-      Dir.new(@asset_path).entries.delete_if { |x| ! (x =~ @match_regex) }.each do |x|
-        File.delete(&quot;#{@asset_path}/#{x}&quot;)
-      end
+      File.delete(@full_path) if File.exists?(@full_path)
     end
 
     private</diff>
      <filename>lib/synthesis/asset_package.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e4a45e4134998ee871852f675dc54fb807fd15ee</id>
    </parent>
  </parents>
  <author>
    <name>Scott Becker</name>
    <email>becker.scott@gmail.com</email>
  </author>
  <url>http://github.com/sbecker/asset_packager/commit/b0aa32d71212c7d3ebbb6683fcc77d19899ac7cf</url>
  <id>b0aa32d71212c7d3ebbb6683fcc77d19899ac7cf</id>
  <committed-date>2008-11-30T01:08:17-08:00</committed-date>
  <authored-date>2008-11-30T01:08:17-08:00</authored-date>
  <message>packages now built on demand in production mode. avoids errors and having to explicitly run the rake asset:packager:build_all task in deployment</message>
  <tree>1c2c52ff21464b27eebfc32723cdc0f6969c17d8</tree>
  <committer>
    <name>Scott Becker</name>
    <email>becker.scott@gmail.com</email>
  </committer>
</commit>
