Project

sdl

0.0
No commit activity in last 3 years
No release in over 3 years
A generic schema definition language.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0
~> 0.17.1

Runtime

 Project Readme

SDL

Build Version

SDL stands for Schema Definition Language. It's a language for describing models in a system.

Alone, it doesn't do a whole lot. However, you might find helpful for building code generators.

Installation

Add this line to your application's Gemfile:

gem 'sdl'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sdl

Examples

Define a schema

SDL.define do
  model :user do
    attribute :email, :string, unique: true
    has_many :posts
    timestamps
  end

  model :post do
    attribute :title, :string, limit: 120
    attribute :body, :text, nullable: true
    enum :status, values: [:draft, :published], default: :draft
    belongs_to :user, foreign_key: true
    has_one_attached :image
    timestamps
  end
end

Load a schema from a file

# schema.rb
model :user do
  attribute :name, :string
end
SDL.load_file "schema.rb"

Parse command-line arguments

SDL.parse "user", %w[
  email:unique
  posts:has_many
]

SDL.parse "post", %w[
  title:string{120}
  body:text:nullable
  status:enum{draft,published}
  user:belongs_to:foreign_key
  image:has_one_attached
]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rzane/sdl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the SDL project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.