Skip to content

Improve Setup instructions for Contributions #334

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

Merged
merged 1 commit into from
Jan 29, 2020
Merged
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
59 changes: 30 additions & 29 deletions docs/contribute/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,57 +22,58 @@ Feel free to take a look at other examples and copy their structure!
Note: We will not approve pull requests that introduce new concepts or components without documentation. Same goes for existing concepts & components.
If you change the behavior of an existing part of this project, make sure to also update the corresponding part of the documentation!

## Core Components
## Setup

Core Components are an essential part of the `matestack-ui-core` gem.
If you are planning to contribute to Matestack you can start doing that by creating a core component. To help you getting started you can use the Core Component Generator.
Assuming you have ruby and bundler already installed.

The generator will create a matestack core component to `app/concepts/matestack/ui/core`.
1. [Install yarn](https://legacy.yarnpkg.com/lang/en/docs/install/)
2. Install [chromedriver](https://sites.google.com/a/chromium.org/chromedriver/) (needed for running tests)
* on Mac it can be installed via `brew cask install chromedriver`, when you get an error about version mismatch like `Chrome version must be between X and Y (Driver info: chromedriver=X.Y.Z)` you should be able to update it via `rails app:webdrivers:chromedriver:update`
* on Linux you need to check the package name, on Ubuntu it's `sudo apt-get install chromium-chromedriver`
3. Install [sqlite](https://www.sqlite.org/) (needed for test execution against a rails app)

Example:

```bash
rails generate matestack:core:component div
bundle install
yarn install
cd spec/dummy
yarn install # dependencies for the dummy app in testing
cd ../..

bundle exec rake db:create
bundle exec rake db:schema:load
```

This will create a component for the HTML `<div>` tag and will generate the following files:

```bash
app/concepts/matestack/ui/core/div/div.haml
app/concepts/matestack/ui/core/div/div.rb
spec/usage/components/div_spec.rb
docs/components/div.md
```


## Tests

To assure this project is and remains in great condition, we heavily rely on automated tests. Tests are defined in `/spec` folder and can be executed by running:

```shell
bundle exec rspec
be rspec spec/lib/ spec/usage/
```

Tests follow quite the same rules as the documentation: Make sure to either add relevant tests (when introducing new concepts or components) or change existing ones to fit your changes (updating existing concepts and components). Pull requests that add/change concepts & components and do not come with corresponding tests will not be approved.

### Note: Running tests on macOS

Make sure you have installed `chromedriver` on your machine. You can install `chromedriver` via `brew` with
## Core Components

```shell
brew cask install chromedriver
```
Core Components are an essential part of the `matestack-ui-core` gem.
If you are planning to contribute to Matestack you can start doing that by creating a core component. To help you getting started you can use the Core Component Generator.

You can then run your the testsuite with `bundle exec rspec`.
The generator will create a matestack core component to `app/concepts/matestack/ui/core`.

If you get an error about a version mismatch similar to this one:
Example:

`Chrome version must be between X and Y (Driver info: chromedriver=X.Y.Z)`
```bash
rails generate matestack:core:component div
```

Make sure you update your chromedriver by executing this command in the project root:
This will create a component for the HTML `<div>` tag and will generate the following files:

```shell
rails app:webdrivers:chromedriver:update
```bash
app/concepts/matestack/ui/core/div/div.haml
app/concepts/matestack/ui/core/div/div.rb
spec/usage/components/div_spec.rb
docs/components/div.md
```

## Release
Expand Down