Class: GollumRails::Page

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Callbacks, ActiveModel::Naming
Includes:
ActiveModel::Conversion, ActiveModel::Model, ActiveModel::Validations, Attributes, Callbacks, Core, Error, Finders, Meta, Persistance, Store, Validation
Defined in:
lib/gollum_rails/page.rb

Overview

GollumRails

Gollum Rails was initially designed to integrate the Gollum wiki software into your Rails application without any mounts or extra applications to run.

Now you can use your completely own layout without struggling with gollum forks.

Just integrate this gem into your Gemfile and you are good to go:

gem install gollum_rails

or in your Gemfile:

gem 'gollum_rails'

If you want to use this gem with Rails version prior 4.0.0 please check out the rails3 branch on Github:

github.com/nirnanaaa/gollum_rails/tree/rails3

Initialization

To make full use of GollumRails you need to enable it in an initializer by genating it:

rails g gollum_rails:install

Now you can add the path to your Repository in there.

Also you need to set the startup boolean to true.

Page model

You also need a model à la ActiveRecord by calling:

rails g gollum_rails:model Page

Creation of a Page

Each action in a Git repository needs a Commit, which identifies the author!

commit = { name: 'nirnanaa', email: '[email protected]', message: 'created page page'}
Page.create(name: 'test_page', content: 'content', format: :markdown, commit: commit)

Page.create!(name: 'test_page', content: 'content', format: :markdown, commit: commit)

The ! version of the method throws an error on failure.

page = Page.new(name: 'test_page', content: 'content', format: :markdown, commit: commit)
page.save

# OR

page.save!

Constant Summary

Constants included from Callbacks

Callbacks::CALLBACKS

Constants included from Core

Core::ATTR_ACCESSORS, Core::ATTR_READERS, Core::ATTR_WRITERS

Method Summary

Methods included from Callbacks

#destroy, #save

Methods included from Persistance

#create_or_update, #create_record, #delete, #destroy, #persisted?, #save, #save!, #seperate_path, #update_attributes, #update_record

Methods included from Meta

#has_yaml?, #html_without_yaml, #meta, #meta_title, #raw_meta

Methods included from Core

#canonicalized_filename, #cname, #compare_commits, #content, #current_version, #file_name, #filename, #format, #full_path, #history, #html_data, #initialize, #last_changed_by, #name, #path_name, #preview, #raw_data, #sub_page?, #title, #to_param, #url, #url_path

Methods included from Attributes

#assign_attributes