Skip to content

Commit 3be279a

Browse files
polish docs to represent status quo
1 parent 83089cd commit 3be279a

File tree

6 files changed

+139
-46
lines changed

6 files changed

+139
-46
lines changed

docs/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
2. [Concepts](./concepts)
77
3. [Core Components](./components)
88
4. [Integrations](./integrations)
9+
5. [Tooling](./tooling_and_ecosystem)
910

1011
## Diving deeper
1112

12-
5. [Extend](./extend)
13-
6. [Architecture](./architecture)
14-
7. [Contribute](./contribute)
13+
6. [Extend](./extend)
14+
7. [Architecture](./architecture)
15+
8. [Contribute](./contribute)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Create Matestack concepts using generators
2+
3+
Those are extensions of the `Rails::Generators` and follow the same system as the classic Rails scaffolders. Reach out to us with feedback or if things don't behave the way you'd expect them to do!
4+
5+
## General usage
6+
7+
Create matestack apps, pages and components (and some corresponding parts, like routes and controllers) automatically from the command line!
8+
9+
Each generator takes mandatory arguments and optional flags. Check their detailed description to see default parameters and the full list of options.
10+
11+
Tests can be found [here](../../spec/lib/generators).
12+
13+
**Note:** We recommend commiting or stashing your current changes so you see created/modified files within your application!
14+
15+
Matestack App Generator is documented [here](./matestack_app_generator.md).
16+
17+
Matestack Page Generator is documented [here](./matestack_page_generator.md).
18+
19+
Matestack Component Generator is documented [here](./matestack_component_generator.md).
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Matestack App Generator
2+
3+
## Usage
4+
5+
Generates matestack apps to `app/matestack/apps`.
6+
7+
## Parameters
8+
9+
**NAME** - Mandatory. Creates an empty matestack page in `app/matestack/apps/NAME.rb`.
10+
11+
**--all_inclusive** - Optional. Also creates a corresponding matestack page, a controller with an action for the matestack page and a route to it.
12+
13+
## Example 1
14+
15+
```bash
16+
rails generate matestack_app example_app
17+
```
18+
19+
Creates an ExampleApp in `app/matestack/apps/example_app.rb`.
20+
21+
## Example 2
22+
23+
```bash
24+
rails generate matestack_app simple_app --all_inclusive
25+
```
26+
27+
Creates:
28+
- a SimpleApp in `app/matestack/apps/simple_app.rb`
29+
- an ExamplePage in `app/matestack/pages/simple_app/example_page.rb`
30+
- a SimpleAppController in `app/controllers/simple_app_controller.rb`
31+
- a route to `http://localhost:3000/simple_app/example_page`
32+
33+
To see all options, run
34+
```bash
35+
rails generate matestack_app -h
36+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Matestack Component Generator
2+
3+
## Usage
4+
5+
Generates matestack components to `app/matestack/components`.
6+
7+
## Parameters
8+
9+
**NAME** - Mandatory. Creates an empty matestack component in `app/matestack/components/NAME.rb`.
10+
11+
**--dynamic** - Optional. Makes the created component dynamic and also creates a corresponding `app/matestack/components/NAME.js` file.
12+
13+
**--haml** - Optional. Creates a `app/matestack/components/NAME.haml` file to use 'normal' HTML tags.
14+
15+
**--scss** - Optional. Creates an `app/matestack/components/NAME.scss` for custom component styling.
16+
17+
## Example
18+
19+
```bash
20+
rails generate matestack_component simple_component
21+
```
22+
23+
Creates a SimpleComponent in `app/matestack/components/simple_component.rb`.
24+
25+
To see all options, run
26+
```bash
27+
rails generate matestack_component -h
28+
```
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Matestack Page Generator
2+
3+
## Usage
4+
5+
Generates matestack pages to `app/matestack/pages`.
6+
7+
## Parameters
8+
9+
**NAME** - Mandatory. Creates an empty matestack component in `app/matestack/components/NAME.rb`.
10+
11+
**--app_name** - Mandatory. Adds a `/app_name` folder to `app/matestack/pages` to indicate to which matestack app the pages belongs. Pages _do not necessarily need to belong to an app_, but for now the page scaffolder can only provide this functionality.
12+
13+
**--namespace** - Optional. Adds a `/namespace` folder within the `/app_name` and a namespace to the `page.rb`.
14+
15+
**--controller_action** - Optional. Takes a `controller#action` to use in the created route for the page. If not provided, a `controller#action` is created from **NAME** and **--app_name**.
16+
17+
## Example 1
18+
19+
```bash
20+
rails generate matestack_page simple_page --app_name example_app
21+
```
22+
23+
Creates a SimplePage in `app/matestack/pages/example_app/simple_page.rb`.
24+
25+
It also adds `get '#example_app/simple_page', to: 'example_app#simple_page'` to the `config/routes.rb` and proposes a
26+
```ruby
27+
def simple_page
28+
responder_for(Pages::ExampleApp::SimplePage)
29+
end
30+
```
31+
in the terminal to use in your controller.
32+
33+
## Example 2
34+
35+
```bash
36+
rails generate matestack_page second_page --app_name example_app --namespace sample_namespace
37+
```
38+
39+
Creates a SimplePage in `app/matestack/pages/example_app/sample_namespace/second_page.rb`.
40+
41+
It also adds `get '#example_app/sample_namespace/second_page', to: 'example_app#second_page'` to the `config/routes.rb` and proposes a
42+
```ruby
43+
def simple_page
44+
responder_for(Pages::ExampleApp::SampleNamespace::SecondPage)
45+
end
46+
```
47+
in the terminal to use in your, e.g., `example_app_controller.rb`.
48+
49+
To see all options, run
50+
```bash
51+
rails generate matestack_page -h
52+
```

docs/tooling_and_ecosystem/scaffolding.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)