Skip to content

Commit a8a657b

Browse files
committed
Let users specify the version of ruby to use (default to 2.6).
Closes #2
1 parent 53551dd commit a8a657b

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Role Variables
1919

2020
| Variable | Default | Description |
2121
|--------- | ------- | ----------- |
22+
| rw_ruby | `2.6` | Ruby version. |
2223
| rw_port | `4567` | The port rubywarden should listen on. |
2324
| rw_user | `_rubywarden` | The user that will be added to the system in order to run rubywarden. |
2425
| rw_home | `/var/rubywarden` | Home directory for rw_user. |

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
# defaults file for openbsd-rubywarden
33

4+
rw_ruby: 2.6
45
rw_port: 4567
56
rw_user: _rubywarden
67
rw_group: _rubywarden
@@ -9,3 +10,5 @@ rw_commit: master
910
rw_env: production
1011
rw_home: /var/rubywarden
1112
rw_src: "{{ rw_home }}/src"
13+
14+
rw_ruby_slug: "{{ rw_ruby | regex_replace('\\.', '') }}"

tasks/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
state: installed
77
loop:
88
- git
9-
- ruby24-bundler
9+
- ruby{{ rw_ruby_slug }}-bundler
1010
- sqlite3
1111

1212
- name: add rubywarden group
@@ -36,7 +36,7 @@
3636

3737
- name: run bundler
3838
bundler:
39-
executable: /usr/local/bin/bundle24
39+
executable: /usr/local/bin/bundle{{ rw_ruby_slug }}
4040
gem_path: "{{ rw_home }}/rb"
4141
binstub_directory: "{{ rw_home }}/rb/bin"
4242
chdir: "{{ rw_src }}"
@@ -53,7 +53,7 @@
5353

5454
- name: run db:migrate
5555
when: git_updated.changed or migrate.changed
56-
command: "env RUBYWARDEN_ENV={{ rw_env }} bundle24 exec rake db:migrate"
56+
command: "env RUBYWARDEN_ENV={{ rw_env }} bundle{{ rw_ruby_slug }} exec rake db:migrate"
5757
args:
5858
chdir: "{{ rw_src }}"
5959

templates/rubywarden.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env="RUBYWARDEN_ENV={{ rw_env }} ALLOW_SIGNUPS=1 PATH=$PATH:{{ rw_home }}/rb/bin
99
{% else %}
1010
env="RUBYWARDEN_ENV={{ rw_env }} PATH=$PATH:{{ rw_home }}/rb/bin HOME={{ rw_home }}"
1111
{% endif %}
12-
daemon="/usr/local/bin/bundle24"
12+
daemon="/usr/local/bin/bundle{{ rw_ruby_slug }}"
1313
daemon_flags="exec rackup -p {{ rw_port }} config.ru"
1414
daemon_user="{{ rw_user }}"
1515

@@ -19,7 +19,7 @@ rc_start() {
1919
${rcexec} "cd {{ rw_home }}/src && env ${env} ${daemon} ${daemon_flags}"
2020
}
2121

22-
pexp="ruby24 .*rackup -p {{ rw_port }} config.ru"
22+
pexp="ruby{{ rw_ruby_slug }} .*rackup -p {{ rw_port }} config.ru"
2323

2424
rc_reload=NO
2525
rc_bg=YES

0 commit comments

Comments
 (0)