<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/serve/application.rb</filename>
    </added>
    <added>
      <filename>spec/serve_application_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,4 @@
 #!/usr/bin/env ruby
-
 lib = File.dirname(__FILE__) + '/../lib'
 require 'rubygems'
 if File.file?(lib + '/serve/version.rb')
@@ -8,69 +7,4 @@ else
   gem 'serve'
 end
 require 'serve'
-
-args = ARGV.join(' ')
-args.gsub!(%r{http://}, '')
-args = args.split(/[ :]/).compact
-
-help = args.delete('--help') || args.delete('-h') || false
-version = args.delete('--version') || args.delete('-v') || false
-environment = args.delete('production') || args.delete('test') || args.delete('test') || 'development'
-port = args.pop
-address = args.pop || '0.0.0.0'
-script = Dir.pwd + '/script/server'
-
-if args.size &gt; 0
-  puts &quot;invalid arguments&quot;
-  puts &quot;&quot;
-  help = true
-end
-
-case
-when version
-  puts &quot;Serve #{Serve.version}&quot;
-when help
-  program = File.basename($0)
-  puts &quot;Usage:&quot;
-  puts &quot;  #{program} [port] [environment]&quot;
-  puts &quot;  #{program} [address:port] [environment]&quot;
-  puts &quot;  #{program} [options]&quot;
-  puts &quot;  &quot;
-  puts &quot;Description:&quot;
-  puts &quot;  Starts a WEBrick server on the specified address and port with its document &quot;
-  puts &quot;  root set to the current working directory. By default the command uses &quot;
-  puts &quot;  0.0.0.0 for the address and 4000 for the port. This means that once the &quot;
-  puts &quot;  command has been started you can access the documents in the current &quot;
-  puts &quot;  directory with any Web browser at:&quot;
-  puts &quot;  &quot;
-  puts &quot;    http://localhost:4000/&quot;
-  puts &quot;  &quot;
-  puts &quot;  If the haml, redcloth, or bluecloth gems are installed the command can serve &quot;
-  puts &quot;  Haml, Sass, Textile, and Markdown for documents with haml, sass, textile, &quot;
-  puts &quot;  and markdown file extensions.&quot;
-  puts &quot;  &quot;
-  puts &quot;  If the Rails command script/server exists in the current directory the &quot;
-  puts &quot;  script will start that instead with the specified environment or the &quot;
-  puts &quot;  development environment if none is specified. Rails apps are started by &quot;
-  puts &quot;  default on port 3000.&quot;
-  puts &quot;  &quot;
-  puts &quot;Options:&quot;
-  puts &quot;  -h, --help      Show this message and quit.&quot;
-  puts &quot;  -v, --version   Show the program version number and quit.&quot;
-else
-  unless File.file?(script) and File.executable?(script)
-    port ||= 4000
-    server = Serve::Server.new(
-      :Port =&gt; port,
-      :BindAddress =&gt; address,
-      :DocumentRoot =&gt; Dir.pwd,
-      :DirectoryIndex =&gt; %w(index.html index.txt index.text index.haml index.textile index.markdown index.email index.redirect),
-      :AppendExtensions =&gt; %w(html txt text haml textile markdown email redirect)
-    )
-    trap(&quot;INT&quot;) { server.shutdown }
-    server.start
-  else
-    port ||= 3000
-    system &quot;#{script} -p #{port} -b #{address} -e #{environment}&quot;
-  end
-end
\ No newline at end of file
+Serve::Application.run
\ No newline at end of file</diff>
      <filename>bin/serve</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 require 'webrick'
 require 'serve/version'
+require 'serve/application'
 require 'serve/webrick/extensions'
 require 'serve/handlers/file_type_handler'
 require 'serve/handlers/textile_handler'</diff>
      <filename>lib/serve.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>84925d74a888605dbaf73affad2ea58e2c2d0b98</id>
    </parent>
  </parents>
  <author>
    <name>jlong</name>
    <email>jlong@bc0a7ee4-b4f2-4507-b10a-a3dd5181224c</email>
  </author>
  <url>http://github.com/jlong/serve/commit/c20f60c50d4b369c4bc861087c53e5cde89f445e</url>
  <id>c20f60c50d4b369c4bc861087c53e5cde89f445e</id>
  <committed-date>2008-05-31T09:23:25-07:00</committed-date>
  <authored-date>2008-05-31T09:23:25-07:00</authored-date>
  <message>refactored bin/serve to use new Application class; added specs for command line parameter parsing; added the ability to specify the document root as the last parameter to the command


git-svn-id: svn+ssh://rubyforge.org/var/svn/serve/trunk/serve@20 bc0a7ee4-b4f2-4507-b10a-a3dd5181224c</message>
  <tree>b0a213ab69ff050d3987c9237871763e14fbde10</tree>
  <committer>
    <name>jlong</name>
    <email>jlong@bc0a7ee4-b4f2-4507-b10a-a3dd5181224c</email>
  </committer>
</commit>
