Giter Club home page Giter Club logo

comatose-engine's Introduction

ComatoseEngine [v0.1.0]

Fork of Polar Humen’s Comatose Engine, http://github.com/polar/comatose_engine

What’s different in this fork

  • Removed photo management, is this even necessary?
  • Rewritten with HAML and SASS support
  • State column added for use with AASM (needs implemented)
  • Role id foreign key column added for use with Roles (not implemented)
  • Comatose-Rake-n-Bake, to autogenerate page structure based on Freemind Mind Map, http://github.com/scullygroup/Comatose-Rake-n-Bake

Note:
AASM and Role-based authorization are not currently implemented in this fork, however the database columns are present if you would like to use those systems. For an example application currently using this, check out http://github.com/scullygroup/scully-rails-template

Also, there are a few custom options included that can be specified in the configure block in your environment. Options include allow/disallow delete, allow/disallow add child, allow/disallow reordering, etc. See the included CONFIG file as an example.

Documentation

Comatose Engine is an Engines Plugin of the popular Comatose plugin, enhanced with associating photos with pages with the attachment_fu plugin.

It’s intended for simple CMS support. Comatose Engine supports

  • Nested pages
  • Versioning
  • Page markup in Textile, Markdown, RDoc, or easily add your own
  • Page processing through Liquid or ERb
  • Engines Ready for easy installation/migration
  • Completely self-contained within plugin folder

It’s meant to be lean, mean, easily embedded, and easy to re-skin for existing applications.

Requirements:

  • RAILS VERSION 2.3.4
  • The engines plugin for Rails 2.3.4

This plugin includes the following plugins in “engine_plugins”, and they are git submodules.

  • acts_as_list
  • acts_as_tree
  • pagnating_find
  • respond_to_parent

You may have to remove them if they conflict with other versions that you are using.

Getting ComatoseEngine Running

  1. From the command line
    
      $ rails site_name (create a rails app if you don't have one already)
      
  2. Install the engines plugin:
    
      $ script/plugin install git://github.com/lazyatom/engines.git
      
  3. Put the comatose engine plugin into plugins directory (use one of the following methods):
    • If you’re not using git, and just want to add the source files:
      
          Download a tarball from https://github.com/bcalloway/comatose-engine/tarball/master and unpack it into /vendor/plugins/comatose\_engine
          
    • Using git, make a shallow clone of the comatose_engine repository:
      
            $ git clone --depth 1 git://github.com/bcalloway/comatose-engine.git vendor/plugins/comatose_engine
            
    • If you want to keep your comatose_engine plugin up to date using git, you’ll have to add it as a submodule (http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#submodules)
      
            git submodule add git://github.com/bcalloway/comatose-engine.git vendor/plugins/comatose_engine
            git submodule init
            git submodule update
            
    • Make sure you rename your CE directory to `comatose_engine` (note the underscore) if it isn’t named that for some reason
  4. Create your database and modify your `config/database.yml` appropriately.
  5. Delete public/index.html (if you haven’t already)
  6. Modify your environment.rb as indicated below:
    
        RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
        #
        require File.join(File.dirname(__FILE__), 'boot')
        require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
        #
        Rails::Initializer.run do |config|
          config.plugins = [:engines, :comatose_engine, :all]
          config.plugin_paths += ["#{RAILS_ROOT}/vendor/plugins/comatose_engine/engine_plugins"]
          ... Your stuff here ...
        end
        #
        #Include your application configuration below
        require "#{RAILS_ROOT}/vendor/plugins/comatose_engine/engine_config/boot.rb"
      
  7. Modify your routes.rb as indicated below:
    If you want default routes from the plugin add this after any of your own existing routes, but before the default rails routes:
    map.from_plugin :comatose_engine

    Otherwise, follow the Comatose Description for routes.
    
         #map.resources "page_photos"
         #map.comatose_admin
         #map.comatose_root "home"
         #
         #Install the default routes as the lowest priority. 
         map.connect ':controller/:action/:id'
         map.connect ':controller/:action/:id.:format'
      
  8. Generate the comatose engine migrations:
    
      $ script/generate plugin_migration
      
  9. From the command line:
    
      $ rake db:migrate
      
  10. You may need to change these lines in application_controller.rb (if you’re not using cookie sessions):
    
        #See ActionController::RequestForgeryProtection for details
        #Uncomment the :secret if you're not using the cookie session store
        protect_from_forgery # :secret => 'your_secret_string'
      
  11. Run tests (remember, you must run ‘rake test’ before you can run the comatose_engine tests):
    
        $ rake test
        $ rake comatose_engine:test
      
  12. Start your server and check out your site!
    
        $ mongrel_rails start
        or
        $ ./script/server
      

You should be able to browse to http://127.0.0.1:3000/comatose_admin and start adding pages to your CMS.
Browsing to http://127.0.0.1:3000/ will render your comatose pages if routing doesn’t match any of your controllers.

Optional Configuration

NOTE: See CONFIG for an example configuration file using AutLogic, http://github.com/binarylogic/authlogic

To override the default configuration, you configure Comatose in your `config/environment.rb` file. Here is an example configuration block:


  Comatose.configure do |config|
    #Sets the text in the Admin UI's title area
    config.admin_title = "Site Content"
    config.admin_sub_title = "Content for the rest of us..."
  end

Since this is Comatose, your Authorization and Admin Authorization procedures are still valid. Here’s an example that uses the AuthenticationSystem as generated by the restful_authentication plugin:


  Comatose.configure do |config|  
    #Includes AuthenticationSystem in the ComatoseController
    config.includes << :authenticated_system
    config.admin_title = "Comatose - TESTING"
    config.admin_sub_title = "Content for the rest of us..."
    #
    #Includes AuthenticationSystem in the ComatoseAdminController
    config.admin_includes << :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
  end

However, now that Comatose is an Engines Plugin, you can just mix in methods in the ComatoseController and ComatoseAdminController.

Other notes

Any views you create in your app directory will override those in `comatose_engine/app/views`.
For example, you could create `RAILS_ROOT/app/views/layouts/application.html.haml` and have that include your own stylesheets, etc.

You can also override ComatoseEngine’s controllers by creating identically-named controllers in your application’s `app/controllers` directory.

Extra Credit

This plugin includes the work of many wonderful contributors to the Railsphere.
Following are the specific libraries that are distributed with Comatose. If I’ve
missed someone/something please let me know.

  • Comatose by M@ McCray
  • Liquid by Tobias Luetke
  • RedCloth by _why
  • Acts as Versioned by Rick Olsen
  • Behaviors by Atomic Object LLC — very nice BDD-like testing library
  • Engines by Lazy Tom

Comatose Engine is released under the MIT license.

comatose-engine's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.