<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>History.txt</filename>
    </added>
    <added>
      <filename>License.txt</filename>
    </added>
    <added>
      <filename>Manifest.txt</filename>
    </added>
    <added>
      <filename>README.txt</filename>
    </added>
    <added>
      <filename>bin/htmlbeautifier</filename>
    </added>
    <added>
      <filename>config/hoe.rb</filename>
    </added>
    <added>
      <filename>config/requirements.rb</filename>
    </added>
    <added>
      <filename>lib/htmlbeautifier.rb</filename>
    </added>
    <added>
      <filename>lib/htmlbeautifier/version.rb</filename>
    </added>
    <added>
      <filename>script/destroy</filename>
    </added>
    <added>
      <filename>script/generate</filename>
    </added>
    <added>
      <filename>tasks/deployment.rake</filename>
    </added>
    <added>
      <filename>tasks/environment.rake</filename>
    </added>
    <added>
      <filename>tasks/website.rake</filename>
    </added>
    <added>
      <filename>test/html_beautifier_test_utilities.rb</filename>
    </added>
    <added>
      <filename>test/test_html_beautifier_integration.rb</filename>
    </added>
    <added>
      <filename>test/test_html_beautifier_regression.rb</filename>
    </added>
    <added>
      <filename>test/test_parser.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,21 +1,4 @@
-require 'rake'
-require 'rake/testtask'
-
-task :default =&gt; :test
-
-Rake::TestTask.new(:test) do |t|
-  t.libs &lt;&lt; 'lib'
-  t.pattern = 'test/*_test.rb'
-  t.verbose = true
-end
-
-desc 'Install libraries and command-line utility'
-task :install do |t|
-  sh 'ruby setup.rb'
-end
-
-desc 'Clean up files left over after installation'
-task :cleanup do |t|
-  rm_f 'InstalledFiles'
-  rm_f '.config'
-end
+require 'config/requirements'
+require 'config/hoe' # setup Hoe + all gem configuration
+
+Dir['tasks/**/*.rake'].each { |rake| load rake }
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ module HtmlBeautifier
     end
   
     def self.debug(match, method)
-      if @debug_block
+      if defined? @debug_block
         @debug_block.call(match, method)
       end
     end</diff>
      <filename>lib/htmlbeautifier/parser.rb</filename>
    </modified>
    <modified>
      <diff>@@ -55,7 +55,6 @@ class ConfigTable
     @config_opt = nil
     @verbose = true
     @no_harm = false
-    @libsrc_pattern = '*.rb'
   end
 
   attr_accessor :install_prefix
@@ -73,8 +72,6 @@ class ConfigTable
     @no_harm
   end
 
-  attr_accessor :libsrc_pattern
-
   def [](key)
     lookup(key).resolve(self)
   end
@@ -150,7 +147,7 @@ class ConfigTable
   def standard_entries(rbconfig)
     c = rbconfig
 
-    rubypath = c['bindir'] + '/' + c['ruby_install_name']
+    rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
 
     major = c['MAJOR'].to_i
     minor = c['MINOR'].to_i
@@ -373,10 +370,12 @@ class ConfigTable
 
     def check(val)
       return 'yes' unless val
-      unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
+      case val
+      when /\Ay(es)?\z/i, /\At(rue)?\z/i then 'yes'
+      when /\An(o)?\z/i, /\Af(alse)\z/i  then 'no'
+      else
         setup_rb_error &quot;config: --#{@name} accepts only yes/no for argument&quot;
       end
