Skip to content
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
27 changes: 14 additions & 13 deletions docs/docs/development/management-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,20 @@ Available commands:

[marten]

› clearsessions Clear all expired sessions.
› collectassets Collect all the assets and copy them in a unique storage.
› gen / g Generate various structures, abstractions, and values within an existing project.
› genmigrations Generate new database migrations.
› listmigrations List all database migrations.
› migrate Run database migrations.
› new Initialize a new Marten project or application repository.
› play Start a Crystal playground server initialized for the current project.
› resetmigrations Reset an existing set of migrations into a single one.
› routes Display all the routes of the application.
› seed Populate the database by running the seed file.
› serve / s Start a development server that is automatically recompiled when source files change.
› version Show the Marten version.
› clearsessions Clear all expired sessions.
› collectartifacts Collect runtime artifacts required by compiled applications.
› collectassets Collect all the assets and copy them in a unique storage.
› gen / g Generate various structures, abstractions, and values within an existing project.
› genmigrations Generate new database migrations.
› listmigrations List all database migrations.
› migrate Run database migrations.
› new Initialize a new Marten project or application repository.
› play Start a Crystal playground server initialized for the current project.
› resetmigrations Reset an existing set of migrations into a single one.
› routes Display all the routes of the application.
› seed Populate the database by running the seed file.
› serve / s Start a development server that is automatically recompiled when source files change.
› version Show the Marten version.

Run a command followed by --help to see command specific information, ex:
marten [command] --help
Expand Down
29 changes: 29 additions & 0 deletions docs/docs/development/reference/management-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ marten clearsessions # Clears all expired sessions
marten clearsessions --no-input # Clears all expired sessions without any prompts
```

## `collectartifacts`

**Usage:** `marten collectartifacts [options]`

Collects runtime artifacts that are required by compiled applications and copies them into a single destination
directory.

This command collects Marten's built-in locale files, project locale files from `config/locales`, and application
locale and template files from `locales` and `templates` directories. Files are copied while preserving their paths
relative to the project compilation root, so the destination directory can be used as the [`root_path`](./settings.md#root_path)
setting in production. Symbolic links encountered in these directories are followed, and the linked files are
collected as regular files.

Custom template loaders and directories configured through `templates.dirs` are not collected by this command.

### Options

* `--dest-path=PATH` - Configures where artifacts should be collected (defaults to `artifacts`)
* `--no-input` - Does not show prompts to the user
* `--app=APP_LABEL` - Collects artifacts for the specified application only

### Examples

```bash
marten collectartifacts # Collects all runtime artifacts into artifacts/
marten collectartifacts --no-input --dest-path runtime_root # Collects all runtime artifacts without any prompts
marten collectartifacts --app=auth # Collects artifacts for the "auth" app only
```

## `collectassets`

**Usage:** `marten collectassets [options]`
Expand Down
13 changes: 13 additions & 0 deletions spec/marten/apps/config_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,19 @@ describe Marten::Apps::Config do
end
end

describe "#artifact_dirs" do
it "returns the locales and templates directories of the application" do
app_config = Marten::Apps::ConfigSpec::AppWithTemplates::App.new

app_config.artifact_dirs.should eq(
[
Path[__DIR__].join("config_spec/app_with_templates/locales"),
Path[__DIR__].join("config_spec/app_with_templates/templates"),
]
)
end
end

describe "#assets_finder" do
around_each do |t|
FileUtils.rm("/tmp/marten_spec") if File.exists?("/tmp/marten_spec")
Expand Down
Loading