<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.suprails.example</filename>
    </added>
    <added>
      <filename>facets/haml.rb</filename>
    </added>
    <added>
      <filename>lib/facet.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -20,18 +20,42 @@
 
 require File.dirname(__FILE__) + '/db'
 require File.dirname(__FILE__) + '/gems'
+require File.dirname(__FILE__) + '/facet'
 
 class Runner
-  def initialize(app_name, runfile = &quot;~/.suprails&quot;)
-    @app_name = app_name
+  
+  class &lt;&lt; self
+    attr_accessor :app_name
+  end
+  
+  def initialize(app_name, runfile = &quot;~/.suprails/config&quot;)
+    # @app_name = app_name
+    Runner.app_name = app_name
     @runfile = File.expand_path(runfile)
     @sources = '.'
+    
+    Facet.registered_facets.each do |name, facet|
+      self.class.send(:define_method, name) {}
+      instance_eval do
+        self.class.send(:define_method, name) do
+          facet.go Runner.app_name
+        end
+      end
+    end
+    
+    
+    # this works
+    # self.class.send(:define_method, 'haml') {nil}
+  end
+  
+  def methods
+    super.each{|x| puts x}
   end
 
   def run
-    gems = Gems.new @app_name
-    db = DB.new @app_name
-    @base = File.expand_path &quot;./#{@app_name}&quot;
+    gems = Gems.new Runner.app_name
+    db = DB.new Runner.app_name
+    @base = File.expand_path &quot;./#{Runner.app_name}&quot;
     #TODO: for each facet in facets folder (TBD), include and instantiate
     Dir.mkdir(@base)
     text = File.read(@runfile).split('\n')
@@ -43,11 +67,11 @@ class Runner
   end
 
   def rails
-    `rails #{@app_name}`
+    `rails #{Runner.app_name}`
   end
   
   def frozen_rails
-    `rails #{@app_name} --freeze`
+    `rails #{Runner.app_name} --freeze`
   end
 
   def debug p = ''
@@ -55,16 +79,16 @@ class Runner
   end
 
   def plugin plugin_location
-    `cd #{@app_name}; script/plugin #{plugin_location}`
+    `cd #{Runner.app_name}; script/plugin #{plugin_location}`
   end
 
   def generate generator, *opts
     if opts.length
       args = ''
       opts.each {|x| args += &quot; #{x}&quot;}
-      `cd #{@app_name}; script/generate #{generator} #{args}`
+      `cd #{Runner.app_name}; script/generate #{generator} #{args}`
     else
-      `cd #{@app_name}; script/generate #{generator}`
+      `cd #{Runner.app_name}; script/generate #{generator}`
     end
   end
 
@@ -80,8 +104,7 @@ class Runner
   def file source_file, destination
     require 'ftools'
     source = File.expand_path &quot;#{@sources}/#{source_file}&quot;
-    dest = File.expand_path &quot;./#{@app_name}/#{destination}&quot;
-    # file = File.new source
+    dest = File.expand_path &quot;./#{Runner.app_name}/#{destination}&quot;
     File.copy(source, dest, true) if File.exists? source
   end
 
@@ -95,9 +118,17 @@ class Runner
     require 'net/http'
     http = Net::HTTP.new('www.gnu.org')
     path = '/licenses/gpl-3.0.txt'
-    File.open(&quot;#{@base}/COPYING&quot;, 'w') do |f|
-      resp, data = http.get(path)
-      f.puts(data)
+    begin
+      resp = http.get(path)
+      if resp.code == '200'
+        File.open(&quot;#{@base}/COPYING&quot;, 'w') do |f|
+          f.puts(resp.body)
+        end
+      else
+        puts &quot;Error #{resp.code} while retrieving GPL text.&quot;
+      end
+    rescue SocketError
+      puts 'SocketError: You might not be connected to the internet. GPL retrieval failed.'
     end
   end
 
@@ -105,9 +136,9 @@ class Runner
     if opts.length
       args = ''
       opts.each {|x| args += &quot; #{x}&quot;}
-      `cd #{@app_name}; rake #{args}`
+      `cd #{Runner.app_name}; rake #{args}`
     else
-      `cd #{@app_name}; rake`
+      `cd #{Runner.app_name}; rake`
     end
   end
 
@@ -122,16 +153,12 @@ class Runner
     if gem
       g = Git.init(@base)
     else
-      `cd #{@app_name}; git init`
+      `cd #{Runner.app_name}; git init`
     end
   end
 
   def svn
-    `cd #{@app_name}; svnadmin create`
+    `cd #{Runner.app_name}; svnadmin create`
   end
   
-  #TODO: This should be generated via a facet, not explicitly defined
-  def haml
-    puts &quot;haml not yet implemented&quot;
-  end
 end</diff>
      <filename>lib/runner.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,16 +18,17 @@
 #     along with Suprails.  If not, see &lt;http://www.gnu.org/licenses/&gt;.
 #
 
-require 'rubygems'
-
+# require 'rubygems'
 require File.dirname(__FILE__) + '/runner'
 
 class Suprails
-  # include SuprailsPlugins
+  
+  PLUGIN_DIR = File.dirname(__FILE__) + '/../facets'
   
   def initialize(app_name = &quot;&quot;)
     @app_name = app_name
     @run_file = &quot;&quot;
+    Dir[&quot;#{PLUGIN_DIR}/*.rb&quot;].each{|x| load x }
   end
 
   def app_name=(val)</diff>
      <filename>lib/suprails.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>plugins/haml.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>92aca5280068a4f45e971f872772a626ea846280</id>
    </parent>
  </parents>
  <author>
    <name>Bradley Grzesiak</name>
    <email>listrophy@gmail.com</email>
  </author>
  <url>http://github.com/ffmike/suprails/commit/599d017c8c185563bdd40407e08425cfb09e39b6</url>
  <id>599d017c8c185563bdd40407e08425cfb09e39b6</id>
  <committed-date>2008-10-18T12:25:12-07:00</committed-date>
  <authored-date>2008-10-18T12:25:12-07:00</authored-date>
  <message>got facets working.</message>
  <tree>7dea6e89f1639fde6e81683bbee541e1bddf1198</tree>
  <committer>
    <name>Bradley Grzesiak</name>
    <email>listrophy@gmail.com</email>
  </committer>
</commit>
