BeaconCMS/beacon

Extension: Rename behaviors modules

AZholtkevych opened this issue · 5 comments

Rename the following modules to remove the Behaviour suffix.

Beacon.DataSource.Behaviour -> Beacon.DataSource
Beacon.Authorization.Behaviour -> Beacon.Authorization.Policy

Also:

  • update tests
  • update docs

Beacon.DataSource.Behaviour -> Beacon.DataSource and Beacon.Authorization.Behaviour -> Beacon.Authorization.Policy

Hey guys! I have a question related to this issue:

There is already a module named Beacon.DataSource( which implements the Beacon.DataSource.Behaviour). So the problem here would be that we can't rename the Beacon.DataSource.Behaviour to just Beacon.DataSource.

What do you guys think about following the same approach it is being taken for the Beacon.Authorization.Behaviour? Go from Behaviour -> Policy in both places?

So than the task would be to change like this:
Beacon.DataSource.Behaviour -> Beacon.DataSource.Policy
Beacon.Authorization.Behaviour -> Beacon.Authorization.Policy

What do you think? @AZholtkevych

Hey @edborsa to answer your concern, a module can implement its own behaviour contract :)
It would look something like:

defmodule Beacon.DataSource do
  @moduledoc false

  @behaviour Beacon.DataSource

  @callback live_data(Beacon.Types.Site.t(), path :: [String.t()], params :: map()) :: map()
  # ... and all the other callbacks
  
  def live_data(site, path, params) do
    # ... actual implementation
  end
  
  # ... and all the other functions of the existing module

Can I pick this one?
I would like to start contributing.
I've created a PR for it #424
Please let me know what to change or adjust.
Thanks

Closed by #424