Sha256: 0760b7632912af4d6aca8032ba04c619d4cb8b2b161193fe24ced524acf56261

Contents?: true

Size: 868 Bytes

Versions: 6

Compression:

Stored size: 868 Bytes

Contents

require 'rails/generators/migration'

module Ecm
  module CmsCore
    module Generators
      class MigrationsGenerator < ::Rails::Generators::Base
        include Rails::Generators::Migration
        source_root File.expand_path('../templates', __FILE__)
        desc "Installs the needed migrations"

        def self.next_migration_number(path)
          unless @prev_migration_nr
            @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
          else
            @prev_migration_nr += 1
          end
          @prev_migration_nr.to_s
        end

        def copy_migrations
          migration_template "create_ecm_cms_core_folders.rb", "db/migrate/create_ecm_cms_core_folders.rb"
          migration_template "create_ecm_cms_core_templates.rb", "db/migrate/create_ecm_cms_core_templates.rb"
        end         
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecm_cms_core-0.0.8 lib/generators/ecm/cms_core/migrations/migrations_generator.rb
ecm_cms_core-0.0.7 lib/generators/ecm/cms_core/migrations/migrations_generator.rb
ecm_cms_core-0.0.6 lib/generators/ecm/cms_core/migrations/migrations_generator.rb
ecm_cms_core-0.0.5 lib/generators/ecm/cms_core/migrations/migrations_generator.rb
ecm_cms_core-0.0.3 lib/generators/ecm/cms_core/migrations/migrations_generator.rb
ecm_cms_core-0.0.2 lib/generators/ecm/cms_core/migrations/migrations_generator.rb