Skip to content

Commit c951b56

Browse files
committed
Initial commit
0 parents  commit c951b56

File tree

20 files changed

+589
-0
lines changed

20 files changed

+589
-0
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Ruby
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
name: Ruby ${{ matrix.ruby }}
14+
strategy:
15+
matrix:
16+
ruby:
17+
- '3.1.3'
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Ruby
22+
uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: ${{ matrix.ruby }}
25+
bundler-cache: true
26+
- name: Run the default task
27+
run: bundle exec rake

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/

.standard.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# For available configuration options, see:
2+
# https://github.com/standardrb/standard
3+
ruby_version: 2.6

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## [Unreleased]
2+
3+
## [0.1.0] - 2024-04-22
4+
5+
- Initial release

CODE_OF_CONDUCT.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment for our community include:
12+
13+
* Demonstrating empathy and kindness toward other people
14+
* Being respectful of differing opinions, viewpoints, and experiences
15+
* Giving and gracefully accepting constructive feedback
16+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17+
* Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior include:
20+
21+
* The use of sexualized language or imagery, and sexual attention or
22+
advances of any kind
23+
* Trolling, insulting or derogatory comments, and personal or political attacks
24+
* Public or private harassment
25+
* Publishing others' private information, such as a physical or email
26+
address, without their explicit permission
27+
* Other conduct which could reasonably be considered inappropriate in a
28+
professional setting
29+
30+
## Enforcement Responsibilities
31+
32+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33+
34+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35+
36+
## Scope
37+
38+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39+
40+
## Enforcement
41+
42+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [email protected]. All complaints will be reviewed and investigated promptly and fairly.
43+
44+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45+
46+
## Enforcement Guidelines
47+
48+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49+
50+
### 1. Correction
51+
52+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53+
54+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55+
56+
### 2. Warning
57+
58+
**Community Impact**: A violation through a single incident or series of actions.
59+
60+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61+
62+
### 3. Temporary Ban
63+
64+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65+
66+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67+
68+
### 4. Permanent Ban
69+
70+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71+
72+
**Consequence**: A permanent ban from any sort of public interaction within the community.
73+
74+
## Attribution
75+
76+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78+
79+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80+
81+
[homepage]: https://www.contributor-covenant.org
82+
83+
For answers to common questions about this code of conduct, see the FAQ at
84+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.

Gemfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
# Specify your gem's dependencies in capistrano-solid_queue.gemspec
6+
gemspec
7+
8+
gem "rake", "~> 13.0"
9+
10+
gem "minitest", "~> 5.16"
11+
12+
gem "standard", "~> 1.3"

