Module: Stiki

Defined in:
lib/stiki.rb,
lib/stiki/model.rb,
lib/stiki/engine.rb,
lib/stiki/version.rb,
lib/stiki/authorize.rb,
app/models/stiki/page.rb,
app/models/stiki/space.rb,
lib/stiki/authenticate.rb,
app/models/stiki/author.rb,
app/helpers/stiki/pages_helper.rb,
app/helpers/stiki/spaces_helper.rb,
app/helpers/stiki/authors_helper.rb,
app/helpers/stiki/application_helper.rb,
app/controllers/stiki/pages_controller.rb,
app/controllers/stiki/spaces_controller.rb,
app/controllers/stiki/authors_controller.rb,
app/controllers/stiki/application_controller.rb

Defined Under Namespace

Modules: ApplicationHelper, Authenticate, Authorize, AuthorsHelper, Helper, Model, PagesHelper, SpacesHelper Classes: ApplicationController, Author, AuthorsController, Engine, Page, PagesController, Space, SpacesController

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Stiki)

    the object that the method was called on



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/stiki.rb', line 20

def self.config(&blk)
  @@config_blk = blk
  
  yield self
  
  if user_class
    unless @@user_name_via.nil?
      @@user_name_via = @@user_name_via.to_sym
    else
      @@user_name_via = :to_s
    end
    
    ::Stiki::Author.send(:include, Stiki::Model::MapAuthor)
  end
  
  if authenticate_by
    
    if authenticate_by.to_sym == :devise
      
      if user_class.nil?
        raise "Stiki.user_class is required for devise auth"
      end
      
      @@authenticate_pagess = {:only => [:new, :create, :edit, :update]} if @@authenticate_pages.nil?
      @@authenticate_spaces = {:only => [:new, :create, :edit, :update]} if @@authenticate_spaces.nil?
      
      @@auth_mapping = { :pages => @@authenticate_pages, :spaces => @@authenticate_spaces }
      
      ::Stiki::SpacesController.send(:include, Stiki::Authenticate::Devise )
      
      ::Stiki::PagesController.send( :include, Stiki::Authenticate::Devise )
    end
    
  end
  
  if authorize_by 
    if authorize_by.to_sym == :cancan
      ::Stiki::SpacesController.send(:include, Stiki::Authorize::Cancan )
      
      ::Stiki::PagesController.send( :include, Stiki::Authorize::Cancan )
    end
  end
end

.reloadObject



16
17
18
# File 'lib/stiki.rb', line 16

def self.reload
  config( &@@config_blk ) if @@config_blk
end