Skip to content

Commit

Permalink
Add VSCode devcontainer configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer committed Oct 3, 2023
1 parent e31f608 commit d906e5a
Show file tree
Hide file tree
Showing 15 changed files with 184 additions and 58 deletions.
11 changes: 11 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/app",
"postCreateCommand": "bundle install && ~/.local/bin/pre-commit install",
"customizations": {
"vscode": {
"extensions": ["GitHub.vscode-github-actions", "GitHub.vscode-pull-request-github", "Shopify.ruby-lsp", "ms-azuretools.vscode-docker"]
}
}
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.bundle/
/.byebug_history
/log/
/pkg/
/workflow/
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/mattlqx/pre-commit-ruby
rev: v1.3.5
hooks:
- id: rubocop
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ RSpec/ContextWording:
Enabled: false
RSpec/FilePath:
Enabled: false
RSpec/SpecFilePathFormat:
Enabled: false
RSpec/VerifiedDoubles:
Enabled: false
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "ruby_lsp",
"request": "launch",
"name": "Run Specs",
"program": "rspec"
},
{
"type": "ruby_lsp",
"request": "launch",
"name": "Run Current Spec",
"program": "rspec ${file}"
}
]
}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ruby:3.1

RUN apt update && \
apt install -y --no-install-recommends \
less \
pipx \
postgresql-client

WORKDIR /app

RUN /bin/bash -lc "pipx install pre-commit && gem update --system"

ENV PATH="${PATH}:/app/bin"

COPY Gemfile *.gemspec *.lock /app/
COPY lib/active_record/pg_extensions/version.rb /app/lib/active_record/pg_extensions/
RUN /bin/bash -lc "bundle install"
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

plugin "bundler-multilock", "1.0.6"
plugin "bundler-multilock", "1.0.11"
return unless Plugin.installed?("bundler-multilock")

Plugin.send(:load_plugin, "bundler-multilock")
Expand Down
61 changes: 37 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activesupport (7.0.7.2)
activemodel (7.0.8)
activesupport (= 7.0.8)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -38,13 +38,19 @@ GEM
ast (2.4.2)
base64 (0.1.1)
builder (3.2.4)
byebug (11.1.3)
concurrent-ruby (1.2.2)
crass (1.0.6)
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
diff-lcs (1.5.0)
erubi (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.8.1)
rdoc
reline (>= 0.3.8)
json (2.6.3)
language_server-protocol (3.17.0.3)
loofah (2.21.3)
Expand All @@ -67,6 +73,8 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.4)
psych (5.1.0)
stringio
racc (1.7.1)
rack (2.2.8)
rack-test (2.1.0)
Expand All @@ -78,16 +86,20 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rdoc (6.5.0)
psych (>= 4.0.0)
regexp_parser (2.8.1)
reline (0.3.9)
io-console (~> 0.5)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -102,7 +114,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.56.2)
rubocop (1.56.4)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand All @@ -116,28 +128,29 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-inst (1.0.2)
rubocop (~> 1.50)
rubocop-performance (~> 1.17)
rubocop-performance (1.19.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.23.2)
rubocop-rspec (2.24.1)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
stringio (3.0.8)
thor (1.2.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
zeitwerk (2.6.11)
unicode-display_width (2.5.0)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin
Expand All @@ -148,7 +161,7 @@ PLATFORMS
DEPENDENCIES
activerecord-pg-extensions!
appraisal (~> 2.4)
byebug (~> 11.1)
debug (~> 1.8)
pg (~> 1.2)
rake (~> 13.0)
rspec (~> 3.0)
Expand All @@ -157,4 +170,4 @@ DEPENDENCIES
rubocop-rspec (~> 2.3)

BUNDLED WITH
2.4.19
2.4.20
61 changes: 37 additions & 24 deletions Gemfile.rails-7.0.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activesupport (7.0.7.2)
activemodel (7.0.8)
activesupport (= 7.0.8)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activesupport (7.0.8)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand All @@ -38,13 +38,19 @@ GEM
ast (2.4.2)
base64 (0.1.1)
builder (3.2.4)
byebug (11.1.3)
concurrent-ruby (1.2.2)
crass (1.0.6)
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
diff-lcs (1.5.0)
erubi (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.8.1)
rdoc
reline (>= 0.3.8)
json (2.6.3)
language_server-protocol (3.17.0.3)
loofah (2.21.3)
Expand All @@ -67,6 +73,8 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.4)
psych (5.1.0)
stringio
racc (1.7.1)
rack (2.2.8)
rack-test (2.1.0)
Expand All @@ -78,16 +86,20 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
rdoc (6.5.0)
psych (>= 4.0.0)
regexp_parser (2.8.1)
reline (0.3.9)
io-console (~> 0.5)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -102,7 +114,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.56.2)
rubocop (1.56.4)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand All @@ -116,28 +128,29 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.23.1)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-inst (1.0.2)
rubocop (~> 1.50)
rubocop-performance (~> 1.17)
rubocop-performance (1.19.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.23.2)
rubocop-rspec (2.24.1)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
stringio (3.0.8)
thor (1.2.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
zeitwerk (2.6.11)
unicode-display_width (2.5.0)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin
Expand All @@ -149,7 +162,7 @@ DEPENDENCIES
activerecord (~> 7.0.0)
activerecord-pg-extensions!
appraisal (~> 2.4)
byebug (~> 11.1)
debug (~> 1.8)
pg (~> 1.2)
rake (~> 13.0)
rspec (~> 3.0)
Expand All @@ -158,4 +171,4 @@ DEPENDENCIES
rubocop-rspec (~> 2.3)

BUNDLED WITH
2.4.19
2.4.20
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ See individual classes for available methods.

## Development

You will need Postgres locally to test. As long as `psql` can connect with no arguments, you're fine. Otherwise use environment variables
as described at https://www.postgresql.org/docs/current/libpq-envars.html to configure it. The database will be created automatically.
Development requires Docker. After checking out the repo, run `docker compose build` to install dependencies.

`rake` will run both tests and Rubocop.
`docker compose run --rm app rake` will run both tests and Rubocop.

After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
If using VSCode, simply click "Reopen in Container" when it pops up.

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).
To release a new version, update the version number in `version.rb`, and then run `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).

## Contributing

Expand Down
Loading

0 comments on commit d906e5a

Please sign in to comment.