comatose 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG +176 -0
  2. data/INSTALL +19 -0
  3. data/LICENSE +20 -0
  4. data/MANIFEST +91 -0
  5. data/README.rdoc +148 -0
  6. data/Rakefile +122 -0
  7. data/SPECS +61 -0
  8. data/about.yml +7 -0
  9. data/bin/comatose +109 -0
  10. data/comatose.gemspec +113 -0
  11. data/generators/comatose_migration/USAGE +15 -0
  12. data/generators/comatose_migration/comatose_migration_generator.rb +59 -0
  13. data/generators/comatose_migration/templates/migration.rb +35 -0
  14. data/generators/comatose_migration/templates/v4_upgrade.rb +15 -0
  15. data/generators/comatose_migration/templates/v6_upgrade.rb +23 -0
  16. data/generators/comatose_migration/templates/v7_upgrade.rb +22 -0
  17. data/init.rb +2 -0
  18. data/install.rb +16 -0
  19. data/lib/acts_as_versioned.rb +543 -0
  20. data/lib/comatose/comatose_drop.rb +79 -0
  21. data/lib/comatose/configuration.rb +68 -0
  22. data/lib/comatose/page_wrapper.rb +119 -0
  23. data/lib/comatose/processing_context.rb +69 -0
  24. data/lib/comatose/tasks/admin.rb +60 -0
  25. data/lib/comatose/tasks/data.rb +82 -0
  26. data/lib/comatose/tasks/setup.rb +52 -0
  27. data/lib/comatose/version.rb +4 -0
  28. data/lib/comatose.rb +33 -0
  29. data/lib/comatose_admin_controller.rb +349 -0
  30. data/lib/comatose_admin_helper.rb +37 -0
  31. data/lib/comatose_controller.rb +141 -0
  32. data/lib/comatose_helper.rb +3 -0
  33. data/lib/comatose_page.rb +141 -0
  34. data/lib/liquid/block.rb +96 -0
  35. data/lib/liquid/context.rb +190 -0
  36. data/lib/liquid/document.rb +17 -0
  37. data/lib/liquid/drop.rb +48 -0
  38. data/lib/liquid/errors.rb +7 -0
  39. data/lib/liquid/extensions.rb +53 -0
  40. data/lib/liquid/file_system.rb +62 -0
  41. data/lib/liquid/htmltags.rb +64 -0
  42. data/lib/liquid/standardfilters.rb +111 -0
  43. data/lib/liquid/standardtags.rb +399 -0
  44. data/lib/liquid/strainer.rb +42 -0
  45. data/lib/liquid/tag.rb +25 -0
  46. data/lib/liquid/template.rb +88 -0
  47. data/lib/liquid/variable.rb +39 -0
  48. data/lib/liquid.rb +52 -0
  49. data/lib/redcloth.rb +1129 -0
  50. data/lib/support/class_options.rb +36 -0
  51. data/lib/support/inline_rendering.rb +48 -0
  52. data/lib/support/route_mapper.rb +50 -0
  53. data/lib/text_filters/markdown.rb +14 -0
  54. data/lib/text_filters/markdown_smartypants.rb +15 -0
  55. data/lib/text_filters/none.rb +8 -0
  56. data/lib/text_filters/rdoc.rb +13 -0
  57. data/lib/text_filters/simple.rb +8 -0
  58. data/lib/text_filters/textile.rb +15 -0
  59. data/lib/text_filters.rb +138 -0
  60. data/rails/init.rb +3 -0
  61. data/resources/layouts/comatose_admin_template.html.erb +28 -0
  62. data/resources/public/images/collapsed.gif +0 -0
  63. data/resources/public/images/expanded.gif +0 -0
  64. data/resources/public/images/no-children.gif +0 -0
  65. data/resources/public/images/page.gif +0 -0
  66. data/resources/public/images/spinner.gif +0 -0
  67. data/resources/public/images/title-hover-bg.gif +0 -0
  68. data/resources/public/javascripts/comatose_admin.js +401 -0
  69. data/resources/public/stylesheets/comatose_admin.css +381 -0
  70. data/tasks/comatose.rake +9 -0
  71. data/test/behaviors.rb +106 -0
  72. data/test/fixtures/comatose_pages.yml +96 -0
  73. data/test/functional/comatose_admin_controller_test.rb +112 -0
  74. data/test/functional/comatose_controller_test.rb +44 -0
  75. data/test/javascripts/test.html +26 -0
  76. data/test/javascripts/test_runner.js +307 -0
  77. data/test/test_helper.rb +43 -0
  78. data/test/unit/class_options_test.rb +52 -0
  79. data/test/unit/comatose_page_test.rb +128 -0
  80. data/test/unit/processing_context_test.rb +108 -0
  81. data/test/unit/text_filters_test.rb +52 -0
  82. data/views/comatose_admin/_form.html.erb +96 -0
  83. data/views/comatose_admin/_page_list_item.html.erb +60 -0
  84. data/views/comatose_admin/delete.html.erb +18 -0
  85. data/views/comatose_admin/edit.html.erb +5 -0
  86. data/views/comatose_admin/index.html.erb +18 -0
  87. data/views/comatose_admin/new.html.erb +5 -0
  88. data/views/comatose_admin/reorder.html.erb +30 -0
  89. data/views/comatose_admin/versions.html.erb +40 -0
  90. data/views/layouts/comatose_admin.html.erb +814 -0
  91. data/views/layouts/comatose_admin_customize.html.erb +28 -0
  92. data/views/layouts/comatose_content.html.erb +17 -0
  93. metadata +156 -0
