camping / camping

the 5k pocket full-of-gags web microframework
MIT License
911 stars 95 forks source link

Get Guidebook working and tested to replace AR #126

Open karloscarweber opened 1 year ago

karloscarweber commented 1 year ago

Right now our Active Record Models stuff in Camping is built in. To remove that we need to replicate the functionality of having a Base Model inherited from ActiveRecord and patched into models by putting that into a Plugin. Guidebook is that plugin.

Guidebook also has a dependency of cairn, which is a mirror/fork of standalone-migrations. This gives us migration support from Rails using Rake. Which is better than the built in migrations. The only downside is that it's a slightly less campingish method. It might be fun to add Automatic migrations into camping through guidebook, or to have automatic migrations based off of Models like the OG (Original Gangster) gem: og.

Honestly the best experience would be a bridge of both of these gems. Automatically generated and applied migrations by inspecting Model objects with og. With migration files stored in db/migrate/ that represent what's automatically happening. A simple setting could turn auto migrations on and off, or setting a version number would lock the version and keep auto migrations from firing.

If you want to be serious about your data you shouldn't let migrations happen automatically, but Camping doesn't need or want to be serious. There are no rules here, and having fun is kinda the point. Why not have Automatic migrations?

The Guidebook Gear repo is located here: https://github.com/karloscarweber/guidebook.

So, sorry, but Recap:

karloscarweber commented 1 year ago

Additionally part of what this issue depends on is having a directory structure for camping defined, Which we sorta already have:

my_app/
  camp.rb
  views/
  public/

I think we should add db/ :

my_app/
  camp.rb
  views/
  public/
  db/
    migrate/
karloscarweber commented 1 year ago

I want to use KDL for configurations. And a Rakefile:

my_app/
  camp.rb
  campguide.kdl
  Rakefile
  views/
  public/
  db/
    migrate/
karloscarweber commented 1 year ago

I've made a lot of progress on Guidebook. It's well tested and completely replaces the built in Active Record dependency of Camping. All using the new Gear plugin system. Most of what's left is to write documentation, and to give example apps.

karloscarweber commented 1 year ago

A big hurdle to get this complete is ActiveSupport, which is part of Rails, still depends on Rack 2.0. Camping 3 is going to use Rack 3.0, so it's not compatible.

To get around this I've been working on new Gear that provides database support, van. It's a wrapper for the Sequel gem. Adding support for the sequel gem has been on mo to do list for a while, Rack 3.0 now necessitates it.

karloscarweber commented 1 year ago

Moving this to 3.1.