staugaard-comatose 2.0.2
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.rb +33 -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_admin_controller.rb +349 -0
- data/lib/comatose_admin_helper.rb +37 -0
- data/lib/comatose_controller.rb +142 -0
- data/lib/comatose_helper.rb +3 -0
- data/lib/comatose_page.rb +141 -0
- data/lib/liquid.rb +52 -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/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.rb +138 -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/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 +147 -0
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
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.2"
|
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
|