zachdaniel

zachdaniel

Creator of Ash

Ash and AshPostgres generators/installers, built with igniter are available on main!
I’ll be very grateful to anyone willing to give them a shot and report back with there experience.

Keep in mind, things will absolutely break. Not only are these brand new generators, but they are an entirely new kind of generator. For more on igniter, see this thread: Igniter - A code generation and project patching framework

Commands to dive in with!

Install the archive

mix archive.install hex igniter_new

Create a new app and install dependencies into it

We use the github dependencies here so that you can use the new installers, which are only available on main currently.

mix igniter.new app_name \
  --install ash@github:ash-project/ash

Or install multiple dependencies at once. iterex in this example doesn’t have an installer (as it doesn’t need one), so it just gets added to the mix.exs file with no other changes

# as a csv
mix igniter.new app_name \
  --install iterex,ash@github:ash-project/ash,ash_postgres@github:ash-project/ash_postgres
# in multiple flags
mix igniter.new app_name \
  --install iterex \
  --install ash@github:ash-project/ash \
  --install ash_postgres@github:ash-project/ash_postgres

Or, modify an existing app!

first, add igniter to your mix.exs

defp deps do
  [
    {:igniter, "~> 0.2"}
  ]
end

Install dependencies

mix igniter.install ash@github:ash-project/ash

Install dependencies with example code!

mix igniter.install ash@github:ash-project/ash --example

Generate a resource

mix ash.gen.resource Twitter.Tweets.Tweet \
  --uuid-primary-key id \
  --attribute text:string:required:public

And generate another one, see how the domain is modified to reference the newly created resource?

mix ash.gen.resource Twitter.Tweets.Like \
  --uuid-primary-key id \
  --relationship belongs_to:tweet:Twitter.Tweets.Tweet:required:public

Generate a resource using a specific extension!

You will want to install ash_postgres first for this to work:

mix igniter.install ash_postgres@github:ash-project/ash_postgres
mix ash.gen.resource Twitter.Tweets.Tweet \
  --uuid-primary-key id \
  --attribute text:string:required:public
  --extend postgres

Modify an existing resource to use a new extension

swap its data layer to use ets

mix ash.extend Twitter.Tweets.Tweet ets

And swap it back to use postgres

mix ash.extend Twitter.Tweets.Tweet postgres

Or add a new extension

mix ash.extend Twitter.Tweets.Tweet Ash.Policy.Authorizer

There are a couple more generators you can play with like mix ash.gen.enum, but I think this is enough to get started.

Happy hacking :sunglasses:

Showing Posts 1 to 6

ghannam80

ghannam80

Got the below error while running :

mix igniter.new app_name \
  --install ash@github:ash-project/ash
  • Getting ash (GitHub - ash-project/ash: A declarative, extensible framework for building Elixir applications. · GitHub)
    remote: Enumerating objects: 44617, done.
    remote: Counting objects: 100% (1646/1646), done.
    remote: Compressing objects: 100% (1099/1099), done.
    remote: Total 44617 (delta 613), reused 1544 (delta 536), pack-reused 42971
    origin/HEAD set to main
    error: invalid path ‘documentation/dsls/DSL:-Ash.DataLayer.Ets.md’
    error: invalid path ‘documentation/dsls/DSL:-Ash.DataLayer.Mnesia.md’
    error: invalid path ‘documentation/dsls/DSL:-Ash.Domain.md’
    error: invalid path ‘documentation/dsls/DSL:-Ash.Notifier.PubSub.md’
    error: invalid path ‘documentation/dsls/DSL:-Ash.Policy.Authorizer.md’
    error: invalid path ‘documentation/dsls/DSL:-Ash.Reactor.md’
    error: invalid path ‘documentation/dsls/DSL:-Ash.Resource.md’
    ** (Mix) Command “git --git-dir=.git checkout --quiet origin/HEAD” failed
    mix deps.get returned exited with code: 1
zachdaniel

zachdaniel OP

Creator of Ash

Interesting…can you please open an issue on the igniter GH repo?

If anyone else is getting that same error please let me know as well.

EDIT: I’m unable to reproduce it. Are you on windows?

ghannam80

ghannam80

Yes , i am on Windows 11

zachdaniel

zachdaniel OP

Creator of Ash

Hmm…I think this issue is unrelated to igniter in that case. If you were to make a fresh project and point a mix dependency at github, you’d likely encounter this same issue. You’ll probably need to wait until we release proper hex version to try these out in that case, sorry about that :cry:

albin

albin

Congrats on the beta release

Tried using uuidv7 with --uuid-v7-primary-key id but noticed that it fails silently, and generates a resource without a primary key.

Then noticed that it also silently ignores any unknown/typo-ed parameters

Could you make it error out instead of silently ignoring unknown params in this case?

TIA

zachdaniel

zachdaniel OP

Creator of Ash

This is actually kind of a tough one because of the way that we pass arguments down into nested generators :thinking: I will see what I can do :slight_smile:

— All posts loaded —

Where Next? Top

Trending in News & Updates Top

sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
bartblast
I’ll be using this thread to share Hologram patch release announcements. Minor releases will continue to get dedicated threads with blog ...
New
sorenone
This release unifies configuration for queues, repos, and services, swaps opaque timing integers for readable durations, and backports pe...
New
pcharbon
:heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::heart::hea...
New
jvoegele
Bond brings Design by Contract to Elixir: preconditions, postconditions and invariants as executable specifications, checked at runtime a...
New
webofbits
Aludel 0.7.0 is released :tada: Since 0.5.0, Aludel has grown into a much more complete LLM evaluation toolkit for Elixir and Phoenix app...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews