zachdaniel

zachdaniel

Creator of Ash

Test out Ash Frameworks' first igniter-backed generators/installers!

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:

Most Liked

zachdaniel

zachdaniel

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:

zachdaniel

zachdaniel

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:

Where Next?

Popular in News & Updates Top

zachdaniel
Hey folks! We’ve just released the beta 0.1.0 version of ash_sqlite. Take a look at the guide here: https://hexdocs.pm/ash_sqlite/get-sta...
New
zachdaniel
Ash and AshPostgres generators/installers, built with igniter are available on main! I’ll be very grateful to anyone willing to give the...
New
mspanc
Membrane v1.2.6 has been released. What’s Changed Adjust to Elixir 1.19 by @Noarkhh in Update to elixir 1.19 by Noarkhh · Pull Request ...
New
lawik
Nerves, fwup and NervesHub have had delta updates as a feature on the checklist for a long time. A delta update being essentially a patch...
New
zachdaniel
Hey folks! We’re starting a new weekly newsletter with the goings on of the various Ash packages and other interesting news from myself a...
New
fhunleth
We’re excited to announce that we’re actively working on NervesHub 2.0, an improved version of our IoT device firmware update and managem...
New
zachdaniel
Hello everyone! We’ve got two big updates on the Ash community today :tada: Discord Support Forum → Elixir Forum The Ash community is g...
New
fhunleth
We’ve released new versions of all of the officially maintained Nerves Systems. The official systems, nerves_system_rpi0, nerves_system_b...
New
jjcarstens
The Raspberry Pi is a very popular hardware platform for Nerves users and the official systems are getting an upgrade! :tada: :beers: Wh...
New
mobileoverlord
Action Advised: NervesHub Sunset In 2018, NervesHub was launched to deliver first-class support for hardware deployments directly from th...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New

We're in Beta

About us Mission Statement