<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,20 +1,109 @@
 #!/usr/bin/env ruby
-# Command line
-
-puts &quot;It's still early, so this doesn't really do anything -- yet.&quot;
-puts
-puts &quot;Soon, you will be able to initialize comatose support in your app by running:&quot;
-puts
-puts &quot;  $&gt; comatose --rails .&quot;
-puts
-puts &quot;Or, upgrade you're current install:&quot;
-puts
-puts &quot;  $&gt; comatose --update .&quot;
-puts
-puts &quot;Or, freeze as plugin:&quot;
-puts
-puts &quot;  $&gt; comatose --freeze .&quot;
-puts
-puts &quot;And maybe other wacky things too... Not sure yet. :-)&quot;
-puts
+require 'rubygems'
+require 'optparse'
+
+args = ARGV
+options = {
+  :action =&gt; :gem
+}
+
+begin
+  OptionParser.new do |opts|
+    opts.banner = &quot;Usage: comatose [options] RAILS_ROOT&quot;
+    
+    opts.on(&quot;-g&quot;, &quot;--gem&quot;, &quot;Initialize to run from gem (DEFAULT)&quot;) do |s| 
+      options[:action] = :gem
+      puts &quot;GEM&quot;
+    end
+
+    opts.on(&quot;-p&quot;, &quot;--plugin&quot;, &quot;Install as plugin&quot;) do |s| 
+      options[:action] = :plugin
+      puts &quot;PLUGIN&quot;
+    end
+
+    opts.on(&quot;-u&quot;, &quot;--update&quot;, &quot;Update current installation (CURRENTLY UNIMPLEMENTED)&quot;) do |s| 
+      options[:action] = :update
+      puts &quot;UPDATE&quot;
+    end
+
+    opts.separator &quot;&quot;
+            opts.separator &quot;Common options:&quot;
+
+    # No argument, shows at tail.  This will print an options summary.
+    # Try it and see!
+    opts.on_tail(&quot;-h&quot;, &quot;--help&quot;, &quot;Show this message&quot;) do
+      puts opts
+      exit
+    end
+
+    # Another typical switch to print the version.
+    opts.on_tail(&quot;--version&quot;, &quot;Show version&quot;) do
+      require 'comatose/version'
+      puts Comatose::VERSION_STRING
+      exit
+    end
+
+  end.parse!(args)
+rescue OptionParser::ParseError =&gt; e
+  puts e
+end
+
+if args.length == 0
+  puts &quot;No action taken.&quot;
+  exit 
+end
+
+RAILS_ROOT = File.expand_path( args.last )
+
+class String
+  def /(string)
+    File.join(self, string)
+  end
+end
+
+unless File.directory?(RAILS_ROOT) and File.exists?( RAILS_ROOT / 'config'/ 'boot.rb' )
+  puts &quot;Not a valid rails application path.&quot;
+  exit
+end
+
+comatose_initializer_path = RAILS_ROOT / 'config' / 'initializers' / 'comatose.rb'
+
+unless File.exists?( comatose_initializer_path )
+  File.open(comatose_initializer_path, 'w') do |f|
+    f.write &lt;&lt;-EOT
+    require 'comatose'
+    
+    # 1.) You should add the following snippet to your environment.rb too, probably...
+    #
+    #        gem 'comatose' 
+    #
+    # 2.) Following is an example configuration block for Comatose:    
+    #
+    Comatose.configure do |config|
+      # Includes AuthenticationSystem in the ComatoseController
+      #config.includes &lt;&lt; :authenticated_system
+
+      # admin 
+      #config.admin_title = &quot;My Content&quot;
+      #config.admin_sub_title = &quot;Content for the rest of us...&quot;
+
+      # Includes AuthenticationSystem in the ComatoseAdminController
+      #config.admin_includes &lt;&lt; :authenticated_system
+
+      # Calls :login_required as a before_filter
+      #config.admin_authorization = :login_required
+      # Returns the author name (login, in this case) for the current user
+      #config.admin_get_author do
+      #  current_user.login
+      #end
+      
+      # See the getting started guide at http://comatose.rubyforge.org for more...
+    end
+EOT
+  end
+else
+  puts &quot;Comatose initializer already exists (at #{comatose_initializer_path})&quot;
+end
+
+puts &quot;Done.&quot;
 </diff>
      <filename>bin/comatose</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,2 @@
-require 'support/class_options'
-require 'acts_as_versioned'
-require 'redcloth' unless defined?(RedCloth)
-require 'liquid' unless defined?(Liquid)
-
 require 'comatose'
-require 'text_filters'
 
-require 'support/inline_rendering'
-require 'support/route_mapper'</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,12 +11,22 @@ module Comatose
 
 end
 
+require 'acts_as_versioned'
+require 'redcloth' unless defined?(RedCloth)
+require 'liquid' unless defined?(Liquid)
+
+require 'support/class_options'
+require 'text_filters'
+
 require 'comatose/configuration'
 require 'comatose/comatose_drop'
 require 'comatose/processing_context'
 require 'comatose/page_wrapper'
 require 'comatose/version'
 
+require 'support/inline_rendering'
+require 'support/route_mapper'
+
 require 'dispatcher' unless defined?(::Dispatcher)
 ::Dispatcher.to_prepare :comatose do
     Comatose.config.after_setup.call</diff>
      <filename>lib/comatose.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 module Comatose
 
-  class ComatoseDrop &lt; Liquid::Drop
+  class ComatoseDrop &lt; ::Liquid::Drop
 
     private :initialize
     </diff>
      <filename>lib/comatose/comatose_drop.rb</filename>
    </modified>
    <modified>
      <diff>@@ -55,9 +55,9 @@ module Comatose
     
     def validate!
       # Rips through the config and validates it's, er, valid
-      raise ConfigurationError.new &quot;admin_get_author must be a Proc or Symbol&quot; unless @admin_get_author.is_a? Proc or @admin_get_author.is_a? Symbol
-      raise ConfigurationError.new &quot;admin_authorization must be a Proc or Symbol&quot; unless @admin_authorization.is_a? Proc or @admin_authorization.is_a? Symbol
-      raise ConfigurationError.new &quot;authorization must be a Proc or Symbol&quot; unless @authorization.is_a? Proc or @authorization.is_a? Symbol
+      raise ConfigurationError.new( &quot;admin_get_author must be a Proc or Symbol&quot; ) unless @admin_get_author.is_a? Proc or @admin_get_author.is_a? Symbol
+      raise ConfigurationError.new( &quot;admin_authorization must be a Proc or Symbol&quot; ) unless @admin_authorization.is_a? Proc or @admin_authorization.is_a? Symbol
+      raise ConfigurationError.new( &quot;authorization must be a Proc or Symbol&quot; ) unless @authorization.is_a? Proc or @authorization.is_a? Symbol
       true
     end
     </diff>
      <filename>lib/comatose/configuration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,3 @@
 # Init for gem version of Comatose
 
-require 'support/class_options'
-require 'acts_as_versioned'
-require 'redcloth' unless defined?(RedCloth)
-require 'liquid' unless defined?(Liquid)
-
 require 'comatose'
-require 'text_filters'
-
-require 'support/inline_rendering'
-require 'support/route_mapper'</diff>
      <filename>rails/init.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8adaa15f077db83deaf302df884ac78fb7ac4681</id>
    </parent>
  </parents>
  <author>
    <name>M@ McCray</name>
    <email>darthapo@gmail.com</email>
  </author>
  <url>http://github.com/jcnetdev/comatose/commit/a650d61c3787b4f4b2425b0d148614e0ea5617bd</url>
  <id>a650d61c3787b4f4b2425b0d148614e0ea5617bd</id>
  <committed-date>2008-05-20T22:57:32-07:00</committed-date>
  <authored-date>2008-05-20T22:57:32-07:00</authored-date>
  <message>* More updates in preparation for use as a GemPlugin
* A start on the CLI support</message>
  <tree>03f8f6aefc7701f2d0edde63d711c33e7ec6857c</tree>
  <committer>
    <name>M@ McCray</name>
    <email>darthapo@gmail.com</email>
  </committer>
</commit>
