PrePAN

Sign in to PrePAN

Pegasus Module-Starter for DBIx-Class-based Data Models

Good

Synopsis


$ sqlite3 example.db < creation_script_not_inc.sql
$ pegasus setup Example::DB dbi:SQLite:./example.db root
$ pegasus run

Description

WHO Al Newkirk - Crazy Idealistic P3rl H@ck3r

WHAT Pegasus - The Module-Starter for DBIx::Class data models

Pegasus is a simple scaffolding utility for RAD (rapid app development). It helps you generate a DBIx::Class data model with schema class, and tests.

It basically extends the convenience of using DBIx::Class::Schema::Loader. This devkit exists solely to help further eliminate the tedium when creating data models using DBIx::Class.

WHEN A developer could use Pegasus after creating the database schema at the database. Pegasus will then generate a DBIC data model.

WHERE Pegasus is far from ready for the CPAN, ... So where do pre-CPAN modules attend daycare? GitHub ofcourse:

  • Pegasus CLI: https://github.com/alnewkirk/Pegasus
  • Pegasus Example Model: https://github.com/alnewkirk/Pegasus-Example

HOW Pegasus Scaffold Generation

    1. generate schema (using DBIC S::L)
    1. generate sql scripts (deploy)
    1. generate transaction layer (Pegasus)
    1. generate tests (Pegasus)

Usage (from the command-line)

  • $ sqlite3 example.db < creation_script_not_inc.sql
  • $ pegasus setup Example::DB dbi:SQLite:./example.db root
  • $ pegasus run

WHY Scaffolding helps us build it faster, bigger, better (some restrictions apply)

Also, -- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Cit. Rich Cook

Comments

Hi, I am actually in the process of creating something similar, basically a way to take a schema generated by DBIx::Class::Loader::Schema and to create a Moose-based Model on top of that. Already there exists something sort of similar, DBICx::Modeler (and a Generator based on that) but they don't quite seem to do what I want.

For your module here, are you aiming to fill in remaining info for each class? Currently it just seems to create the CRUD subs for each Source. Which, btw, seems like it could be factored out into a Role unless you are providing it inline so it can be further modified.

Anyway, what are your future plans for the module? I'll try and have my code up over the weekend to see if there is some overlap. Thanks!
Thanks for the feedback, what you are in the process of creating is actually what Pegasus tries to do now. Creates a Moose-based Model on top of your DBIx-Class schema class. DBICx::Modeler doesn't seem to be in the neighborhood, I agree.

"are you aiming to fill in remaining info for each class" - I don't know what you mean by this. Currently Pegasus tries to assume as little as possible about how you work and code, it only makes the assumption that you use Moose and DBIx::Class and that you want to create a data-model and not just a schema class.

There are no immediate plans for Pegasus as it currently generates enough for most of my development needs and I havent gotten much feedback just yet.

Please sign up to post a review.