git migration generator finally working
Oleg
committed Oct 13, 2010
commit 88475b77b22a7bc12cc2ec8405a1405bff93e9a6
Showing 2
changed files with
16 additions
and 0 deletions
comfortable_mexican_sofa.gemspec
+2
-0
| @@ | @@ -55,6 +55,7 @@ Gem::Specification.new do |s| |
| "app/views/cms_admin/uploads/destroy.js.erb", | |
| "app/views/cms_admin/uploads/index.html.erb", | |
| "app/views/layouts/cms_admin.html.erb", | |
| + | "comfortable_mexican_sofa.gemspec", |
| "config.ru", | |
| "config/application.rb", | |
| "config/boot.rb", | |
| @@ | @@ -89,6 +90,7 @@ Gem::Specification.new do |s| |
| "lib/comfortable_mexican_sofa/cms_tag/page_text.rb", | |
| "lib/comfortable_mexican_sofa/cms_tag/partial.rb", | |
| "lib/comfortable_mexican_sofa/cms_tag/snippet.rb", | |
| + | "lib/generators/cms_generator.rb", |
| "public/404.html", | |
| "public/422.html", | |
| "public/500.html", | |
generators/cms_generator.rb b/lib/generators/cms_generator.rb
+14
-0
| @@ | @@ -1,4 +1,18 @@ |
| class CmsGenerator < Rails::Generators::Base | |
| + | include Rails::Generators::Migration |
| + | include Thor::Actions |
| + | |
| + | source_root File.expand_path('../../..', __FILE__) |
| + | |
| + | def generate_migration |
| + | migration_template 'db/migrate/01_create_cms.rb', 'db/migrate/create_cms.rb' |
| + | end |
| + | |
| + | def self.next_migration_number(dirname) |
| + | orm = Rails.configuration.generators.options[:rails][:orm] |
| + | require "rails/generators/#{orm}" |
| + | "#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname) |
| + | end |
| end | |
| \ No newline at end of file | |