Sha256: 44daab00d1ddc375899543ccccdfdce363304cfcbb6794ec1a15e9f83bfe7459

Contents?: true

Size: 1010 Bytes

Versions: 6

Compression:

Stored size: 1010 Bytes

Contents

require 'rails/generators/migration'
require 'rails/generators/active_record'

###
# BookmarkSystemGenerator class
#
# This class generates the bookmark model migration in bookmark system
###
class BookmarkSystemGenerator < Rails::Generators::Base
  ###
  # Includes Rails::Generators::Migration
  ###
  include Rails::Generators::Migration

  ###
  # Generator description definition
  ###
  desc "Generates a migration for the Bookmark model"

  ###
  # Retrieves the source root
  #
  # @return [String]
  ###
  def self.source_root
    @source_root ||= File.dirname(__FILE__) + '/templates'
  end

  ###
  # Retrieves the next migration number
  #
  # @path [String] path - the path to calculate the next migration number
  # @return [String]
  ###
  def self.next_migration_number(path)
    ActiveRecord::Generators::Base.next_migration_number(path)
  end

  ###
  # Generates the migration
  ###
  def generate_migration
    migration_template 'migration.rb', 'db/migrate/create_bookmarks.rb'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bookmark_system-0.1.1 lib/generators/bookmark_system/bookmark_system_generator.rb
bookmark_system-0.1.0 lib/generators/bookmark_system/bookmark_system_generator.rb
bookmark_system-0.0.9 lib/generators/bookmark_system/bookmark_system_generator.rb
bookmark_system-0.0.8 lib/generators/bookmark_system/bookmark_system_generator.rb
bookmark_system-0.0.7 lib/generators/bookmark_system/bookmark_system_generator.rb
bookmark_system-0.0.6 lib/generators/bookmark_system/bookmark_system_generator.rb