-      (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
     end
   end
 
@@ -472,7 +471,7 @@ class ConfigTable
   end
 
   class MetaConfigEnvironment
-    def intiailize(config, installer)
+    def initialize(config, installer)
       @config = config
       @installer = installer
     end
@@ -751,7 +750,7 @@ end
 
 class ToplevelInstaller
 
-  Version   = '3.4.0'
+  Version   = '3.4.1'
   Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
 
   TASKS = [
@@ -892,6 +891,7 @@ class ToplevelInstaller
 
   def parsearg_no_options
     unless ARGV.empty?
+      task = caller(0).first.slice(%r&lt;`parsearg_(\w+)'&gt;, 1)
       setup_rb_error &quot;#{task}: unknown options: #{ARGV.join(' ')}&quot;
     end
   end
@@ -1173,6 +1173,9 @@ class Installer
     &quot;#&lt;#{self.class} #{File.basename(@srcdir)}&gt;&quot;
   end
 
+  def noop(rel)
+  end
+
   #
   # Hook Script API base methods
   #
@@ -1220,29 +1223,21 @@ class Installer
     exec_task_traverse 'config'
   end
 
-  def config_dir_bin(rel)
-  end
-
-  def config_dir_lib(rel)
-  end
-
-  def config_dir_man(rel)
-  end
+  alias config_dir_bin noop
+  alias config_dir_lib noop
 
   def config_dir_ext(rel)
     extconf if extdir?(curr_srcdir())
   end
 
+  alias config_dir_data noop
+  alias config_dir_conf noop
+  alias config_dir_man noop
+
   def extconf
     ruby &quot;#{curr_srcdir()}/extconf.rb&quot;, *@config.config_opt
   end
 
-  def config_dir_data(rel)
-  end
-
-  def config_dir_conf(rel)
-  end
-
   #
   # TASK setup
   #
@@ -1253,43 +1248,89 @@ class Installer
 
   def setup_dir_bin(rel)
     files_of(curr_srcdir()).each do |fname|
-      adjust_shebang &quot;#{curr_srcdir()}/#{fname}&quot;
+      update_shebang_line &quot;#{curr_srcdir()}/#{fname}&quot;
     end
   end
 
-  def adjust_shebang(path)
+  alias setup_dir_lib noop
+
+  def setup_dir_ext(rel)
+    make if extdir?(curr_srcdir())
+  end
+
+  alias setup_dir_data noop
+  alias setup_dir_conf noop
+  alias setup_dir_man noop
+
+  def update_shebang_line(path)
     return if no_harm?
+    return if config('shebang') == 'never'
+    old = Shebang.load(path)
+    if old
+      $stderr.puts &quot;warning: #{path}: Shebang line includes too many args.  It is not portable and your program may not work.&quot; if old.args.size &gt; 1
+      new = new_shebang(old)
+      return if new.to_s == old.to_s
+    else
+      return unless config('shebang') == 'all'
+      new = Shebang.new(config('rubypath'))
+    end
+    $stderr.puts &quot;updating shebang: #{File.basename(path)}&quot; if verbose?
+    open_atomic_writer(path) {|output|
+      File.open(path, 'rb') {|f|
+        f.gets if old   # discard
+        output.puts new.to_s
+        output.print f.read
+      }
+    }
+  end
+
+  def new_shebang(old)
+    if /\Aruby/ =~ File.basename(old.cmd)
+      Shebang.new(config('rubypath'), old.args)
+    elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby'
+      Shebang.new(config('rubypath'), old.args[1..-1])
+    else
+      return old unless config('shebang') == 'all'
+      Shebang.new(config('rubypath'))
+    end
+  end
+
+  def open_atomic_writer(path, &amp;block)
     tmpfile = File.basename(path) + '.tmp'
     begin
-      File.open(path, 'rb') {|r|
-        first = r.gets
-        return unless File.basename(first.sub(/\A\#!/, '').split[0].to_s) == 'ruby'
-        $stderr.puts &quot;adjusting shebang: #{File.basename(path)}&quot; if verbose?
-        File.open(tmpfile, 'wb') {|w|
-          w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
-          w.write r.read
-        }
-      }
-      move_file tmpfile, File.basename(path)
+      File.open(tmpfile, 'wb', &amp;block)
+      File.rename tmpfile, File.basename(path)
     ensure
       File.unlink tmpfile if File.exist?(tmpfile)
     end
   end
 
-  def setup_dir_lib(rel)
-  end
+  class Shebang
+    def Shebang.load(path)
+      line = nil
+      File.open(path) {|f|
+        line = f.gets
+      }
+      return nil unless /\A#!/ =~ line
+      parse(line)
+    end
 
-  def setup_dir_man(rel)
-  end
+    def Shebang.parse(line)
+      cmd, *args = *line.strip.sub(/\A\#!/, '').split(' ')
+      new(cmd, args)
+    end
 
-  def setup_dir_ext(rel)
-    make if extdir?(curr_srcdir())
-  end
+    def initialize(cmd, args = [])
+      @cmd = cmd
+      @args = args
+    end
 
-  def setup_dir_data(rel)
-  end
+    attr_reader :cmd
+    attr_reader :args
 
-  def setup_dir_conf(rel)
+    def to_s
+      &quot;#! #{@cmd}&quot; + (@args.empty? ? '' : &quot; #{@args.join(' ')}&quot;)
+    end
   end
 
   #
@@ -1306,7 +1347,7 @@ class Installer
   end
 
   def install_dir_lib(rel)
-    install_files rubyscripts(), &quot;#{config('rbdir')}/#{rel}&quot;, 0644
+    install_files libfiles(), &quot;#{config('rbdir')}/#{rel}&quot;, 0644
   end
 
   def install_dir_ext(rel)
@@ -1337,8 +1378,8 @@ class Installer
     end
   end
 
-  def rubyscripts
-    glob_select(@config.libsrc_pattern, targetfiles())
+  def libfiles
+    glob_reject(%w(*.y *.output), targetfiles())
   end
 
   def rubyextentions(dir)
@@ -1416,7 +1457,11 @@ class Installer
       return
     end
     $stderr.puts 'Running tests...' if verbose?
-    require 'test/unit'
+    begin
+      require 'test/unit'
+    rescue LoadError
+      setup_rb_error 'test/unit cannot loaded.  You need Ruby 1.8 or later to invoke this task.'
+    end
     runner = Test::Unit::AutoRunner.new(true)
     runner.to_run &lt;&lt; TESTDIR
     runner.run
@@ -1432,23 +1477,17 @@ class Installer
     rm_f 'InstalledFiles'
   end
 
-  def clean_dir_bin(rel)
-  end
-
-  def clean_dir_lib(rel)
-  end
+  alias clean_dir_bin noop
+  alias clean_dir_lib noop
+  alias clean_dir_data noop
+  alias clean_dir_conf noop
+  alias clean_dir_man noop
 
   def clean_dir_ext(rel)
     return unless extdir?(curr_srcdir())
     make 'clean' if File.file?('Makefile')
   end
 
-  def clean_dir_data(rel)
-  end
-
-  def clean_dir_conf(rel)
-  end
-
   #
   # TASK distclean
   #
@@ -1459,31 +1498,26 @@ class Installer
     rm_f 'InstalledFiles'
   end
 
-  def distclean_dir_bin(rel)
-  end
-
-  def distclean_dir_lib(rel)
-  end
+  alias distclean_dir_bin noop
+  alias distclean_dir_lib noop
 
   def distclean_dir_ext(rel)
     return unless extdir?(curr_srcdir())
     make 'distclean' if File.file?('Makefile')
   end
 
-  def distclean_dir_data(rel)
-  end
-
-  def distclean_dir_conf(rel)
-  end
+  alias distclean_dir_data noop
+  alias distclean_dir_conf noop
+  alias distclean_dir_man noop
 
   #
-  # lib
+  # Traversing
   #
 
   def exec_task_traverse(task)
     run_hook &quot;pre-#{task}&quot;
     FILETYPES.each do |type|
-      if config('without-ext') == 'yes' and type == 'ext'
+      if type == 'ext' and config('without-ext') == 'yes'
         $stderr.puts 'skipping ext/* by user option' if verbose?
         next
       end</diff>
      <filename>setup.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,2 @@
 require 'test/unit'
-$:.unshift(File.dirname(__FILE__) + '/../lib')
+require File.dirname(__FILE__) + '/../lib/htmlbeautifier'</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>bin/beautify-html</filename>
    </removed>
    <removed>
      <filename>test/beautifier_test.rb</filename>
    </removed>
    <removed>
      <filename>test/parser_test.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>c167c42085670887b4c1a7e89a7491cc67be190e</id>
    </parent>
  </parents>
  <author>
    <name>pbattley</name>
    <email>pbattley@4238139e-d638-0410-8448-13745569799a</email>
  </author>
  <url>http://github.com/hosh/htmlbeautifier/commit/e8124f1190172bbbf61595f98ad848a56fcfb11d</url>
  <id>e8124f1190172bbbf61595f98ad848a56fcfb11d</id>
  <committed-date>2007-09-03T04:54:35-07:00</committed-date>
  <authored-date>2007-09-03T04:54:35-07:00</authored-date>
  <message>Applied Dr Nic's patch to integrate with rubygems and autotest.

git-svn-id: http://paulbattley.googlecode.com/svn/htmlbeautifier/trunk@17 4238139e-d638-0410-8448-13745569799a</message>
  <tree>2b96c0f211e600b1ae5c5a6b9479952f342120f1</tree>
  <committer>
    <name>pbattley</name>
    <email>pbattley@4238139e-d638-0410-8448-13745569799a</email>
  </committer>
</commit>
