Skip to content

Commit a77d532

Browse files
authored
Merge branch 'main' into user_management_interface
2 parents 564ac2f + c644d00 commit a77d532

18 files changed

+192
-44
lines changed

.rubocop.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
# Omakase Ruby styling for Rails
22
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
33

4+
Style/TrailingCommaInArguments:
5+
EnforcedStyleForMultiline: consistent_comma
6+
Style/TrailingCommaInArrayLiteral:
7+
EnforcedStyleForMultiline: consistent_comma
8+
Style/TrailingCommaInHashLiteral:
9+
EnforcedStyleForMultiline: consistent_comma
10+
Style/StringLiterals:
11+
Enabled: true
12+
EnforcedStyle: double_quotes
13+
Include:
14+
- "app/**/*"
15+
- "config/**/*"
16+
- "lib/**/*"
17+
- "spec/**/*"
18+
- "Gemfile"
19+
Bundler/OrderedGems:
20+
Enabled: true
21+
422
# Overwrite or add rules to create your own house style
523
#
624
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`

Gemfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ gem "bcrypt", "~> 3.1.7"
2424
gem "tzinfo-data", platforms: %i[ windows jruby ]
2525

2626
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
27+
gem "solid_cable"
2728
gem "solid_cache"
2829
gem "solid_queue"
29-
gem "solid_cable"
30-
gem "faker"
30+
3131
# Reduces boot times through caching; required in config/boot.rb
3232
gem "bootsnap", require: false
3333

@@ -43,19 +43,21 @@ gem "thruster", require: false
4343
group :development, :test do
4444
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
4545
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
46-
46+
gem "faker"
4747
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
4848
gem "brakeman", require: false
49+
gem "factory_bot_rails"
4950

5051
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
5152
gem "rubocop-rails-omakase", require: false
5253

5354
gem "rspec-rails"
54-
gem "factory_bot_rails"
5555
end
5656

5757
group :development do
58+
gem "bullet"
5859
gem "hotwire-spark"
60+
gem "letter_opener"
5961
# Use console on exceptions pages [https://github.com/rails/web-console]
6062
gem "web-console"
6163
end

Gemfile.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ GEM
8888
brakeman (7.0.0)
8989
racc
9090
builder (3.3.0)
91+
bullet (8.0.0)
92+
activesupport (>= 3.0.0)
93+
uniform_notifier (~> 1.11)
9194
capybara (3.40.0)
9295
addressable
9396
matrix
@@ -97,6 +100,8 @@ GEM
97100
rack-test (>= 0.6.3)
98101
regexp_parser (>= 1.5, < 3.0)
99102
xpath (~> 3.2)
103+
childprocess (5.1.0)
104+
logger (~> 1.5)
100105
concurrent-ruby (1.3.5)
101106
connection_pool (2.5.0)
102107
crass (1.0.6)
@@ -162,6 +167,12 @@ GEM
162167
thor (~> 1.3)
163168
zeitwerk (>= 2.6.18, < 3.0)
164169
language_server-protocol (3.17.0.4)
170+
launchy (3.1.0)
171+
addressable (~> 2.8)
172+
childprocess (~> 5.0)
173+
logger (~> 1.6)
174+
letter_opener (1.10.0)
175+
launchy (>= 2.2, < 4)
165176
listen (3.9.0)
166177
rb-fsevent (~> 0.10, >= 0.10.3)
167178
rb-inotify (~> 0.9, >= 0.9.10)
@@ -375,6 +386,7 @@ GEM
375386
unicode-display_width (3.1.4)
376387
unicode-emoji (~> 4.0, >= 4.0.4)
377388
unicode-emoji (4.0.4)
389+
uniform_notifier (1.16.0)
378390
uri (1.0.2)
379391
useragent (0.16.11)
380392
web-console (4.2.1)
@@ -408,6 +420,7 @@ DEPENDENCIES
408420
bcrypt (~> 3.1.7)
409421
bootsnap
410422
brakeman
423+
bullet
411424
capybara
412425
debug
413426
factory_bot_rails
@@ -416,6 +429,7 @@ DEPENDENCIES
416429
importmap-rails
417430
jbuilder
418431
kamal
432+
letter_opener
419433
pg (~> 1.1)
420434
propshaft
421435
puma (>= 5.0)

README.md

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,65 @@ SkillRX is one of many projects initiated and run by Ruby for Good. You can find
1111
# Welcome Contributors!
1212
Thank you for checking out our work. We are in the process of setting up the repository, roadmap, values, and contribution guidelines for the project. We will be adding issues and putting out a call for contributions soon.
1313

14+
[Contribution guidelines for this project](CONTRIBUTING.md)
15+
16+
17+
# Install & Setup
18+
19+
Clone the codebase
20+
```
21+
git clone [email protected]:rubyforgood/skillrx.git
22+
```
23+
24+
Run the setup script to prepare DB and assets
25+
```sh
26+
bin/setup
27+
```
28+
29+
To run the app locally, use:
30+
```
31+
bin/dev
32+
```
33+
34+
To update dependencies in Gemfile, use:
35+
```
36+
bundle install
37+
```
38+
39+
You should see the seed organization by going to:
40+
```
41+
http://localhost:3000/
42+
```
43+
44+
45+
# Running specs
46+
47+
```sh
48+
# Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)
49+
$ bundle exec rspec
50+
51+
# Run all spec files in a single directory (recursively)
52+
$ bundle exec rspec spec/models
53+
54+
# Run a single spec file
55+
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb
56+
57+
# Run a single example from a spec file (by line number)
58+
$ bundle exec rspec spec/controllers/accounts_controller_spec.rb:8
59+
60+
# See all options for running specs
61+
$ bundle exec rspec --help
62+
```
63+
64+
# Setup
65+
66+
Clone this repo and run `bin/setup`. Run `bin/dev` or `bin/server` (if you like Overmind) to start working with app.
67+
1468
# Testing
1569

1670
This project uses:
1771
* `rspec` for testing
1872
* `shoulda-matchers` for expectations
1973
* `factory_bot` for making records
2074

21-
To run tests execute
22-
```
23-
bin/rspec
24-
```
75+
To run tests simply use `bin/rspec`. You can also you `bin/quality` to check for code style issues.

bin/quality

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'pathname'
4+
require 'fileutils'
5+
include FileUtils
6+
7+
# path to your application root.
8+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
9+
10+
def system!(*args)
11+
system(*args) || abort("\n== Command #{args} failed ==")
12+
end
13+
14+
# rubocop
15+
chdir APP_ROOT do
16+
system! 'bin/rubocop --config .rubocop.yml'
17+
end
18+
19+
# brakeman
20+
chdir APP_ROOT do
21+
system! 'bin/brakeman --no-pager --no-progress'
22+
end
23+
24+
# js
25+
chdir APP_ROOT do
26+
system! 'bin/importmap audit'
27+
end

config/environments/development.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
require "active_support/core_ext/integer/time"
22

33
Rails.application.configure do
4+
if defined?(Bullet)
5+
config.after_initialize do
6+
Bullet.enable = true
7+
Bullet.alert = true
8+
Bullet.bullet_logger = true
9+
Bullet.console = true
10+
Bullet.rails_logger = true
11+
Bullet.add_footer = true
12+
end
13+
end
14+
415
# Settings specified here will take precedence over those in config/application.rb.
516

617
# Make code changes take effect immediately without server restart.
@@ -31,6 +42,9 @@
3142
# Store uploaded files on the local file system (see config/storage.yml for options).
3243
config.active_storage.service = :local
3344

45+
config.action_mailer.delivery_method = :letter_opener
46+
config.action_mailer.perform_deliveries = true
47+
3448
# Don't care if the mailer can't send.
3549
config.action_mailer.raise_delivery_errors = false
3650

config/environments/test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
# and recreated between test runs. Don't rely on the data there!
55

66
Rails.application.configure do
7+
if defined?(Bullet)
8+
config.after_initialize do
9+
Bullet.enable = true
10+
Bullet.bullet_logger = true
11+
Bullet.raise = true # raise an error if n+1 query occurs
12+
end
13+
end
14+
715
# Settings specified here will take precedence over those in config/application.rb.
816

917
# While tests run files are not watched, reloading is not necessary.

config/initializers/filter_parameter_logging.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
# Use this to limit dissemination of sensitive information.
55
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
66
Rails.application.config.filter_parameters += [
7-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
7+
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc,
88
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if defined?(LetterOpener)
2+
LetterOpener.configure do |config|
3+
# To overrider the location for message storage.
4+
# Default value is `tmp/letter_opener`
5+
config.location = Rails.root.join("tmp", "my_mails")
6+
7+
# To render only the message body, without any metadata or extra containers or styling.
8+
# Default value is `:default` that renders styled message with showing useful metadata.
9+
config.message_template = :light
10+
11+
# To change default file URI scheme you can provide `file_uri_scheme` config.
12+
# It might be useful when you use WSL (Windows Subsystem for Linux) and default
13+
# scheme doesn't work for you.
14+
# Default value is blank
15+
config.file_uri_scheme = "file://///wsl$/Ubuntu-18.04"
16+
end
17+
end

spec/models/region_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'rails_helper'
1+
require "rails_helper"
22

33
RSpec.describe Region, type: :model do
44
it { should validate_presence_of(:name) }

0 commit comments

Comments
 (0)