comatose 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +176 -0
- data/INSTALL +19 -0
- data/LICENSE +20 -0
- data/MANIFEST +91 -0
- data/README.rdoc +148 -0
- data/Rakefile +122 -0
- data/SPECS +61 -0
- data/about.yml +7 -0
- data/bin/comatose +109 -0
- data/comatose.gemspec +113 -0
- data/generators/comatose_migration/USAGE +15 -0
- data/generators/comatose_migration/comatose_migration_generator.rb +59 -0
- data/generators/comatose_migration/templates/migration.rb +35 -0
- data/generators/comatose_migration/templates/v4_upgrade.rb +15 -0
- data/generators/comatose_migration/templates/v6_upgrade.rb +23 -0
- data/generators/comatose_migration/templates/v7_upgrade.rb +22 -0
- data/init.rb +2 -0
- data/install.rb +16 -0
- data/lib/acts_as_versioned.rb +543 -0
- data/lib/comatose/comatose_drop.rb +79 -0
- data/lib/comatose/configuration.rb +68 -0
- data/lib/comatose/page_wrapper.rb +119 -0
- data/lib/comatose/processing_context.rb +69 -0
- data/lib/comatose/tasks/admin.rb +60 -0
- data/lib/comatose/tasks/data.rb +82 -0
- data/lib/comatose/tasks/setup.rb +52 -0
- data/lib/comatose/version.rb +4 -0
- data/lib/comatose.rb +33 -0
- data/lib/comatose_admin_controller.rb +349 -0
- data/lib/comatose_admin_helper.rb +37 -0
- data/lib/comatose_controller.rb +141 -0
- data/lib/comatose_helper.rb +3 -0
- data/lib/comatose_page.rb +141 -0
- data/lib/liquid/block.rb +96 -0
- data/lib/liquid/context.rb +190 -0
- data/lib/liquid/document.rb +17 -0
- data/lib/liquid/drop.rb +48 -0
- data/lib/liquid/errors.rb +7 -0
- data/lib/liquid/extensions.rb +53 -0
- data/lib/liquid/file_system.rb +62 -0
- data/lib/liquid/htmltags.rb +64 -0
- data/lib/liquid/standardfilters.rb +111 -0
- data/lib/liquid/standardtags.rb +399 -0
- data/lib/liquid/strainer.rb +42 -0
- data/lib/liquid/tag.rb +25 -0
- data/lib/liquid/template.rb +88 -0
- data/lib/liquid/variable.rb +39 -0
- data/lib/liquid.rb +52 -0
- data/lib/redcloth.rb +1129 -0
- data/lib/support/class_options.rb +36 -0
- data/lib/support/inline_rendering.rb +48 -0
- data/lib/support/route_mapper.rb +50 -0
- data/lib/text_filters/markdown.rb +14 -0
- data/lib/text_filters/markdown_smartypants.rb +15 -0
- data/lib/text_filters/none.rb +8 -0
- data/lib/text_filters/rdoc.rb +13 -0
- data/lib/text_filters/simple.rb +8 -0
- data/lib/text_filters/textile.rb +15 -0
- data/lib/text_filters.rb +138 -0
- data/rails/init.rb +3 -0
- data/resources/layouts/comatose_admin_template.html.erb +28 -0
- data/resources/public/images/collapsed.gif +0 -0
- data/resources/public/images/expanded.gif +0 -0
- data/resources/public/images/no-children.gif +0 -0
- data/resources/public/images/page.gif +0 -0
- data/resources/public/images/spinner.gif +0 -0
- data/resources/public/images/title-hover-bg.gif +0 -0
- data/resources/public/javascripts/comatose_admin.js +401 -0
- data/resources/public/stylesheets/comatose_admin.css +381 -0
- data/tasks/comatose.rake +9 -0
- data/test/behaviors.rb +106 -0
- data/test/fixtures/comatose_pages.yml +96 -0
- data/test/functional/comatose_admin_controller_test.rb +112 -0
- data/test/functional/comatose_controller_test.rb +44 -0
- data/test/javascripts/test.html +26 -0
- data/test/javascripts/test_runner.js +307 -0
- data/test/test_helper.rb +43 -0
- data/test/unit/class_options_test.rb +52 -0
- data/test/unit/comatose_page_test.rb +128 -0
- data/test/unit/processing_context_test.rb +108 -0
- data/test/unit/text_filters_test.rb +52 -0
- data/views/comatose_admin/_form.html.erb +96 -0
- data/views/comatose_admin/_page_list_item.html.erb +60 -0
- data/views/comatose_admin/delete.html.erb +18 -0
- data/views/comatose_admin/edit.html.erb +5 -0
- data/views/comatose_admin/index.html.erb +18 -0
- data/views/comatose_admin/new.html.erb +5 -0
- data/views/comatose_admin/reorder.html.erb +30 -0
- data/views/comatose_admin/versions.html.erb +40 -0
- data/views/layouts/comatose_admin.html.erb +814 -0
- data/views/layouts/comatose_admin_customize.html.erb +28 -0
- data/views/layouts/comatose_content.html.erb +17 -0
- metadata +156 -0
data/bin/comatose
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'optparse'
|
|
4
|
+
|
|
5
|
+
args = ARGV
|
|
6
|
+
options = {
|
|
7
|
+
:action => :gem
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
OptionParser.new do |opts|
|
|
12
|
+
opts.banner = "Usage: comatose [options] RAILS_ROOT"
|
|
13
|
+
|
|
14
|
+
opts.on("-g", "--gem", "Initialize to run from gem (DEFAULT)") do |s|
|
|
15
|
+
options[:action] = :gem
|
|
16
|
+
puts "GEM"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
opts.on("-p", "--plugin", "Install as plugin") do |s|
|
|
20
|
+
options[:action] = :plugin
|
|
21
|
+
puts "PLUGIN"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
opts.on("-u", "--update", "Update current installation (CURRENTLY UNIMPLEMENTED)") do |s|
|
|
25
|
+
options[:action] = :update
|
|
26
|
+
puts "UPDATE"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
opts.separator ""
|
|
30
|
+
opts.separator "Common options:"
|
|
31
|
+
|
|
32
|
+
# No argument, shows at tail. This will print an options summary.
|
|
33
|
+
# Try it and see!
|
|
34
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
|
35
|
+
puts opts
|
|
36
|
+
exit
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Another typical switch to print the version.
|
|
40
|
+
opts.on_tail("--version", "Show version") do
|
|
41
|
+
require 'comatose/version'
|
|
42
|
+
puts Comatose::VERSION_STRING
|
|
43
|
+
exit
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end.parse!(args)
|
|
47
|
+
rescue OptionParser::ParseError => e
|
|
48
|
+
puts e
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if args.length == 0
|
|
52
|
+
puts "No action taken."
|
|
53
|
+
exit
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
RAILS_ROOT = File.expand_path( args.last )
|
|
57
|
+
|
|
58
|
+
class String
|
|
59
|
+
def /(string)
|
|
60
|
+
File.join(self, string)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
unless File.directory?(RAILS_ROOT) and File.exists?( RAILS_ROOT / 'config'/ 'boot.rb' )
|
|
65
|
+
puts "Not a valid rails application path."
|
|
66
|
+
exit
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
comatose_initializer_path = RAILS_ROOT / 'config' / 'initializers' / 'comatose.rb'
|
|
70
|
+
|
|
71
|
+
unless File.exists?( comatose_initializer_path )
|
|
72
|
+
File.open(comatose_initializer_path, 'w') do |f|
|
|
73
|
+
f.write <<-EOT
|
|
74
|
+
require 'comatose'
|
|
75
|
+
|
|
76
|
+
# 1.) You should add the following snippet to your environment.rb too, probably...
|
|
77
|
+
#
|
|
78
|
+
# gem 'comatose'
|
|
79
|
+
#
|
|
80
|
+
# 2.) Following is an example configuration block for Comatose:
|
|
81
|
+
#
|
|
82
|
+
Comatose.configure do |config|
|
|
83
|
+
# Includes AuthenticationSystem in the ComatoseController
|
|
84
|
+
#config.includes << :authenticated_system
|
|
85
|
+
|
|
86
|
+
# admin
|
|
87
|
+
#config.admin_title = "My Content"
|
|
88
|
+
#config.admin_sub_title = "Content for the rest of us..."
|
|
89
|
+
|
|
90
|
+
# Includes AuthenticationSystem in the ComatoseAdminController
|
|
91
|
+
#config.admin_includes << :authenticated_system
|
|
92
|
+
|
|
93
|
+
# Calls :login_required as a before_filter
|
|
94
|
+
#config.admin_authorization = :login_required
|
|
95
|
+
# Returns the author name (login, in this case) for the current user
|
|
96
|
+
#config.admin_get_author do
|
|
97
|
+
# current_user.login
|
|
98
|
+
#end
|
|
99
|
+
|
|
100
|
+
# See the getting started guide at http://comatose.rubyforge.org for more...
|
|
101
|
+
end
|
|
102
|
+
EOT
|
|
103
|
+
end
|
|
104
|
+
else
|
|
105
|
+
puts "Comatose initializer already exists (at #{comatose_initializer_path})"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
puts "Done."
|
|
109
|
+
|
data/comatose.gemspec
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Generated on Tue May 20 20:13:12 -0500 2008
|
|
2
|
+
Gem::Specification.new do |s|
|
|
3
|
+
s.name = "comatose"
|
|
4
|
+
s.version = "2.0.1"
|
|
5
|
+
s.date = "2008-09-15" # 2008-05-20
|
|
6
|
+
s.summary = "Micro CMS designed for being embedded into existing Rails applications"
|
|
7
|
+
s.email = "matt@elucidata.net"
|
|
8
|
+
s.rubyforge_project = 'comatose'
|
|
9
|
+
s.homepage = "http://comatose.rubyforge.org"
|
|
10
|
+
s.description = "Comatose is a micro CMS designed for being embedded into existing Rails applications."
|
|
11
|
+
s.has_rdoc = true
|
|
12
|
+
s.authors = ["M@ McCray"]
|
|
13
|
+
s.bindir = 'bin'
|
|
14
|
+
s.executables = ['comatose']
|
|
15
|
+
|
|
16
|
+
s.files = ["CHANGELOG",
|
|
17
|
+
"INSTALL",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"MANIFEST",
|
|
20
|
+
"README.rdoc",
|
|
21
|
+
"Rakefile",
|
|
22
|
+
"SPECS",
|
|
23
|
+
"about.yml",
|
|
24
|
+
"bin/comatose",
|
|
25
|
+
"comatose.gemspec",
|
|
26
|
+
"generators/comatose_migration/comatose_migration_generator.rb",
|
|
27
|
+
"generators/comatose_migration/templates/migration.rb",
|
|
28
|
+
"generators/comatose_migration/templates/v4_upgrade.rb",
|
|
29
|
+
"generators/comatose_migration/templates/v6_upgrade.rb",
|
|
30
|
+
"generators/comatose_migration/templates/v7_upgrade.rb",
|
|
31
|
+
"generators/comatose_migration/USAGE",
|
|
32
|
+
"init.rb",
|
|
33
|
+
"install.rb",
|
|
34
|
+
"lib/acts_as_versioned.rb",
|
|
35
|
+
"lib/comatose/comatose_drop.rb",
|
|
36
|
+
"lib/comatose/configuration.rb",
|
|
37
|
+
"lib/comatose/page_wrapper.rb",
|
|
38
|
+
"lib/comatose/processing_context.rb",
|
|
39
|
+
"lib/comatose/tasks/admin.rb",
|
|
40
|
+
"lib/comatose/tasks/data.rb",
|
|
41
|
+
"lib/comatose/tasks/setup.rb",
|
|
42
|
+
"lib/comatose/version.rb",
|
|
43
|
+
"lib/comatose.rb",
|
|
44
|
+
"lib/comatose_admin_controller.rb",
|
|
45
|
+
"lib/comatose_admin_helper.rb",
|
|
46
|
+
"lib/comatose_controller.rb",
|
|
47
|
+
"lib/comatose_helper.rb",
|
|
48
|
+
"lib/comatose_page.rb",
|
|
49
|
+
"lib/liquid/block.rb",
|
|
50
|
+
"lib/liquid/context.rb",
|
|
51
|
+
"lib/liquid/document.rb",
|
|
52
|
+
"lib/liquid/drop.rb",
|
|
53
|
+
"lib/liquid/errors.rb",
|
|
54
|
+
"lib/liquid/extensions.rb",
|
|
55
|
+
"lib/liquid/file_system.rb",
|
|
56
|
+
"lib/liquid/htmltags.rb",
|
|
57
|
+
"lib/liquid/standardfilters.rb",
|
|
58
|
+
"lib/liquid/standardtags.rb",
|
|
59
|
+
"lib/liquid/strainer.rb",
|
|
60
|
+
"lib/liquid/tag.rb",
|
|
61
|
+
"lib/liquid/template.rb",
|
|
62
|
+
"lib/liquid/variable.rb",
|
|
63
|
+
"lib/liquid.rb",
|
|
64
|
+
"lib/redcloth.rb",
|
|
65
|
+
"lib/support/class_options.rb",
|
|
66
|
+
"lib/support/inline_rendering.rb",
|
|
67
|
+
"lib/support/route_mapper.rb",
|
|
68
|
+
"lib/text_filters/markdown.rb",
|
|
69
|
+
"lib/text_filters/markdown_smartypants.rb",
|
|
70
|
+
"lib/text_filters/none.rb",
|
|
71
|
+
"lib/text_filters/rdoc.rb",
|
|
72
|
+
"lib/text_filters/simple.rb",
|
|
73
|
+
"lib/text_filters/textile.rb",
|
|
74
|
+
"lib/text_filters.rb",
|
|
75
|
+
"rails/init.rb",
|
|
76
|
+
"resources/layouts/comatose_admin_template.html.erb",
|
|
77
|
+
"resources/public/images/collapsed.gif",
|
|
78
|
+
"resources/public/images/expanded.gif",
|
|
79
|
+
"resources/public/images/no-children.gif",
|
|
80
|
+
"resources/public/images/page.gif",
|
|
81
|
+
"resources/public/images/spinner.gif",
|
|
82
|
+
"resources/public/images/title-hover-bg.gif",
|
|
83
|
+
"resources/public/javascripts/comatose_admin.js",
|
|
84
|
+
"resources/public/stylesheets/comatose_admin.css",
|
|
85
|
+
"tasks/comatose.rake",
|
|
86
|
+
"views/comatose_admin/_form.html.erb",
|
|
87
|
+
"views/comatose_admin/_page_list_item.html.erb",
|
|
88
|
+
"views/comatose_admin/delete.html.erb",
|
|
89
|
+
"views/comatose_admin/edit.html.erb",
|
|
90
|
+
"views/comatose_admin/index.html.erb",
|
|
91
|
+
"views/comatose_admin/new.html.erb",
|
|
92
|
+
"views/comatose_admin/reorder.html.erb",
|
|
93
|
+
"views/comatose_admin/versions.html.erb",
|
|
94
|
+
"views/layouts/comatose_admin.html.erb",
|
|
95
|
+
"views/layouts/comatose_admin_customize.html.erb",
|
|
96
|
+
"views/layouts/comatose_content.html.erb"]
|
|
97
|
+
|
|
98
|
+
s.test_files = ["test/behaviors.rb",
|
|
99
|
+
"test/fixtures/comatose_pages.yml",
|
|
100
|
+
"test/functional/comatose_admin_controller_test.rb",
|
|
101
|
+
"test/functional/comatose_controller_test.rb",
|
|
102
|
+
"test/javascripts/test.html",
|
|
103
|
+
"test/javascripts/test_runner.js",
|
|
104
|
+
"test/test_helper.rb",
|
|
105
|
+
"test/unit/class_options_test.rb",
|
|
106
|
+
"test/unit/comatose_page_test.rb",
|
|
107
|
+
"test/unit/processing_context_test.rb",
|
|
108
|
+
"test/unit/text_filters_test.rb"]
|
|
109
|
+
|
|
110
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
|
111
|
+
s.extra_rdoc_files = %w(README.rdoc CHANGELOG SPECS LICENSE)
|
|
112
|
+
#s.add_dependency("mime-types", ["> 0.0.0"])
|
|
113
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Description:
|
|
2
|
+
The comatose generator creates a migration for the comatose model.
|
|
3
|
+
|
|
4
|
+
The generator takes a migration name as its argument. The migration
|
|
5
|
+
name may be given in CamelCase or under_score. 'add_comatose_support'
|
|
6
|
+
is the default.
|
|
7
|
+
|
|
8
|
+
The generator creates a migration class in db/migrate prefixed by its
|
|
9
|
+
number in the queue.
|
|
10
|
+
|
|
11
|
+
Example:
|
|
12
|
+
./script/generate comatose add_comatose_support
|
|
13
|
+
|
|
14
|
+
With 4 existing migrations, this will create an Comatose migration in the
|
|
15
|
+
file db/migrate/005_add_comatose_support.rb
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
class ComatoseMigrationGenerator < Rails::Generator::Base
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def initialize(runtime_args, runtime_options = {})
|
|
5
|
+
@mode = :new
|
|
6
|
+
if runtime_args.include? '--upgrade' or runtime_args.include? '-u'
|
|
7
|
+
@mode = :upgrade
|
|
8
|
+
@upgrade_from = nil
|
|
9
|
+
runtime_args.delete '--upgrade'
|
|
10
|
+
runtime_args.delete '-u'
|
|
11
|
+
|
|
12
|
+
runtime_args.each do |arg|
|
|
13
|
+
if arg.starts_with? '--from'
|
|
14
|
+
@upgrade_from = arg[7..-1]
|
|
15
|
+
elsif arg.starts_with? '-f'
|
|
16
|
+
@upgrade_from = arg[3..-1]
|
|
17
|
+
end
|
|
18
|
+
runtime_args.delete arg
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if @upgrade_from.nil? or @upgrade_from.empty?
|
|
22
|
+
puts ""
|
|
23
|
+
puts "Please specify which version of Comatose you're upgrading from:"
|
|
24
|
+
puts ""
|
|
25
|
+
puts " ./script/generate comatose_migration --upgrade --from=0.3"
|
|
26
|
+
puts ""
|
|
27
|
+
puts "Upgrade canceled"
|
|
28
|
+
exit(0)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
puts "Upgrading from version #{ @upgrade_from }"
|
|
32
|
+
end
|
|
33
|
+
super
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def manifest
|
|
37
|
+
record do |m|
|
|
38
|
+
case @mode
|
|
39
|
+
when :new
|
|
40
|
+
m.migration_template 'migration.rb', 'db/migrate', :migration_file_name=>'add_comatose_support', :assigns=>{:class_name=>'AddComatoseSupport'}
|
|
41
|
+
|
|
42
|
+
when :upgrade
|
|
43
|
+
from = @upgrade_from
|
|
44
|
+
if from == '0.3'
|
|
45
|
+
m.migration_template 'v4_upgrade.rb', 'db/migrate', :migration_file_name=>'upgrade_to_comatose_v04', :assigns=>{:class_name=>'UpgradeToComatoseV04'}
|
|
46
|
+
m.migration_template 'v6_upgrade.rb', 'db/migrate', :migration_file_name=>'upgrade_to_comatose_v06', :assigns=>{:class_name=>'UpgradeToComatoseV06'}
|
|
47
|
+
m.migration_template 'v7_upgrade.rb', 'db/migrate', :migration_file_name=>'upgrade_to_comatose_v07', :assigns=>{:class_name=>'UpgradeToComatoseV07'}
|
|
48
|
+
end
|
|
49
|
+
if from == '0.4' or from == '0.5'
|
|
50
|
+
m.migration_template 'v6_upgrade.rb', 'db/migrate', :migration_file_name=>'upgrade_to_comatose_v06', :assigns=>{:class_name=>'UpgradeToComatoseV06'}
|
|
51
|
+
m.migration_template 'v7_upgrade.rb', 'db/migrate', :migration_file_name=>'upgrade_to_comatose_v07', :assigns=>{:class_name=>'UpgradeToComatoseV07'}
|
|
52
|
+
end
|
|
53
|
+
if from == '0.6'
|
|
54
|
+
m.migration_template 'v7_upgrade.rb', 'db/migrate', :migration_file_name=>'upgrade_to_comatose_v07', :assigns=>{:class_name=>'UpgradeToComatoseV07'}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
class ComatosePage < ActiveRecord::Base
|
|
2
|
+
set_table_name 'comatose_pages'
|
|
3
|
+
acts_as_versioned :table_name=>'comatose_page_versions', :if_changed => [:title, :slug, :keywords, :body]
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class <%= class_name %> < ActiveRecord::Migration
|
|
8
|
+
|
|
9
|
+
# Schema for Comatose version 0.7+
|
|
10
|
+
def self.up
|
|
11
|
+
create_table :comatose_pages do |t|
|
|
12
|
+
t.integer "parent_id"
|
|
13
|
+
t.text "full_path", :default => ''
|
|
14
|
+
t.string "title", :limit => 255
|
|
15
|
+
t.string "slug", :limit => 255
|
|
16
|
+
t.string "keywords", :limit => 255
|
|
17
|
+
t.text "body"
|
|
18
|
+
t.string "filter_type", :limit => 25, :default => "Textile"
|
|
19
|
+
t.string "author", :limit => 255
|
|
20
|
+
t.integer "position", :default => 0
|
|
21
|
+
t.integer "version"
|
|
22
|
+
t.datetime "updated_on"
|
|
23
|
+
t.datetime "created_on"
|
|
24
|
+
end
|
|
25
|
+
ComatosePage.create_versioned_table
|
|
26
|
+
puts "Creating the default 'Home Page'..."
|
|
27
|
+
ComatosePage.create( :title=>'Home Page', :body=>"h1. Welcome\n\nYour content goes here...", :author=>'System' )
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.down
|
|
31
|
+
ComatosePage.drop_versioned_table
|
|
32
|
+
drop_table :comatose_pages
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Migration
|
|
2
|
+
|
|
3
|
+
# Upgrades schema from version 0.3 to version 0.4
|
|
4
|
+
def self.up
|
|
5
|
+
add_column :comatose_pages, "filter_type", :string, :limit => 25, :default => "Textile"
|
|
6
|
+
add_column :comatose_pages, "keywords", :string, :limit => 1000
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Downgrades schema from version 0.4 to version 0.3
|
|
10
|
+
def self.down
|
|
11
|
+
remove_column :comatose_pages, "filter_type"
|
|
12
|
+
remove_column :comatose_pages, "keywords"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Comatose
|
|
2
|
+
class Page < ActiveRecord::Base
|
|
3
|
+
set_table_name 'comatose_pages'
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class <%= class_name %> < ActiveRecord::Migration
|
|
8
|
+
|
|
9
|
+
# Upgrades schema from version 0.4 to version 0.6
|
|
10
|
+
def self.up
|
|
11
|
+
add_column :comatose_pages, "created_on", :datetime
|
|
12
|
+
puts "Setting created_on times..."
|
|
13
|
+
Comatose::Page.find(:all).each do |page|
|
|
14
|
+
page.update_attribute('created_on', page.updated_on || Time.now)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Downgrades schema from version 0.6 to version 0.4
|
|
19
|
+
def self.down
|
|
20
|
+
remove_column :comatose_pages, "created_on"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module Comatose
|
|
2
|
+
class Page < ActiveRecord::Base
|
|
3
|
+
set_table_name 'comatose_pages'
|
|
4
|
+
acts_as_versioned :if_changed => [:title, :slug, :keywords, :body]
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class <%= class_name %> < ActiveRecord::Migration
|
|
9
|
+
|
|
10
|
+
# Upgrades schema from version 0.6 to version 0.7
|
|
11
|
+
def self.up
|
|
12
|
+
add_column :comatose_pages, "version", :integer
|
|
13
|
+
Comatose::Page.create_versioned_table
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Downgrades schema from version 0.7 to version 0.6
|
|
17
|
+
def self.down
|
|
18
|
+
Comatose::Page.drop_versioned_table
|
|
19
|
+
remove_column :comatose_pages, "version"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
data/init.rb
ADDED
data/install.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Copy the images (*.gif) into RAILS_ROOT/public/images/comatose
|
|
2
|
+
RAILS_ROOT = File.join(File.dirname(__FILE__), '../../../')
|
|
3
|
+
|
|
4
|
+
unless FileTest.exist? File.join(RAILS_ROOT, 'public', 'images', 'comatose')
|
|
5
|
+
FileUtils.mkdir( File.join(RAILS_ROOT, 'public', 'images', 'comatose') )
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
FileUtils.cp(
|
|
9
|
+
Dir[File.join(File.dirname(__FILE__), 'resources', 'public', 'images', '*.gif')],
|
|
10
|
+
File.join(RAILS_ROOT, 'public', 'images', 'comatose'),
|
|
11
|
+
:verbose => true
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
# Show the INSTALL text file
|
|
15
|
+
puts IO.read(File.join(File.dirname(__FILE__), 'INSTALL'))
|
|
16
|
+
|