Sha256: d42b4c5e6bd0b21fe5cc024f19891fa6b8ba12a8194a9a34170baa51d7433e1e

Contents?: true

Size: 974 Bytes

Versions: 4

Compression:

Stored size: 974 Bytes

Contents

module EffectiveLearndash
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      desc 'Creates an EffectiveLearndash initializer in your application.'

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

      def self.next_migration_number(dirname)
        if not ActiveRecord::Base.timestamped_migrations
          Time.new.utc.strftime("%Y%m%d%H%M%S")
        else
          '%.3d' % (current_migration_number(dirname) + 1)
        end
      end

      def copy_initializer
        template ('../' * 3) + 'config/effective_learndash.rb', 'config/initializers/effective_learndash.rb'
      end

      def create_migration_file
        @learndash_courses_table_name  = ':' + EffectiveLearndash.learndash_courses_table_name.to_s
        migration_template ('../' * 3) + 'db/migrate/01_create_effective_learndash.rb.erb', 'db/migrate/create_effective_learndash.rb'
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
effective_learndash-0.1.3 lib/generators/effective_learndash/install_generator.rb
effective_learndash-0.1.2 lib/generators/effective_learndash/install_generator.rb
effective_learndash-0.1.1 lib/generators/effective_learndash/install_generator.rb
effective_learndash-0.1.0 lib/generators/effective_learndash/install_generator.rb