github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

georgi / shinmun

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 74
    • 5
  • Source
  • Commits
  • Network (5)
  • Issues (0)
  • Downloads (9)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (9)
    • rm
    • 0.9
    • 0.5.2
    • 0.5.1
    • 0.5
    • 0.4
    • 0.3.10
    • 0.2
    • 0.1
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

git-based blog engine — Read more

  cancel

http://www.matthias-georgi.de/shinmun

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Version 0.9 
georgi (author)
Mon Feb 08 03:51:44 -0800 2010
commit  499a8bf90467e6bac5af618dc303799b2470eb7b
tree    224c1b535e5d00812bca3ff1f4b3004d87c82eb2
parent  21411d9af9d9c0dbc2f57dd899130eb3a2c30e0a
shinmun /
name age
history
message
file .gitignore Tue Jan 06 16:03:24 -0800 2009 moved test templates. added routes. fixed README. [georgi]
file LICENSE Sun Sep 07 14:53:59 -0700 2008 improved README [georgi]
file README.md Tue May 05 09:08:46 -0700 2009 fixed README [georgi]
file Rakefile Mon Apr 13 04:22:25 -0700 2009 added rspec tasks. fixed specs. [georgi]
directory bin/ Mon Feb 08 03:51:44 -0800 2010 Version 0.9 [georgi]
file config.ru Mon Apr 27 03:40:25 -0700 2009 reorganized directory structure [georgi]
directory lib/ Mon Feb 08 03:51:44 -0800 2010 Version 0.9 [georgi]
file shinmun.gemspec Mon Feb 08 03:51:44 -0800 2010 Version 0.9 [georgi]
directory templates/ Mon Feb 08 03:51:44 -0800 2010 Version 0.9 [georgi]
directory test/ Mon Feb 08 03:51:44 -0800 2010 Version 0.9 [georgi]
README.md

Shinmun - a git-based blog engine

Shinmun is a small git-based blog engine. Write posts in your favorite editor, git-push it and serve your blog straight from a repository.

Features

  • Posts are text files formatted with Markdown, Textile or HTML
  • Runs on Rack, Kontrol and GitStore
  • Deploy via git-push
  • Index, category and archive listings
  • RSS feeds
  • Syntax highlighting provided by CodeRay
  • Markdown comments

Quickstart

Install the gems:

$ gem sources -a http://gems.github.com
$ gem install rack BlueCloth rubypants coderay georgi-git_store georgi-kontrol georgi-shinmun

Create a sample blog:

$ shinmun init myblog

This will create a directory with all necessary files. Now start the web server:

$ cd myblog
$ rackup

Browse to the following url:

http://localhost:9292

VoilĂ , your first blog is up and running!

Writing Posts

Posts can be created by using the shinmun command inside your blog folder:

shinmun post 'The title of the post'

Shinmun will then create a post file in the right place, for example in posts/2008/9/the-title-of-the-post.md and open it with $EDITOR.

Post Format

Each blog post is just a text file with a YAML header and a body. The YAML header is surrounded with 2 lines of 3 dashes. This format is compatible with [Jekyll][13] and [Github Pages][14].

The YAML header has following attributes:

  • title: mandatory
  • date: posts need one, pages not
  • category: a post belongs to one category
  • tags: a comma separated list of tags

Example post:

--- 
date: 2008-09-05
category: Ruby
tags: bluecloth, markdown
title: BlueCloth, a Markdown library
---
This is the summary, which is by definition the first paragraph of the
article. The summary shows up in category listings or the index listing.

Syntax highlighting

Thanks to the fantastic highlighting library CodeRay, highlighted code blocks can be embedded easily in Markdown. For Textile support you have to require coderay/for_redcloth. These languages are supported: C, Diff, Javascript, Scheme, CSS, HTML, XML, Java, JSON, RHTML, YAML, Delphi

To activate CodeRay for a code block, you have to declare the language in lower case:

@@ruby

def method_missing(id, *args, &block)
  puts "#{id} was called with #{args.inspect}"
end             

Note that the declaration MUST be followed by a blank line!

Directory layout

+ assets
  + print.css
  + styles.css
+ config.ru
+ pages
  + about.md
+ posts
  + 2007
  + 2008
    + 9
      + my-article.md
+ templates
  + 404.rhtml
  + archive.rhtml
  + category.rhtml
  + category.rxml
  + _comments.rhtml
  + _comment_form.rhtml
  + index.rhtml
  + index.rxml
  + index.rhtml
  + layout.rhtml
  + page.rhtml
  + post.rhtml  

Blog configuation

In config.ru you can set the properties of your blog:

blog.config = {
  :language => 'en',
  :title => "Blog Title",
  :author => "The Author",
  :categories => ["Ruby", "Javascript"],
  :description => "Blog description"
}

Templates

Layout and templates are rendered by ERB. The layout is defined in templates/layout.rhtml. The content will be provided in the variable @content. A minimal example:

<html>
  <head>
    <title><%= @blog.title %></title>
    <%= stylesheet_link_tag 'style' %>
  </head>
  <body>
     <%= @content %>
  </body>
 </html>

The attributes of a post are accessible via the @post variable:

<div class="article">

  <h1><%= @post.title %></h1>

  <div class="date">
    <%= human_date @post.date %>
  </div>

  <%= @post.body_html %>

  ...      

</div>

Commenting System

Comments are stored as flat files and encoded as YAML objects. Each post has a corresponding comment file located at comments/<path to post>. So administration of comments is possible by editing the YAML file, which can be done on your local machine, as you can just pull the comments from your live server.

Deployment

Shinmun can server the blog straight from the git repository. So on your webserver initialize a new git repo like:

$ cd /var/www
$ mkdir myblog
$ cd myblog
$ git init

Now on your local machine, you add a new remote repository and push your blog to your server:

$ cd ~/myblog
$ git remote add live ssh://myserver.com/var/www/myblog
$ git push live

On your production server, you just need the rackup file config.ru to run the blog:

$ git checkout config.ru

Now you can run just a pure ruby server or something like Phusion Passenger. Anytime you want to publish a post on your blog, you just write, commit and finally push a post by:

$ git commit -a -m 'new post'
$ git push live

Phusion Passenger

Shinmun is compatible with Phusion Passenger. Install Phusion Passenger as described in my blog post.

Assuming that you are on a Debian or Ubuntu system, you can create a file named /etc/apache2/sites-available/blog:

<VirtualHost *:80>
    ServerName myblog.com
    DocumentRoot /var/www/blog/public
</VirtualHost>

Enable the new virtual host:

$ a2ensite myapp

After restarting Apache your blog should run on Apache on your desired domain:

$ /etc/init.d/apache2 restart

GitHub Project

Download or fork the package at my github repository

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server