diff --git a/.github/wiki/Contribution-Guide.md b/.github/wiki/Contribution-Guide.md new file mode 100644 index 000000000..bc9d360cc --- /dev/null +++ b/.github/wiki/Contribution-Guide.md @@ -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. diff --git a/.github/wiki/Testing.md b/.github/wiki/Testing.md new file mode 100644 index 000000000..571675112 --- /dev/null +++ b/.github/wiki/Testing.md @@ -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 +``` diff --git a/.github/wiki/_Footer.md b/.github/wiki/_Footer.md new file mode 100644 index 000000000..1f4f54625 --- /dev/null +++ b/.github/wiki/_Footer.md @@ -0,0 +1,19 @@ +## About + + + + + Nimble logo + + + +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/ diff --git a/.github/wiki/_Sidebar.md b/.github/wiki/_Sidebar.md new file mode 100644 index 000000000..c4f1313b0 --- /dev/null +++ b/.github/wiki/_Sidebar.md @@ -0,0 +1,4 @@ +## Table of Contents + +- [[Contribution Guide]] +- [[Testing]] diff --git a/.github/wiki/assets/images/.keep b/.github/wiki/assets/images/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/README.md b/README.md index add4e1f1b..be635f675 100644 --- a/README.md +++ b/README.md @@ -62,138 +62,10 @@ make dev Read more about Rails Application Template in the [official Rails Guides](https://guides.rubyonrails.org/rails_application_templates.html). -## How to contribute +## Contribution Resources -### 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. - -## 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 -``` +- [Contributions Guidelines](../../wiki/Contribution_Guide). +- [Testing the template](../../wiki/Testing) ## License diff --git a/spec/codebase/codebase_spec.rb b/spec/codebase/codebase_spec.rb index 62b745b73..15fb53587 100644 --- a/spec/codebase/codebase_spec.rb +++ b/spec/codebase/codebase_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe 'Codebase', codebase: true do +describe 'Codebase', :codebase do it 'does not offend Rubocop' do expect(`rubocop --parallel --format simple`).to include 'no offenses detected' end