Sha256: 3631325170acd8b38f6dc38dead03654e3990190ad66684aeb03cf843a960270
Contents?: true
Size: 1.39 KB
Versions: 2
Compression:
Stored size: 1.39 KB
Contents
module SocialFramework module Generators # Generator to add migrations in the application class InstallMigrationsGenerator < Rails::Generators::Base class_option :migrations, aliases: "-m", type: :array, desc: "Select specific migrations to generate (edges, users, schedules, events, events_schedules, participant_events, routes, locations)" source_root File.expand_path('../../../db/migrate', __FILE__) desc "Install migrations to application" # Copy the migrations to application # # Without '-m' option copy all migrations, # With '-m' option copy specifics migrations. def add_migrations migrations = Dir.glob(SocialFramework::Engine.config.paths["db/migrate"].first + "/*") if options[:migrations] options[:migrations].each do |migrate| file = "social_framework_#{migrate.pluralize}.rb" file = migrations.select { |m| m.include?(file) }.first unless file.nil? or file.empty? file_name = file.split("/").last copy_file file, "db/migrate/#{file_name}" else puts "Could not find migration: '#{migrate}'" end end else migrations.each do |migrate| file = migrate.split("/").last copy_file migrate, "db/migrate/#{file}" end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
social_framework-1.0.1 | lib/generators/social_framework/install_migrations_generator.rb |
social_framework-0.0.3 | lib/generators/social_framework/install_migrations_generator.rb |