modulorails 1.5.2.pre.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/skills/release-modulorails/SKILL.md +150 -0
  3. data/.rubocop.yml +2 -1
  4. data/CHANGELOG.md +55 -8
  5. data/Gemfile.lock +75 -26
  6. data/README.md +69 -9
  7. data/lib/generators/modulorails/claude_code/claude_code_generator.rb +64 -0
  8. data/lib/generators/modulorails/claude_code/templates/.gitlab-ci.yml.tt +120 -0
  9. data/lib/generators/modulorails/claude_code/templates/.modulorails-gitlab-ci +6 -0
  10. data/lib/generators/modulorails/claude_code/templates/bin/init-firewall.sh.tt +118 -0
  11. data/lib/generators/modulorails/docker/compose/compose_generator.rb +7 -6
  12. data/lib/generators/modulorails/docker/config/config_generator.rb +11 -5
  13. data/lib/generators/modulorails/docker/config/templates/config/database.yml.tt +7 -2
  14. data/lib/generators/modulorails/docker/devcontainer/devcontainer_generator.rb +52 -0
  15. data/lib/generators/modulorails/docker/devcontainer/templates/devcontainer/Dockerfile.tt +53 -0
  16. data/lib/generators/modulorails/docker/devcontainer/templates/devcontainer/compose.yml.tt +97 -0
  17. data/lib/generators/modulorails/docker/devcontainer/templates/devcontainer/devcontainer.json.tt +80 -0
  18. data/lib/generators/modulorails/docker/docker_generator.rb +7 -0
  19. data/lib/generators/modulorails/docker/dockerfile/dockerfile_generator.rb +15 -11
  20. data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/{rails/Dockerfile.prod.tt → Dockerfile.prod.tt} +31 -12
  21. data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/dockerignore.tt +120 -0
  22. data/lib/generators/modulorails/docker/entrypoint/entrypoint_generator.rb +11 -5
  23. data/lib/generators/modulorails/docker/entrypoint/templates/entrypoints/docker-entrypoint.sh.tt +5 -0
  24. data/lib/generators/modulorails/githooks/githooks_generator.rb +5 -3
  25. data/lib/generators/modulorails/githooks/templates/dc.sh +30 -0
  26. data/lib/generators/modulorails/githooks/templates/dcr.sh +47 -0
  27. data/lib/generators/modulorails/githooks/templates/post-rewrite.sh +1 -1
  28. data/lib/generators/modulorails/githooks/templates/pre-merge-commit.sh +1 -1
  29. data/lib/generators/modulorails/githooks/templates/refresh_generations.sh +17 -9
  30. data/lib/generators/modulorails/gitlabci/gitlabci_generator.rb +7 -1
  31. data/lib/generators/modulorails/gitlabci/templates/.gitlab-ci.yml.tt +15 -13
  32. data/lib/generators/modulorails/gitlabci/templates/bin/test.sh.tt +36 -0
  33. data/lib/generators/modulorails/gitlabci/templates/config/deploy/production.yaml.tt +4 -4
  34. data/lib/generators/modulorails/gitlabci/templates/config/deploy/review.yaml.tt +4 -4
  35. data/lib/generators/modulorails/gitlabci/templates/config/deploy/staging.yaml.tt +7 -7
  36. data/lib/generators/modulorails/moduloproject/moduloproject_generator.rb +8 -3
  37. data/lib/generators/modulorails/moduloproject/templates/config/environments/production.rb.tt +21 -51
  38. data/lib/generators/modulorails/rubocop/rubocop_generator.rb +8 -3
  39. data/lib/generators/modulorails/rubocop/templates/rubocop.yml.tt +7 -1
  40. data/lib/generators/modulorails/self_update/self_update_generator.rb +4 -0
  41. data/lib/generators/modulorails/sidekiq/sidekiq_generator.rb +95 -38
  42. data/lib/generators/modulorails/sidekiq/templates/config/initializers/sidekiq.rb.tt +4 -4
  43. data/lib/modulorails/configuration.rb +17 -7
  44. data/lib/modulorails/data.rb +41 -12
  45. data/lib/modulorails/generators/base.rb +1 -1
  46. data/lib/modulorails/railtie.rb +4 -1
  47. data/lib/modulorails/version.rb +1 -1
  48. data/lib/modulorails.rb +15 -5
  49. metadata +17 -10
  50. data/lib/generators/modulorails/docker/compose/templates/docker-compose.yml.tt +0 -81
  51. data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/modulotech/Dockerfile.prod.tt +0 -66
  52. data/lib/generators/modulorails/docker/dockerfile/templates/dockerfiles/modulotech/Dockerfile.tt +0 -30
  53. data/lib/generators/modulorails/docker/entrypoint/templates/entrypoints/webpack-entrypoint.sh.tt +0 -7
  54. data/lib/generators/modulorails/githooks/templates/dockeruby.rb +0 -124
  55. data/lib/generators/modulorails/sidekiq/templates/entrypoints/sidekiq-entrypoint.sh.tt +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee7efcc2d3da4b18443714b9b6c28d0b72363dd9eb796bc3a315a3083eef7fa9
