Skip to content

Commit cfe7a9c

Browse files
feat: Add DevContainer, EditorConfig, and Justfile
Introduces a comprehensive local development environment setup: - Adds an `.editorconfig` file for consistent coding styles. - Implements a VS Code DevContainer configuration (`.devcontainer/devcontainer.json`) using a Ruby 3.4 image, with VS Code extensions for Ruby, installation of 'just', and automatic bundle install. - Creates a `Justfile` with common development tasks such as `setup`, `console`, and `list`. - Updates `README.md` to include a section on the new development environment setup.
1 parent b3c6270 commit cfe7a9c

File tree

4 files changed

+90
-1
lines changed

4 files changed

+90
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "Ruby Dev Container",
3+
"image": "mcr.microsoft.com/devcontainers/ruby:0-3.4-bullseye",
4+
"customizations": {
5+
"vscode": {
6+
"extensions": [
7+
"rebornix.Ruby",
8+
"Shopify.ruby-lsp",
9+
"EditorConfig.EditorConfig",
10+
"yzhang.markdown-all-in-one",
11+
"redhat.vscode-yaml",
12+
"esbenp.prettier-vscode"
13+
],
14+
"settings": {
15+
"terminal.integrated.shell.linux": "/bin/bash",
16+
"[ruby]": {
17+
"editor.defaultFormatter": "Shopify.ruby-lsp",
18+
"editor.formatOnSave": true
19+
}
20+
}
21+
}
22+
},
23+
"features": {
24+
// If a standard feature for 'just' becomes available, it could be listed here.
25+
// For example: "ghcr.io/devcontainers-contrib/features/just:1": {}
26+
},
27+
// Using onCreateCommand to ensure 'just' is available when the container is ready.
28+
// This command runs inside the container.
29+
"onCreateCommand": "sudo apt-get update && sudo apt-get install -y curl && sudo curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin",
30+
"postCreateCommand": "bundle install",
31+
"remoteUser": "vscode"
32+
}

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
insert_final_newline = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{yaml,yml}]
18+
indent_size = 2

Justfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Justfile for controller_setter_pattern
2+
3+
# Default task: list available commands or run tests
4+
default: test
5+
6+
# Setup development environment
7+
setup:
8+
bundle install
9+
10+
# Run RSpec tests
11+
test:
12+
bundle exec rspec
13+
14+
# Run a Ruby console session
15+
console:
16+
bundle exec irb
17+
18+
# Placeholder for linter (e.g., RuboCop)
19+
lint:
20+
echo "Linter not yet configured. Add RuboCop or other linter."
21+
22+
# List available tasks (simple version)
23+
list:
24+
@echo "Available tasks:"
25+
@echo " setup - Install dependencies"
26+
@echo " test - Run RSpec tests"
27+
@echo " console - Start IRB console"
28+
@echo " lint - Run linter (not yet configured)"
29+
@echo " list - List available tasks"

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,24 @@
66

77
Pattern for assign instance variables in controllers for use in views, etc.
88

9-
## Instalation
9+
## Installation
1010

1111
Add `controller_setter_pattern` to your Gemfile:
1212

1313
```ruby
1414
gem "controller_setter_pattern"
1515
```
1616

17+
## Development Environment
18+
19+
This project includes a [VS Code DevContainer](https://code.visualstudio.com/docs/remote/containers) configuration for a consistent development environment.
20+
Open this project in a DevContainer to automatically get all dependencies and tools set up.
21+
22+
Common development tasks are managed using a `Justfile`. To see available commands, run:
23+
```sh
24+
just list
25+
```
26+
1727
## Basic usage
1828

1929
Before setter pattern:

0 commit comments

Comments
 (0)