module Rails
  module Generators
    class BlockGenerator < NamedBase
      source_root File.expand_path('../templates', __FILE__)
      check_class_collision suffix: 'Cell'

      def create_block_file
        template 'block.rb.erb', File.join('app', 'blocks', "#{file_name}_cell.rb")
      end

      def create_view_file
        create_file File.join('app', 'blocks', file_name, 'block.html.erb')
      end
    end
  end
end
