Introducing the Dynarex Blog gem
- 18-Mar-2014: This gem isn't currently being maintained. *
The Dynarex Blog gem is an XML based Blog publishing sytem.
Installation
sudo gem install dynarex-blog
Example
require 'dynarex-blog'
blog = DynarexBlog.new
blog.create_entry title: "abc2", body: "aaa", tags: "aasd fwerf"
Notes:
- A maximum of 10 entries are stored in the index.xml file.
- A maximum of 15 entries are stored in the back-end files.
- The lookup files primarily contain all the ids for the blog.
- To view a page containing 10 blog entries use Blog#page(number).
- To delete a blog entry use Blog#delete(id).
- Ideally create a new blog from an empty directory e.g. DynarexBlog.new '~/jrobertson/blog'
Here's the output directory listing for the excuted code above:
james@lucia:~/learning/ruby/blog$ ls -ltr total 32 -rw-r--r-- 1 james james 425 2010-06-03 00:20 index.xml -rw-r--r-- 1 james james 425 2010-06-03 00:20 entry1.xml -rw-r--r-- 1 james james 481 2010-06-03 00:20 entry_lookup.xml -rw-r--r-- 1 james james 425 2010-06-03 00:20 aasd1.xml -rw-r--r-- 1 james james 480 2010-06-03 00:20 aasd_lookup.xml -rw-r--r-- 1 james james 872 2010-06-03 00:20 entities.xml -rw-r--r-- 1 james james 425 2010-06-03 00:20 fwerf1.xml -rw-r--r-- 1 james james 481 2010-06-03 00:20 fwerf_lookup.xml
Here's what index.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<entries>
<summary>
<recordx_type>dynarex</recordx_type>
<format_mask>[!title]; [!body]; [!tags]</format_mask>
<schema>entries/entry(title,body,tags)</schema>
</summary>
<records>
<entry id="2" created="2010-06-03 00:20:33 +0100" last_modified="">
<title>abc2</title>
<body>aaa</body>
<tags>aasd fwerf</tags>
</entry>
</records>
</entries>
Here's the lookup file:
<?xml version="1.0" encoding="UTF-8"?>
<entries>
<summary>
<recordx_type>dynarex</recordx_type>
<format_mask>[!id] [!file] [!year] [!month] [!uri]</format_mask>
<schema>entries/entry(id,file,year,month,uri)</schema>
</summary>
<records>
<entry id="1" created="2010-06-03 00:20:33 +0100" last_modified="">
<id>2</id>
<file>entry1.xml</file>
<year>2010</year>
<month>06</month>
<uri>abc2</uri>
</entry>
</records>
</entries>
update: 03-Jun-2010 @ 5:47pm
Resources: