<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -85,9 +85,16 @@ class CampingReloader
             load @script
         rescue Exception =&gt; e
             puts &quot;!! trouble loading #{title}: [#{e.class}] #{e.message}&quot;
+            @klass = nil
             return
         end
+
         @klass = Object.const_get(Object.constants.grep(/^#{title}$/i)[0]) rescue nil
+        unless @klass.const_defined? :C
+            puts &quot;!! trouble loading #{title}: not a Camping app&quot;
+            @klass = nil
+            return
+        end
         @klass.create if @klass.respond_to? :create
         @klass
     end
@@ -110,6 +117,10 @@ class CampingReloader
             Camping.run(*a)
         end
     end
+
+    def view_source
+        File.read(@script)
+    end
 end
 
 apps = ARGV.map { |script| CampingReloader.new(script) }
@@ -137,6 +148,7 @@ def apps.index_page
                 p %{Good day.  These are the Camping apps you've mounted.}
                 ul do
                     apps.each do |app|
+                        next unless app.klass
                         li do
                             h3(:style =&gt; &quot;display: inline&quot;) { a app.klass.name, :href =&gt; &quot;/#{app.mount}&quot; }
                             small { text &quot; / &quot; ; a &quot;View Source&quot;, :href =&gt; &quot;/code/#{app.mount}&quot; }
@@ -162,10 +174,22 @@ begin
             end
         end
     end
+    class ViewSource &lt; Mongrel::HttpHandler
+        def initialize(app)
+            @app = app
+        end
+        def process(req, res)
+            res.start(200) do |head, out|
+                head['Content-Type'] = 'text/plain'
+                out &lt;&lt; @app.view_source
+            end
+        end
+    end
     config = Mongrel::Configurator.new :host =&gt; host do
         listener :port =&gt; port do
             apps.each do |app|
                 uri &quot;/#{app.mount}&quot;, :handler =&gt; Mongrel::Camping::CampingHandler.new(app)
+                uri &quot;/code/#{app.mount}&quot;, :handler =&gt; ViewSource.new(app)
             end
             uri &quot;/&quot;, :handler =&gt; IndexHandler.new(apps)
             uri &quot;/favicon.ico&quot;, :handler =&gt; Mongrel::Error404Handler.new(&quot;&quot;)
@@ -182,6 +206,10 @@ rescue LoadError
     s = WEBrick::HTTPServer.new(:BindAddress =&gt; host, :Port =&gt; port)
     apps.each do |app|
         s.mount &quot;/#{app.mount}&quot;, WEBrick::CampingHandler, app
+        s.mount_proc(&quot;/code/#{app.mount}&quot;) do |req, resp|
+            resp['Content-Type'] = 'text/plain'
+            resp.body = app.view_source
+        end
     end
     s.mount_proc(&quot;/&quot;) { |req, resp| resp.body = apps.index_page }
 </diff>
      <filename>bin/camping</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>31bdfc49dffafc46b1f83460303731edeeef378e</id>
    </parent>
  </parents>
  <author>
    <name>_why</name>
    <email>why@whytheluckystiff.net</email>
  </author>
  <url>http://github.com/judofyr/camping/commit/3302af538d449bd5e9e1389b9358b4a69693cfd8</url>
  <id>3302af538d449bd5e9e1389b9358b4a69693cfd8</id>
  <committed-date>2006-05-16T15:12:17-07:00</committed-date>
  <authored-date>2006-05-16T15:12:17-07:00</authored-date>
  <message> * bin/camping: get view source working, ignore apps which throw loading exceptions.</message>
  <tree>063776f64ee0c8a5dc9cdf183d3b0d704ca62e8e</tree>
  <committer>
    <name>_why</name>
    <email>why@whytheluckystiff.net</email>
  </committer>
</commit>
