trusty-cms 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (388) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +23 -0
  3. data/CHANGELOG.md +754 -0
  4. data/CONTRIBUTORS.md +263 -0
  5. data/Gemfile +40 -0
  6. data/Gemfile.lock +177 -0
  7. data/INSTALL.md +10 -0
  8. data/LICENSE.md +21 -0
  9. data/README.md +85 -0
  10. data/Rakefile +7 -0
  11. data/app/controllers/admin/configuration_controller.rb +50 -0
  12. data/app/controllers/admin/extensions_controller.rb +11 -0
  13. data/app/controllers/admin/layouts_controller.rb +8 -0
  14. data/app/controllers/admin/page_fields_controller.rb +9 -0
  15. data/app/controllers/admin/page_parts_controller.rb +9 -0
  16. data/app/controllers/admin/pages_controller.rb +89 -0
  17. data/app/controllers/admin/preferences_controller.rb +46 -0
  18. data/app/controllers/admin/references_controller.rb +7 -0
  19. data/app/controllers/admin/resource_controller.rb +245 -0
  20. data/app/controllers/admin/users_controller.rb +40 -0
  21. data/app/controllers/admin/welcome_controller.rb +48 -0
  22. data/app/controllers/application_controller.rb +114 -0
  23. data/app/controllers/site_controller.rb +97 -0
  24. data/app/helpers/admin/configuration_helper.rb +80 -0
  25. data/app/helpers/admin/export_helper.rb +2 -0
  26. data/app/helpers/admin/extensions_helper.rb +2 -0
  27. data/app/helpers/admin/layouts_helper.rb +21 -0
  28. data/app/helpers/admin/node_helper.rb +96 -0
  29. data/app/helpers/admin/pages_helper.rb +117 -0
  30. data/app/helpers/admin/preferences_helper.rb +3 -0
  31. data/app/helpers/admin/references_helper.rb +46 -0
  32. data/app/helpers/admin/regions_helper.rb +28 -0
  33. data/app/helpers/admin/resource_helper.rb +2 -0
  34. data/app/helpers/admin/users_helper.rb +8 -0
  35. data/app/helpers/admin/welcome_helper.rb +2 -0
  36. data/app/helpers/application_helper.rb +241 -0
  37. data/app/helpers/site_helper.rb +2 -0
  38. data/app/models/deprecated_tags.rb +42 -0
  39. data/app/models/file_not_found_page.rb +32 -0
  40. data/app/models/layout.rb +15 -0
  41. data/app/models/menu_renderer.rb +140 -0
  42. data/app/models/page.rb +377 -0
  43. data/app/models/page_context.rb +53 -0
  44. data/app/models/page_field.rb +3 -0
  45. data/app/models/page_part.rb +20 -0
  46. data/app/models/standard_tags.rb +1318 -0
  47. data/app/models/status.rb +41 -0
  48. data/app/models/text_filter.rb +36 -0
  49. data/app/models/trusty_cms/config.rb +313 -0
  50. data/app/models/trusty_cms/page_response_cache_director.rb +43 -0
  51. data/app/models/user.rb +96 -0
  52. data/app/models/user_action_observer.rb +25 -0
  53. data/app/views/admin/configuration/edit.html.haml +38 -0
  54. data/app/views/admin/configuration/show.html.haml +58 -0
  55. data/app/views/admin/extensions/index.html.haml +41 -0
  56. data/app/views/admin/layouts/_form.html.haml +39 -0
  57. data/app/views/admin/layouts/edit.html.haml +9 -0
  58. data/app/views/admin/layouts/index.html.haml +35 -0
  59. data/app/views/admin/layouts/new.html.haml +7 -0
  60. data/app/views/admin/layouts/remove.html.haml +16 -0
  61. data/app/views/admin/page_fields/_page_field.html.haml +12 -0
  62. data/app/views/admin/page_parts/_page_part.html.haml +18 -0
  63. data/app/views/admin/pages/_fields.html.haml +71 -0
  64. data/app/views/admin/pages/_meta_row.html.haml +8 -0
  65. data/app/views/admin/pages/_node.html.haml +26 -0
  66. data/app/views/admin/pages/_popups.html.haml +27 -0
  67. data/app/views/admin/pages/children.html.haml +2 -0
  68. data/app/views/admin/pages/edit.html.haml +12 -0
  69. data/app/views/admin/pages/index.html.haml +26 -0
  70. data/app/views/admin/pages/new.html.haml +10 -0
  71. data/app/views/admin/pages/remove.html.haml +18 -0
  72. data/app/views/admin/preferences/edit.html.haml +44 -0
  73. data/app/views/admin/references/_tag_reference.haml +3 -0
  74. data/app/views/admin/references/filters.haml +6 -0
  75. data/app/views/admin/references/tags.haml +30 -0
  76. data/app/views/admin/users/_avatar.html.haml +5 -0
  77. data/app/views/admin/users/_form.html.haml +53 -0
  78. data/app/views/admin/users/_password_fields.html.haml +18 -0
  79. data/app/views/admin/users/edit.html.haml +9 -0
  80. data/app/views/admin/users/index.html.haml +39 -0
  81. data/app/views/admin/users/new.html.haml +6 -0
  82. data/app/views/admin/users/remove.html.haml +16 -0
  83. data/app/views/admin/welcome/login.html.haml +23 -0
  84. data/app/views/layouts/application.html.haml +50 -0
  85. data/app/views/site/not_found.html.haml +3 -0
  86. data/bin/ci/before_script +15 -0
  87. data/bin/trusty_cms +53 -0
  88. data/config/application.rb +124 -0
  89. data/config/boot.rb +9 -0
  90. data/config/compass.config +15 -0
  91. data/config/database.db2.yml +20 -0
  92. data/config/database.mysql.yml +25 -0
  93. data/config/database.postgresql.yml +25 -0
  94. data/config/database.sqlite.yml +16 -0
  95. data/config/database.sqlserver.yml +20 -0
  96. data/config/environment.rb +5 -0
  97. data/config/environments/development.rb +19 -0
  98. data/config/environments/production.rb +27 -0
  99. data/config/environments/test.rb +35 -0
  100. data/config/initializers/active_record_extensions.rb +1 -0
  101. data/config/initializers/configuration_extensions.rb +0 -0
  102. data/config/initializers/haml.rb +2 -0
  103. data/config/initializers/object_extensions.rb +1 -0
  104. data/config/initializers/radiant_config.rb +16 -0
  105. data/config/initializers/rails_patch.rb +2 -0
  106. data/config/initializers/response_cache_timeout.rb +3 -0
  107. data/config/initializers/string_extensions.rb +1 -0
  108. data/config/initializers/symbol_extensions.rb +1 -0
  109. data/config/initializers/tmp.rb +2 -0
  110. data/config/locales/en.yml +230 -0
  111. data/config/locales/en_available_tags.yml +625 -0
  112. data/config/preinitializer.rb +18 -0
  113. data/config/routes.rb +30 -0
  114. data/db/migrate/001_create_radiant_tables.rb +75 -0
  115. data/db/migrate/002_insert_initial_data.rb +12 -0
  116. data/db/migrate/003_rename_behavior_column.rb +9 -0
  117. data/db/migrate/004_rename_filter_column.rb +11 -0
  118. data/db/migrate/005_add_virtual_column_to_page.rb +9 -0
  119. data/db/migrate/006_integer_columns_to_boolean.rb +36 -0
  120. data/db/migrate/007_remove_virtual_column_from_page.rb +9 -0
  121. data/db/migrate/008_add_virtual_column_to_page_again.rb +9 -0
  122. data/db/migrate/009_add_content_type_field_to_layout.rb +9 -0
  123. data/db/migrate/010_merge_behaviors_and_pages.rb +57 -0
  124. data/db/migrate/011_rename_type_column_on_page_to_class_name.rb +9 -0
  125. data/db/migrate/012_create_extension_meta.rb +13 -0
  126. data/db/migrate/013_add_notes_field_to_user.rb +9 -0
  127. data/db/migrate/014_rename_config_default_parts_key.rb +17 -0
  128. data/db/migrate/015_add_optimistic_locking.rb +15 -0
  129. data/db/migrate/016_add_sessions.rb +16 -0
  130. data/db/migrate/017_rename_created_by_updated_by_columns.rb +15 -0
  131. data/db/migrate/018_add_description_and_keywords_to_pages.rb +11 -0
  132. data/db/migrate/019_add_salt_to_users.rb +11 -0
  133. data/db/migrate/020_add_session_info_to_users.rb +11 -0
  134. data/db/migrate/021_remove_session_expire_from_users.rb +9 -0
  135. data/db/migrate/20081203140407_add_indexes.rb +19 -0
  136. data/db/migrate/20090226140109_add_user_language.rb +9 -0
  137. data/db/migrate/20090929164633_rename_developer_role_to_designer.rb +9 -0
  138. data/db/migrate/20091003095744_change_user_language_to_locale.rb +9 -0
  139. data/db/migrate/20100805154952_add_page_fields.rb +15 -0
  140. data/db/migrate/20100805155020_convert_page_metas.rb +24 -0
  141. data/db/migrate/20100810151922_add_field_name_index.rb +11 -0
  142. data/db/migrate/20110902203823_add_allowed_children_cache_to_pages.rb +13 -0
  143. data/db/migrate/20111016150725_extend_page_part_content_limit.rb +15 -0
  144. data/db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb +11 -0
  145. data/db/schema.rb +128 -0
  146. data/lib/active_record_extensions/active_record_extensions.rb +27 -0
  147. data/lib/annotatable.rb +68 -0
  148. data/lib/configuration_extensions/configuration_extensions.rb +357 -0
  149. data/lib/generators/extension/USAGE +30 -0
  150. data/lib/generators/extension/extension_generator.rb +97 -0
  151. data/lib/generators/extension/templates/README.md +6 -0
  152. data/lib/generators/extension/templates/RSpecRakefile +109 -0
  153. data/lib/generators/extension/templates/Rakefile +25 -0
  154. data/lib/generators/extension/templates/cucumber.yml +1 -0
  155. data/lib/generators/extension/templates/cucumber_env.rb +11 -0
  156. data/lib/generators/extension/templates/cucumber_paths.rb +22 -0
  157. data/lib/generators/extension/templates/en.yml +3 -0
  158. data/lib/generators/extension/templates/extension.rb +21 -0
  159. data/lib/generators/extension/templates/functional_test.rb +15 -0
  160. data/lib/generators/extension/templates/gemspec.rb +29 -0
  161. data/lib/generators/extension/templates/lib.rb +8 -0
  162. data/lib/generators/extension/templates/migration.rb +9 -0
  163. data/lib/generators/extension/templates/radiant_config.rb +3 -0
  164. data/lib/generators/extension/templates/routes.rb +5 -0
  165. data/lib/generators/extension/templates/spec.opts +6 -0
  166. data/lib/generators/extension/templates/spec_helper.rb +42 -0
  167. data/lib/generators/extension/templates/tasks.rake +47 -0
  168. data/lib/generators/extension/templates/test_helper.rb +26 -0
  169. data/lib/generators/extension_controller/USAGE +36 -0
  170. data/lib/generators/extension_controller/extension_controller_generator.rb +84 -0
  171. data/lib/generators/extension_controller/templates/controller.rb +10 -0
  172. data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
  173. data/lib/generators/extension_controller/templates/functional_test.rb +11 -0
  174. data/lib/generators/extension_controller/templates/helper.rb +2 -0
  175. data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
  176. data/lib/generators/extension_controller/templates/helper_test.rb +4 -0
  177. data/lib/generators/extension_controller/templates/view.html.erb +2 -0
  178. data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
  179. data/lib/generators/extension_mailer/USAGE +17 -0
  180. data/lib/generators/extension_mailer/extension_mailer_generator.rb +68 -0
  181. data/lib/generators/extension_mailer/templates/fixture.erb +3 -0
  182. data/lib/generators/extension_mailer/templates/mailer.rb +15 -0
  183. data/lib/generators/extension_mailer/templates/unit_test.rb +21 -0
  184. data/lib/generators/extension_mailer/templates/view.erb +3 -0
  185. data/lib/generators/extension_migration/USAGE +34 -0
  186. data/lib/generators/extension_migration/extension_migration_generator.rb +25 -0
  187. data/lib/generators/extension_migration/templates/migration.rb +11 -0
  188. data/lib/generators/extension_model/USAGE +35 -0
  189. data/lib/generators/extension_model/extension_model_generator.rb +68 -0
  190. data/lib/generators/extension_model/templates/fixtures.yml +19 -0
  191. data/lib/generators/extension_model/templates/migration.rb +16 -0
  192. data/lib/generators/extension_model/templates/model.rb +2 -0
  193. data/lib/generators/extension_model/templates/model_spec.rb +11 -0
  194. data/lib/generators/extension_model/templates/unit_test.rb +8 -0
  195. data/lib/generators/generator_base_extension.rb +16 -0
  196. data/lib/generators/instance/instance_generator.rb +148 -0
  197. data/lib/generators/instance/templates/databases/db2.yml +40 -0
  198. data/lib/generators/instance/templates/databases/mysql.yml +47 -0
  199. data/lib/generators/instance/templates/databases/postgresql.yml +44 -0
  200. data/lib/generators/instance/templates/databases/sqlite3.yml +16 -0
  201. data/lib/generators/instance/templates/databases/sqlserver.yml +21 -0
  202. data/lib/generators/instance/templates/instance_boot.rb +122 -0
  203. data/lib/generators/instance/templates/instance_config.ru +2 -0
  204. data/lib/generators/instance/templates/instance_environment.rb +83 -0
  205. data/lib/generators/instance/templates/instance_gemfile +81 -0
  206. data/lib/generators/instance/templates/instance_generate +6 -0
  207. data/lib/generators/instance/templates/instance_radiant_config.rb +16 -0
  208. data/lib/generators/instance/templates/instance_rakefile +3 -0
  209. data/lib/generators/instance/templates/instance_routes.rb +1 -0
  210. data/lib/generators/language_extension/USAGE +27 -0
  211. data/lib/generators/language_extension/language_extension_generator.rb +71 -0
  212. data/lib/generators/language_extension/templates/README +3 -0
  213. data/lib/generators/language_extension/templates/RSpecRakefile +123 -0
  214. data/lib/generators/language_extension/templates/Rakefile +25 -0
  215. data/lib/generators/language_extension/templates/available_tags.yml +553 -0
  216. data/lib/generators/language_extension/templates/cucumber.yml +1 -0
  217. data/lib/generators/language_extension/templates/cucumber_env.rb +16 -0
  218. data/lib/generators/language_extension/templates/cucumber_paths.rb +14 -0
  219. data/lib/generators/language_extension/templates/extension.rb +12 -0
  220. data/lib/generators/language_extension/templates/functional_test.rb +15 -0
  221. data/lib/generators/language_extension/templates/gemspec.rb +24 -0
  222. data/lib/generators/language_extension/templates/lang.yml +181 -0
  223. data/lib/generators/language_extension/templates/lib.rb +8 -0
  224. data/lib/generators/language_extension/templates/spec.opts +6 -0
  225. data/lib/generators/language_extension/templates/spec_helper.rb +36 -0
  226. data/lib/generators/language_extension/templates/tasks.rake +28 -0
  227. data/lib/generators/language_extension/templates/test_helper.rb +26 -0
  228. data/lib/inheritable_class_attributes.rb +65 -0
  229. data/lib/local_time.rb +6 -0
  230. data/lib/login_system.rb +132 -0
  231. data/lib/method_observer.rb +50 -0
  232. data/lib/object_extensions/object_extensions.rb +5 -0
  233. data/lib/simpleton.rb +21 -0
  234. data/lib/string_extensions/string_extensions.rb +25 -0
  235. data/lib/symbol_extensions/symbol_extensions.rb +5 -0
  236. data/lib/tasks/database.rake +85 -0
  237. data/lib/tasks/environments.rake +11 -0
  238. data/lib/tasks/extensions.rake +85 -0
  239. data/lib/tasks/framework.rake +255 -0
  240. data/lib/tasks/instance.rake +23 -0
  241. data/lib/tasks/prototype.rake +31 -0
  242. data/lib/tasks/radiant_config.rake +18 -0
  243. data/lib/tasks/release.rake +131 -0
  244. data/lib/tasks/translate.rake +59 -0
  245. data/lib/tasks/undefine.rake +28 -0
  246. data/lib/translation_support.rb +54 -0
  247. data/lib/trusty_cms/admin_ui/region_partials.rb +23 -0
  248. data/lib/trusty_cms/admin_ui/region_set.rb +35 -0
  249. data/lib/trusty_cms/admin_ui.rb +244 -0
  250. data/lib/trusty_cms/available_locales.rb +19 -0
  251. data/lib/trusty_cms/cache.rb +100 -0
  252. data/lib/trusty_cms/config/definition.rb +142 -0
  253. data/lib/trusty_cms/engine.rb +10 -0
  254. data/lib/trusty_cms/extension/script.rb +395 -0
  255. data/lib/trusty_cms/extension.rb +146 -0
  256. data/lib/trusty_cms/extension_loader.rb +130 -0
  257. data/lib/trusty_cms/extension_migrator.rb +98 -0
  258. data/lib/trusty_cms/extension_path.rb +200 -0
  259. data/lib/trusty_cms/initializer.rb +162 -0
  260. data/lib/trusty_cms/pagination/controller.rb +41 -0
  261. data/lib/trusty_cms/pagination/link_renderer.rb +34 -0
  262. data/lib/trusty_cms/resource_responses.rb +121 -0
  263. data/lib/trusty_cms/setup.rb +227 -0
  264. data/lib/trusty_cms/taggable.rb +138 -0
  265. data/lib/trusty_cms/task_support.rb +66 -0
  266. data/lib/trusty_cms.rb +19 -0
  267. data/log/.keep +0 -0
  268. data/public/.htaccess +40 -0
  269. data/public/404.html +8 -0
  270. data/public/500.html +8 -0
  271. data/public/dispatch.cgi +10 -0
  272. data/public/dispatch.fcgi +24 -0
  273. data/public/dispatch.rb +10 -0
  274. data/public/favicon.ico +0 -0
  275. data/public/images/admin/add_tab.png +0 -0
  276. data/public/images/admin/avatar_32x32.png +0 -0
  277. data/public/images/admin/avatar_64x64.png +0 -0
  278. data/public/images/admin/avatar_96x96.png +0 -0
  279. data/public/images/admin/brown_bottom_line.gif +0 -0
  280. data/public/images/admin/calendar_down.gif +0 -0
  281. data/public/images/admin/collapse.png +0 -0
  282. data/public/images/admin/draft_page.png +0 -0
  283. data/public/images/admin/expand.png +0 -0
  284. data/public/images/admin/image.png +0 -0
  285. data/public/images/admin/javascript.png +0 -0
  286. data/public/images/admin/layout.png +0 -0
  287. data/public/images/admin/metadata_toggle.png +0 -0
  288. data/public/images/admin/minus.png +0 -0
  289. data/public/images/admin/minus_disabled.png +0 -0
  290. data/public/images/admin/minus_grey.png +0 -0
  291. data/public/images/admin/navigation_secondary_separator.gif +0 -0
  292. data/public/images/admin/page.png +0 -0
  293. data/public/images/admin/plus.png +0 -0
  294. data/public/images/admin/plus_disabled.png +0 -0
  295. data/public/images/admin/plus_grey.png +0 -0
  296. data/public/images/admin/popup_border_background.png +0 -0
  297. data/public/images/admin/popup_border_bottom_left.png +0 -0
  298. data/public/images/admin/popup_border_bottom_right.png +0 -0
  299. data/public/images/admin/popup_border_top_left.png +0 -0
  300. data/public/images/admin/popup_border_top_right.png +0 -0
  301. data/public/images/admin/search.png +0 -0
  302. data/public/images/admin/single_form_shadow.png +0 -0
  303. data/public/images/admin/snippet.png +0 -0
  304. data/public/images/admin/spinner.gif +0 -0
  305. data/public/images/admin/status_background.png +0 -0
  306. data/public/images/admin/status_bottom_left.png +0 -0
  307. data/public/images/admin/status_bottom_right.png +0 -0
  308. data/public/images/admin/status_spinner.gif +0 -0
  309. data/public/images/admin/status_top_left.png +0 -0
  310. data/public/images/admin/status_top_right.png +0 -0
  311. data/public/images/admin/stylesheet.png +0 -0
  312. data/public/images/admin/tab_close.png +0 -0
  313. data/public/images/admin/upload.png +0 -0
  314. data/public/images/admin/virtual_page.png +0 -0
  315. data/public/images/radiant/radiant-badge-color.png +0 -0
  316. data/public/javascripts/admin/application.js +94 -0
  317. data/public/javascripts/admin/codearea.js +165 -0
  318. data/public/javascripts/admin/controls.js +965 -0
  319. data/public/javascripts/admin/cookie.js +80 -0
  320. data/public/javascripts/admin/dateinput.js +402 -0
  321. data/public/javascripts/admin/dragdrop.js +974 -0
  322. data/public/javascripts/admin/dropdown.js +216 -0
  323. data/public/javascripts/admin/effects.js +1122 -0
  324. data/public/javascripts/admin/lowpro.js +340 -0
  325. data/public/javascripts/admin/overrides.js +1 -0
  326. data/public/javascripts/admin/page_preview.js +41 -0
  327. data/public/javascripts/admin/pagefield.js +54 -0
  328. data/public/javascripts/admin/pagestatus.js +17 -0
  329. data/public/javascripts/admin/popup.js +339 -0
  330. data/public/javascripts/admin/prototype.js +4874 -0
  331. data/public/javascripts/admin/ruledtable.js +13 -0
  332. data/public/javascripts/admin/shortcuts.js +33 -0
  333. data/public/javascripts/admin/sitemap.js +149 -0
  334. data/public/javascripts/admin/status.js +233 -0
  335. data/public/javascripts/admin/tabcontrol.js +123 -0
  336. data/public/javascripts/admin/toggle.js +430 -0
  337. data/public/javascripts/admin/utility.js +53 -0
  338. data/public/javascripts/admin/validationerror.js +18 -0
  339. data/public/loading-iframe.html +11 -0
  340. data/public/robots.txt +1 -0
  341. data/public/stylesheets/sass/admin/_base.sass +18 -0
  342. data/public/stylesheets/sass/admin/main.sass +27 -0
  343. data/public/stylesheets/sass/admin/modules/_boxes.sass +6 -0
  344. data/public/stylesheets/sass/admin/modules/_gradients.sass +4 -0
  345. data/public/stylesheets/sass/admin/modules/_links.sass +18 -0
  346. data/public/stylesheets/sass/admin/overrides.sass +2 -0
  347. data/public/stylesheets/sass/admin/partials/_actions.sass +96 -0
  348. data/public/stylesheets/sass/admin/partials/_avatars.sass +10 -0
  349. data/public/stylesheets/sass/admin/partials/_content.sass +58 -0
  350. data/public/stylesheets/sass/admin/partials/_dateinput.sass +62 -0
  351. data/public/stylesheets/sass/admin/partials/_deprecated.sass +55 -0
  352. data/public/stylesheets/sass/admin/partials/_dropdown.sass +28 -0
  353. data/public/stylesheets/sass/admin/partials/_footer.sass +12 -0
  354. data/public/stylesheets/sass/admin/partials/_forms.sass +322 -0
  355. data/public/stylesheets/sass/admin/partials/_header.sass +114 -0
  356. data/public/stylesheets/sass/admin/partials/_index.sass +147 -0
  357. data/public/stylesheets/sass/admin/partials/_layout.sass +10 -0
  358. data/public/stylesheets/sass/admin/partials/_messages.sass +10 -0
  359. data/public/stylesheets/sass/admin/partials/_popup.sass +213 -0
  360. data/public/stylesheets/sass/admin/partials/_tabcontrol.sass +72 -0
  361. data/public/stylesheets/sass/admin/partials/_toolbar.sass +31 -0
  362. data/public/stylesheets/sass/admin/partials/_typography.sass +60 -0
  363. data/public/stylesheets/sass/admin/partials/_validations.sass +19 -0
  364. data/rails/init.rb +1 -0
  365. data/script/about +4 -0
  366. data/script/breakpointer +3 -0
  367. data/script/console +3 -0
  368. data/script/dbconsole +3 -0
  369. data/script/destroy +3 -0
  370. data/script/extension +5 -0
  371. data/script/generate +3 -0
  372. data/script/performance/benchmarker +3 -0
  373. data/script/performance/profiler +3 -0
  374. data/script/performance/request +3 -0
  375. data/script/plugin +3 -0
  376. data/script/process/inspector +3 -0
  377. data/script/process/reaper +3 -0
  378. data/script/process/spawner +3 -0
  379. data/script/process/spinner +3 -0
  380. data/script/rails +6 -0
  381. data/script/runner +3 -0
  382. data/script/server +3 -0
  383. data/script/version +5 -0
  384. data/spec/ci/database.mysql.yml +4 -0
  385. data/spec/ci/database.postgresql.yml +4 -0
  386. data/spec/ci/database.sqlite.yml +3 -0
  387. data/trusty_cms.gemspec +50 -0
  388. metadata +781 -0
