Manuscript
Manuscript is a wildly simple website publishing system built on Rack using Sinatra (github.com/sinatra/sinatra). It’s intended for use with Hot Ink (github.com/hotink/hotink), but as you’ll see when we talk about set-up, you can roll it anyway you’d like.
Manuscript is meant to handle very simple static content websites. For example: cup.ca. The very simple admin interface allows users to upload template files (like images and css), to write templates (to hold the code), and write page text in Markdown (to make page maintenance easy).
Roll your own database
Getting a database in shape for Manuscript to use production is a little complicated at the moment, but it’s manageable. To start off, install the gem:
gem install manuscript --source http://gemcutter.org
Then, clone this repository (this is only used to configure the database) wherever you want to deploy your Manuscript:
git clone git://github.com/chrisdinn/manuscript.git
Edit the ActiveRecord configuration settings in Rakefile
, at the bottom in the :environment
task. You can name your database whatever you want. Like so:
task :environment do
require 'manuscript'
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => 'manuscript.sqlite3.db'
end
Then, in the project’s directory:
rake db:migrate
Now you’ve got a ready-for-production database.
Setting up your Manuscript
In the repository directory, edit the file called config.ru
to match your desired set up:
require 'rubygems'
require 'manuscript'
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => 'manuscript.sqlite3.db', :encoding => 'UTF-8'
use Rack::Session::Cookie
use Rack::Static, :urls => ["/template_files"]
use Gatekeeper::Middleware do |sso|
sso.sso_url = "http://hotink.theorem.ca/sso"
end
use Manuscript::Keymaster, :hotink_account_id => 1
use Manuscript::PageManager
use Manuscript::TemplateManager
use Manuscript::TemplateFileManager
run Manuscript::Base.new
Manuscript::Keymaster works with the Gatekeeper gem to handle authentication with a Hot Ink SSO server. If your Hot Ink installation is located somewhere else, be sure you set its address in the Gatekeeper::Middleware config block shown above. Set the Manuscript::Keymaster config option :hotink_account_id to the id number of the Hot Ink account that owns this Manuscript.
You can then deploy this like any other Rack app. You can even test it out:
rackup config.ru
To start settings things up, visit “/admin” from your application’s host and port.
A cleaner setup
While you can deploy a Manuscript as indicated above, if you don’t want to clone a repository onto your production machine you have another option. Simply prepare an sqlite3 database on you local machine, in a cloned Manuscript repository.
Make sure the gem is installed on your production machine, then create a new directory and create a rackup.ru
file and make it read as shown above.
Template files will be saved into a directory ‘/template_files’ alongside config.ru
. They’ll also be served from there. Now deploy away.
Development plans
Expect to see editable stylesheet and javascript template files, as well as special processing for images. Page caching is also a priority. If you have others you’d like to see, please file an issue.
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests 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 when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright © 2010 Chris Dinn. See LICENSE for details.