Sha256: d6af05c58fe4ba45d9c3fd64c303edffc5ff0190902fb2123a856e36c236ee10

Contents?: true

Size: 665 Bytes

Versions: 5

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

require 'thor/group'
require 'active_support/inflector'

module Ditty
  module Generators
    class MigrationGenerator < Thor::Group
      include Thor::Actions

      attr_reader :namespace, :folder

      desc 'Creates a new Sequel migration for the current project'
      argument :name, type: :string, desc: 'Name of the migration'

      def self.source_root
        File.expand_path('../templates', __dir__)
      end

      def create_model
        filename = File.join('migrations', "#{Time.now.strftime('%Y%m%d')}_#{name.underscore}.rb")
        template '../templates/migration.rb.erb', filename
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ditty-0.11.1 lib/ditty/generators/migration_generator.rb
ditty-0.10.2 lib/ditty/generators/migration_generator.rb
ditty-0.10.1 lib/ditty/generators/migration_generator.rb
ditty-0.9.1 lib/ditty/generators/migration_generator.rb
ditty-0.9.0 lib/ditty/generators/migration_generator.rb