aslakjo-comatose 2.0.5.2

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 +195 -0
  2. data/INSTALL +20 -0
  3. data/LICENSE +20 -0
  4. data/MANIFEST +91 -0
  5. data/README.markdown +159 -0
  6. data/Rakefile +176 -0
  7. data/SPECS +61 -0
  8. data/about.yml +7 -0
  9. data/bin/comatose +112 -0
  10. data/comatose.gemspec +113 -0
  11. data/generators/comatose_migration/USAGE +15 -0
  12. data/generators/comatose_migration/comatose_migration_generator.rb +74 -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 +18 -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 +69 -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 +395 -0
  30. data/lib/comatose_admin_helper.rb +37 -0
  31. data/lib/comatose_controller.rb +138 -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 +140 -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 +404 -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 +114 -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 +55 -0
  78. data/test/unit/class_options_test.rb +52 -0
  79. data/test/unit/comatose_page_test.rb +136 -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 +29 -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 +837 -0
  91. data/views/layouts/comatose_admin_customize.html.erb +28 -0
  92. data/views/layouts/comatose_content.html.erb +17 -0
  93. metadata +148 -0
data/CHANGELOG ADDED
@@ -0,0 +1,195 @@
1
+ - version: 2.0.5 (beta)
2
+ - Added configuration option for importing/exporting pages from admin: `config.allow_import_export = true|false`, `true` is the default at the moment
3
+ - Reworked the UI for import/export a little bit
4
+ - Added LINK option to `test_harness` rake task to symlink the comatose plugin directory instead of copying it
5
+ - Updated manifest and gemspec
6
+
7
+ - version: 2.0.4 (beta)
8
+ - Added a rake task to generate a test_harness (for use in development). From the comatose directory, run: `rake test_harness TARGET=../comatose_test_harness`. This will create an empty rails app, copy this working folder over to vendor/plugins/comatose, install acts_as_list and acts_as_tree, and run any setup needed, like script/generate comatose_migration and rake db:migrate.
9
+ - Bugfix in tasks/comatose.rake
10
+ - Comatose migration generator now adds the default comatose routes (`map.comatose_admin` and `map.comatose_root ''`) to the top of the routes.rb file. POSSIBLE GOTCHA: `map.comatose_root` should be moved to the bottom of the routes file!
11
+
12
+ - version: 2.0.3 (beta)
13
+ - Moving from alpha to beta!
14
+ - staugaard: Added import and export of pages in admin controller
15
+
16
+ - version: 2.0.2 (alpha)
17
+ - staugaard: Added "unloadable" to ComatoseController (problems with ActsAsAuthenticated-integration similar to http://tinyurl.com/6caz5r)
18
+ - jcnetdev: Tweaking gemspec
19
+
20
+ - version: 2.0.1 (alpha)
21
+ - Merged changes from andreas (http://github.com/andreas)...
22
+ - andreas: Fixed comatose:admin:customize raketask (seems plugin_path was wrong, and made use of mkdir_p to avoid "File exists"-errors.)
23
+ - andreas: Added "unloadable" to ComatoseAdminController (problems with ActsAsAuthenticated-integration similar to http://tinyurl.com/6caz5r)
24
+
25
+ - version: 2.0 (uber alpha)
26
+ - Removed controllers, models, and helpers from Comatose module. It was causing odd issues
27
+ - Initial support for Rails 2.1(ish)
28
+ - Fixed up slug generation to remove leading and trailing whitespace
29
+ - Moved to github
30
+ - Changed all the .rhtml files to .html.erb
31
+ - Adding support for use as a gem plugin
32
+
33
+ - version: 0.8.1
34
+ changes:
35
+ - All includes and helpers are loaded at the end of the ComatoseController and ComatoseAdminController classes
36
+ - Fixed the ComatoseController#show action to correctly send an HTTP status of 404 even if it finds, and renders, a page at '/404'
37
+ - Fixed the migration to default a page's full_path to '' instead of null
38
+ - 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 }}
39
+ - Added support for a config.after_setup block that gets called after Comatose is setup (in the Dispatcher#to_prepare event)
40
+ - Added HTML comment output for calls that result in a method_missing on the ProcessingContext
41
+ - Updated page tree to remember collapsed/expanded nodes between page visits
42
+ - Fixed some errors that were caused by null revisions (usually happened after initial installation)
43
+ - Added my javascript test_runner lib for testing slugs generated by JavaScript. More JS tests to come.
44
+ - Bugfix #8640 (rubyforge bug)
45
+
46
+ - version: 0.8
47
+ changes:
48
+ - Now ONLY supports Rails 1.2 (not even tested in Rails 1.1)
49
+ - New configuration system
50
+ - DEFER_COMATOSE_LOAD is gone -- Using Dispatcher.to_prepare replaces it
51
+ - 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
52
+ - The automatic loading of RAILS_ROOT/lib/comatose/*.rb files is NO longer supported.
53
+ - In addition to mapping comatose_root in your routes.rb, you'll want to map.comatose_admin as well
54
+
55
+ - version: 0.7.1
56
+ changes:
57
+ - 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
58
+ - The revisions link on the edit page is now only shown if you have revisions
59
+
60
+ - version: 0.7
61
+ changes:
62
+ - Finally, page versioning via Rick Olsen's excellent acts_as_versioned! (included)
63
+ - 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
64
+ - Previewing a page no longer updates it
65
+
66
+ - version: 0.6.9
67
+ changes:
68
+ - The page context now supports page.next, page.last, page.first_child, page.last_child
69
+
70
+ - version: 0.6.8
71
+ changes:
72
+ - Bugfix ComatoseController now references plugin_layout_path correctly from the class method
73
+ - Some HTML/CSS/JS cleanup on the administration view -- should degrade to straight HTML pretty well now
74
+
75
+ - version: 0.6.7
76
+ changes:
77
+ - Removed Comatose::Page.record_timestamps = false -- it was breaking the magic. Override the record_timestamp methds instead
78
+ - AdminController was still referencing, in a few places, ComatoseController for page cache expiration
79
+
80
+ - version: 0.6.6
81
+ changes:
82
+ - The cache expiration code is now on the ComatoseAdminController, as it should have been in the first place
83
+ - 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
84
+ - Cleaned up the class_options code
85
+ - Added initial support for pre-caching pages (generating static HTML), there's not a UI element for it yet, however
86
+ - Changes to content-type handling:
87
+ - Removed Comatose::Options.force_utf8
88
+ - 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
89
+ - Changed this log file to yaml format. And yes, there's a method to my madness... Wait for it.
90
+
91
+ - version: 0.6.5
92
+ changes:
93
+ - Fixed a bug in comatose_admin.js -- if you hid any of the meta_fields it would barf
94
+
95
+ - version: 0.6.4
96
+ changes:
97
+ - Fixed a typo in comatose_admin_customize.rhtml
98
+ - Controller now keeps all information about mount points not just the :root (uri) and :index (page tree)
99
+
100
+ - version: 0.6.3
101
+ changes:
102
+ - Fixed the customization tasks
103
+ - Added support for the new Routes system in Edge Rails
104
+ - Removed the getting started guide -- it's now available at: http://comatose.rubyforge.org/getting-started-guide
105
+
106
+ - version: 0.6.2
107
+ changes:
108
+ - Fixed an issue with named_routes
109
+
110
+ - version: 0.6.1
111
+ changes:
112
+ - Fixed a migration issue
113
+
114
+ - version: 0.6
115
+ changes:
116
+ - Split out the admin from the ComatoseController into a new ComatoseAdminController class.
117
+ - Moved controllers/model into Comatose module, now ComatoseController extends Comatose::Controller, and ComatoseAdminController extends Comatose::AdminController. And they extend your ApplicationController ComatoseController
118
+ - Created a Comatose::Options class for configuration.
119
+ - Add Liquid support to Text Processing -- made it the default processor.
120
+ - Added support for adding 'tags' to processing context. They are Liquid Drops when using Liquid for processing, use like objects/methods when in ERB
121
+ - Changed comatose.css, comatose.js, and app/views/comatose to comatose_admin.css, comatose_admin.js, and app/views/comatose_admin
122
+ - Changed the names of some of the internals... ComatoseBinding is now Comatose::ProcessingContext, ComatosePageWrapper is Comatose::PageWrapper
123
+ - Bugfix: PostgreSQL need the scope to be a symbol instead of a string, eh? Fine -- it is so. (Thanks to Lyle for the fix)
124
+ - Added support for named routes... Anytime you use map.comatose_*, if * isn't 'root', it will use it as a named route
125
+
126
+ - version: 0.5
127
+ changes:
128
+ - 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.
129
+ - Support for a Hash ERB context exists all the way down to the TextFilters.
130
+ - 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
131
+ - Return reloadable? false for the ComatoseController by default... This should prevent the development mode hassles people have been having.
132
+ - Updated data migration tasks to better support nested pages.
133
+ - comatose:data:export FROM=page_path TO_FILE=file_path
134
+ - comatose:data:import TO=page_path FROM_FILE=file_path
135
+ - FROM_FILE and TO_FILE default to 'db/comatose-pages.yml'
136
+ - FROM and TO default to '', the page tree root
137
+ - Fixed 'Clear Page Cache' bug -- it didn't handle the page root being an array like it should have.
138
+ - Removed :page_title and :page_keywords from session
139
+ - 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!
140
+ - Adds the utf8 header to all output (text/html; charset=utf-8). Use ComatoseController.force_utf8 = false to disable.
141
+ - Initial support for page reordering (via AJAX)
142
+ - Updated the administration look-n-feel.
143
+
144
+ - version: 0.4
145
+ changes:
146
+ - Added keywords field
147
+ - Abstracted text filters into a micro plugin structure, default support for Textile, Markdown, and RDoc
148
+ - It will only show the filters as a choice in the admin if you have the necessary libraries for the filters to function.
149
+ - Added ComatoseController.hidden_meta_fields = [] as a way of showing/hiding the meta fields
150
+ - The comatose_migration generator now accepts an --upgrade flag which will create a micro migration that only has the new fields in it
151
+ - get_root_page will now support returning an array of root pages to show in the admin page list
152
+ - Created some initial tests... (Can you tell I'm not a test _first_ guy?)
153
+ - Inline rendering now handles :silent flag -- it will just return and empty string if :silent=>true
154
+ - 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.
155
+
156
+ - version: 0.3.1
157
+ changes:
158
+ - Abstracted retrieval of root comatose page to allow multi-user/limited view support
159
+ - Added redcloth so there are now no external dependencies... Other than Rails, of course ;-)
160
+ - DRYed up the folder structure a bit
161
+ - Added a Rakefile
162
+ - Made this ChangeLog more human-readable
163
+
164
+ - version: 0.3
165
+ changes:
166
+ - Added support for running entirely from the plugin
167
+ - Added support for hierarchal pages
168
+ - Pages are pre-filtered by ERB, therefor ERB can generate Textile
169
+ - Comatose binding object
170
+ - Used with ERB context to protect AR model
171
+ - Has a few helper methods too: link, include
172
+ - Migration updated
173
+ - rendered_body removed, not much sense with ERB pre-processing and page-caching
174
+ - full_path added for easy access to child pages
175
+ - position, and author fields for future use
176
+ - Administration Updates
177
+ - Page listing is now a collapsible tree view
178
+ - Page edit supports previewing the content
179
+ - Preview textile only for new pages, full ERB previews for existing pages
180
+ - ERB errors show up as AR errors
181
+ - Shows Title and Body fields by default, clicking 'more...' makes Slug and Parent visible
182
+ - CSS updates to lighten it up a bit
183
+
184
+ - version: 0.2
185
+ changes:
186
+ - Added support for rendering pages inline
187
+ - Added support for expiring entire page cache
188
+ - Added support for properly expiring pages when they are modified or deleted
189
+ - Update stylesheets, generally made it usable
190
+ - Fixed #new action
191
+ - Minor tweaks
192
+
193
+ - version: 0.1
194
+ changes:
195
+ - First mostly-working version
data/INSTALL ADDED
@@ -0,0 +1,20 @@
1
+
2
+ ======================
3
+ Welcome to Comatose!
4
+ ======================
5
+
6
+ Be sure and install the acts_as_tree and acts_as_list plugins!
7
+
8
+ From here you'll want to run:
9
+
10
+ $ ./script/generate comatose_migration
11
+
12
+ NOTE: The generator will add the default comatose routes to the top of your routes.rb file. You'll want to move `map.comatose_root ''` to the bottom of your routes block.
13
+
14
+ When that's finished, run:
15
+
16
+ $ rake db:migrate
17
+
18
+ That's it for the Comatose setup!
19
+
20
+ 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.markdown
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.markdown ADDED
@@ -0,0 +1,159 @@
1
+ # Comatose
2
+
3
+ * Version: 2.0.5 (beta)
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.
26
+
27
+ ### Requirements
28
+
29
+ * Rails 2+ (2.1)
30
+ * `acts_as_list` and `acts_as_tree` plugins are required (at the moment)
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
+ * Improve `ComatoseAdminController` to reduce number of DB calls for building the page tree
40
+ * Move to gem plugin
41
+ * `Comatose.configure` needs to be an initializer (update docs)
42
+ * Go through bugs on 1x branch from google code and ensure they are fixed
43
+ * Give access to all the default rails helpers to Comatose Pages by default?
44
+ * UI refresh (nothing major, just some cleanup).
45
+ * RESTful goodness.
46
+ * Support XML/JSON responses from `ComatoseController` and `ComatoseAdminController`.
47
+ * Support for static rendering (for generating sites like this blog).
48
+
49
+ ### Installation
50
+
51
+ *Note*: See the 'Upgrading' section if you already have an older version of
52
+ the comatose plugin installed.
53
+
54
+ $ ./script/plugin install git://github.com/darthapo/comatose.git
55
+ $ ./script/generate comatose_migration
56
+ $ rake db:migrate
57
+
58
+ Open your `routes.rb` and move the following comatose route to the
59
+ bottom:
60
+
61
+ map.comatose_root ''
62
+
63
+ That's it, you're ready to go! You should be able to browse to
64
+ http://127.0.0.1:3000/**comatose_admin** and start adding pages to your CMS.
65
+ Browsing to http://127.0.0.1:3000/ will render your comatose pages if
66
+ routing doesn't match any of your controllers.
67
+
68
+
69
+ ### Upgrading
70
+
71
+ *NOTE*: This is an experimental 2.0 branch, so upgrading is possible at
72
+ the moment, but these instructions may not work for much longer.
73
+
74
+ If you are upgrading from an older version of Comatose (version 0.3,
75
+ 0.4, 0.5, or 0.6), then you will need to re-install the comatose
76
+ plugin and run:
77
+
78
+ $ ./script/plugin remove comatose
79
+ $ ./script/plugin install comatose
80
+ $ ./script/generate comatose_migration --upgrade --from=VERSION
81
+ $ rake migrate
82
+
83
+ *Note*: Be sure to set the `--from` parameter to the version of
84
+ Comatose you last had installed. Also, you only need to first two digits,
85
+ including the dot, of the version you are upgrading from. For example, if
86
+ you're upgrading from version 0.6.9 you can use:
87
+
88
+ $ ./script/generate comatose_migration --upgrade --from=0.6
89
+
90
+ This will create the upgrade migration(s) for you. It just adds the new
91
+ fields, so you can keep the original migration comatose created.
92
+
93
+
94
+ ### Configuration
95
+
96
+ You configure Comatose in your `config/environment.rb` file. Here is an example
97
+ configuration block:
98
+
99
+ Comatose.configure do |config|
100
+ # Sets the text in the Admin UI's title area
101
+ config.admin_title = "Site Content"
102
+ config.admin_sub_title = "Content for the rest of us..."
103
+ end
104
+
105
+ Here's an example that uses the `AuthenticationSystem` as generated by the
106
+ `restful_authentication` plugin:
107
+
108
+ Comatose.configure do |config|
109
+ # Includes AuthenticationSystem in the ComatoseController
110
+ config.includes << :authenticated_system
111
+
112
+ # admin
113
+ config.admin_title = "Comatose - TESTING"
114
+ config.admin_sub_title = "Content for the rest of us..."
115
+
116
+ # Includes AuthenticationSystem in the ComatoseAdminController
117
+ config.admin_includes << :authenticated_system
118
+
119
+ # Calls :login_required as a before_filter
120
+ config.admin_authorization = :login_required
121
+ # Returns the author name (login, in this case) for the current user
122
+ config.admin_get_author do
123
+ current_user.login
124
+ end
125
+ end
126
+
127
+
128
+ ### Extra Credit
129
+
130
+ This plugin includes the work of many wonderful contributors to the Railsphere.
131
+ Following are the specific libraries that are distributed with Comatose. If I've
132
+ missed someone/something please let me know.
133
+
134
+ * [Liquid][] by [Tobias Luetke][]
135
+ * [RedCloth][] by [_why][]
136
+ * [Acts as Versioned][] by [Rick Olsen][]
137
+ * [Behaviors][] by Atomic Object LLC -- very nice BDD-like testing library
138
+
139
+ ### Feedback
140
+
141
+ I’ve released Comatose under the MIT license. Which basically means you
142
+ can use it however you want.
143
+
144
+ Don't forget to read the [Getting Started][] guide located on the RubyForge
145
+ project site.
146
+
147
+ If you like it, hate it, or have some ideas for new features, let me know!
148
+
149
+ matt at elucidata dot net
150
+
151
+
152
+ [Getting Started]: http://comatose.rubyforge.org/getting-started-guide
153
+ [Liquid]: http://home.leetsoft.com/liquid
154
+ [Tobias Luetke]: http://blog.leetsoft.com
155
+ [RedCloth]: http://whytheluckystiff.net/ruby/redcloth
156
+ [_why]: http://whytheluckystiff.net
157
+ [Acts as Versioned]: http://ar-versioned.rubyforge.org
158
+ [Rick Olsen]: http://weblog.techno-weenie.net
159
+ [Behaviors]: http://behaviors.rubyforge.org
data/Rakefile ADDED
@@ -0,0 +1,176 @@
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 customizable 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
123
+
124
+
125
+ desc "Creates an empty rails application for use as a test harness"
126
+ task :test_harness do
127
+ target = ENV['TARGET']
128
+ sym_link = (ENV['LINK'].to_s == 'true')
129
+ if target.nil?
130
+ puts "You must specify a TARGET for the test harness"
131
+ exit(1)
132
+ else
133
+ target = File.expand_path target
134
+ if target == File.expand_path(File.dirname(__FILE__))
135
+ puts "You must specify a folder other than this one."
136
+ exit(1)
137
+ end
138
+ end
139
+ comatose_plugin_path = target / 'vendor' / 'plugins' / 'comatose'
140
+
141
+ puts "Creating test harness at #{ target }"
142
+ run_sh "rails -d sqlite3 #{target}"
143
+ if sym_link
144
+ run_sh "ln -s #{ File.dirname(__FILE__) } #{ comatose_plugin_path }"
145
+ else
146
+ run_sh "cp -r #{ File.dirname(__FILE__) }/ #{ comatose_plugin_path }"
147
+ end
148
+ run_sh "ruby #{ comatose_plugin_path / 'install.rb' }"
149
+ run_sh "ruby #{ target / 'script' / 'generate' } comatose_migration"
150
+ run_sh "ruby #{ comatose_plugin_path / 'bin' / 'comatose' } --plugin #{ target }"
151
+ run_sh "cd #{ target } && rake db:migrate"
152
+
153
+ run_sh "cp #{ target / 'db' / 'development.sqlite3' } #{target / 'db' / 'test.sqlite3'}"
154
+ run_sh "rm #{ target / 'public' / 'index.html' }"
155
+ run_sh "cp #{ comatose_plugin_path / 'views' / 'layouts' / 'comatose_content.html.erb' } #{ target / 'app' / 'views' / 'layouts' / 'comatose_content.html.erb' }"
156
+
157
+ # Remove me soon!
158
+ run_sh "cd #{ target } && ruby #{ target / 'script' / 'plugin' } install acts_as_tree"
159
+ run_sh "cd #{ target } && ruby #{ target / 'script' / 'plugin' } install acts_as_list"
160
+
161
+ puts "Done."
162
+ end
163
+
164
+ class String
165
+ def /(str)
166
+ File.join(self, str)
167
+ end
168
+ end
169
+
170
+ def run_sh(command)
171
+ puts "-------------------------------------------------------------------------------"
172
+ puts "Running `#{command}`:"
173
+ sh command
174
+ puts
175
+ puts
176
+ end