Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple blog engine built using sinatra
Ruby JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
db
public
tests
.gitignore
Gemfile
Gemfile.lock
README.rdoc
config.ru
rakefile.rb
setup

README.rdoc

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 http://localhost:9393

connect your blogging client to http://localhost:9393/xmlrpc or http://localhost:9393/xmlrpc.php (default wordpress) 

with username: dan@shout_mouth.com password: password123

Setting Up Live Enviroment

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

Rake Tasks

rake check:all_urls (Send a GET request to every url ShoutMouth has generated and will show a status code - sanity check that the blog is performing correctly

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

Code Syntax Highlighting For Posts

Automated syntax highlighting will occur for any techincal posts by wrapping your code inside a pre tag with the prettyprint class.

<pre class="prettyprint"> 
class Blog
  include Shout::Record

  storage_names[:default] = "settings"

  property :key_name, String, :length => 200
  property :value, String, :length => 200
  property :type, String, :length => 50

  validates_presence_of :key_name, :value, :type

end
</pre>

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

  • you can also add global settings by calling Blog.your_setting = “your value” which can be retrieved using Blog.your_setting

    -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.