diff --git a/comfy_carousel.gemspec b/comfy_carousel.gemspec index 5bf4b95..f8d87c5 100644 --- a/comfy_carousel.gemspec +++ b/comfy_carousel.gemspec @@ -60,8 +60,6 @@ Gem::Specification.new do |s| "lib/comfy_carousel/configuration.rb", "lib/comfy_carousel/engine.rb", "lib/comfy_carousel/form_builder.rb", - "lib/generators/comfy/README", - "lib/generators/comfy/carousel_generator.rb", "lib/tasks/.gitkeep", "log/.gitkeep", "script/rails", diff --git a/lib/comfy/generators/carousel_generator.rb b/lib/comfy/generators/carousel_generator.rb deleted file mode 100644 index e29a49a..0000000 --- a/lib/comfy/generators/carousel_generator.rb +++ /dev/null @@ -1,31 +0,0 @@ -class CarouselGenerator < Rails::Generators::Base - require 'rails/generators/active_record' - include Rails::Generators::Migration - include Thor::Actions - - source_root File.expand_path('../../../..', __FILE__) - - def generate_migration - destination = File.expand_path('db/migrate/01_create_comfy_carousel.rb', self.destination_root) - migration_dir = File.dirname(destination) - destination = self.class.migration_exists?(migration_dir, 'create_comfy_blog') - - if destination - puts "\e[0m\e[31mFound existing create_comfy_blog.rb migration. Remove it if you want to regenerate.\e[0m" - else - migration_template 'db/migrate/01_create_comfy_carousel.rb', 'db/migrate/create_comfy_carousel.rb' - end - end - - def generate_initialization - copy_file 'config/initializers/comfy_carousel.rb', 'config/initializers/comfy_carousel.rb' - end - - def show_readme - readme 'lib/generators/README' - end - - def self.next_migration_number(dirname) - ActiveRecord::Generators::Base.next_migration_number(dirname) - end -end \ No newline at end of file diff --git a/lib/comfy/generators/README b/lib/generators/README similarity index 100% rename from lib/comfy/generators/README rename to lib/generators/README diff --git a/lib/generators/carousel_generator.rb b/lib/generators/carousel_generator.rb new file mode 100644 index 0000000..b399062 --- /dev/null +++ b/lib/generators/carousel_generator.rb @@ -0,0 +1,35 @@ +module Comfy + module Generators + class CarouselGenerator < Rails::Generators::Base + require 'rails/generators/active_record' + include Rails::Generators::Migration + include Thor::Actions + + source_root File.expand_path('../../../..', __FILE__) + + def generate_migration + destination = File.expand_path('db/migrate/01_create_comfy_carousel.rb', self.destination_root) + migration_dir = File.dirname(destination) + destination = self.class.migration_exists?(migration_dir, 'create_comfy_blog') + + if destination + puts "\e[0m\e[31mFound existing create_comfy_blog.rb migration. Remove it if you want to regenerate.\e[0m" + else + migration_template 'db/migrate/01_create_comfy_carousel.rb', 'db/migrate/create_comfy_carousel.rb' + end + end + + def generate_initialization + copy_file 'config/initializers/comfy_carousel.rb', 'config/initializers/comfy_carousel.rb' + end + + def show_readme + readme 'lib/generators/README' + end + + def self.next_migration_number(dirname) + ActiveRecord::Generators::Base.next_migration_number(dirname) + end + end + end +end \ No newline at end of file