From 0f84b6363986a338fbee47e1ff25639add4b6fc5 Mon Sep 17 00:00:00 2001 From: Philip Arndt Date: Fri, 4 Mar 2011 11:45:41 +1300 Subject: We no longer support Rails 2 on this engine so I'm removing the old generator. --- .../refinerycms_blog/refinerycms_blog_generator.rb | 69 ---------------------- .../templates/db/migrate/migration.rb | 26 -------- .../refinerycms_blog/templates/db/seeds/seed.rb | 16 ----- 3 files changed, 111 deletions(-) delete mode 100644 generators/refinerycms_blog/refinerycms_blog_generator.rb delete mode 100644 generators/refinerycms_blog/templates/db/migrate/migration.rb delete mode 100644 generators/refinerycms_blog/templates/db/seeds/seed.rb (limited to 'generators/refinerycms_blog') diff --git a/generators/refinerycms_blog/refinerycms_blog_generator.rb b/generators/refinerycms_blog/refinerycms_blog_generator.rb deleted file mode 100644 index f967df3..0000000 --- a/generators/refinerycms_blog/refinerycms_blog_generator.rb +++ /dev/null @@ -1,69 +0,0 @@ -class RefinerycmsBlogGenerator < Rails::Generator::NamedBase - - def initialize(*runtime_args) - # set argument for the user. - runtime_args[0] = %w(refinerycms_blog) - super(*runtime_args) - end - - def banner - 'Usage: script/generate refinerycms_blog' - end - - def manifest - record do |m| - matches = Dir[ - File.expand_path('../../../public/images/**/*', __FILE__), - File.expand_path('../../../public/stylesheets/**/*', __FILE__), - File.expand_path('../../../public/javascripts/**/*', __FILE__), - ] - matches.reject{|d| !File.directory?(d)}.each do |dir| - m.directory((%w(public) | dir.split('public/').last.split('/')).join('/')) - end - matches.reject{|f| File.directory?(f)}.each do |image| - path = (%w(public) | image.split('public/').last.split('/'))[0...-1].join('/') - m.template "../../../#{path}/#{image.split('/').last}", "#{path}/#{image.split('/').last}" - end - - m.directory('db/seeds') - m.template('db/seeds/seed.rb', 'db/seeds/refinerycms_blog.rb') - - m.migration_template('db/migrate/migration.rb', 'db/migrate', - :migration_file_name => 'create_blog_structure', - :assigns => { - :migration_name => 'CreateBlogStructure', - :tables => [{ - :table_name => 'blog_posts', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('title', 'string'), - Rails::Generator::GeneratedAttribute.new('body', 'text'), - Rails::Generator::GeneratedAttribute.new('draft', 'boolean'), - Rails::Generator::GeneratedAttribute.new('published_at', 'datetime') - ], :id => true - },{ - :table_name => 'blog_comments', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer'), - Rails::Generator::GeneratedAttribute.new('spam', 'boolean'), - Rails::Generator::GeneratedAttribute.new('name', 'string'), - Rails::Generator::GeneratedAttribute.new('email', 'string'), - Rails::Generator::GeneratedAttribute.new('body', 'text'), - Rails::Generator::GeneratedAttribute.new('state', 'string'), - ], :id => true - },{ - :table_name => 'blog_categories', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('title', 'string') - ], :id => true - },{ - :table_name => 'blog_categories_blog_posts', - :attributes => [ - Rails::Generator::GeneratedAttribute.new('blog_category_id', 'integer'), - Rails::Generator::GeneratedAttribute.new('blog_post_id', 'integer') - ], :id => false - }] - }) - end - end - -end if defined?(Rails::Generator::NamedBase) diff --git a/generators/refinerycms_blog/templates/db/migrate/migration.rb b/generators/refinerycms_blog/templates/db/migrate/migration.rb deleted file mode 100644 index 5ba29c6..0000000 --- a/generators/refinerycms_blog/templates/db/migrate/migration.rb +++ /dev/null @@ -1,26 +0,0 @@ -class <%= migration_name %> < ActiveRecord::Migration - - def self.up<% tables.each do |table| %> - create_table :<%= table[:table_name] %>, :id => <%= table[:id].to_s %> do |t| -<% table[:attributes].each do |attribute| -%> - t.<%= attribute.type %> :<%= attribute.name %> -<% end -%> - <%= 't.timestamps' if table[:id] %> - end - - <%= "add_index :#{table[:table_name]}, :id" if table[:id] %> -<% end -%> - load(Rails.root.join('db', 'seeds', 'refinerycms_blog.rb').to_s) - end - - def self.down - UserPlugin.destroy_all({:name => "refinerycms_blog"}) - - Page.delete_all({:link_url => "/blog"}) - -<% tables.each do |table| -%> - drop_table :<%= table[:table_name] %> -<% end -%> - end - -end diff --git a/generators/refinerycms_blog/templates/db/seeds/seed.rb b/generators/refinerycms_blog/templates/db/seeds/seed.rb deleted file mode 100644 index 228fc7b..0000000 --- a/generators/refinerycms_blog/templates/db/seeds/seed.rb +++ /dev/null @@ -1,16 +0,0 @@ -User.find(:all).each do |user| - user.plugins.create(:name => "<%= singular_name %>", - :position => (user.plugins.maximum(:position) || -1) +1) -end - -page = Page.create( - :title => "Blog", - :link_url => "/blog", - :deletable => false, - :position => ((Page.maximum(:position, :conditions => {:parent_id => nil}) || -1)+1), - :menu_match => "^/blogs?(\/|\/.+?|)$" -) - -RefinerySetting.find_or_set(:default_page_parts, %w(Body Side\ Body)).each do |default_page_part| - page.parts.create(:title => default_page_part, :body => nil) -end -- cgit v1.2.3