data/CHANGELOG ADDED
@@ -0,0 +1,176 @@
1
+ - version: 2.0.1 (alpha)
2
+ - Merged changes from andreas (http://github.com/andreas)...
3
+ - andreas: Fixed comatose:admin:customize raketask (seems plugin_path was wrong, and made use of mkdir_p to avoid "File exists"-errors.)
4
+ - andreas: Added "unloadable" to ComatoseAdminController (problems with ActsAsAuthenticated-integration similar to http://tinyurl.com/6caz5r)
5
+
6
+ - version: 2.0 (uber alpha)
7
+ - Removed controllers, models, and helpers from Comatose module. It was causing odd issues
8
+ - Initial support for Rails 2.1(ish)
9
+ - Fixed up slug generation to remove leading and trailing whitespace
10
+ - Moved to github
11
+ - Changed all the .rhtml files to .html.erb
12
+ - Adding support for use as a gem plugin
13
+
14
+ - version: 0.8.1
15
+ changes:
16
+ - All includes and helpers are loaded at the end of the ComatoseController and ComatoseAdminController classes
17
+ - Fixed the ComatoseController#show action to correctly send an HTTP status of 404 even if it finds, and renders, a page at '/404'
18
+ - Fixed the migration to default a page's full_path to '' instead of null
19
+ - Formalized ComatoseDrops. Use Comatose.define_drop "drop_name", do ... end. Every method within that block should return a value for use with a Liquid and/or ERB template. Usage in a comatose page: {{ drop_name.def_name }}
20
+ - Added support for a config.after_setup block that gets called after Comatose is setup (in the Dispatcher#to_prepare event)
21
+ - Added HTML comment output for calls that result in a method_missing on the ProcessingContext
22
+ - Updated page tree to remember collapsed/expanded nodes between page visits
23
+ - Fixed some errors that were caused by null revisions (usually happened after initial installation)
24
+ - Added my javascript test_runner lib for testing slugs generated by JavaScript. More JS tests to come.
25
+ - Bugfix #8640 (rubyforge bug)
26
+
27
+ - version: 0.8
28
+ changes:
29
+ - Now ONLY supports Rails 1.2 (not even tested in Rails 1.1)
30
+ - New configuration system
31
+ - DEFER_COMATOSE_LOAD is gone -- Using Dispatcher.to_prepare replaces it
32
+ - You no longer extend the base classes to add functionality. You configure Comatose to include modules and send it symbols for providing said functionality. e.g. Comatose.config.includes << :authentiation_system; Comatose.config.authorization = :require_login
33
+ - The automatic loading of RAILS_ROOT/lib/comatose/*.rb files is NO longer supported.
34
+ - In addition to mapping comatose_root in your routes.rb, you'll want to map.comatose_admin as well
35
+
36
+ - version: 0.7.1
37
+ changes:
38
+ - A new DEFER_COMATOSE_LOAD flag is defined in the init.rb -- if you manually set it to `true`, you'll need to call Comatose.load in your environment.rb, but this should combat a lot of the plugin incompatiblities Coamtose has been suffering from
39
+ - The revisions link on the edit page is now only shown if you have revisions
40
+
41
+ - version: 0.7
42
+ changes:
43
+ - Finally, page versioning via Rick Olsen's excellent acts_as_versioned! (included)
44
+ - Tries to load any text filters, tags/drops, or extensions under RAILS_ROOT/lib/comatose/ (actually it just `require`'s every .rb file in that folder) so you no longer need to muck around with adding stuff in your environment.rb file
45
+ - Previewing a page no longer updates it
46
+
47
+ - version: 0.6.9
48
+ changes:
49
+ - The page context now supports page.next, page.last, page.first_child, page.last_child
50
+
51
+ - version: 0.6.8
52
+ changes:
53
+ - Bugfix ComatoseController now references plugin_layout_path correctly from the class method
54
+ - Some HTML/CSS/JS cleanup on the administration view -- should degrade to straight HTML pretty well now
55
+
56
+ - version: 0.6.7
57
+ changes:
58
+ - Removed Comatose::Page.record_timestamps = false -- it was breaking the magic. Override the record_timestamp methds instead
59
+ - AdminController was still referencing, in a few places, ComatoseController for page cache expiration
60
+
61
+ - version: 0.6.6
62
+ changes:
63
+ - The cache expiration code is now on the ComatoseAdminController, as it should have been in the first place
64
+ - Changed internal references from root_paths or cms_root to mount_point, since that's what I've started calling them... And it seems to make the most sense
65
+ - Cleaned up the class_options code
66
+ - Added initial support for pre-caching pages (generating static HTML), there's not a UI element for it yet, however
67
+ - Changes to content-type handling:
68
+ - Removed Comatose::Options.force_utf8
69
+ - Added Support for Comatose::Options.content_type = "utf-8" This will affect the HTTP headers, as well as the META tag in the admin views
70
+ - Changed this log file to yaml format. And yes, there's a method to my madness... Wait for it.
71
+
72
+ - version: 0.6.5
73
+ changes:
74
+ - Fixed a bug in comatose_admin.js -- if you hid any of the meta_fields it would barf
75
+
76
+ - version: 0.6.4
77
+ changes:
78
+ - Fixed a typo in comatose_admin_customize.rhtml
79
+ - Controller now keeps all information about mount points not just the :root (uri) and :index (page tree)
80
+
81
+ - version: 0.6.3
82
+ changes:
83
+ - Fixed the customization tasks
84
+ - Added support for the new Routes system in Edge Rails
85
+ - Removed the getting started guide -- it's now available at: http://comatose.rubyforge.org/getting-started-guide
86
+
87
+ - version: 0.6.2
88
+ changes:
89
+ - Fixed an issue with named_routes
90
+
91
+ - version: 0.6.1
92
+ changes:
93
+ - Fixed a migration issue
94
+
95
+ - version: 0.6
96
+ changes:
97
+ - Split out the admin from the ComatoseController into a new ComatoseAdminController class.
98
+ - Moved controllers/model into Comatose module, now ComatoseController extends Comatose::Controller, and ComatoseAdminController extends Comatose::AdminController. And they extend your ApplicationController ComatoseController
99
+ - Created a Comatose::Options class for configuration.
100
+ - Add Liquid support to Text Processing -- made it the default processor.
101
+ - Added support for adding 'tags' to processing context. They are Liquid Drops when using Liquid for processing, use like objects/methods when in ERB
102
+ - Changed comatose.css, comatose.js, and app/views/comatose to comatose_admin.css, comatose_admin.js, and app/views/comatose_admin
103
+ - Changed the names of some of the internals... ComatoseBinding is now Comatose::ProcessingContext, ComatosePageWrapper is Comatose::PageWrapper
104
+ - Bugfix: PostgreSQL need the scope to be a symbol instead of a string, eh? Fine -- it is so. (Thanks to Lyle for the fix)
105
+ - Added support for named routes... Anytime you use map.comatose_*, if * isn't 'root', it will use it as a named route
106
+
107
+ - version: 0.5
108
+ changes:
109
+ - Added support for parameterized inline rendering of comatose pages. Uselike a partial: render :comatose=>'path', :locals=>{:username=>'stuff'} the locals hash will be sent to the ERB context for use when rendering the page.
110
+ - Support for a Hash ERB context exists all the way down to the TextFilters.
111
+ - Initial support for fragment caching for inline rendering. It's turned off by default. Send :use_cache=>true in the render :comatose=>'' tag to use it. Caching will also not be used if you are sending the page parameters via the :locals hash. Oh, and don't forget to set your ActionController::Base.fragment_cache_store
112
+ - Return reloadable? false for the ComatoseController by default... This should prevent the development mode hassles people have been having.
113
+ - Updated data migration tasks to better support nested pages.
114
+ - comatose:data:export FROM=page_path TO_FILE=file_path
115
+ - comatose:data:import TO=page_path FROM_FILE=file_path
116
+ - FROM_FILE and TO_FILE default to 'db/comatose-pages.yml'
117
+ - FROM and TO default to '', the page tree root
118
+ - Fixed 'Clear Page Cache' bug -- it didn't handle the page root being an array like it should have.
119
+ - Removed :page_title and :page_keywords from session
120
+ - Updated the rails_version in the about.yml to 1.1+ -- just because I haven't tested it on anything less than that. If you have, and it works, let me know!
121
+ - Adds the utf8 header to all output (text/html; charset=utf-8). Use ComatoseController.force_utf8 = false to disable.
122
+ - Initial support for page reordering (via AJAX)
123
+ - Updated the administration look-n-feel.
124
+
125
+ - version: 0.4
126
+ changes:
127
+ - Added keywords field
128
+ - Abstracted text filters into a micro plugin structure, default support for Textile, Markdown, and RDoc
129
+ - It will only show the filters as a choice in the admin if you have the necessary libraries for the filters to function.
130
+ - Added ComatoseController.hidden_meta_fields = [] as a way of showing/hiding the meta fields
131
+ - The comatose_migration generator now accepts an --upgrade flag which will create a micro migration that only has the new fields in it
132
+ - get_root_page will now support returning an array of root pages to show in the admin page list
133
+ - Created some initial tests... (Can you tell I'm not a test _first_ guy?)
134
+ - Inline rendering now handles :silent flag -- it will just return and empty string if :silent=>true
135
+ - Modified all the internal references to ComatoseController to self.class.The views reference controller.class. Redirects redirect to :controller=>self.controller_name or controller.controller_name (action and view respectively). This show allow you to sub-class the ComatoseController.
136
+
137
+ - version: 0.3.1
138
+ changes:
139
+ - Abstracted retrieval of root comatose page to allow multi-user/limited view support
140
+ - Added redcloth so there are now no external dependencies... Other than Rails, of course ;-)
141
+ - DRYed up the folder structure a bit
142
+ - Added a Rakefile
143
+ - Made this ChangeLog more human-readable
144
+
145
+ - version: 0.3
146
+ changes:
147
+ - Added support for running entirely from the plugin
148
+ - Added support for hierarchal pages
149
+ - Pages are pre-filtered by ERB, therefor ERB can generate Textile
150
+ - Comatose binding object
151
+ - Used with ERB context to protect AR model
152
+ - Has a few helper methods too: link, include
153
+ - Migration updated
154
+ - rendered_body removed, not much sense with ERB pre-processing and page-caching
155
+ - full_path added for easy access to child pages
156
+ - position, and author fields for future use
157
+ - Administration Updates
158
+ - Page listing is now a collapsible tree view
159
+ - Page edit supports previewing the content
160
+ - Preview textile only for new pages, full ERB previews for existing pages
161
+ - ERB errors show up as AR errors
162
+ - Shows Title and Body fields by default, clicking 'more...' makes Slug and Parent visible
163
+ - CSS updates to lighten it up a bit
164
+
165
+ - version: 0.2
166
+ changes:
167
+ - Added support for rendering pages inline
168
+ - Added support for expiring entire page cache
169
+ - Added support for properly expiring pages when they are modified or deleted
170
+ - Update stylesheets, generally made it usable
171
+ - Fixed #new action
172
+ - Minor tweaks
173
+
174
+ - version: 0.1
175
+ changes:
176
+ - First mostly-working version
data/INSTALL ADDED
@@ -0,0 +1,19 @@
1
+
2
+ ======================
3
+ Welcome to Comatose!
4
+ ======================
5
+
6
+ From here you'll want to run:
7
+
8
+ $ ./script/generate comatose_migration
9
+
10
+ When that's finished, run:
11
+
12
+ $ rake db:migrate
13
+
14
+ That's it for the Comatose setup! Now just add the following line to the bottom of your config/routes.rb file:
15
+
16
+ map.comatose_admin
17
+ map.comatose_root ''
18
+
19
+ Be sure to read the README file, and the 'Getting Started' guide. They are located at vendor/plugins/comatose/README and http://comatose.rubyforge.org/getting-started-guide respectively.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2006 Matthew McCray [ http://www.mattmccray.com ]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sub-license, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/MANIFEST ADDED
@@ -0,0 +1,91 @@
1
+ about.yml
2
+ bin/comatose
3
+ CHANGELOG
4
+ generators/comatose_migration/comatose_migration_generator.rb
5
+ generators/comatose_migration/templates/migration.rb
6
+ generators/comatose_migration/templates/v4_upgrade.rb
7
+ generators/comatose_migration/templates/v6_upgrade.rb
8
+ generators/comatose_migration/templates/v7_upgrade.rb
9
+ generators/comatose_migration/USAGE
10
+ init.rb
11
+ INSTALL
12
+ install.rb
13
+ lib/acts_as_versioned.rb
14
+ lib/comatose/comatose_drop.rb
15
+ lib/comatose/configuration.rb
16
+ lib/comatose/page_wrapper.rb
17
+ lib/comatose/processing_context.rb
18
+ lib/comatose/tasks/admin.rb
19
+ lib/comatose/tasks/data.rb
20
+ lib/comatose/tasks/setup.rb
21
+ lib/comatose/version.rb
22
+ lib/comatose.rb
23
+ lib/comatose_admin_controller.rb
24
+ lib/comatose_admin_helper.rb
25
+ lib/comatose_controller.rb
26
+ lib/comatose_helper.rb
27
+ lib/comatose_page.rb
28
+ lib/liquid/block.rb
29
+ lib/liquid/context.rb
30
+ lib/liquid/document.rb
31
+ lib/liquid/drop.rb
32
+ lib/liquid/errors.rb
33
+ lib/liquid/extensions.rb
34
+ lib/liquid/file_system.rb
35
+ lib/liquid/htmltags.rb
36
+ lib/liquid/standardfilters.rb
37
+ lib/liquid/standardtags.rb
38
+ lib/liquid/strainer.rb
39
+ lib/liquid/tag.rb
40
+ lib/liquid/template.rb
41
+ lib/liquid/variable.rb
42
+ lib/liquid.rb
43
+ lib/redcloth.rb
44
+ lib/support/class_options.rb
45
+ lib/support/inline_rendering.rb
46
+ lib/support/route_mapper.rb
47
+ lib/text_filters/markdown.rb
48
+ lib/text_filters/markdown_smartypants.rb
49
+ lib/text_filters/none.rb
50
+ lib/text_filters/rdoc.rb
51
+ lib/text_filters/simple.rb
52
+ lib/text_filters/textile.rb
53
+ lib/text_filters.rb
54
+ LICENSE
55
+ MANIFEST
56
+ rails/init.rb
57
+ Rakefile
58
+ README.rdoc
59
+ resources/layouts/comatose_admin_template.html.erb
60
+ resources/public/images/collapsed.gif
61
+ resources/public/images/expanded.gif
62
+ resources/public/images/no-children.gif
63
+ resources/public/images/page.gif
64
+ resources/public/images/spinner.gif
65
+ resources/public/images/title-hover-bg.gif
66
+ resources/public/javascripts/comatose_admin.js
67
+ resources/public/stylesheets/comatose_admin.css
68
+ SPECS
69
+ tasks/comatose.rake
70
+ test/behaviors.rb
71
+ test/fixtures/comatose_pages.yml
72
+ test/functional/comatose_admin_controller_test.rb
73
+ test/functional/comatose_controller_test.rb
74
+ test/javascripts/test.html
75
+ test/javascripts/test_runner.js
76
+ test/test_helper.rb
77
+ test/unit/class_options_test.rb
78
+ test/unit/comatose_page_test.rb
79
+ test/unit/processing_context_test.rb
80
+ test/unit/text_filters_test.rb
81
+ views/comatose_admin/_form.html.erb
82
+ views/comatose_admin/_page_list_item.html.erb
83
+ views/comatose_admin/delete.html.erb
84
+ views/comatose_admin/edit.html.erb
85
+ views/comatose_admin/index.html.erb
86
+ views/comatose_admin/new.html.erb
87
+ views/comatose_admin/reorder.html.erb
88
+ views/comatose_admin/versions.html.erb
89
+ views/layouts/comatose_admin.html.erb
90
+ views/layouts/comatose_admin_customize.html.erb
91
+ views/layouts/comatose_content.html.erb
data/README.rdoc ADDED
@@ -0,0 +1,148 @@
1
+ = Comatose
2
+
3
+ Version:: 2.0 (uber-alpha)
4
+ Author:: M@ McCray
5
+ Website:: comatose.rubyforge.org
6
+ Email:: matt at elucidata dot net
7
+
8
+
9
+ *Comatose* is a micro CMS designed for being embedded into existing Rails
10
+ applications.
11
+
12
+ It's intended for simple CMS support. Comatose supports
13
+
14
+ * Nested pages
15
+ * Versioning
16
+ * Page markup in Textile, Markdown, RDoc, or easily add your own
17
+ * Page processing through Liquid or ERb
18
+ * Generators for easy installation/migration
19
+ * Completely self-contained within plugin folder
20
+
21
+ It's meant to be lean, mean, easily embedded, and easy to re-skin for
22
+ existing applications. If you need something more, I would recommend
23
+ looking into Radiant.
24
+
25
+ For more information, see the 'Getting Started' guide: http://comatose.rubyforge.org
26
+
27
+ === Requirements
28
+
29
+ * Rails 2+ (2.1)
30
+ * <tt>acts_as_list</tt> and <tt>acts_as_tree</tt> plugins are required
31
+
32
+
33
+ === Development Notes
34
+
35
+ *NOTE*: This is an active branch of Comatose that is built specifically for Rails 2.1.
36
+ I will *probably* remove any legacy support.
37
+
38
+ * Make comatose fully self-contained, which means removing acts_as_(tree|list)
39
+ * Move to gem plugin
40
+ * Comatose.configure needs to be an initializer (update docs)
41
+ * Go through bugs on 1x branch from google code and ensure they are fixed
42
+ * Give access to all the default rails helpers to Comatose Pages by default?
43
+
44
+
45
+ == Installation
46
+
47
+ *Note*: See the 'Upgrading' section if you already have an older version of
48
+ the comatose plugin installed.
49
+
50
+ $ ./script/plugin source http://mattmccray.com/svn/rails/plugins
51
+ $ ./script/plugin install comatose
52
+ $ ./script/generate comatose_migration
53
+ $ rake migrate
54
+
55
+ Open your <tt>routes.rb</tt> and add the comatose root route at the
56
+ bottom:
57
+
58
+ map.comatose_admin
59
+ map.comatose_root ''
60
+
61
+ That's it, you're ready to go! You should be able to browse to
62
+ http://127.0.0.1:3000/comatose_admin and start adding pages to your CMS.
63
+ Browsing to http://127.0.0.1:3000/ will render your comatose pages if
64
+ routing doesn't match any of your controllers.
65
+
66
+
67
+ == Upgrading
68
+
69
+ *NOTE*: This is an experimental 2.0 branch, so upgrading is possible at
70
+ the moment, but these instructions may not work for much longer.
71
+
72
+ If you are upgrading from an older version of Comatose (version 0.3,
73
+ 0.4, 0.5, or 0.6), then you will need to re-install the comatose
74
+ plugin and run:
75
+
76
+ $ ./script/plugin remove comatose
77
+ $ ./script/plugin install comatose
78
+ $ ./script/generate comatose_migration --upgrade --from=VERSION
79
+ $ rake migrate
80
+
81
+ *Note*: Be sure to set the <tt>--from</tt> parameter to the version of
82
+ Comatose you last had installed. Also, you only need to first two digits,
83
+ including the dot, of the version you are upgrading from. For example, if
84
+ you're upgrading from version 0.6.9 you can use:
85
+
86
+ $ ./script/generate comatose_migration --upgrade --from=0.6
87
+
88
+ This will create the upgrade migration(s) for you. It just adds the new
89
+ fields, so you can keep the original migration comatose created.
90
+
91
+
92
+ == Configuration
93
+
94
+ You configure Comatose in your `config/environment.rb` file. Here is an example
95
+ configuration block:
96
+
97
+ Comatose.configure do |config|
98
+ # Sets the text in the Admin UI's title area
99
+ config.admin_title = "Site Content"
100
+ config.admin_sub_title = "Content for the rest of us..."
101
+ end
102
+
103
+ Here's an example that uses the AuthentiationSystem as generated by the
104
+ restful_authentication plugin:
105
+
106
+ Comatose.configure do |config|
107
+ # Includes AuthenticationSystem in the ComatoseController
108
+ config.includes << :authenticated_system
109
+
110
+ # admin
111
+ config.admin_title = "Comatose - TESTING"
112
+ config.admin_sub_title = "Content for the rest of us..."
113
+
114
+ # Includes AuthenticationSystem in the ComatoseAdminController
115
+ config.admin_includes << :authenticated_system
116
+
117
+ # Calls :login_required as a before_filter
118
+ config.admin_authorization = :login_required
119
+ # Returns the author name (login, in this case) for the current user
120
+ config.admin_get_author do
121
+ current_user.login
122
+ end
123
+ end
124
+
125
+
126
+ == Extra Credit
127
+
128
+ This plugin includes the work of many wonderful contributors to the Railsphere.
129
+ Following are the specific libraries that are distributed with Comatose. If I've
130
+ missed someone/something please let me know.
131
+
132
+ * Liquid (http://home.leetsoft.com/liquid) by Tobias Luetke (http://blog.leetsoft.com)
133
+ * RedCloth (http://whytheluckystiff.net/ruby/redcloth) by why the lucky stiff (http://whytheluckystiff.net)
134
+ * Acts as Versioned (http://ar-versioned.rubyforge.org) by Rick Olsen (http://weblog.techno-weenie.net)
135
+ * Behaviors (http://behaviors.rubyforge.org) by Atomic Object LLC -- very nice BDD-like testing library
136
+
137
+ == Feedback
138
+
139
+ I’ve released Comatose under the MIT license. Which basically means you
140
+ can use it however you want.
141
+
142
+ Don't forget to read the 'Getting Started' guide located on the RubyForge
143
+ project site: http://comatose.rubyforge.org/getting-started-guide
144
+
145
+ If you like it, hate it, or have some ideas for new features, let me know!
146
+
147
+ darthapo at gmail dot com
148
+
data/Rakefile ADDED
@@ -0,0 +1,122 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+ require 'test/behaviors'
6
+
7
+ desc 'Default: run unit tests.'
8
+ task :default => :test
9
+
10
+ desc 'Test the Comatose plugin.'
11
+ Rake::TestTask.new(:test) do |t|
12
+ t.libs << 'lib'
13
+ t.pattern = 'test/**/*_test.rb'
14
+ t.verbose = false
15
+ end
16
+
17
+ Behaviors::ReportTask.new :specs do |t|
18
+ t.pattern = 'test/**/*_test.rb'
19
+ end
20
+
21
+ desc 'Generate documentation for Comatose.'
22
+ Rake::RDocTask.new(:rdoc) do |rdoc|
23
+ rdoc.rdoc_dir = 'rdoc'
24
+ rdoc.title = 'Comatose'
25
+ rdoc.options << '--line-numbers' << '--inline-source'
26
+ rdoc.rdoc_files.include('README')
27
+ rdoc.rdoc_files.include('lib/**/*.rb')
28
+ end
29
+
30
+ def manifest_files
31
+ Dir.glob("**/*").delete_if do |item|
32
+ item.include?(".git") or item =~ /gem(?:spec)?$/ or File.directory?(item)
33
+ end
34
+ end
35
+
36
+ desc "Generate a MANIFEST files"
37
+ task :manifest do
38
+ File.open('MANIFEST', 'w') do |f|
39
+ f.write manifest_files.join("\n")
40
+ end
41
+ puts 'Created MANIFEST'
42
+ end
43
+
44
+
45
+ desc "Update GEMSPEC"
46
+ task :gemspec=>:manifest do
47
+ $: << 'lib'
48
+ require 'comatose/version'
49
+
50
+ gemspec_src =<<-EOGS
51
+ # Generated on #{ Time.now.to_s }
52
+ Gem::Specification.new do |s|
53
+ s.name = "comatose"
54
+ s.version = "#{ Comatose::VERSION }"
55
+ s.date = "#{ Time.now.strftime('%Y-%m-%d') }" # 2008-05-20
56
+ s.summary = "Micro CMS designed for being embedded into existing Rails applications"
57
+ s.email = "matt@elucidata.net"
58
+ s.rubyforge_project = 'comatose'
59
+ s.homepage = "http://comatose.rubyforge.org"
60
+ s.description = "Comatose is a micro CMS designed for being embedded into existing Rails applications."
61
+ s.has_rdoc = true
62
+ s.authors = ["M@ McCray"]
63
+ s.bindir = 'bin'
64
+ s.executables = ['comatose']
65
+ s.files = ["#{ manifest_files.join('", "') }"]
66
+ s.test_files = ["#{ manifest_files.delete_if{ |f| !f.include?('test/') }.join('", "') }"]
67
+ s.rdoc_options = ["--main", "README.rdoc"]
68
+ s.extra_rdoc_files = %w(README.rdoc CHANGELOG SPECS LICENSE)
69
+ #s.add_dependency("mime-types", ["> 0.0.0"])
70
+ end
71
+ EOGS
72
+
73
+ File.open("comatose.gemspec", 'w') do |f|
74
+ f.write gemspec_src
75
+ end
76
+
77
+ puts "Update GEMSPEC"
78
+ end
79
+
80
+ desc "Builds the admin costumizable layout, the embedded layout have the JS and CSS inlined"
81
+ task :build do
82
+ require 'erb'
83
+
84
+ # Javascript
85
+ script_path = File.join('resources', 'public', 'javascripts', 'comatose_admin.js')
86
+ script_contents = ''
87
+ # Stylesheet
88
+ style_path = File.join('resources', 'public', 'stylesheets', 'comatose_admin.css')
89
+ style_contents = ''
90
+ # Layout Template
91
+ tmpl_path = File.join('resources', 'layouts', 'comatose_admin_template.html.erb')
92
+ tmpl_contents = ''
93
+ # Layout Target
94
+ layout_path = File.join('views', 'layouts', 'comatose_admin.html.erb')
95
+ layout_contents = ''
96
+ # Customizable Target
97
+ customizable_path = File.join('views', 'layouts', 'comatose_admin_customize.html.erb')
98
+
99
+ # Read the file contents...
100
+ File.open(script_path, 'r') {|f| script_contents = "<script>\n#{f.read}\n</script>" }
101
+ File.open(style_path, 'r') {|f| style_contents = "<style>\n#{f.read}\n</style>" }
102
+ File.open(tmpl_path, 'r') {|f| tmpl_contents = f.read }
103
+
104
+ # Create the final layout...
105
+ layout_contents = ERB.new( tmpl_contents ).result(binding)
106
+
107
+ # Write it out...
108
+ File.open(layout_path, 'w') {|f| f.write layout_contents }
109
+
110
+ # Now let's create the customizable one...
111
+ style_contents = "<%= stylesheet_link_tag 'comatose_admin' %>"
112
+ script_contents = "<%= javascript_include_tag 'comatose_admin' %>"
113
+
114
+ # Create the final layout...
115
+ layout_contents = ERB.new( tmpl_contents ).result(binding)
116
+
117
+ # Write it out...
118
+ File.open(customizable_path, 'w') {|f| f.write layout_contents }
119
+
120
+ # That's it -- we're done.
121
+ puts "Finished."
122
+ end
data/SPECS ADDED
@@ -0,0 +1,61 @@
1
+ Comatose Admin Controller should:
2
+ - show the index action
3
+ - show the new action
4
+ - successfully create pages
5
+ - create a page with an empty body
6
+ - not create a page with a missing title
7
+ - not create a page associated to an invalid parent
8
+ - contain all the correct options for filter_type
9
+ - show the edit action
10
+ - update pages with valid data
11
+ - not update pages with invalid data
12
+ - delete a page
13
+ - reorder pages
14
+ - set runtime mode
15
+
16
+ Comatose Controller should:
17
+ - show pages based on path_info
18
+
19
+ Class Options should:
20
+ - allow nil as a default
21
+ - allow boolean defaults
22
+ - allow string defaults
23
+ - allow numeric defaults
24
+ - allow symbolic defaults
25
+ - allow array literals as defaults
26
+ - allow hash literals as defaults
27
+
28
+ Comatose Page should:
29
+ - create page
30
+ - create a new version of an updated page
31
+ - render content through textile and liquid processors
32
+ - not allow creation of page when missing a title
33
+ - have good fixtures for this to work out
34
+ - generate slugs correctly
35
+ - generate page paths correctly
36
+ - update page paths when pages are moved
37
+ - set an AR error with processor syntax error info
38
+ - render body text accurately
39
+ - render data from parameterized calls too
40
+ - render data from a Drop
41
+
42
+ Processing Context should:
43
+ - process liquid tags with no filters correctly
44
+ - process erb tags correctly
45
+ - support text translation and processing with ERB
46
+ - support text translation and processing with Liquid
47
+ - allow access to safe properties and methods when processing with ERB
48
+ - prevent access to protected properties and methods when processing with ERB
49
+ - allow access to safe properties and methods when processing with Liquid
50
+ - prevent access to protected properties and methods when processing with Liquid
51
+ - allow referenceing of defined ComatoseDrops
52
+ - let ComatoseDrop errors bubble upward
53
+
54
+ Text Filters should:
55
+ - not alter output when using filter :none
56
+ - convert newlines into <br/>s when using :simple filter
57
+ - support Textile, if it's available, using :textile or 'Textile' as a key
58
+ - support Markdown, if it's available, using :markdown or 'Markdown' as a key
59
+ - support RDoc, if it's available, using :rdoc or 'RDoc' as a key
60
+ - support transformation of parameters via ERB
61
+ - support transformation of parameters via Liquid
data/about.yml ADDED
@@ -0,0 +1,7 @@
1
+ author: Matt McCray
2
+ summary: A micro CMS for embedding in Rails applications.
3
+ homepage: http://comatose.rubyforge.org
4
+ plugin: git://github.com/darthapo/comatose.git
5
+ license: MIT
6
+ version: 2.0.1
7
+ rails_version: 2+