Rack::Blogengine
Rack Middleware to serve a simple blog
Build status
Supported Ruby Versions & Platforms
- rbx 2.2.*
- ruby 2.*
- ruby 1.9.*
Installation
$ gem install rack-blogengine
To install the signed gem you have to add my public certificate and install with proper security level:
$ gem cert –add <(curl -Ls https://raw.github.com/benny1992/rack-blogengine/master/certs/benny1992.pem)
$ gem install rack-blogengine -P MediumSecurity
NOTE
Installing signed Gems is currently not working (rubygem version 2.2.2)
Issue will be fixed in version 2.3
Usage
rack-blogengine generate <folder>
will create your Folder skeleton
Structure
These folders and files will be created for you
Folders
targetfolder/assets
targetfolder/assets/style
targetfolder/assets/js
targetfolder/assets/layout
targetfolder/assets/images
targetfolder/operator
Files
targetfolder/assets/style/style.css
targetfolder/assets/js/script.js
targetfolder/assets/layout/layout.html
(filled with basic structure)
targetfolder/index.content
(filled with dummy content)
targetfolder/config.yml
(basic config setup - server: webrick, port: 3000)
targetfolder/operator/operator.rb
(define your operator methods in module UserOperator)
Layout
In the layout.html you use title, content and date which will then be populated with the values from each .content file Example:
<!DOCTYPE html>
<html>
<head>
<title>{title}</title>
</head>
<body>
<h1>{title}</h1>
<div>
{date}
{content}
</div>
</body>
</html>
Content
The Content files (.content) includes your content
[path][/path]
- this will be your access path to your blog entry
[title][/title]
- the title for your article
[date][/date]
- publishing date of your article
[content][/content]
- your content
Hint
For a root document (http://pathtoapp.tld/) path should be empty ([path]:[/path])
Operators
In version 0.1.2 operator handling is included. To use this new feature you have to create a operator directory in your rackblog folder. In this directory create your operators (.rb files) with following skeleton
module UserOperator
end
Your operators are normal ruby methods defined in this module. Available params are documents & html
Param documents: An Array with document objects. This Document objects has following attributes: path, title, html
Param html: The content of the file where the operator was included
Example
module UserOperator
def show_nav
end
end
In your layout.html then
<div class="nav">
{% show_nav %}
</div>
TODO
Implement pygments without nokogiri html parser (maybe use oga as alternative - https://github.com/YorickPeterse/oga)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request