Gemfile.lock

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
PATH
2+
remote: .
3+
specs:
4+
capistrano-solid_queue (0.1.0)
5+
capistrano (>= 3.0)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
airbrussh (1.4.1)
11+
sshkit (>= 1.6.1, != 1.7.0)
12+
ast (2.4.2)
13+
capistrano (3.17.1)
14+
airbrussh (>= 1.0.0)
15+
i18n
16+
rake (>= 10.0.0)
17+
sshkit (>= 1.9.0)
18+
concurrent-ruby (1.2.0)
19+
i18n (1.12.0)
20+
concurrent-ruby (~> 1.0)
21+
json (2.6.3)
22+
language_server-protocol (3.17.0.3)
23+
minitest (5.22.3)
24+
net-scp (4.0.0)
25+
net-ssh (>= 2.6.5, < 8.0.0)
26+
net-ssh (7.0.1)
27+
parallel (1.22.1)
28+
parser (3.2.1.0)
29+
ast (~> 2.4.1)
30+
rainbow (3.1.1)
31+
rake (13.0.6)
32+
regexp_parser (2.7.0)
33+
rexml (3.2.5)
34+
rubocop (1.44.1)
35+
json (~> 2.3)
36+
parallel (~> 1.10)
37+
parser (>= 3.2.0.0)
38+
rainbow (>= 2.2.2, < 4.0)
39+
regexp_parser (>= 1.8, < 3.0)
40+
rexml (>= 3.2.5, < 4.0)
41+
rubocop-ast (>= 1.24.1, < 2.0)
42+
ruby-progressbar (~> 1.7)
43+
unicode-display_width (>= 2.4.0, < 3.0)
44+
rubocop-ast (1.26.0)
45+
parser (>= 3.2.1.0)
46+
rubocop-performance (1.15.2)
47+
rubocop (>= 1.7.0, < 2.0)
48+
rubocop-ast (>= 0.4.0)
49+
ruby-progressbar (1.11.0)
50+
sshkit (1.21.3)
51+
net-scp (>= 1.1.2)
52+
net-ssh (>= 2.8.0)
53+
standard (1.24.3)
54+
language_server-protocol (~> 3.17.0.2)
55+
rubocop (= 1.44.1)
56+
rubocop-performance (= 1.15.2)
57+
unicode-display_width (2.4.2)
58+
59+
PLATFORMS
60+
arm64-darwin-22
61+
arm64-darwin-23
62+
63+
DEPENDENCIES
64+
capistrano-solid_queue!
65+
minitest (~> 5.16)
66+
rake (~> 13.0)
67+
standard (~> 1.3)
68+
69+
BUNDLED WITH
70+
2.4.7

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 Codeur SAS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Capistrano Systemd integration for SolidQueue
2+
3+
Adds the following capistrano commands:
4+
5+
```sh
6+
solid_queue:generate # Generate locally solid_queue systemd service unit file
7+
solid_queue:disable # Disable solid_queue systemd service
8+
solid_queue:enable # Enable solid_queue systemd service
9+
solid_queue:install # Install solid_queue systemd service
10+
solid_queue:reload # Reload solid_queue service via systemd
11+
solid_queue:restart # Restart solid_queue service via systemd
12+
solid_queue:start # Start solid_queue service via systemd
13+
solid_queue:status # Get solid_queue service status via systemd
14+
solid_queue:stop # Stop solid_queue service via systemd
15+
solid_queue:uninstall # Uninstall solid_queue systemd service
16+
```
17+
18+
19+
## Installation
20+
21+
Add this line to your application's Gemfile:
22+
23+
```ruby
24+
group :development do
25+
gem 'capistrano-solid_queue', require: false
26+
end
27+
```
28+
29+
And then execute:
30+
31+
$ bundle
32+
33+
```ruby
34+
# Capfile
35+
36+
require 'capistrano/solid_queue'
37+
install_plugin Capistrano::SolidQueue::Systemd
38+
```
39+
40+
To prevent loading [the hooks](lib/capistrano/solid_queue.rb) of the plugin, add false to the load_hooks param.
41+
```ruby
42+
# Capfile
43+
44+
install_plugin Capistrano::SolidQueue, load_hooks: false
45+
```
46+
47+
Then run once
48+
49+
```sh
50+
bundle exec cap production solid_queue:install
51+
```
52+
53+
for the initial setup. This will copy a [`systemd` service definition](lib/capistrano/templates/solid_queue.service.erb) to `~/.config/systemd/user/<application>_solid_queue_<stage>.service` on your server marked with Capistrano role `db`.
54+
55+
It will also `enable` it in `systemd`, allowing to to then run commands such as:
56+
57+
```sh
58+
systemctl --user status your_app_solid_queue_production
59+
systemctl --user start your_app_solid_queue_production
60+
systemctl --user stop your_app_solid_queue_production
61+
systemctl --user reload your_app_solid_queue_production
62+
systemctl --user restart your_app_solid_queue_production
63+
```
64+
65+
through their Capistrano counterparts, ex: `bundle exec cap solid_queue:restart`.
66+
67+
## Usage
68+
69+
The plugin has registered a Capistrano `hook` to run `bundle exec cap solid_queue:restart` after deploy.
70+
See [`#register_hooks`](lib/capistrano/solid_queue.rb)
71+
72+
## Development
73+
74+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
75+
76+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
77+
78+
## Contributing
79+
80+
Bug reports and pull requests are welcome on GitHub at https://github.com/codeur/capistrano-solid_queue.
81+
82+
## License
83+
84+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
85+
86+
## Code of Conduct
87+
88+
Everyone interacting in the Capistrano::SolidQueue project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/capistrano-solid_queue/blob/main/CODE_OF_CONDUCT.md).
89+
90+
## Credits
91+
92+
The structure and code of the gem are heavily inspired by [`capistrano-good_job`](https://github.com/mtomov/capistrano-good-job)'s [`systemd` tasks](https://github.com/seuros/capistrano-puma/blob/master/lib/capistrano/tasks/systemd.rake)
93+
and [(How I) Deploy Solid Queue with Capistrano](https://world.hey.com/robzolkos/how-i-deploy-solid-queue-with-capistrano-487b4a31) article.

Rakefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
require "bundler/gem_tasks"
4+
require "minitest/test_task"
5+
6+
Minitest::TestTask.create
7+
8+
require "standard/rake"
9+
10+
task default: %i[test standard]

0 commit comments

Comments
 (0)