Skip to content
This repository

A stripped down fork of Enki re-worked into a Gem

branch: master
README.textile

Enki Engine

A Ruby on Rails blogging engine extracted from Xavier Shay’s Enki blogging app.

Quick Start

  • Add to your bundle:
gem ‘enki_engine’
  • Add the migrations
rake enki:install:migrations
  • Create a config/enki.yml like the one below until I write a generator. Hint! Hint!
# Configuration options for your blog - customise to taste
# This file contains no secret information, so can be stored in source control (unlike database.yml)
title: Articles
url: http://enkiblog.com/posts
author:
  name:    Don Alias        # For copyright notice and ATOM feeds
  email:   don@enkiblog.com # Exception emails will go here, and it is used in ATOM feeds
  open_id:                  # These are used to login to the admin area
      - http://enkiblog.com
      - http://secondaryopenid.com

engine:
  mount_at: /content
  pages_at: /

features:
  comments: false
  tags: true
  form_helper: false

  • A good place to start customizing is with Enki::Admin::BaseController, as you may want some authentication & authorization from the host app
# app/models/enki/post.rb
module Enki
  class Post < Base::Post

    belongs_to :author, :class_name => 'User'

    validates_presence_of :author_id

  end
end

# app/controllers/enki/admin/base_controller.rb
module Enki
  module Admin
    class BaseController < Enki::ApplicationController

      before_filter :require_account, :authorize

      protected

      # Post management is a proxy for all blog abilities.
      def authorize
        raise CanCan::AccessDenied unless can?(:manage, Enki::Post)
      end
        
      # requires a migration to put the author_id into posts and pages
      def post_attributes
        {:author => current_user}
      end

    end
  end
end

  • Read the code and improve it at will.

More info

Enki is a compact, easily extendable base for your blog. It does this by being highly opinionated, for example:

  • Public facing views should adhere to standards (XHTML, Atom)
  • /yyyy/mm/dd/post-title is a good URL for your posts
  • Live comment preview should be provided by default
  • Google does search better than you or I
  • You don’t need a plugin system when you’ve got decent source control
  • Hacking code is the easiest way to customize something

Compatibility

Uses rails 3. Runs on MySQL or Postgres. Works on heroku.
Uses ActsAsTaggableOn but I’d like to make it agnostic of a tagging solution.
Uses SimpleForm whereas Enki uses Formtastic. I’d like this to be agnostic.
Supports WillPaginate and Kaminari or no pagination with a couple of untidy shims I threw in which could be implemented much better.

Patches/Pull Request

  • Fork the project.
  • Make your improvement or bug fix.
  • Add specs for it. This is important so I don’t break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore it when I pull)
  • Send a pull request. Bonus points for topic branches.

Contributors, these guys rock

git log | grep Author | sort | uniq

If you want to help out, try tackling something from the TODO or an open issue. Please include specs for any fixes. Enki Engine is by design feature light. Unless you feel very strongly your feature should be in core, add a link to your fork in the wiki instead.

License

GPL – See LICENSE

Admin design heavily inspired by Habari and broken by https://github.com/james2m

Something went wrong with that request. Please try again.