-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [#322] Remove contribution guide from readme * [#322] Add contribution guide section to github wiki * [#322] Add template spec for contribution guide wiki * [#322] Add link to contribution guideline wiki in readme * [#322] Change contribution guide link text in wiki sidebar * [#322] Extract template testing instructions from readme to wiki * [#322] Modify template spec * [#322] Update .template/addons/github/.github/wiki/Testing.md Co-authored-by: rajibরাজীব <[email protected]> * [#322] Add spec for contribution guide on github wiki * [#322] Fix lint * [#322] Add contribution resources section to readme * [#322] Add testing as root link of github wiki on sidebar * [#322] Remove spec for contribution guide * Use the templete wiki instead of the generated app wiki * Fix lint with new rubocop rule --------- Co-authored-by: rajibরাজীব <[email protected]> Co-authored-by: Xavier MALPARTY <[email protected]>
- Loading branch information
1 parent
2683520
commit 71ebbb8
Showing
7 changed files
with
158 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
## How to contribute | ||
|
||
### Template structure | ||
|
||
``` | ||
. | ||
├── .template | ||
│ ├── addons | ||
│ │ └── docker | ||
│ │ ├── ... | ||
│ │ └── template.rb | ||
│ └── variants | ||
│ ├── api | ||
│ │ ├── ... | ||
│ │ └── template.rb | ||
│ └── web | ||
│ ├── ... | ||
│ └── template.rb | ||
├── app | ||
├── bin | ||
├── config | ||
├── spec | ||
├── ... | ||
├── README.md | ||
├── README.md.tt | ||
└── template.rb | ||
``` | ||
|
||
We keep the Rails-app-like structure. On the root, there are base project file templates. | ||
Other files including the template options are in `.template` folder. | ||
|
||
There are 2 kinds of the template options: | ||
|
||
1. **Variants** - For the app main options, which are `web` and `api`. | ||
|
||
2. **Addons** - For other extra options that we can add to the project like `docker` or `bootstrap`, | ||
use the prompt `ask` to generate a question before generating the project. | ||
|
||
### Template files | ||
|
||
There are 2 template file types: | ||
|
||
1. **`.tt` files** | ||
|
||
This file is used for templating the whole new file. | ||
In case if we want to create a new file that Rails has not generated. | ||
|
||
2. **`.rb` files** | ||
|
||
This is used for modifying the files that Rails has generated. | ||
The file name should be the same as on the generated app. | ||
If it is not a ruby file, append the `.rb` as an extension e.g. `Gemfile.rb` | ||
|
||
### Template specs | ||
|
||
We are using [Serverspec](https://serverspec.org/) to test the template. | ||
For any changes made, you **must** add a spec for it. | ||
|
||
Test files are located under `.template/spec` folder | ||
|
||
``` | ||
. | ||
├── ... | ||
├── .template | ||
│ ├── ... | ||
│ ├── spec | ||
│ │ └── addons | ||
│ │ │ └── base | ||
│ │ │ │ └── docker | ||
│ │ │ │ │ ├── ... | ||
│ │ │ │ │ └── template_spec.rb | ||
│ │ │ │ └── semaphore | ||
│ │ │ │ │ ├── ... | ||
│ │ │ │ │ └── template_spec.rb | ||
│ │ │ └── variants | ||
│ │ │ │ └── web | ||
│ │ │ │ │ └── boostrap | ||
│ │ │ │ │ ├── ... | ||
│ │ │ │ │ └── template_spec.rb | ||
│ │ │ │ └── api | ||
│ │ │ │ │ └── addon | ||
│ │ │ │ │ ├── ... | ||
│ │ │ │ │ └── template_spec.rb | ||
│ │ └── base | ||
│ │ │ ├── ... | ||
│ │ │ └── template_spec.rb | ||
│ │ └── variants | ||
│ │ │ └── web | ||
│ │ │ │ ├── ... | ||
│ │ │ │ └── template_spec.rb | ||
│ │ │ └── api | ||
│ │ │ │ ├── ... | ||
│ │ │ │ └── template_spec.rb | ||
``` | ||
|
||
### Template Strings | ||
|
||
When using template string with heredoc, use the proper name following the file type / content. | ||
|
||
This provides the meaningful context to the content and some IDEs also support to highlight the content depending on the type. | ||
|
||
- `DOCKERFILE` | ||
- `ERB` | ||
- `HTML` | ||
- `IGNORE` - For any ignore file e.g. `.gitignore`, `.eslintignore` | ||
- `JAVASCRIPT` | ||
- `JSON` | ||
- `PROCFILE` | ||
- `RUBY` | ||
- `SCSS` | ||
- `SHELL` | ||
|
||
For other files that are not fit the types above, use the extension as the name | ||
e.g. `TOOL_VERSION` for `.tool-version` file. | ||
|
||
For the normal string, name it after the content | ||
e.g. `ERROR` for template error message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Testing the Template | ||
|
||
To run [RuboCop](https://github.com/rubocop/rubocop) against the template: | ||
|
||
```sh | ||
.template/bin/rubocop | ||
``` | ||
|
||
Any RuboCop command options can be passed: | ||
|
||
```sh | ||
# Run RuboCop with auto correct | ||
.template/bin/rubocop -a | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## About | ||
|
||
<a href="https://nimblehq.co/"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://assets.nimblehq.co/logo/dark/logo-dark-text-160.png"> | ||
<img alt="Nimble logo" src="https://assets.nimblehq.co/logo/light/logo-light-text-160.png"> | ||
</picture> | ||
</a> | ||
|
||
This project is maintained and funded by Nimble. | ||
|
||
We ❤️ open source and do our part in sharing our work with the community! | ||
See [our other projects][community] or [hire our team][hire] to help build your product. | ||
|
||
Want to join? [Check out our Jobs][jobs]! | ||
|
||
[community]: https://github.com/nimblehq | ||
[hire]: https://nimblehq.co/ | ||
[jobs]: https://jobs.nimblehq.co/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Table of Contents | ||
|
||
- [[Contribution Guide]] | ||
- [[Testing]] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters