Sha256: bc0f1a007db2547e523313d08de6b86c76064ea4175a2391e5795e7e48f00a76

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

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

module CargoWiki
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration
      extend ActiveRecord::Generators::Migration

      source_root File.expand_path('../templates', __FILE__)

      desc 'Copy (but does not run) the migrations of the engine.'
      def copy_migrations_files
        empty_directory "db/migrate"

        migrations_folder = File.expand_path("../../../../db/migrate", __FILE__)
        Dir["#{migrations_folder}/*.rb"].each do |file|
          filename = File.basename(file)
          copy_file file, "db/migrate/#{filename}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cargo_wiki-1.0.1 lib/generators/cargo_wiki/install_generator.rb
cargo_wiki-1.0.0 lib/generators/cargo_wiki/install_generator.rb