roda-project 0.1.16 → 0.1.18
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.
- checksums.yaml +4 -4
- data/lib/roda/project/bin/generators/routes.rb +162 -74
- data/lib/roda/project/bin/generators.rb +1 -0
- data/lib/roda/project/cli.rb +19 -12
- data/lib/roda/project/helpers/ids.rb +9 -0
- data/lib/roda/project/main_context.rb +22 -1
- data/lib/roda/project/templates/base/app/app.rb.erb +11 -2
- data/lib/roda/project/templates/base-scaffold/AGENTS.md.erb +72 -0
- data/lib/roda/project/templates/{base/scaffold → base-scaffold}/Gemfile.erb +3 -2
- data/lib/roda/project/templates/front-end-inertia/app/assets/css/app.css +20 -0
- data/lib/roda/project/templates/front-end-inertia/app/assets/js/app.js +11 -0
- data/lib/roda/project/templates/front-end-inertia/app/assets/js/inertia/components/Layout.jsx +11 -0
- data/lib/roda/project/templates/front-end-inertia/app/assets/js/inertia/views/Index.jsx +13 -0
- data/lib/roda/project/templates/front-end-inertia/app/config/locales/en.yml +273 -0
- data/lib/roda/project/templates/front-end-inertia/app/config/locales/foo/en.yml +2 -0
- data/lib/roda/project/templates/front-end-inertia/app/config/locales/foo/pt-br.yml +2 -0
- data/lib/roda/project/templates/front-end-inertia/app/config/locales/pt-br.yml +244 -0
- data/lib/roda/project/templates/front-end-inertia/app/views/foo/bar.erb +1 -0
- data/lib/roda/project/templates/front-end-inertia/app/views/index.erb +1 -0
- data/lib/roda/project/templates/front-end-inertia/app/views/layout.erb +23 -0
- data/lib/roda/project/templates/front-end-inertia/esbuild.js +53 -0
- data/lib/roda/project/templates/front-end-inertia/package.json +23 -0
- data/lib/roda/project/templates/front-end-inertia/public/assets/app.css +1 -0
- data/lib/roda/project/templates/front-end-inertia/public/images/roda-project.png +0 -0
- data/lib/roda/project/templates/tests-rspec/spec/app/views/html_spec.rb +0 -0
- data/lib/roda/project/version.rb +1 -1
- data/lib/roda/project.rb +3 -0
- metadata +53 -38
- data/lib/roda/project/templates/base/scaffold/AGENTS.md.erb +0 -47
- data/lib/roda/project/templates/front-end/app/assets/js/some/foo.js +0 -5
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/AGENTS.md +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/Gemfile.erb +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/Gemfile.lock +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/Guardfile +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/README.md +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/app.rb +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/bin/roda.erb +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/boot.rb +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/config.ru +0 -0
- /data/lib/roda/project/templates/{base/minimal → base-minimal}/public/exception_page.css +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/Guardfile +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/README.md +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/app/config/config.rb.erb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/app/config/providers/logger.rb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/app/config/providers/mailer.rb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/app/routes/foo.rb.erb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/bin/roda.erb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/boot.rb.erb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/config.ru.erb +0 -0
- /data/lib/roda/project/templates/{base/scaffold → base-scaffold}/public/exception_page.css +0 -0
- /data/lib/roda/project/templates/{tests/minitest/spec/app/views/html_spec.rb → front-end-inertia/public/assets/app.js} +0 -0
- /data/lib/roda/project/templates/{tests/minimal/minitest → tests-minimal-minitest}/spec/app_spec.rb +0 -0
- /data/lib/roda/project/templates/{tests/minimal/minitest → tests-minimal-minitest}/spec/spec_helper.rb.erb +0 -0
- /data/lib/roda/project/templates/{tests/minimal/rspec → tests-minimal-rspec}/spec/app_spec.rb +0 -0
- /data/lib/roda/project/templates/{tests/minimal/rspec → tests-minimal-rspec}/spec/spec_helper.rb +0 -0
- /data/lib/roda/project/templates/{tests/minitest → tests-minitest}/spec/app/app_spec.rb.erb +0 -0
- /data/lib/roda/project/templates/{tests/minitest → tests-minitest}/spec/app/routes/foo_spec.rb.erb +0 -0
- /data/lib/roda/project/templates/{tests/minitest → tests-minitest}/spec/app/routes/test_branch_spec.rb +0 -0
- /data/lib/roda/project/templates/{tests/rspec → tests-minitest}/spec/app/views/html_spec.rb +0 -0
- /data/lib/roda/project/templates/{tests/minitest → tests-minitest}/spec/spec_helper.rb.erb +0 -0
- /data/lib/roda/project/templates/{tests/rspec → tests-rspec}/spec/app/app_spec.rb.erb +0 -0
- /data/lib/roda/project/templates/{tests/rspec → tests-rspec}/spec/app/routes/foo_spec.rb.erb +0 -0
- /data/lib/roda/project/templates/{tests/rspec → tests-rspec}/spec/app/routes/test_branch_spec.rb +0 -0
- /data/lib/roda/project/templates/{tests/rspec → tests-rspec}/spec/spec_helper.rb.erb +0 -0
data/lib/roda/project.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda-project
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Henrique F. Teixeira
|
|
@@ -94,34 +94,49 @@ files:
|
|
|
94
94
|
- lib/roda/project/helpers/template.rb
|
|
95
95
|
- lib/roda/project/jeremy_template_creator.rb
|
|
96
96
|
- lib/roda/project/main_context.rb
|
|
97
|
+
- lib/roda/project/templates/base-minimal/AGENTS.md
|
|
98
|
+
- lib/roda/project/templates/base-minimal/Gemfile.erb
|
|
99
|
+
- lib/roda/project/templates/base-minimal/Gemfile.lock
|
|
100
|
+
- lib/roda/project/templates/base-minimal/Guardfile
|
|
101
|
+
- lib/roda/project/templates/base-minimal/README.md
|
|
102
|
+
- lib/roda/project/templates/base-minimal/app.rb
|
|
103
|
+
- lib/roda/project/templates/base-minimal/bin/roda.erb
|
|
104
|
+
- lib/roda/project/templates/base-minimal/boot.rb
|
|
105
|
+
- lib/roda/project/templates/base-minimal/config.ru
|
|
106
|
+
- lib/roda/project/templates/base-minimal/public/exception_page.css
|
|
107
|
+
- lib/roda/project/templates/base-scaffold/AGENTS.md.erb
|
|
108
|
+
- lib/roda/project/templates/base-scaffold/Gemfile.erb
|
|
109
|
+
- lib/roda/project/templates/base-scaffold/Guardfile
|
|
110
|
+
- lib/roda/project/templates/base-scaffold/README.md
|
|
111
|
+
- lib/roda/project/templates/base-scaffold/app/config/config.rb.erb
|
|
112
|
+
- lib/roda/project/templates/base-scaffold/app/config/providers/logger.rb
|
|
113
|
+
- lib/roda/project/templates/base-scaffold/app/config/providers/mailer.rb
|
|
114
|
+
- lib/roda/project/templates/base-scaffold/app/routes/foo.rb.erb
|
|
115
|
+
- lib/roda/project/templates/base-scaffold/bin/roda.erb
|
|
116
|
+
- lib/roda/project/templates/base-scaffold/boot.rb.erb
|
|
117
|
+
- lib/roda/project/templates/base-scaffold/config.ru.erb
|
|
118
|
+
- lib/roda/project/templates/base-scaffold/public/exception_page.css
|
|
97
119
|
- lib/roda/project/templates/base/app/app.rb.erb
|
|
98
|
-
- lib/roda/project/templates/base/minimal/AGENTS.md
|
|
99
|
-
- lib/roda/project/templates/base/minimal/Gemfile.erb
|
|
100
|
-
- lib/roda/project/templates/base/minimal/Gemfile.lock
|
|
101
|
-
- lib/roda/project/templates/base/minimal/Guardfile
|
|
102
|
-
- lib/roda/project/templates/base/minimal/README.md
|
|
103
|
-
- lib/roda/project/templates/base/minimal/app.rb
|
|
104
|
-
- lib/roda/project/templates/base/minimal/bin/roda.erb
|
|
105
|
-
- lib/roda/project/templates/base/minimal/boot.rb
|
|
106
|
-
- lib/roda/project/templates/base/minimal/config.ru
|
|
107
|
-
- lib/roda/project/templates/base/minimal/public/exception_page.css
|
|
108
|
-
- lib/roda/project/templates/base/scaffold/AGENTS.md.erb
|
|
109
|
-
- lib/roda/project/templates/base/scaffold/Gemfile.erb
|
|
110
|
-
- lib/roda/project/templates/base/scaffold/Guardfile
|
|
111
|
-
- lib/roda/project/templates/base/scaffold/README.md
|
|
112
|
-
- lib/roda/project/templates/base/scaffold/app/config/config.rb.erb
|
|
113
|
-
- lib/roda/project/templates/base/scaffold/app/config/providers/logger.rb
|
|
114
|
-
- lib/roda/project/templates/base/scaffold/app/config/providers/mailer.rb
|
|
115
|
-
- lib/roda/project/templates/base/scaffold/app/routes/foo.rb.erb
|
|
116
|
-
- lib/roda/project/templates/base/scaffold/bin/roda.erb
|
|
117
|
-
- lib/roda/project/templates/base/scaffold/boot.rb.erb
|
|
118
|
-
- lib/roda/project/templates/base/scaffold/config.ru.erb
|
|
119
|
-
- lib/roda/project/templates/base/scaffold/public/exception_page.css
|
|
120
120
|
- lib/roda/project/templates/database/app/config/providers/db/conn.rb
|
|
121
121
|
- lib/roda/project/templates/database/db/seeds.rb
|
|
122
|
+
- lib/roda/project/templates/front-end-inertia/app/assets/css/app.css
|
|
123
|
+
- lib/roda/project/templates/front-end-inertia/app/assets/js/app.js
|
|
124
|
+
- lib/roda/project/templates/front-end-inertia/app/assets/js/inertia/components/Layout.jsx
|
|
125
|
+
- lib/roda/project/templates/front-end-inertia/app/assets/js/inertia/views/Index.jsx
|
|
126
|
+
- lib/roda/project/templates/front-end-inertia/app/config/locales/en.yml
|
|
127
|
+
- lib/roda/project/templates/front-end-inertia/app/config/locales/foo/en.yml
|
|
128
|
+
- lib/roda/project/templates/front-end-inertia/app/config/locales/foo/pt-br.yml
|
|
129
|
+
- lib/roda/project/templates/front-end-inertia/app/config/locales/pt-br.yml
|
|
130
|
+
- lib/roda/project/templates/front-end-inertia/app/views/foo/bar.erb
|
|
131
|
+
- lib/roda/project/templates/front-end-inertia/app/views/index.erb
|
|
132
|
+
- lib/roda/project/templates/front-end-inertia/app/views/layout.erb
|
|
133
|
+
- lib/roda/project/templates/front-end-inertia/esbuild.js
|
|
134
|
+
- lib/roda/project/templates/front-end-inertia/package.json
|
|
135
|
+
- lib/roda/project/templates/front-end-inertia/public/assets/app.css
|
|
136
|
+
- lib/roda/project/templates/front-end-inertia/public/assets/app.js
|
|
137
|
+
- lib/roda/project/templates/front-end-inertia/public/images/roda-project.png
|
|
122
138
|
- lib/roda/project/templates/front-end/app/assets/css/app.css
|
|
123
139
|
- lib/roda/project/templates/front-end/app/assets/js/app.js
|
|
124
|
-
- lib/roda/project/templates/front-end/app/assets/js/some/foo.js
|
|
125
140
|
- lib/roda/project/templates/front-end/app/config/locales/en.yml
|
|
126
141
|
- lib/roda/project/templates/front-end/app/config/locales/foo/en.yml
|
|
127
142
|
- lib/roda/project/templates/front-end/app/config/locales/foo/pt-br.yml
|
|
@@ -137,20 +152,20 @@ files:
|
|
|
137
152
|
- lib/roda/project/templates/rodauth/app/models/account.rb
|
|
138
153
|
- lib/roda/project/templates/rodauth/app/views/create-account.erb
|
|
139
154
|
- lib/roda/project/templates/rodauth/db/migrations/001_add_rodauth.rb
|
|
140
|
-
- lib/roda/project/templates/tests
|
|
141
|
-
- lib/roda/project/templates/tests
|
|
142
|
-
- lib/roda/project/templates/tests
|
|
143
|
-
- lib/roda/project/templates/tests
|
|
144
|
-
- lib/roda/project/templates/tests
|
|
145
|
-
- lib/roda/project/templates/tests
|
|
146
|
-
- lib/roda/project/templates/tests
|
|
147
|
-
- lib/roda/project/templates/tests
|
|
148
|
-
- lib/roda/project/templates/tests
|
|
149
|
-
- lib/roda/project/templates/tests
|
|
150
|
-
- lib/roda/project/templates/tests
|
|
151
|
-
- lib/roda/project/templates/tests
|
|
152
|
-
- lib/roda/project/templates/tests
|
|
153
|
-
- lib/roda/project/templates/tests
|
|
155
|
+
- lib/roda/project/templates/tests-minimal-minitest/spec/app_spec.rb
|
|
156
|
+
- lib/roda/project/templates/tests-minimal-minitest/spec/spec_helper.rb.erb
|
|
157
|
+
- lib/roda/project/templates/tests-minimal-rspec/spec/app_spec.rb
|
|
158
|
+
- lib/roda/project/templates/tests-minimal-rspec/spec/spec_helper.rb
|
|
159
|
+
- lib/roda/project/templates/tests-minitest/spec/app/app_spec.rb.erb
|
|
160
|
+
- lib/roda/project/templates/tests-minitest/spec/app/routes/foo_spec.rb.erb
|
|
161
|
+
- lib/roda/project/templates/tests-minitest/spec/app/routes/test_branch_spec.rb
|
|
162
|
+
- lib/roda/project/templates/tests-minitest/spec/app/views/html_spec.rb
|
|
163
|
+
- lib/roda/project/templates/tests-minitest/spec/spec_helper.rb.erb
|
|
164
|
+
- lib/roda/project/templates/tests-rspec/spec/app/app_spec.rb.erb
|
|
165
|
+
- lib/roda/project/templates/tests-rspec/spec/app/routes/foo_spec.rb.erb
|
|
166
|
+
- lib/roda/project/templates/tests-rspec/spec/app/routes/test_branch_spec.rb
|
|
167
|
+
- lib/roda/project/templates/tests-rspec/spec/app/views/html_spec.rb
|
|
168
|
+
- lib/roda/project/templates/tests-rspec/spec/spec_helper.rb.erb
|
|
154
169
|
- lib/roda/project/version.rb
|
|
155
170
|
homepage: https://github.com/roda-project
|
|
156
171
|
licenses:
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Project Code Generation Rules
|
|
2
|
-
|
|
3
|
-
## Core Stack
|
|
4
|
-
- **Web Framework**: Roda (STRICT: Do NOT use Rails, ActionController, or Sinatra conventions).
|
|
5
|
-
- **No Rails Magic:** Do not use `ActiveSupport` methods (like `.present?` or `.blank?`) unless the gem is explicitly in the Gemfile.<% if context.database %>
|
|
6
|
-
- **ORM**: Sequel (STRICT: Do NOT use ActiveRecord. Use Sequel Models, Datasets, and Migrations).<% end %>
|
|
7
|
-
- **Autoloader**: Zeitwerk (Do NOT manually `require` files located in the `app/` directory. Only require standard libraries or gems).<% if context.fullstack? %>
|
|
8
|
-
- **Frontend**: esbuild + ERB (Fullstack mode).<% end %>
|
|
9
|
-
|
|
10
|
-
## Code Style & Conventions
|
|
11
|
-
|
|
12
|
-
### 1. Types
|
|
13
|
-
- Rely on standard Ruby 3.x patterns. Use explicit YARD docs for method signatures.
|
|
14
|
-
|
|
15
|
-
### 2. Routing (Roda)
|
|
16
|
-
- The main app resides in `app/[project_name].rb`.
|
|
17
|
-
- Sub-routes MUST be implemented using Roda **Hash Branches** (`hash_branches` plugin) and placed in `app/routes/`.
|
|
18
|
-
- Do not create deep routing blocks. Use Roda's tree routing efficiently (`r.on`, `r.is`, `r.get`, `r.post`).<% if context.database %>
|
|
19
|
-
|
|
20
|
-
### 3. Database & Models (Sequel)
|
|
21
|
-
- Models reside in `app/models/`.
|
|
22
|
-
- Migrations reside in `db/migrations/` and MUST use sequential numbering (e.g., `001_...`).
|
|
23
|
-
- When writing database queries, use Sequel's dataset methods (e.g., `where`, `select`, `exclude`, `join`). Do not use string interpolation for SQL queries.
|
|
24
|
-
|
|
25
|
-
<% end %><% if context.fullstack? %>### 4. Views & Presentation
|
|
26
|
-
- ERB templates go in `app/views/`.
|
|
27
|
-
|
|
28
|
-
<% end %>### 5. Testing
|
|
29
|
-
- Specs reside in `spec/app/`.
|
|
30
|
-
- Use `rack-test` for route testing.
|
|
31
|
-
- Ensure database transactions are rolled back after each test block.
|
|
32
|
-
- Mirror the file structure of `app/` inside `spec/app/` (e.g., `app/models/user.rb` -> `spec/app/models/user_spec.rb`).
|
|
33
|
-
|
|
34
|
-
### 6. Boot Sequence & Initialization
|
|
35
|
-
- **`boot.rb`**: The absolute starting point. It sets up `Bundler`, boots `Zeitwerk` for autoloading the `app/` directory, and loads service providers from `app/config/providers/`.
|
|
36
|
-
- **`config.ru`**: The Rack entrypoint. It defines middleware (like `Rack::LiveReload` in development) and mounts the primary Roda application class defined in `app/[project_name].rb`.
|
|
37
|
-
|
|
38
|
-
### 7. Tooling
|
|
39
|
-
- Do NOT run `bundle exec rake` for scaffolding/servers. The project uses a custom CLI: `bin/roda`. Suggest commands using `bin/roda` (e.g., generators, running the server).
|
|
40
|
-
|
|
41
|
-
#### Generators
|
|
42
|
-
- To maintain consistency and avoid manual boilerplate, the project uses custom generators for scaffolding new features. These automatically hook into Zeitwerk's expectations, Sequel's DSL, and Roda's Hash Branches.
|
|
43
|
-
- **`bin/roda g routes <branch> [options]`**: Scaffolds a Roda hash branch file in `app/routes/`, matching spec files, and ERB views (for GET routes). Supports nested paths (e.g., `api/v1`) and bare verbs (e.g., `books :get :post`).<% if context.database %>
|
|
44
|
-
- **`bin/roda g model <name> [fields]`**: Generates a Sequel ORM model class, a matching model spec, and a timestamped Sequel migration. Supports namespacing (`Admin/User`) and auto-pluralizes table names.
|
|
45
|
-
- **`bin/roda g migration <name> [fields]`**: Creates a timestamped Sequel migration. It automatically detects intent from the name (e.g., `add_status_to_users` generates the `alter_table` block) and maps Rails-like field types (e.g., `user:references`, `body:text`) to Sequel schema methods.
|
|
46
|
-
<% end %>- **`bin/roda g service <type> <name>`**: Scaffolds a class or module service in `app/services/` and a matching spec. Defaults to `class` if type is omitted.
|
|
47
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/roda/project/templates/{base/scaffold → base-scaffold}/app/config/providers/logger.rb
RENAMED
|
File without changes
|
/data/lib/roda/project/templates/{base/scaffold → base-scaffold}/app/config/providers/mailer.rb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/roda/project/templates/{tests/minimal/minitest → tests-minimal-minitest}/spec/app_spec.rb
RENAMED
|
File without changes
|
|
File without changes
|
/data/lib/roda/project/templates/{tests/minimal/rspec → tests-minimal-rspec}/spec/app_spec.rb
RENAMED
|
File without changes
|
/data/lib/roda/project/templates/{tests/minimal/rspec → tests-minimal-rspec}/spec/spec_helper.rb
RENAMED
|
File without changes
|
|
File without changes
|
/data/lib/roda/project/templates/{tests/minitest → tests-minitest}/spec/app/routes/foo_spec.rb.erb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/lib/roda/project/templates/{tests/rspec → tests-rspec}/spec/app/routes/foo_spec.rb.erb
RENAMED
|
File without changes
|
/data/lib/roda/project/templates/{tests/rspec → tests-rspec}/spec/app/routes/test_branch_spec.rb
RENAMED
|
File without changes
|
|
File without changes
|