@@ -0,0 +1,181 @@
1
+ ---
2
+ <%= localization_name %>:
3
+ account: 'Account'
4
+ activerecord:
5
+ errors:
6
+ messages:
7
+ blank: 'this must not be blank' # required
8
+ invalid: 'this does not match the expected format' #invalid_format
9
+ not_a_number: 'this must be a number' # must be number
10
+ taken: 'this name is already in use' # name_in_use
11
+ too_long: 'this must not be longer than %{count} characters' # character_limit
12
+ too_short: 'this must be at least %{count} characters long' # character_minimum
13
+ models:
14
+ page:
15
+ attributes:
16
+ slug:
17
+ taken: 'slug already in use for child of parent' # slug_in_use
18
+ user:
19
+ attributes:
20
+ email:
21
+ invalid: 'invalid e-mail address' # invalid_email
22
+ login:
23
+ taken: 'login already in use' # login already in use
24
+ password:
25
+ confirmation: 'must match confirmation' # password_confirmation
26
+ add_child: 'Add Child'
27
+ add_part: 'Add Part'
28
+ add_tab: 'Add Tab'
29
+ admin: 'Administrator'
30
+ available_tags: 'Available Tags'
31
+ available_tags_for: 'Available Tags for'
32
+ body: 'Body'
33
+ breadcrumb: 'Breadcrumb'
34
+ buttons:
35
+ create: 'Create %{name}'
36
+ save_and_continue: 'Save and Continue Editing'
37
+ save_changes: 'Save Changes'
38
+ cancel: 'Cancel'
39
+ change: 'Change'
40
+ close: 'Close'
41
+ content: 'Content'
42
+ content_type: 'Content&#8209;Type'
43
+ creating_status: 'Creating %{model}&#8230;'
44
+ date:
45
+ abbr_day_names: [Sun, Mon, Tue, Wed, Thu, Fri, Sat]
46
+ abbr_month_names: [~, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec]
47
+ day_names: [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
48
+ formats:
49
+ default: "%Y-%m-%d"
50
+ long: "%B %e, %Y"
51
+ only_day: "%e"
52
+ short: "%e %b"
53
+ month_names: [~, January, February, March, April, May, June, July, August, September, October, November, December]
54
+ order: [ :year, :month, :day ]
55
+ delete_layout: 'Delete Layout'
56
+ delete_pages: 'Delete %{pages}'
57
+ delete_snippet: 'Delete Snippet'
58
+ delete_user: 'Delete User'
59
+ description: 'Description'
60
+ design: 'Design'
61
+ designer: 'Designer'
62
+ draft: 'Draft'
63
+ edit_layout: 'Edit Layout'
64
+ edit_page: 'Edit Page'
65
+ edit_snippet: 'Edit Snippet'
66
+ edit_user: 'Edit User'
67
+ email_address: 'E-mail Address'
68
+ extension: 'Extension'
69
+ extensions: 'Extensions'
70
+ filter: 'Filter'
71
+ hidden: 'Hidden'
72
+ hide: 'Hide'
73
+ keywords: 'Keywords'
74
+ language: 'Language'
75
+ layout: 'Layout'
76
+ layouts: 'Layouts'
77
+ log_out: 'Logout'
78
+ logged_in_as: 'Logged in as'
79
+ login: 'Login'
80
+ modify: 'Modify'
81
+ more: 'More'
82
+ name: 'Name'
83
+ new_layout: 'New Layout'
84
+ new_page: 'New Page'
85
+ new_password: 'New Password'
86
+ new_snippet: 'New Snippet'
87
+ new_user: 'New User'
88
+ no_pages: 'No Pages'
89
+ notes: 'Notes'
90
+ optional: 'Optional'
91
+ or: 'or'
92
+ page: 'Page'
93
+ page_page: 'Page Part'
94
+ page_title: 'Page Title'
95
+ page_type: 'Page Type'
96
+ pages: 'Pages'
97
+ pages_controller:
98
+ removed_many: "The pages were successfully removed from the site."
99
+ removed_one: "The page was successfully removed from the site."
100
+ saved: "Your page has been saved below."
101
+ password: 'Password'
102
+ password_confirmation: 'Confirm New Password'
103
+ personal: 'Personal'
104
+ personal_preferences: 'Personal Preferences'
105
+ please_login: 'Please Login'
106
+ powered_by: 'Powered by'
107
+ preferences: 'Preferences'
108
+ preferences_controller:
109
+ error_updating: 'There was an error updating your preferences.'
110
+ updated: 'Your preferences have been updated.'
111
+ published: 'Published'
112
+ published_at: 'Published at'
113
+ reference: 'Reference'
114
+ remember_me: 'Remember me'
115
+ remove: 'Remove'
116
+ remove_layout: 'Remove Layout'
117
+ remove_page: 'Remove Page'
118
+ remove_pages: 'Remove %{pages}'
119
+ remove_tab: 'Remove Tab'
120
+ remove_user: 'Remove user'
121
+ required: 'Required'
122
+ resource_controller:
123
+ not_found: "%{humanized_model_name} could not be found."
124
+ removed: "%{humanized_model_name} has been deleted."
125
+ saved: "%{humanized_model_name} saved below."
126
+ update_conflict: "%{humanized_model_name} has been modified since it was last loaded. Changes cannot be saved without potentially losing data."
127
+ validation_errors: "Validation errors occurred while processing this form. Please take a moment to review the form and correct any input errors before continuing."
128
+ reviewed: 'Reviewed'
129
+ roles: 'Roles'
130
+ saving_changes: Saving Changes
131
+ saving_preferences: Saving preferences
132
+ search_tags: 'Search Tags:'
133
+ select:
134
+ inherit: '<inherit>'
135
+ none: '<none>'
136
+ normal: '<normal>'
137
+ settings: 'Settings'
138
+ slug: 'Slug'
139
+ snippet: 'Snippet'
140
+ snippets: 'Snippets'
141
+ status: 'Status'
142
+ # Warnings and info text:
143
+ text:
144
+ layouts:
145
+ remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following layout?'
146
+ pages:
147
+ remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following %{pages}?'
148
+ snippets:
149
+ remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following snippet?'
150
+ users:
151
+ remove_warning: 'Are you sure you want to <strong class="warning">permanently remove</strong> the following user?'
152
+ this_file_language: "<%= file_name.capitalize %>"
153
+ time:
154
+ am: 'am'
155
+ formats:
156
+ datetime:
157
+ formats:
158
+ default: "%Y-%m-%dT%H:%M:%S%Z"
159
+ default: "%a %b %d %H:%M:%S %Z %Y"
160
+ long: "%B %d, %Y %H:%M"
161
+ only_second: "%S"
162
+ short: "%d %b %H:%M"
163
+ time: "%H:%M"
164
+ timestamp: "%I:%M %p on %B %d, %Y"
165
+ pm: 'pm'
166
+ timestamp:
167
+ at: 'at'
168
+ by: 'by'
169
+ last_updated: 'Last Updated'
170
+ user: 'User'
171
+ username: 'Username'
172
+ username_or_email: 'Username or E-mail Address'
173
+ users: 'Users'
174
+ users_controller:
175
+ cannot_delete_self: 'You cannot delete yourself.'
176
+ version: 'Version'
177
+ view_site: 'View Site'
178
+ website: 'Website'
179
+ welcome_controller:
180
+ invalid_user: 'Invalid username, e-mail address, or password.'
181
+ logged_out: 'You are now logged out.'
@@ -0,0 +1,8 @@
1
+ module TrustyCms<%= class_name %>
2
+ VERSION = "1.0.0"
3
+ SUMMARY = "<%= localization_name.capitalize %> language pack for TrustyCms CMS"
4
+ DESCRIPTION = "Adds <%= localization_name.capitalize %> translations to the TrustyCms CMS interface."
5
+ URL = "<%= homepage %>"
6
+ AUTHORS = ["<%= author_name %>"]
7
+ EMAIL = ["<%= author_email %>"]
8
+ end
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
@@ -0,0 +1,36 @@
1
+ unless defined? TRUSTY_CMS_ROOT
2
+ ENV["Rails.env"] = "test"
3
+ case
4
+ when ENV["RADIANT_ENV_FILE"]
5
+ require ENV["RADIANT_ENV_FILE"]
6
+ when File.dirname(__FILE__) =~ %r{vendor/trusty_cms/vendor/extensions}
7
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
8
+ else
9
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
10
+ end
11
+ end
12
+ require "#{TRUSTY_CMS_ROOT}/spec/spec_helper"
13
+
14
+ Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
15
+
16
+ if File.directory?(File.dirname(__FILE__) + "/matchers")
17
+ Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
18
+ end
19
+
20
+ Spec::Runner.configure do |config|
21
+ # config.use_transactional_fixtures = true
22
+ # config.use_instantiated_fixtures = false
23
+ # config.fixture_path = Rails.root + '/spec/fixtures'
24
+
25
+ # You can declare fixtures for each behaviour like this:
26
+ # describe "...." do
27
+ # fixtures :table_a, :table_b
28
+ #
29
+ # Alternatively, if you prefer to declare them only once, you can
30
+ # do so here, like so ...
31
+ #
32
+ # config.global_fixtures = :table_a, :table_b
33
+ #
34
+ # If you declare global fixtures, be aware that they will be declared
35
+ # for all of your examples, even those that don't use them.
36
+ end
@@ -0,0 +1,28 @@
1
+ namespace :radiant do
2
+ namespace :extensions do
3
+ namespace :<%= file_name %> do
4
+
5
+ desc "Runs the migration of the <%= localization_name %> language pack"
6
+ task :migrate => :environment do
7
+ require 'trusty_cms/extension_migrator'
8
+ if ENV["VERSION"]
9
+ <%= class_name %>.migrator.migrate(ENV["VERSION"].to_i)
10
+ else
11
+ <%= class_name %>.migrator.migrate
12
+ end
13
+ end
14
+
15
+ desc "Copies public assets of the <%= localization_name %> language pack to the instance public/ directory."
16
+ task :update => :environment do
17
+ is_svn_or_dir = proc {|path| path =~ /\.svn/ || File.directory?(path) }
18
+ puts "Copying assets from <%= class_name %>"
19
+ Dir[<%= class_name %>.root + "/public/**/*"].reject(&is_svn_or_dir).each do |file|
20
+ path = file.sub(<%= class_name %>.root, '')
21
+ directory = File.dirname(path)
22
+ mkdir_p Rails.root + directory, :verbose => false
23
+ cp file, Rails.root + path, :verbose => false
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ require 'test/unit'
2
+ # Load the environment
3
+ unless defined? TRUSTY_CMS_ROOT
4
+ ENV["Rails.env"] = "test"
5
+ case
6
+ when ENV["RADIANT_ENV_FILE"]
7
+ require ENV["RADIANT_ENV_FILE"]
8
+ when File.dirname(__FILE__) =~ %r{vendor/trusty_cms/vendor/extensions}
9
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
10
+ else
11
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
12
+ end
13
+ end
14
+ require "#{TRUSTY_CMS_ROOT}/test/test_helper"
15
+
16
+ class Test::Unit::TestCase
17
+
18
+ # Include a helper to make testing Radius tags easier
19
+ test_helper :extension_tags
20
+
21
+ # Add the fixture directory to the fixture path
22
+ self.fixture_path << File.dirname(__FILE__) + "/fixtures"
23
+
24
+ # Add more helper methods to be used by all extension tests here...
25
+
26
+ end
@@ -0,0 +1,65 @@
1
+ module InheritableClassAttributes
2
+ def self.included(base)
3
+ base.extend ClassMethods
4
+ base.module_eval do
5
+ class << self
6
+ alias inherited_without_inheritable_class_attributes inherited
7
+ alias inherited inherited_with_inheritable_class_attributes
8
+ end
9
+ end
10
+ end
11
+
12
+ module ClassMethods
13
+ def inheritable_cattr_readers
14
+ @inheritable_class_readers ||= []
15
+ end
16
+
17
+ def inheritable_cattr_writers
18
+ @inheritable_class_writers ||= []
19
+ end
20
+
21
+ def cattr_inheritable_reader(*symbols)
22
+ symbols.each do |symbol|
23
+ self.inheritable_cattr_readers << symbol
24
+ self.module_eval %{
25
+ def self.#{symbol}
26
+ @#{symbol}
27
+ end
28
+ }
29
+ end
30
+ self.inheritable_cattr_readers.uniq!
31
+ end
32
+
33
+ def cattr_inheritable_writer(*symbols)
34
+ symbols.each do |symbol|
35
+ self.inheritable_cattr_writers << symbol
36
+ self.module_eval %{
37
+ def self.#{symbol}=(value)
38
+ @#{symbol} = value
39
+ end
40
+ }
41
+ end
42
+ self.inheritable_cattr_writers.uniq!
43
+ end
44
+
45
+ def cattr_inheritable_accessor(*symbols)
46
+ cattr_inheritable_writer(*symbols)
47
+ cattr_inheritable_reader(*symbols)
48
+ end
49
+
50
+ def inherited_with_inheritable_class_attributes(klass)
51
+ inherited_without_inheritable_class_attributes(klass) if respond_to?(:inherited_without_inheritable_class_attributes)
52
+
53
+ readers = inheritable_cattr_readers.dup
54
+ writers = inheritable_cattr_writers.dup
55
+ inheritables = [:inheritable_cattr_readers, :inheritable_cattr_writers]
56
+
57
+ (readers + writers + inheritables).uniq.each do |attr|
58
+ var = "@#{attr}"
59
+ old_value = self.module_eval(var)
60
+ new_value = (old_value.dup rescue old_value)
61
+ klass.module_eval("#{var} = new_value")
62
+ end
63
+ end
64
+ end
65
+ end
data/lib/local_time.rb ADDED
@@ -0,0 +1,6 @@
1
+ module LocalTime
2
+ def adjust_time(time)
3
+ ::ActiveSupport::Deprecation.warn("`adjust_time' is deprecated. All time output is now auto-adjusted to TrustyCms::Config['local.timezone'] or the default ActiveRecord time zone.", caller)
4
+ time
5
+ end
6
+ end
@@ -0,0 +1,132 @@
1
+ module LoginSystem
2
+ def self.included(base)
3
+ base.extend ClassMethods
4
+ base.class_eval do
5
+ prepend_before_filter :authenticate
6
+ prepend_before_filter :authorize
7
+ helper_method :current_user
8
+ end
9
+ end
10
+
11
+ protected
12
+
13
+ def current_user
14
+ @current_user ||= (login_from_session || login_from_cookie || login_from_http)
15
+ end
16
+
17
+ def current_user=(value=nil)
18
+ if value && value.is_a?(User)
19
+ @current_user = value
20
+ session['user_id'] = value.id
21
+ else
22
+ @current_user = nil
23
+ session['user_id'] = nil
24
+ end
25
+ @current_user
26
+ end
27
+
28
+ def authenticate
29
+ #puts _process_action_callbacks.map(&:filter)
30
+ action = params['action'].to_s.intern
31
+ if current_user
32
+ session['user_id'] = current_user.id
33
+ true
34
+ else
35
+ session[:return_to] = request.original_url
36
+ respond_to do |format|
37
+ format.html { redirect_to login_url }
38
+ format.any(:xml,:json) { request_http_basic_authentication }
39
+ end
40
+ false
41
+ end
42
+ end
43
+
44
+ def authorize
45
+ #puts _process_action_callbacks.map(&:filter)
46
+ action = action_name.to_s.intern
47
+ if user_has_access_to_action?(action)
48
+ true
49
+ else
50
+ permissions = self.class.controller_permissions[action]
51
+ flash[:error] = permissions[:denied_message] || 'Access denied.'
52
+ respond_to do |format|
53
+ format.html { redirect_to(permissions[:denied_url] || { :action => :index }) }
54
+ format.any(:xml, :json) { head :forbidden }
55
+ end
56
+ false
57
+ end
58
+ end
59
+
60
+ def user_has_access_to_action?(action)
61
+ self.class.user_has_access_to_action?(current_user, action, self)
62
+ end
63
+
64
+ def login_from_session
65
+ User.find(session['user_id']) rescue nil
66
+ end
67
+
68
+ def login_from_cookie
69
+ if !cookies[:session_token].blank? && user = User.find_by_session_token(cookies[:session_token]) # don't find by empty value
70
+ user.remember_me
71
+ set_session_cookie(user)
72
+ user
73
+ end
74
+ end
75
+
76
+ def login_from_http
77
+ if [Mime::XML, Mime::JSON].include?(request.format)
78
+ authenticate_with_http_basic do |user_name, password|
79
+ User.authenticate(user_name, password)
80
+ end
81
+ end
82
+ end
83
+
84
+ def set_session_cookie(user = current_user)
85
+ cookies[:session_token] = { :value => user.session_token , :expires => TrustyCms::Config['session_timeout'].to_i.from_now.utc }
86
+ end
87
+
88
+ module ClassMethods
89
+ def no_login_required
90
+ skip_before_filter :authenticate
91
+ skip_before_filter :authorize
92
+ puts _process_action_callbacks.map(&:filter)
93
+ end
94
+
95
+ def login_required?
96
+ filter_chain.any? {|f| f.method == :authenticate || f.method == :authorize }
97
+ end
98
+
99
+ def login_required
100
+ unless login_required?
101
+ prepend_before_filter :authenticate, :authorize
102
+ end
103
+ end
104
+
105
+ def only_allow_access_to(*args)
106
+ options = {}
107
+ options = args.pop.dup if args.last.kind_of?(Hash)
108
+ options.symbolize_keys!
109
+ actions = args.map { |a| a.to_s.intern }
110
+ actions.each do |action|
111
+ controller_permissions[action] = options
112
+ end
113
+ end
114
+
115
+ def controller_permissions
116
+ @controller_permissions ||= Hash.new { |h,k| h[k.to_s.intern] = Hash.new }
117
+ end
118
+
119
+ def user_has_access_to_action?(user, action, instance=new)
120
+ permissions = controller_permissions[action.to_s.intern]
121
+ case
122
+ when allowed_roles = permissions[:when]
123
+ allowed_roles = [allowed_roles].flatten
124
+ allowed_roles.any? { |role| user.has_role?(role) }
125
+ when condition_method = permissions[:if]
126
+ instance.send(condition_method)
127
+ else
128
+ true
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,50 @@
1
+ class MethodObserver
2
+
3
+ attr_reader :target
4
+ attr_accessor :result
5
+
6
+ class ObserverCannotObserveTwiceError < StandardError
7
+ def initialize(message = 'observer cannot observe twice')
8
+ super
9
+ end
10
+ end
11
+
12
+ def observe(target)
13
+ raise ObserverCannotObserveTwiceError if @target
14
+ @target = target
15
+ make_observable(target)
16
+ end
17
+
18
+ def self.instances
19
+ @instances ||= {}
20
+ end
21
+
22
+ def self.new(*args)
23
+ o = super
24
+ instances[o.object_id] = o
25
+ o
26
+ end
27
+
28
+ private
29
+ def make_observable(target)
30
+ methods_to_observe.each do |method|
31
+ target.instance_eval %{
32
+ def #{method}(*args, &block)
33
+ observer = #{self.class}.instances[#{self.object_id}]
34
+ observer.send(:before_#{method}, *args, &block) if observer.respond_to? :before_#{method}
35
+ observer.result = super
36
+ observer.send(:after_#{method}, *args, &block) if observer.respond_to? :after_#{method}
37
+ observer.result
38
+ end
39
+ }
40
+ end
41
+ end
42
+
43
+ def methods_to_observe
44
+ (methods_for(:before) + methods_for(:after)).uniq
45
+ end
46
+
47
+ def methods_for(name)
48
+ methods.grep(/^#{name}_/).map { |n| n.to_s.gsub(/^#{name}_/, '').intern }
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ class Object
2
+ def presence
3
+ return self if present?
4
+ end
5
+ end
data/lib/simpleton.rb ADDED
@@ -0,0 +1,21 @@
1
+ module Simpleton
2
+
3
+ def self.included(base)
4
+ base.extend(ClassMethods)
5
+ end
6
+
7
+ module ClassMethods
8
+
9
+ def instance(&block)
10
+ @instance ||= new
11
+ block.call(@instance) if block_given?
12
+ @instance
13
+ end
14
+
15
+ def method_missing(method, *args, &block)
16
+ instance.respond_to?(method) ? instance.send(method, *args, &block) : super
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,25 @@
1
+ require 'stringex'
2
+
3
+ class String
4
+ def symbolize
5
+ self.gsub(/[^A-Za-z0-9]+/, "_").gsub(/(^_+|_+$)/, "").underscore.to_sym
6
+ end
7
+
8
+ def titlecase
9
+ self.gsub(/((?:^|\s)[a-z])/) { $1.upcase }
10
+ end
11
+
12
+ def to_name(last_part = '')
13
+ self.underscore.gsub('/', ' ').humanize.titlecase.gsub(/\s*#{last_part}$/, '')
14
+ end
15
+
16
+ unless methods.include?('parameterize')
17
+ def parameterize(sep = '-')
18
+ remove_formatting.downcase.replace_whitespace(sep).collapse(sep)
19
+ end
20
+ end
21
+
22
+ alias :to_slug :parameterize
23
+ alias :slugify :parameterize
24
+ alias :slugerize :parameterize
25
+ end
@@ -0,0 +1,5 @@
1
+ class Symbol
2
+ def symbolize
3
+ self.to_s.symbolize
4
+ end
5
+ end