We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.
$ bundle install --path vendor/bundle$ STREAM_KEY=my_api_key STREAM_SECRET=my_api_secret bundle exec rspec specAdd :focus tag on target test:
it 'can mark messages as read', :focus do
# test something
endAnd then run as following:
$ STREAM_KEY=myapi_key STREAM_SECRET=my_secret STREAM_CHAT_URL=http://127.0.0.1:3030 bundle exec rspec spec --tag focusWe use Rubocop for linting and Sorbet for type checking.
To run them:
$ bundle exec rake rubocop
$ bundle exec srb tcThese linters can be easily integrated into IDEs such as RubyMine or VS Code.
For VS Code, just install the basic Ruby extension which handles Rubocop (rebornix.ruby) and the official Sorbet one (sorbet.sorbet-vscode-extension).
Recommended settings:
{
"editor.formatOnSave": true,
"ruby.useBundler": true,
"ruby.lint": {
"rubocop": {
"useBundler": true, // enable rubocop via bundler
}
},
"ruby.format": "rubocop",
"ruby.useLanguageServer": true,
"sorbet.enabled": true
}For Docker-based development, you can use:
$ make lint_with_docker # Run linters in Docker
$ make lint-fix_with_docker # Fix linting issues in Docker
$ make test_with_docker # Run tests in Docker
$ make check_with_docker # Run both linters and tests in Docker
$ make sorbet_with_docker # Run Sorbet type checker in DockerYou can customize the Ruby version used in Docker by setting the RUBY_VERSION variable:
$ RUBY_VERSION=3.1 make test_with_dockerBy default, the API client connects to the production Stream Chat API. You can override this by setting the STREAM_CHAT_URL environment variable:
$ STREAM_CHAT_URL=http://localhost:3030 make testWhen running tests in Docker, the test_with_docker command automatically sets up networking to allow the Docker container to access services running on your host machine via host.docker.internal. This is particularly useful for connecting to a local Stream Chat server:
$ STREAM_CHAT_URL=http://host.docker.internal:3030 make test_with_dockerThis repository follows a commit message convention in order to automatically generate the CHANGELOG. Make sure you follow the rules of conventional commits when opening a pull request.
In order to release new version you need to be a maintainer of the library.
- Kick off a job called
initiate_release(link).
The job creates a pull request with the changelog. Check if it looks good.
- Merge the pull request.
Once the PR is merged, it automatically kicks off another job which will upload the Gem to RubyGems.org and creates a GitHub release.