Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/improve config no_auto_register_paths docs #285

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/v2.0/app/app-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Sets the keys for the app components to be automatically imported into each slic

### `no_auto_register_paths`

Sets an array of paths (relative to the root of the app or any slice) to be excluded from component auto-registration. Defaults to `["entities"]`. See the [containers and components guide](/v2.0/app/container-and-components) for more detail.
Sets an array of paths to be excluded from component auto-registration. Defaults to `["entities"]`. Note that files in `lib/` are always excluded from auto-registration, too. These paths are all relative to the root of the app or any [slice](/v2.0/app/slices). See the [containers and components guide](/v2.0/app/container-and-components) for more detail.

## Router

Expand Down
9 changes: 7 additions & 2 deletions content/v2.0/app/container-and-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ end

If you have a whole class of objects that shouldn't be placed in your container, you can configure your Hanami application to exclude an entire directory from auto registration by adjusting its `no_auto_register_paths` configuration.

Here for example, the `app/structs` directory is excluded, meaning nothing in the `app/structs` directory will be registered with the container:
Here for example, the `app/values` directory is excluded, meaning nothing in the `app/values` directory will be registered with the container:

```ruby
# config/app.rb
Expand All @@ -333,11 +333,16 @@ require "hanami"

module Bookshelf
class App < Hanami::App
config.no_auto_register_paths << "structs"
config.no_auto_register_paths << "values"
end
end
```

The default value for `no_auto_register_paths` is `["entities"]`.

These apply for the root of the application, as well within any [slices](/v2.0/app/slices)
Additionally, the `config/` directory within a slice is always excluded from auto-registration.

A third alternative for classes you do not want to be registered in your container is to place them in the `lib` directory at the root of your project.

For example, this `SlackNotifier` class can be used anywhere in your application, and is not registered in the container:
Expand Down
2 changes: 1 addition & 1 deletion content/v2.1/app/app-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Sets the keys for the app components to be automatically imported into each slic

### `no_auto_register_paths`

Sets an array of paths (relative to the root of the app or any slice) to be excluded from component auto-registration. Defaults to `["entities"]`. See the [containers and components guide](/v2.1/app/container-and-components) for more detail.
Sets an array of paths to be excluded from component auto-registration. Defaults to `["entities"]`. Note that files in `lib/` are always excluded from auto-registration, too. These paths are all relative to the root of the app or any [slice](/v2.1/app/slices). See the [containers and components guide](/v2.1/app/container-and-components) for more detail.

## Router

Expand Down
9 changes: 7 additions & 2 deletions content/v2.1/app/container-and-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ end

If you have a whole class of objects that shouldn't be placed in your container, you can configure your Hanami application to exclude an entire directory from auto registration by adjusting its `no_auto_register_paths` configuration.

Here for example, the `app/structs` directory is excluded, meaning nothing in the `app/structs` directory will be registered with the container:
Here for example, the `app/values` directory is excluded, meaning nothing in the `app/values` directory will be registered with the container:

```ruby
# config/app.rb
Expand All @@ -333,11 +333,16 @@ require "hanami"

module Bookshelf
class App < Hanami::App
config.no_auto_register_paths << "structs"
config.no_auto_register_paths << "values"
end
end
```

The default value for `no_auto_register_paths` is `["entities"]`.

These apply for the root of the application, as well within any [slices](/v2.1/app/slices)
Additionally, the `config/` directory within a slice is always excluded from auto-registration.

A third alternative for classes you do not want to be registered in your container is to place them in the `lib` directory at the root of your project.

For example, this `SlackNotifier` class can be used anywhere in your application, and is not registered in the container:
Expand Down
3 changes: 2 additions & 1 deletion content/v2.2/app/app-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ Sets the keys for the app components to be automatically imported into each slic

### `no_auto_register_paths`

Sets an array of paths (relative to the root of the app or any slice) to be excluded from component auto-registration. Defaults to `["entities"]`. See the [containers and components guide](/v2.2/app/container-and-components) for more detail.
Sets an array of paths to be excluded from component auto-registration. Defaults to `["db", "entities", "relations", "structs"]`. Note that files in `lib/` are always excluded from auto-registration, too. These paths are all relative to the root of the app or any [slice](/v2.2/app/slices). See the [containers and components guide](/v2.2/app/container-and-components) for more detail.


## Router

Expand Down
10 changes: 8 additions & 2 deletions content/v2.2/app/container-and-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ end

If you have a whole class of objects that shouldn't be placed in your container, you can configure your Hanami application to exclude an entire directory from auto registration by adjusting its `no_auto_register_paths` configuration.

Here for example, the `app/structs` directory is excluded, meaning nothing in the `app/structs` directory will be registered with the container:
Here for example, the `app/values` directory is excluded, meaning nothing in the `app/values` directory will be registered with the container:

```ruby
# config/app.rb
Expand All @@ -333,11 +333,17 @@ require "hanami"

module Bookshelf
class App < Hanami::App
config.no_auto_register_paths << "structs"
config.no_auto_register_paths << "values"
end
end
```

Note that the default value for `no_auto_register_paths` is `["db", "entities", "relations", "structs"]`,
so you do not need to specify those. Also, be sure to append to that list.

These apply for the root of the application, as well within any [slices](/v2.2/app/slices)
Additionally, the `config/` directory within a slice is always excluded from auto-registration.

A third alternative for classes you do not want to be registered in your container is to place them in the `lib` directory at the root of your project.

For example, this `SlackNotifier` class can be used anywhere in your application, and is not registered in the container:
Expand Down