4
- data.tar.gz: eb1694b391cd532700a3121261531078a1031c7b56c0413d02b9d1e8e3ab45a4
3
+ metadata.gz: 1be41ee3e5898a6e283359c6df4525cd77cec83e6a37d255996316a305511722
4
+ data.tar.gz: dec467bed1e055a3c0d11c948563eaa6eead755be40e6b7185cbb2678f54e180
5
5
  SHA512:
6
- metadata.gz: 636da5294080814834c215a2296e2b0b0726c1eb603318782b2b8854d65c96d940ef4ef0a0f72267e9b02c5a3eda44bd69c26b9a09ca3fc9a3cbcaa7b6038c52
7
- data.tar.gz: 3365fb68e3be8bd2a490766610871046ae5d2d64e2dfe6c472ebbb95b28522eb5bf44dbd244bc35a2a69eaee996660974e83b05f1286cf9ebee089b0fa74c0cf
6
+ metadata.gz: a69ef3ab27fd2e422e5bc7ce588bfa46ca273281ca2e43de7336048b038c1328b22a970066856bd7320df0b144e637348e7d1139cce614c2d068083247d3f666
7
+ data.tar.gz: 7952e968f9bdf475bfe2806933e7e5e5114e8418891dc4dc09809438eb20c804e48a1d85bca8ed558636db64c1b0eca501ea57da5ae03b0eaf4b943a0c466478
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: release-modulorails
3
+ description: Release a new version of the Modulorails Ruby gem to RubyGems. Handles version bump, CHANGELOG, commit, tag, push, GitHub release, and gem publication. Trigger this skill whenever the user asks to release, publish, ship, bump, or cut a new version of modulorails — even if they don't explicitly mention "release" or specify a version (ask for it if missing).
4
+ ---
5
+
6
+ # Release the Modulorails gem
7
+
8
+ Run the full release pipeline for the `modulorails` gem. The user provides the version number (e.g. `1.7.0`) without the `v` prefix. If they omit it, ask before proceeding.
9
+
10
+ ## Conventions
11
+
12
+ - `<version>`: the version number without `v` prefix (e.g. `1.7.0`)
13
+ - All commands run from the project root: `/home/claude/modulorails`
14
+ - GitHub repo: `https://github.com/moduloTech/modulorails`
15
+ - Gem published to: `https://rubygems.org/gems/modulorails`
16
+ - Tag format: `v<version>` (e.g. `v1.7.0`)
17
+ - The gemspec has `rubygems_mfa_required = 'true'`, so `gem push` will prompt for an OTP. Tell the user to have their authenticator app ready before step 7.
18
+
19
+ ## Steps
20
+
21
+ ### 1. Pre-flight check
22
+
23
+ - Run `git status` and `git diff` to surface any uncommitted changes.
24
+ - The release commit should only touch `lib/modulorails/version.rb` and `CHANGELOG.md`. If unrelated changes are pending, ask the user whether to include them, stash them, or abort.
25
+ - Confirm the current branch is `master` (the project's main branch) unless the user specified otherwise.
26
+
27
+ ### 2. Bump the version constant
28
+
29
+ - Edit `lib/modulorails/version.rb` and replace the value of `VERSION` with `<version>`.
30
+ - The constant looks like: `VERSION = '1.6.0'.freeze` — keep the single quotes and `.freeze` to match the existing style.
31
+
32
+ ### 3. Update CHANGELOG.md
33
+
34
+ The Modulorails CHANGELOG uses its own format — **do not** convert it to Keep-a-Changelog. The structure is:
35
+
36
+ ```
37
+ # Unreleased
38
+
39
+ # <version>
40
+
41
+ <one-line summary, optional>
42
+
43
+ ## Features
44
+ - ...
45
+
46
+ ## Improvements
47
+ - ...
48
+
49
+ ## Fixes
50
+ - ...
51
+
52
+ ## Deprecations (will be removed in <next major>)
53
+ - ...
54
+ ```
55
+
56
+ To update:
57
+
58
+ - Replace the `# Unreleased` heading with `# <version>` (and add a fresh `# Unreleased` line above it for the next cycle).
59
+ - Categorize changes under `## Features`, `## Improvements`, `## Fixes`, or `## Deprecations` as appropriate. Omit sections that have no entries.
60
+ - Run `git log --oneline <last-tag>..HEAD` to find the commits since the previous release; use those as the source of changelog entries. Phrase entries as user-facing descriptions, not commit-message echoes.
61
+
62
+ ### 4. Commit the bump
63
+
64
+ Stage **only** `lib/modulorails/version.rb` and `CHANGELOG.md`, then commit. Match the project's existing release commit style — prior bumps use messages like `Bump modulorails to 1.6.0`:
65
+
66
+ ```bash
67
+ git add lib/modulorails/version.rb CHANGELOG.md
68
+ git commit -m "$(cat <<'EOF'
69
+ Bump modulorails to <version>
70
+
71
+ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
72
+ EOF
73
+ )"
74
+ ```
75
+
76
+ (Use whichever Co-Authored-By trailer matches the model running the session — don't hardcode an older one.)
77
+
78
+ ### 5. Tag
79
+
80
+ ```bash
81
+ git tag -a v<version> -m "v<version>"
82
+ ```
83
+
84
+ ### 6. Push commit and tag
85
+
86
+ ```bash
87
+ git push origin master
88
+ git push origin v<version>
89
+ ```
90
+
91
+ ### 7. Build and push the gem to RubyGems
92
+
93
+ ```bash
94
+ gem build modulorails.gemspec
95
+ gem push modulorails-<version>.gem
96
+ ```
97
+
98
+ `gem push` will prompt for the OTP because `rubygems_mfa_required` is set in the gemspec. The user must enter it interactively — surface the prompt to them.
99
+
100
+ If the user is unauthenticated (`You don't have any sources that contain this gem.` or similar), they need to run `gem signin` first. Don't try to manage their RubyGems credentials.
101
+
102
+ After a successful push, delete the local `.gem` artifact: `rm modulorails-<version>.gem`.
103
+
104
+ ### 8. Create the GitHub release
105
+
106
+ ```bash
107
+ gh release create v<version> --title "v<version>" --notes "<notes>"
108
+ ```
109
+
110
+ Notes should mirror the CHANGELOG section for this version (markdown-formatted). Pass the body via a HEREDOC if it's multi-line, e.g.:
111
+
112
+ ```bash
113
+ gh release create v<version> --title "v<version>" --notes "$(cat <<'EOF'
114
+ ## Features
115
+ - ...
116
+
117
+ ## Fixes
118
+ - ...
119
+ EOF
120
+ )"
121
+ ```
122
+
123
+ ### 9. Confirm
124
+
125
+ - Print the GitHub release URL (`gh release view v<version> --json url -q .url`).
126
+ - Print the RubyGems URL: `https://rubygems.org/gems/modulorails/versions/<version>`.
127
+ - Remind the user that downstream apps can pull the new version via `bundle update modulorails`.
128
+
129
+ ## Alternative: `bundle exec rake release`
130
+
131
+ The Rakefile already loads `bundler/gem_tasks`, so `bundle exec rake release` will, in one shot:
132
+
133
+ 1. Verify the working tree is clean.
134
+ 2. Build `modulorails-<version>.gem`.
135
+ 3. Tag `v<version>` from the current HEAD.
136
+ 4. Push the tag to `origin`.
137
+ 5. `gem push` to RubyGems.
138
+
139
+ Use this only when:
140
+ - The version bump and CHANGELOG are already committed and pushed (it does **not** create the bump commit).
141
+ - The user explicitly asks for the shortcut.
142
+
143
+ The downsides vs. the step-by-step flow: if `gem push` fails (bad OTP, network), the tag is already pushed and you need to clean up manually. The manual flow keeps tag and gem push independent so each failure mode is recoverable on its own.
144
+
145
+ ## Troubleshooting
146
+
147
+ - **`gem push` fails with 401 / OTP rejected**: the OTP window is short — re-run with a fresh code. Don't re-tag or re-commit; just retry the `gem push` step.
148
+ - **Tag already exists locally but push fails**: `git tag -d v<version>` and recreate after fixing the underlying issue. Never force-push a tag that's already on RubyGems.
149
+ - **`gem build` complains about missing files**: the gemspec uses `git ls-files` to enumerate files, so untracked files won't be in the gem. Stage them first if they belong, or `.gitignore` them if not.
150
+ - **GitHub release notes don't render properly**: HEREDOC quoting matters — use `<<'EOF'` (with quotes) to prevent shell expansion in the notes body.
data/.rubocop.yml CHANGED
@@ -10,7 +10,8 @@
10
10
  # See https://docs.rubocop.org/rubocop/configuration
11
11
 
12
12
  # Enabling Rails-specific cops.
13
- require: rubocop-rails
13
+ plugins:
14
+ - rubocop-rails
14
15
 
15
16
  inherit_mode:
16
17
  merge:
data/CHANGELOG.md CHANGED
@@ -4,15 +4,62 @@ This file is used to list changes made in each version of the gem.
4
4
 
5
5
  # Unreleased
6
6
 
7
- # 1.5.2
7
+ # 1.7.0
8
+
9
+ ## Improvements
10
+
11
+ - Make the Rubocop generator idempotent: `.rubocop.yml` is no longer rewritten on every Rails boot. Like the other generators, `RubocopGenerator` now uses the `.modulorails.yml` keepfile and a `VERSION` constant — the config is only (re)generated on the first run or when the generator's version is bumped.
12
+
13
+ ## Fixes
14
+
15
+ - Fix `initialize_from_git` when the git repository is not available (no `.git`, missing `git` binary, or no `origin` remote): rescue the error, warn, and leave `repository` as `nil` instead of crashing the application boot.
16
+ - Fix `send_data` and `self_update` crashing with `NoMethodError` when `Rails.logger` is `nil` (e.g. early initialization or minimal apps): use safe navigation on debug logging.
17
+
18
+ ## Internal
19
+
20
+ - Add `release-modulorails` Claude Code skill (`.claude/skills/release-modulorails/`) to standardize the gem release workflow.
21
+
22
+ # 1.6.0
23
+
24
+ The devcontainer release.
25
+
26
+ ## Features
27
+
28
+ - Add devcontainer support (`.devcontainer/` with Dockerfile, compose.yml, devcontainer.json).
29
+ - Add Claude Code generator for devcontainer (native installation).
30
+ - Add `Bun` JS engine support.
31
+ - Add `bin/dc` and `bin/dcr` scripts to wrap `docker compose` commands.
32
+
33
+ ## Improvements
34
+
35
+ - Split DockerGenerator in multiple sub-generators for individual versioning.
36
+ - Merge all keepfiles into `.modulorails.yml`.
37
+ - Force overwrite of keepfile and config files.
38
+ - Speed-up git hooks by checking if regeneration is needed in `refresh_generations.sh`.
39
+ - Add `Modulorails.deprecator` for Rails 7.2+ compatibility.
40
+ - Wrap health_check initializer in `reloader.to_prepare` block.
41
+ - Update Rubocop rules:
42
+ - Allow `class_methods`/`included` blocks in Concerns to break `Metrics/BlockLength`.
43
+ - Allow commented lines to break `Layout/LineLength`.
44
+ - Update generators for devcontainers (Sidekiq, GitLab CI).
45
+ - Update production.rb template for Rails 8.
46
+ - Replace old `Dockerfile.prod` with Rails-standard one.
47
+
48
+ ## Fixes
8
49
 
9
50
  - Fix typo in `database.yml` template for test database.
10
- - Fix removal of rails' server's pidfile in docker entrypoint.
11
- - Split DockerGenerator in multiple sub-generators to version each one individually.
12
- - Merge all keepfiles in one.
13
- - Wrap health_check initializer in a reloader.to_prepare block.
14
- - Always use latest ruby in dockeruby.
15
- - Add Modulorails.deprecator for compatibility with Rails 7.2.
51
+ - Fix removal of rails server's pidfile in docker entrypoint.
52
+
53
+ ## Deprecations (will be removed in 2.0)
54
+
55
+ - Configuration options: `config.staging_url`, `config.review_base_url`, `config.production_url`, `config.no_auto_update`.
56
+ - `Modulorails::SelfUpdateGenerator`.
57
+ - Infrastructure generators (use Moduloproject 3.0, available later):
58
+ - `DockerGenerator` and all sub-generators
59
+ - `GitlabciGenerator`
60
+ - `ClaudeCodeGenerator`
61
+ - `ModuloprojectGenerator`
62
+ - `SidekiqGenerator`
16
63
 
17
64
  # 1.5.1
18
65
 
@@ -136,7 +183,7 @@ Fixes, updates and health_check release.
136
183
  Docker release.
137
184
 
138
185
  - Add generator for Docker.
139
- - Use templates for Gitlabci generator.
186
+ - Use templates for Gitlabci generator.
140
187
 
141
188
  # 0.2.3
142
189
 
data/Gemfile.lock CHANGED
@@ -1,12 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modulorails (0.4.0)
4
+ modulorails (1.6.0)
5
+ bundler-audit (~> 0.9.1)
5
6
  git (~> 1.7, >= 1.7.0)
6
7
  health_check (~> 3.1)
7
- httparty
8
- i18n
8
+ httparty (>= 0.13.3)
9
+ i18n (>= 0.9.5)
9
10
  railties (>= 4.2.0)
11
+ rubocop (>= 1.28.2)
12
+ rubocop-rails (>= 2.14.2)
10
13
 
11
14
  GEM
12
15
  remote: https://rubygems.org/
@@ -34,44 +37,64 @@ GEM
34
37
  i18n (>= 1.6, < 2)
35
38
  minitest (>= 5.1)
36
39
  tzinfo (~> 2.0)
40
+ addressable (2.9.0)
41
+ public_suffix (>= 2.0.2, < 8.0)
37
42
  appraisal (2.4.1)
38
43
  bundler
39
44
  rake
40
45
  thor (>= 0.14.0)
41
- builder (3.2.4)
46
+ ast (2.4.3)
47
+ bigdecimal (4.1.2)
48
+ builder (3.3.0)
49
+ bundler-audit (0.9.3)
50
+ bundler (>= 1.2.0)
51
+ thor (~> 1.0)
42
52
  concurrent-ruby (1.1.9)
43
53
  crass (1.0.6)
54
+ csv (3.3.5)
44
55
  diff-lcs (1.5.0)
45
- erubi (1.10.0)
46
- git (1.10.2)
56
+ erubi (1.13.1)
57
+ git (1.19.1)
58
+ addressable (~> 2.8)
47
59
  rchardet (~> 1.8)
48
60
  health_check (3.1.0)
49
61
  railties (>= 5.0)
50
- httparty (0.20.0)
51
- mime-types (~> 3.0)
62
+ httparty (0.24.2)
63
+ csv
64
+ mini_mime (>= 1.0.0)
52
65
  multi_xml (>= 0.5.2)
53
66
  i18n (1.8.11)
54
67
  concurrent-ruby (~> 1.0)
55
- loofah (2.13.0)
68
+ json (2.19.4)
69
+ language_server-protocol (3.17.0.5)
70
+ lint_roller (1.1.0)
71
+ loofah (2.25.1)
56
72
  crass (~> 1.0.2)
57
- nokogiri (>= 1.5.9)
58
- method_source (1.0.0)
59
- mime-types (3.4.1)
60
- mime-types-data (~> 3.2015)
61
- mime-types-data (3.2022.0105)
73
+ nokogiri (>= 1.12.0)
74
+ method_source (1.1.0)
75
+ mini_mime (1.1.5)
62
76
  minitest (5.15.0)
63
- multi_xml (0.6.0)
64
- nokogiri (1.13.1-aarch64-linux)
77
+ multi_xml (0.8.1)
78
+ bigdecimal (>= 3.1, < 5)
79
+ nokogiri (1.19.3-aarch64-linux-gnu)
65
80
  racc (~> 1.4)
66
- racc (1.6.0)
67
- rack (2.2.3)
68
- rack-test (1.1.0)
69
- rack (>= 1.0, < 3)
70
- rails-dom-testing (2.0.3)
71
- activesupport (>= 4.2.0)
81
+ parallel (1.28.0)
82
+ parser (3.3.11.1)
83
+ ast (~> 2.4.1)
84
+ racc
85
+ prism (1.9.0)
86
+ public_suffix (7.0.5)
87
+ racc (1.8.1)
88
+ rack (2.2.23)
89
+ rack-test (2.2.0)
90
+ rack (>= 1.3)
91
+ rails-dom-testing (2.3.0)
92
+ activesupport (>= 5.0.0)
93
+ minitest
72
94
  nokogiri (>= 1.6)
73
- rails-html-sanitizer (1.4.2)
74
- loofah (~> 2.3)
95
+ rails-html-sanitizer (1.7.0)
96
+ loofah (~> 2.25)
97
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
75
98
  railties (7.0.0)
76
99
  actionpack (= 7.0.0)
77
100
  activesupport (= 7.0.0)
@@ -79,8 +102,10 @@ GEM
79
102
  rake (>= 12.2)
80
103
  thor (~> 1.0)
81
104
  zeitwerk (~> 2.5)
105
+ rainbow (3.1.1)
82
106
  rake (12.3.3)
83
- rchardet (1.8.0)
107
+ rchardet (1.10.0)
108
+ regexp_parser (2.12.0)
84
109
  rspec (3.10.0)
85
110
  rspec-core (~> 3.10.0)
86
111
  rspec-expectations (~> 3.10.0)
@@ -94,10 +119,34 @@ GEM
94
119
  diff-lcs (>= 1.2.0, < 2.0)
95
120
  rspec-support (~> 3.10.0)
96
121
  rspec-support (3.10.3)
122
+ rubocop (1.86.1)
123
+ json (~> 2.3)
124
+ language_server-protocol (~> 3.17.0.2)
125
+ lint_roller (~> 1.1.0)
126
+ parallel (>= 1.10)
127
+ parser (>= 3.3.0.2)
128
+ rainbow (>= 2.2.2, < 4.0)
129
+ regexp_parser (>= 2.9.3, < 3.0)
130
+ rubocop-ast (>= 1.49.0, < 2.0)
131
+ ruby-progressbar (~> 1.7)
132
+ unicode-display_width (>= 2.4.0, < 4.0)
133
+ rubocop-ast (1.49.1)
134
+ parser (>= 3.3.7.2)
135
+ prism (~> 1.7)
136
+ rubocop-rails (2.34.3)
137
+ activesupport (>= 4.2.0)
138
+ lint_roller (~> 1.1)
139
+ rack (>= 1.1)
140
+ rubocop (>= 1.75.0, < 2.0)
141
+ rubocop-ast (>= 1.44.0, < 2.0)
142
+ ruby-progressbar (1.13.0)
97
143
  thor (1.2.1)
98
144
  tzinfo (2.0.4)
99
145
  concurrent-ruby (~> 1.0)
100
- zeitwerk (2.5.3)
146
+ unicode-display_width (3.2.0)
147
+ unicode-emoji (~> 4.1)
148
+ unicode-emoji (4.2.0)
149
+ zeitwerk (2.7.5)
101
150
 
102
151
  PLATFORMS
103
152
  aarch64-linux
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Modulorails [![Build Status](https://travis-ci.com/Ezveus/modulorails.svg?branch=master)](https://travis-ci.com/Ezveus/modulorails)
1
+ # Modulorails
2
2
 
3
3
  **Modulorails** is the common base for the Ruby on Rails project at [Modulotech](https://www.modulotech.fr/).
4
4
 
@@ -28,11 +28,73 @@ Modulorails.configure do |config|
28
28
  config.project_manager 'The email of the project manager of the application'
29
29
  config.endpoint 'The url to the intranet'
30
30
  config.api_key 'The API key'
31
- config.review_base_url 'The base url for the review environments' # optional
32
- config.staging_url 'The url for the staging environment' # optional
33
- config.production_url 'The url for the production environment' # optional
34
31
  end
35
- ```
32
+ ```
33
+
34
+ ## Features
35
+
36
+ ### Devcontainer Support
37
+
38
+ Modulorails automatically generates a `.devcontainer/` configuration for VS Code and compatible IDEs:
39
+ - `Dockerfile` for the development container
40
+ - `compose.yml` with database, Redis, and mailcatcher services
41
+ - `devcontainer.json` for VS Code integration
42
+
43
+ ### Docker Scripts
44
+
45
+ Two helper scripts are provided in `bin/`:
46
+ - `bin/dc` - Wrapper for `docker compose` commands targeting the devcontainer
47
+ - `bin/dcr` - Wrapper for `docker compose run` with proper TTY and Git configuration
48
+
49
+ Usage:
50
+ ```bash
51
+ bin/dc up -d # Start services in background
52
+ bin/dc logs -f app # Follow app logs
53
+ bin/dcr rails console # Run Rails console in container
54
+ bin/dcr rspec # Run tests in container
55
+ ```
56
+
57
+ ### Claude Code Integration
58
+
59
+ Modulorails can configure your devcontainer for efficient use with Claude Code:
60
+ - Persistent bash history across container restarts
61
+ - Claude Code configuration volume
62
+ - Firewall initialization script
63
+
64
+ ### Bun JS Engine Support
65
+
66
+ Modulorails detects and supports the Bun JavaScript runtime. When `bun.config.js` is present, the devcontainer will include appropriate JS and CSS build services.
67
+
68
+ ### Other Generators
69
+
70
+ - **RubocopGenerator** - Configures `.rubocop.yml` with Modulotech standards
71
+ - **BundlerauditGenerator** - Sets up bundler-audit for security checks
72
+ - **GithooksGenerator** - Installs git hooks for automated checks
73
+ - **HealthCheckGenerator** - Configures the health_check gem
74
+ - **SidekiqGenerator** - Adds Sidekiq background job processing
75
+
76
+ ## Deprecations (will be removed in 2.0)
77
+
78
+ The following features are deprecated and will be removed in version 2.0:
79
+
80
+ ### Configuration options
81
+ - `config.staging_url`
82
+ - `config.review_base_url`
83
+ - `config.production_url`
84
+ - `config.no_auto_update`
85
+
86
+ ### Services
87
+ - `Modulorails::BaseService#log` - Use `Rails.logger.debug` directly
88
+ - `Modulorails::LogsForMethodService` - Use `Rails.logger.debug` directly
89
+
90
+ ### Generators
91
+ The following generators are deprecated and will be moved to Moduloproject 3.0:
92
+ - `Modulorails::DockerGenerator` (and all sub-generators)
93
+ - `Modulorails::GitlabciGenerator`
94
+ - `Modulorails::ClaudeCodeGenerator`
95
+ - `Modulorails::ModuloprojectGenerator`
96
+ - `Modulorails::SidekiqGenerator`
97
+ - `Modulorails::SelfUpdateGenerator` (will be removed entirely)
36
98
 
37
99
  ## Development
38
100
 
@@ -47,10 +109,8 @@ There are tests in `spec`. To run tests:
47
109
  - Ruby 3.1: `docker compose run ruby31`
48
110
 
49
111
  [Appraisal](https://github.com/thoughtbot/appraisal) is used to test the gem against many supported Rails versions:
50
- - Rails 5.2, 6.0 and 6.1 on Ruby 2.5 and 2.6.
51
- - Rails 5.2, 6.0, 6.1 and 7.0 on Ruby 2.7, 3.0 and 3.1.
52
-
53
- Travis CI is configured to automatically run tests in all supported Ruby versions and dependency sets after each push.
112
+ - Rails 5.2, 6.0 and 6.1 on Ruby 2.5 and 2.6.
113
+ - Rails 5.2, 6.0, 6.1 and 7.0 on Ruby 2.7, 3.0 and 3.1.
54
114
 
55
115
  ## Contributing
56
116
 
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'modulorails/generators/base'
4
+
5
+ class Modulorails::ClaudeCodeGenerator < Modulorails::Generators::Base
6
+
7
+ VERSION = 1
8
+
9
+ desc 'This generator configures the devcontainer to use Claude Code efficiently'
10
+
11
+ protected
12
+
13
+ def create_config
14
+ Modulorails.deprecator.warn(<<~MESSAGE)
15
+ Modulorails::ClaudeCodeGenerator is deprecated and will be removed in version 2.0.
16
+ Use Moduloproject 3.0 (available later) to initialize new projects with Claude Code configuration.
17
+ MESSAGE
18
+
19
+ @data = Modulorails.data
20
+ @image_name = @data.name.parameterize
21
+ @environment_name = @data.environment_name
22
+ @adapter = @data.adapter
23
+ @review_base_url = @data.review_base_url
24
+ @staging_url = @data.staging_url
25
+ @production_url = @data.production_url
26
+
27
+ template 'bin/init-firewall.sh'
28
+ inject_into_file(Rails.root.join('bin/setup'), "\n puts \"== Setting up firewall rules ==\"\n system(\"bin/init-firewall.sh\")\n", after: "APP_ROOT do")
29
+ inject_into_file(Rails.root.join('.devcontainer/devcontainer.json'), after: '"shutdownAction": "stopCompose",') do
30
+ <<-JSON
31
+
32
+ "mounts": [
33
+ "source=claude-code-bashhistory,target=/commandhistory,type=volume",
34
+ "source=claude-code-config,target=/root/.claude,type=volume"
35
+ ],
36
+
37
+ "remoteEnv": {
38
+ "NODE_OPTIONS": "--max-old-space-size=4096",
39
+ "CLAUDE_CONFIG_DIR": "/root/.claude"
40
+ },
41
+
42
+ JSON
43
+ end
44
+ inject_into_file(Rails.root.join('.devcontainer/Dockerfile'), before: 'RUN gem install bundler') do
45
+ <<-DOCKERFILE
46
+ ENV DEVCONTAINER=true
47
+
48
+ # Persist bash history.
49
+ RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
50
+ && mkdir /commandhistory \
51
+ && touch /commandhistory/.bash_history
52
+
53
+ RUN mkdir -p /root/.claude
54
+
55
+ # Install Claude Code (native installation)
56
+ RUN curl -fsSL https://claude.ai/install.sh | bash
57
+
58
+ DOCKERFILE
59
+ end
60
+ rescue StandardError => e
61
+ warn("[Modulorails] Error: cannot configure Claude Code: #{e.message}")
62
+ end
63
+
64
+ end
@@ -0,0 +1,120 @@
1
+ include:
2
+ - project: 'modulosource/modulotech/devops/gitlab-ci-templates'
3
+ file:
4
+ - '/templates/helm.gitlab-ci.yml'
5
+ - '/templates/integration.gitlab-ci.yml'
6
+ - '/templates/docker-buildx.gitlab-ci.yml'
7
+
8
+ variables:
9
+ IMAGE_NAME: <%= @image_name %>
10
+
11
+ stages:
12
+ - test
13
+ - build
14
+ - deploy
15
+
16
+ build_integration_image:
17
+ extends: .build_integration_image
18
+
19
+ test:
20
+ extends: .test
21
+ services:
22
+ <%- if @adapter =~ /mysql/ -%>
23
+ - mysql:8-alpine
24
+ <%- else -%>
25
+ - postgres:16-alpine
26
+ <%- end -%>
27
+ - redis:7-alpine
28
+ variables:
29
+ RAILS_ENV: test
30
+ <%- if @adapter =~ /mysql/ -%>
31
+ MYSQL_DATABASE: <%= @image_name %>-test
32
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
33
+ DATABASE_TEST_URL: 'mysql2://root@mysql/<%= @image_name %>-test'
34
+ <%- else -%>
35
+ POSTGRES_DB: <%= @image_name %>-test
36
+ POSTGRES_USER: postgres
37
+ POSTGRES_PASSWORD: postgres
38
+ DATABASE_TEST_URL: 'postgresql://postgres:postgres@postgres/<%= @image_name %>-test'
39
+ <%- end -%>
40
+ script:
41
+ - bin/test
42
+
43
+ docker_build:
44
+ extends: .docker_buildx_push
45
+ variables:
46
+ DOCKERFILE: Dockerfile
47
+ only:
48
+ - merge_requests
49
+ - staging
50
+ - master
51
+
52
+ <%- if @review_base_url.present? -%>
53
+ deploy_review:
54
+ extends: .deploy_helm
55
+ variables:
56
+ NAMESPACE: <%= @image_name %>-$CI_ENVIRONMENT_SLUG
57
+ NAME: <%= @image_name %>
58
+ CHART_NAME: rails
59
+ CONFIG_FILE: config/deploy/review.yaml
60
+ EXTRA_VARS: --set image.tag=$CI_COMMIT_SHORT_SHA --set ingress.hosts[0].host=${CI_ENVIRONMENT_SLUG}.<%= @review_base_url %> --set ingress.tls[0].hosts[0]=${CI_ENVIRONMENT_SLUG}.<%= @review_base_url %> --set env.url=${CI_ENVIRONMENT_SLUG}.<%= @review_base_url %> --set database.url=$DATABASE_URL --set master_key.key=$MASTER_KEY
61
+ environment:
62
+ name: review/$CI_COMMIT_REF_SLUG
63
+ url: https://${CI_ENVIRONMENT_SLUG}.<%= @review_base_url %>
64
+ on_stop: stop_review
65
+ auto_stop_in: 3 days
66
+ only:
67
+ - merge_requests
68
+
69
+ stop_review:
70
+ extends: .stop_review
71
+ variables:
72
+ NAMESPACE: <%= @image_name %>-$CI_ENVIRONMENT_SLUG
73
+ NAME: <%= @image_name %>
74
+ only:
75
+ - merge_requests
76
+ <%- end -%>
77
+
78
+ <%- if @staging_url.present? -%>
79
+ deploy_staging:
80
+ extends: .deploy_helm
81
+ variables:
82
+ NAMESPACE: <%= @image_name %>
83
+ NAME: <%= @image_name %>
84
+ CHART_NAME: rails
85
+ CONFIG_FILE: config/deploy/staging.yaml
86
+ EXTRA_VARS: --set image.tag=$CI_COMMIT_SHORT_SHA --set database.url=$DATABASE_URL --set master_key.key=$MASTER_KEY
87
+ environment:
88
+ name: staging
89
+ url: https://<%= @staging_url %>
90
+ on_stop: stop_staging
91
+ auto_stop_in: 7 days
92
+ only:
93
+ - staging
94
+
95
+ stop_staging:
96
+ extends: .stop_staging
97
+ variables:
98
+ NAMESPACE: <%= @image_name %>
99
+ NAME: <%= @image_name %>
100
+ only:
101
+ - staging
102
+ needs:
103
+ - docker_build
104
+ <%- end -%>
105
+
106
+ <%- if @production_url.present? -%>
107
+ deploy_production:
108
+ extends: .deploy_helm
109
+ variables:
110
+ NAMESPACE: <%= @image_name %>
111
+ NAME: <%= @image_name %>
112
+ CHART_NAME: rails
113
+ CONFIG_FILE: config/deploy/production.yaml
114
+ EXTRA_VARS: --set image.tag=$CI_COMMIT_SHORT_SHA
115
+ environment:
116
+ name: production
117
+ url: https://<%= @production_url %>
118
+ only:
119
+ - master
120
+ <%- end -%>