Skip to content

Commit

Permalink
let's thrust
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed May 28, 2024
0 parents commit c72def9
Show file tree
Hide file tree
Showing 21 changed files with 480 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gem_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bump:
file: lib/capybara/thruster/version.rb
skip_ci: true

25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: palkan

---

## What did you do?

## What did you expect to happen?

## What actually happened?

## Additional context

## Environment

**Ruby Version:**

**Framework Version (Rails, whatever):**

**Capybara Thruster Version:**

25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: palkan

---

## Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

## Describe the solution you'd like

A clear and concise description of what you want to happen.

## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

## Additional context

Add any other context or screenshots about the feature request here.

24 changes: 24 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!--
First of all, thanks for contributing!
If it's a typo fix or minor documentation update feel free to skip the rest of this template!
-->

## What is the purpose of this pull request?

<!--
If it's a bug fix, then link it to the issue, for example:
Fixes #xxx
-->

## What changes did you make? (overview)

## Is there anything you'd like reviewers to focus on?

## Checklist

- [ ] I've added tests for this change
- [ ] I've added a Changelog entry
- [ ] I've updated a documentation

27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release gems
on:
workflow_dispatch:
push:
tags:
- v*

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch current tag as annotated. See https://github.com/actions/checkout/issues/290
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- name: Configure RubyGems Credentials
uses: rubygems/configure-rubygems-credentials@main
- name: Publish to RubyGems
run: |
gem install gem-release
gem release
23 changes: 23 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint Ruby

on:
push:
branches:
- master
pull_request:

jobs:
rubocop:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/rubocop.gemfile
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
- name: Lint Ruby code with RuboCop
run: |
bundle exec rubocop
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
rspec:
runs-on: ubuntu-latest
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3

CI: true
strategy:
fail-fast: false
matrix:

ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true


- name: Run tests
run: |
bundle exec rake test

44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
*.sass-cache
*.iml
.idea/

# Sublime
*.sublime-project
*.sublime-workspace

# OS or Editor folders
.DS_Store
.cache
.project
.settings
.tmproj
Thumbs.db

.bundle/
log/*.log
pkg/
spec/dummy/db/*.sqlite3
spec/dummy/db/*.sqlite3-journal
spec/dummy/tmp/

Gemfile.lock
Gemfile.local
.rspec-local
.ruby-version
*.gem

tmp/
.rbnext/

gemfiles/*.lock

25 changes: 25 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require:
- standard

inherit_gem:
standard: config/base.yml


AllCops:
Exclude:
- 'bin/*'
- 'tmp/**/*'
- 'Gemfile'
- 'vendor/**/*'
- 'gemfiles/**/*'
- 'lib/.rbnext/**/*'
- 'lib/generators/**/templates/*.rb'
- '.github/**/*'
DisplayCopNames: true
SuggestExtensions: false
NewCops: disable
TargetRubyVersion: 2.7

Style/FrozenStringLiteralComment:
Enabled: true

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Change log

## master
16 changes: 16 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "debug", platform: :mri

gemspec

eval_gemfile "gemfiles/rubocop.gemfile"

local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local"

if File.exist?(local_gemfile)
eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
end

23 changes: 23 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2024 Vladimir Dementyev

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[![Gem Version](https://badge.fury.io/rb/capybara-thruster.svg)](https://rubygems.org/gems/capybara-thruster)
[![Build](https://github.com/evilmartians/capybara-thruster/workflows/Build/badge.svg)](https://github.com/palkan/capybara-thruster/actions)

# Capybara Thruster server

This gem makes it possible to use [Thruster][] as a Capybara server. Run your browser test with HTTP/2 enabled and static assets served via Thruster for faster load times!

> [TIP!]
> Using AnyCable? This gem works with [AnyCable-d Thruster][anycable-thruster], so you can run your system tests against a real AnyCable server with all its features!
## Getting started

Adding the gem to your project:

```ruby
# Gemfile
gem "capybara-thruster", group: :test
```

Then, configure Capybara to use Thruster as a server:

```ruby
Capybara.server = :thruster

# You can also specify some options.

# For example, if you want to see the server output,
# pass the `debug: true` option
Capybara.server = :thruster, {debug: true}

# To customize the server settings, you can pass arbitrary environment
# variables via the `env` option
Capybara.server = :thruster, {env: {"DEBUG" => "true"}}
```

## Contributing

Bug reports and pull requests are welcome on GitHub at [https://github.com/evilmartians/capybara-thruster](https://github.com/evilmartians/capybara-thruster).

## Credits

This gem is generated via [`newgem` template](https://github.com/palkan/newgem) by [@palkan](https://github.com/palkan).

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

[Thruster]: https://github.com/basecamp/thruster
[anycable-thruster]: https://github.com/anycable/thruster
43 changes: 43 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# How to release a gem

This document describes a process of releasing a new version of a gem.

1. Bump version.

```sh
git commit -m "Bump 1.<x>.<y>"
```

We're (kinda) using semantic versioning:

- Bugfixes should be released as fast as possible as patch versions.
- New features could be combined and released as minor or patch version upgrades (depending on the _size of the feature_—it's up to maintainers to decide).
- Breaking API changes should be avoided in minor and patch releases.
- Breaking dependencies changes (e.g., dropping older Ruby support) could be released in minor versions.

How to bump a version:

- Change the version number in `lib/capybara/thruster/version.rb` file.
- Update the changelog (add new heading with the version name and date).
- Update the installation documentation if necessary (e.g., during minor and major updates).

2. Push code to GitHub and make sure CI passes.

```sh
git push
```

3. Release a gem.

```sh
gem release -t
git push --tags
```

We use [gem-release](https://github.com/svenfuchs/gem-release) for publishing gems with a single command:

```sh
gem release -t
```

Don't forget to push tags and write release notes on GitHub (if necessary).
Loading

0 comments on commit c72def9

Please sign in to comment.