darthapo-comatose 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
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
+
1
7
  - version: 2.0.4 (beta)
2
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.
3
9
  - Bugfix in tasks/comatose.rake
data/MANIFEST CHANGED
@@ -55,7 +55,7 @@ LICENSE
55
55
  MANIFEST
56
56
  rails/init.rb
57
57
  Rakefile
58
- README.rdoc
58
+ README.markdown
59
59
  resources/layouts/comatose_admin_template.html.erb
60
60
  resources/public/images/collapsed.gif
61
61
  resources/public/images/expanded.gif
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 CHANGED
@@ -125,6 +125,7 @@ end
125
125
  desc "Creates an empty rails application for use as a test harness"
126
126
  task :test_harness do
127
127
  target = ENV['TARGET']
128
+ sym_link = (ENV['LINK'].to_s == 'true')
128
129
  if target.nil?
129
130
  puts "You must specify a TARGET for the test harness"
130
131
  exit(1)
@@ -139,7 +140,11 @@ task :test_harness do
139
140
 
140
141
  puts "Creating test harness at #{ target }"
141
142
  run_sh "rails -d sqlite3 #{target}"
142
- run_sh "cp -r #{ File.dirname(__FILE__) }/ #{ comatose_plugin_path }"
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
143
148
  run_sh "ruby #{ comatose_plugin_path / 'install.rb' }"
144
149
  run_sh "ruby #{ target / 'script' / 'generate' } comatose_migration"
145
150
  run_sh "ruby #{ comatose_plugin_path / 'bin' / 'comatose' } --plugin #{ target }"
data/about.yml CHANGED
@@ -3,5 +3,5 @@ summary: A micro CMS for embedding in Rails applications.
3
3
  homepage: http://comatose.rubyforge.org
4
4
  plugin: git://github.com/darthapo/comatose.git
5
5
  license: MIT
6
- version: 2.0.4
6
+ version: 2.0.5
7
7
  rails_version: 2+
data/bin/comatose CHANGED
@@ -97,6 +97,9 @@ Comatose.configure do |config|
97
97
  # current_user.login
98
98
  #end
99
99
 
100
+ # Allows users to import and export pages (in YAML format)
101
+ #config.allow_import_export = true
102
+
100
103
  # See the getting started guide at http://comatose.rubyforge.org for more...
101
104
  end
102
105
  EOT
data/comatose.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  # Generated on Tue May 20 20:13:12 -0500 2008
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "comatose"
4
- s.version = "2.0.4"
5
- s.date = "2008-10-10" # 2008-05-20
4
+ s.version = "2.0.5"
5
+ s.date = "2008-10-31" # 2008-05-20
6
6
  s.summary = "Micro CMS designed for being embedded into existing Rails applications"
7
7
  s.email = "matt@elucidata.net"
8
8
  s.rubyforge_project = 'comatose'
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  "INSTALL",
18
18
  "LICENSE",
19
19
  "MANIFEST",
20
- "README.rdoc",
20
+ "README.markdown",
21
21
  "Rakefile",
22
22
  "SPECS",
23
23
  "about.yml",
@@ -107,7 +107,7 @@ Gem::Specification.new do |s|
107
107
  "test/unit/processing_context_test.rb",
108
108
  "test/unit/text_filters_test.rb"]
109
109
 
110
- s.rdoc_options = ["--main", "README.rdoc"]
111
- s.extra_rdoc_files = %w(README.rdoc CHANGELOG SPECS LICENSE)
110
+ s.rdoc_options = ["--main", "README.markdown"]
111
+ s.extra_rdoc_files = %w(README.markdown CHANGELOG SPECS LICENSE)
112
112
  #s.add_dependency("mime-types", ["> 0.0.0"])
113
113
  end
data/install.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
 
3
3
  # Copy the images (*.gif) into RAILS_ROOT/public/images/comatose
4
- RAILS_ROOT = File.join(File.dirname(__FILE__), '../../../')
4
+ RAILS_ROOT = File.expand_path( File.join(File.dirname(__FILE__), '../../../') )
5
5
 
6
6
  unless FileTest.exist? File.join(RAILS_ROOT, 'public', 'images', 'comatose')
7
7
  FileUtils.mkdir( File.join(RAILS_ROOT, 'public', 'images', 'comatose') )
@@ -36,6 +36,7 @@ module Comatose
36
36
  attr_accessor_with_default :hidden_meta_fields, []
37
37
  attr_accessor_with_default :helpers, []
38
38
  attr_accessor_with_default :includes, []
39
+ attr_accessor_with_default :allow_import_export, true
39
40
 
40
41
  # 'Blockable' setters
41
42
  blockable_attr_accessor :authorization
@@ -1,4 +1,4 @@
1
1
  module Comatose
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  VERSION_STRING = "#{VERSION} (beta)"
4
4
  end
@@ -141,13 +141,22 @@ class ComatoseAdminController < ActionController::Base
141
141
  end
142
142
 
143
143
  def export
144
- send_data(page_to_hash(ComatosePage.root).to_yaml, :disposition => 'inline', :type => 'text/yaml', :filename => "comatose-pages.yml")
144
+ if Comatose.config.allow_import_export
145
+ send_data(page_to_hash(ComatosePage.root).to_yaml, :disposition => 'attachment', :type => 'text/yaml', :filename => "comatose-pages.yml")
146
+ else
147
+ flash[:notice] = "Export is not allowed"
148
+ redirect_to :controller=>self.controller_name, :action=>'index'
149
+ end
145
150
  end
146
151
 
147
152
  def import
