Skip to content

Importer DSL Idea #502

@ashmaroli

Description

@ashmaroli

Jotting this down for feedback and for future reference.

# frozen_string_literal: true

module JekyllImport
  class Foobar < Importers::Importer
    title "Foo Bar"
    needs "sequel", "sqlite3", "safe_yaml"

    set_option "dbname",   "--dbname DB",   "Database name."
    set_option "user",     "--user NAME",   "Database user name."
    set_option "password", "--password PW", "Database user's password. (default: '')"
    set_option "host",     "--host HOST",   "Database host name. (default: 'localhost')"
    set_option "port",     "--port NUM",    "Database port. (default: '8080')"

    class << self
      # Entry point.
      # Mandatory public method. Will raise exception if not defined.
      def process(options)
        # ...
      end

      # Optional public method
      def validate(options)
        # ...
      end

      private

      # ...
    end
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions