Module: Caboose
- Defined in:
- lib/caboose.rb,
lib/caboose/version.rb,
lib/caboose/migrations.rb,
app/models/caboose/std_class.rb,
lib/caboose/migration_version.rb,
app/helpers/caboose/pages_helper.rb,
app/models/caboose/page_bar_generator.rb,
app/helpers/caboose/application_helper.rb,
app/helpers/caboose/permissions_helper.rb,
app/controllers/caboose/admin_controller.rb,
app/controllers/caboose/login_controller.rb,
app/controllers/caboose/pages_controller.rb,
app/controllers/caboose/posts_controller.rb,
app/controllers/caboose/roles_controller.rb,
app/controllers/caboose/users_controller.rb,
app/controllers/caboose/logout_controller.rb,
app/controllers/caboose/station_controller.rb,
app/controllers/caboose/register_controller.rb,
app/controllers/caboose/settings_controller.rb,
app/controllers/caboose/application_controller.rb,
app/controllers/caboose/permissions_controller.rb,
lib/caboose/engine.rb
Defined Under Namespace
Modules: ApplicationHelper, PagesHelper, PermissionsHelper
Classes: AdminController, ApplicationController, ApprovalRequest, Asset, Authenticator, CaboosePlugin, CorePlugin, Engine, LoginController, LogoutController, MenuBlock, Page, PageBarGenerator, PageBlock, PagePermission, Pager, PagesController, Permission, PermissionsController, Post, PostCategory, PostCategoryMembership, PostsController, RegisterController, Role, RoleMembership, RolePermission, RolesController, Setting, SettingsController, StationController, StdClass, User, UsersController, Version
Constant Summary
collapse
- VERSION =
'0.2.94'
- VERSIONS =
[
Caboose::Version.new('0.2.19', 000..000),
]
- @@salt =
"This needs to be changed pronto."
- @@assets_path =
"assets"
- @@plugins =
['Caboose::CorePlugin']
- @@modeljs_js_files =
[]
- @@modeljs_js_paths =
[]
- @@modeljs_css_files =
[]
- @@authenticator_class =
'Caboose::Authenticator'
Class Method Summary
collapse
Class Method Details
.create_schema(schema_file) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/caboose/engine.rb', line 52
def Caboose.create_schema(schema_file)
c = ActiveRecord::Base.connection
require schema_file
@schema.each do |table, columns|
c.create_table table if !c.table_exists?(table)
columns.each do |col|
next if c.column_exists?(table, col[0], col[1])
if c.column_exists?(table, col[0])
if col.count > 2
c.change_column table, col[0], col[1], col[2]
else
c.change_column table, col[0], col[1]
end
else
if col.count > 2
c.add_column table, col[0], col[1], col[2]
else
c.add_column table, col[0], col[1]
end
end
end
end
end
|
.json(obj, defaultvalue = "") ⇒ Object
47
48
49
50
|
# File 'lib/caboose/engine.rb', line 47
def Caboose.json(obj, defaultvalue = "")
return defaultvalue.to_json if obj.nil?
return obj.to_json
end
|
.log(message, title = nil) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/caboose/engine.rb', line 21
def Caboose.log(message, title = nil)
if (Rails.logger.nil?)
puts "\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
puts title.to_s unless title.nil?
puts message
puts ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"
else
Rails.logger.debug("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
Rails.logger.debug(title.to_s) unless title.nil?
Rails.logger.debug(message)
Rails.logger.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n")
end
end
|
.plugin_hook(*args) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/caboose/engine.rb', line 35
def Caboose.plugin_hook(*args)
resp = nil
args[0] = args[0].to_sym
Caboose.plugins.each do |mod|
if (mod.constantize.respond_to?(args[0]))
resp = mod.constantize.send(*args)
end
end
return resp
end
|
.teaser_text(str, length = 100) ⇒ Object
Strips html and returns the text that breaks closest to the given length
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/caboose/engine.rb', line 81
def Caboose.teaser_text(str, length = 100)
return "" if str.nil?
str2 = ActionController::Base.helpers.strip_tags(str)
if str2.length > 200
i = str2.index(' ', 200) - 1
i = 200 if i.nil?
str2 = str2[0..i]
str2[str2.length-1] = "" if str2.ends_with?(",")
str2 = "#{str2}..."
end
return str2
end
|