Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

documentation

  • Loading branch information...
commit 531d8e607da25aaf061f99d63029c38262ec8ef2 1 parent b3bab13
Moritz Lenz authored

Showing 2 changed files with 40 additions and 0 deletions. Show diff stats Hide diff stats

  1. +1 0  TODO
  2. +39 0 lib/Chalice/Model/JSONFile.pm
1  TODO
@@ -6,6 +6,7 @@ General items on the agenda:
6 6 * proof of concept frontend
7 7 * comments, trackbacks
8 8 * API for updating posts
  9 + * tags
9 10
10 11 JSONFile backend:
11 12 * make the index file plain text, one post per line -- should be much
39 lib/Chalice/Model/JSONFile.pm
@@ -158,3 +158,42 @@ sub write_index_file {
158 158 }
159 159
160 160 1;
  161 +__END__
  162 +
  163 +=head1 NAME
  164 +
  165 +Chalice::Model::JSONFile - a JSON file storage backend for Chalice::Model
  166 +
  167 +=head1 SYNOPSIS
  168 +
  169 +Create a directory for the blog files, and put a file C<config.json> into it
  170 +which looks like this:
  171 +
  172 + {
  173 + "title": "Your Blog Title",
  174 + "tagline": "a second line describing the blog a bit more"
  175 + }
  176 +
  177 +And then access Chalice::Model::JSONFile as
  178 +
  179 + use Chalice::Model;
  180 + my $config_file = "path/to/newly/made/config.json";
  181 + my $model = Chalice::Model->new(
  182 + backend => 'JSONFile',
  183 + config_file => $config_file,
  184 + );
  185 +
  186 +The methods are documented in L<Chalice::Model>.
  187 +
  188 +=head1 DESCRIPTION
  189 +
  190 +This backend stores blog posts and configuration in JSON files. It expects
  191 +URLs to be of the form C<directory/post-without-any-further-slashes>, and
  192 +supplies the current year as default directory if the URL is not supplied
  193 +(but rather generated from the title).
  194 +
  195 +If the config file is stored in C<$path/config.json>, a post of URL
  196 +C<foo/bar> is stored in C<$path/posts/foo/bar.json>. An index file is
  197 +generated in C<$path/index.json>.
  198 +
  199 +=cut

0 comments on commit 531d8e6

Please sign in to comment.
Something went wrong with that request. Please try again.