148
- data = YAML::load(params[:import_file])
149
- hash_to_page_tree(data, ComatosePage.root)
150
- flash[:notice] = "Pages Imported Successfully"
153
+ if Comatose.config.allow_import_export
154
+ data = YAML::load(params[:import_file])
155
+ hash_to_page_tree(data, ComatosePage.root)
156
+ flash[:notice] = "Pages Imported Successfully"
157
+ else
158
+ flash[:notice] = "Import isn't allowed"
159
+ end
151
160
  redirect_to :controller=>self.controller_name, :action=>'index'
152
161
  end
153
162
 
@@ -60,8 +60,9 @@ BODY {
60
60
  #content .action A {
61
61
  font-weight: bold;
62
62
  text-decoration: none;
63
- color: darkgreen;
64
- border-bottom: 1px solid black;
63
+ color: navy;
64
+ border-bottom: 1px solid blue;
65
+ margin-left: 15px;
65
66
  }
66
67
  #content .action A:hover {
67
68
  color: red;
@@ -70,6 +71,28 @@ BODY {
70
71
  #content .page-header {
71
72
  color: gray;
72
73
  }
74
+ #import_form {
75
+ position: fixed;
76
+ right: 75px;
77
+ border: 3px solid gray !important;
78
+ -webkit-border-radius: 10px;
79
+ -moz-border-radius: 10px;
80
+ background: #FFF;
81
+ padding: 15px;
82
+ }
83
+ #import_form FORM {
84
+ display: inline;
85
+ margin: 0px;
86
+ padding: 0px;
87
+ }
88
+ #import_form A {
89
+ color: maroon !important;
90
+ border-bottom: 1px solid gray !important;
91
+ }
92
+ #import_form A:hover {
93
+ color: red !important;
94
+ border-bottom: 1px solid red !important;
95
+ }
73
96
 
74
97
  /* Page Listing */
75
98
  #content .tree-controller {
@@ -1,12 +1,16 @@
1
1
  <div class="action">
2
- <% form_tag(url_for(:action => 'import'), :multipart => true, :style => 'display: none;', :id => 'import_form') do %>
2
+ <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %>
3
+ <% if Comatose.config.allow_import_export %>
4
+ <%= link_to 'Import', '#', :id => 'import_link2', :onclick => "$('import_form').setStyle({display: 'inline'}); return false;" %>
5
+ <%= link_to 'Export', :controller=>controller.controller_name, :action=>'export' %>
6
+ <div id="import_form" style="display: none;">
7
+ <% form_tag(url_for(:action => 'import'), :multipart => true) do %>
3
8
  <%= file_field_tag 'import_file' %>
4
- <%= submit_tag 'Import' %>
9
+ <%= submit_tag 'Upload and Import' %>
10
+ <a href="#" onclick="$('import_form').hide(); return false;">Cancel</a>
5
11
  <% end %>
6
-
7
- <%= link_to 'Import', '#', :id => 'import_link2', :onclick => "$('import_form').setStyle({display: 'inline'}); this.hide();" %>
8
- <%= link_to 'Export', :controller=>controller.controller_name, :action=>'export' %>
9
- <%= link_to 'Clear Page Cache', :controller=>controller.controller_name, :action=>'expire_page_cache' %>
12
+ </div>
13
+ <% end %>
10
14
  </div>
11
15
 
12
16
  <h1>
@@ -67,8 +67,9 @@ BODY {
67
67
  #content .action A {
68
68
  font-weight: bold;
69
69
  text-decoration: none;
70
- color: darkgreen;
71
- border-bottom: 1px solid black;
70
+ color: navy;
71
+ border-bottom: 1px solid blue;
72
+ margin-left: 15px;
72
73
  }
73
74
  #content .action A:hover {
74
75
  color: red;
@@ -77,6 +78,28 @@ BODY {
77
78
  #content .page-header {
78
79
  color: gray;
79
80
  }
81
+ #import_form {
82
+ position: fixed;
83
+ right: 75px;
84
+ border: 3px solid gray !important;
85
+ -webkit-border-radius: 10px;
86
+ -moz-border-radius: 10px;
87
+ background: #FFF;
88
+ padding: 15px;
89
+ }
90
+ #import_form FORM {
91
+ display: inline;
92
+ margin: 0px;
93
+ padding: 0px;
94
+ }
95
+ #import_form A {
96
+ color: maroon !important;
97
+ border-bottom: 1px solid gray !important;
98
+ }
99
+ #import_form A:hover {
100
+ color: red !important;
101
+ border-bottom: 1px solid red !important;
102
+ }
80
103
 
81
104
  /* Page Listing */
82
105
  #content .tree-controller {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darthapo-comatose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - M@ McCray
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-10 00:00:00 -07:00
12
+ date: 2008-10-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -20,7 +20,7 @@ executables:
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
- - README.rdoc
23
+ - README.markdown
24
24
  - CHANGELOG
25
25
  - SPECS
26
26
  - LICENSE
@@ -29,7 +29,7 @@ files:
29
29
  - INSTALL
30
30
  - LICENSE
31
31
  - MANIFEST
32
- - README.rdoc
32
+ - README.markdown
33
33
  - Rakefile
34
34
  - SPECS
35
35
  - about.yml
@@ -111,7 +111,7 @@ homepage: http://comatose.rubyforge.org
111
111
  post_install_message:
112
112
  rdoc_options:
113
113
  - --main
114
- - README.rdoc
114
+ - README.markdown
115
115
  require_paths:
116
116
  - lib
117
117
  required_ruby_version: !ruby/object:Gem::Requirement