Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Simple blog engine built using sinatra

tag: v1.5

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

Known Issues

  • Error writing to the public/cache directory - you need to fix permissions so that the webservers process can read/write from/to the folder.

Demo Information

Runs the site on test data (bundler must be installed)

bundle install (I would recommend using RVM to manage your GEMSETS - ruby 1.9.2) rake db:demo_data shotgun –env=test browse to the localhost:9393 connect your blogging client to localhost:9393/xmlrpc or localhost:9393/xmlrpc.php (default wordpress) with username: dan@shout_mouth.com password: password123

Setting Up Live Enviroment (AUTOSETUP - the application will do into setup mode when no database exists and the setup file is in the applications root directory)

Setup shout mouth on your server and browse to http://yourblog.com
Follow the on screen instructions

Rake Tasks

rake db:create (Create The Database) rake db:delete (Delete Database) rake db:demo_data (Seed Demo Data) rake db:update (Upgrade The Database To The Latest Schema Version) rake specs:run_all - (Run All The Specs)

rake user:create create email=email password=password firstname=firstname lastname=lastname (Create a user)

Rails Style Console

	type racksh inside the console when in the shout_mouth directory - (supports reload!)

Tests

To run all the tests rake specs:run_all

Rails Style Console

racksh - when in the application root -eg RACK_ENV=production racksh

Caching On NGINX

-place the following code in the server block of the nginx config if (-f $request_filename) { break; }

if (-f $document_root/cache$request_filename) { rewrite (.*) /cache$1 break; break; }

if (-f $document_root/cache$request_uri.html) { rewrite (.*) /cache$1.html break; break; }

if (-f $document_root/cache$request_uri/index.html) { rewrite (.*) /cache$1/index.html break; break; }

Writing Plugins For Shout Mouth

1) Create a directory structure inside the app/plugins folder as shown below.

  • Convention matters

-app —-plugins ———–easy_rider —————easy_rider_plugin.rb ———–view ————-easy_rider_plugin.haml 2) The information below is based on writing a new plugin called “easy rider”

  • our easy_rider plugin should contain a class file named easy_rider_plugin.rb whose class name should be EasyRiderPlugin

  • our easy_rider_plugin.rb file needs to reside in a folder called easy_rider under the plugins directory (see above)

  • EasyRiderPlugin class should inherit the base class Plugin (see below)

  • EasyRiderPlugin class should implement one method from the base class which is data (see below)

class EasyRiderPlugin < Plugin def data Post.all_active #or any other data from the model api end end

  • All classes that inherit from Plugin have access to all of shout mouths model classes and data

  • our EasyRiderPlugin classes data method can return any object and will be passed down to the view

  • a HAML layout file should be included in the view folder called easy_rider_plugin.haml. The view folder should reside under the easy rider directory

  • by convention the variable name containing the returned data inside the view will be called easy_rider

-easy_rider.each do |easy_rider| %li %a{:href => “/bikes/#{easy_rider.bike}”, :rel => “follow”}=easy_rider.bike 3) To place a plugin on one of your pages just call the following code (example is for easy rider).

  • please note you may need to restart your application for your plugin to register

= plugin(PluginFactory.instance.get_plugin(:easy_rider))

Something went wrong with that request. Please try again.