plutonium 0.33.1 → 0.34.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 (143) hide show
  1. checksums.yaml +4 -4
  2. data/# Plutonium: The pre-alpha demo.md +4 -2
  3. data/.claude/skills/assets/SKILL.md +416 -0
  4. data/.claude/skills/connect-resource/SKILL.md +112 -0
  5. data/.claude/skills/controller/SKILL.md +302 -0
  6. data/.claude/skills/create-resource/SKILL.md +240 -0
  7. data/.claude/skills/definition/SKILL.md +218 -0
  8. data/.claude/skills/definition-actions/SKILL.md +386 -0
  9. data/.claude/skills/definition-fields/SKILL.md +474 -0
  10. data/.claude/skills/definition-query/SKILL.md +334 -0
  11. data/.claude/skills/forms/SKILL.md +439 -0
  12. data/.claude/skills/installation/SKILL.md +300 -0
  13. data/.claude/skills/interaction/SKILL.md +382 -0
  14. data/.claude/skills/model/SKILL.md +267 -0
  15. data/.claude/skills/model-features/SKILL.md +286 -0
  16. data/.claude/skills/nested-resources/SKILL.md +274 -0
  17. data/.claude/skills/package/SKILL.md +191 -0
  18. data/.claude/skills/policy/SKILL.md +352 -0
  19. data/.claude/skills/portal/SKILL.md +400 -0
  20. data/.claude/skills/resource/SKILL.md +281 -0
  21. data/.claude/skills/rodauth/SKILL.md +452 -0
  22. data/.claude/skills/views/SKILL.md +563 -0
  23. data/Appraisals +46 -4
  24. data/CHANGELOG.md +32 -1
  25. data/app/assets/plutonium.css +2 -2
  26. data/config/brakeman.ignore +239 -0
  27. data/config/initializers/action_policy.rb +1 -1
  28. data/docs/.vitepress/config.ts +132 -47
  29. data/docs/concepts/architecture.md +226 -0
  30. data/docs/concepts/auto-detection.md +254 -0
  31. data/docs/concepts/index.md +61 -0
  32. data/docs/concepts/packages-portals.md +304 -0
  33. data/docs/concepts/resources.md +224 -0
  34. data/docs/cookbook/blog.md +412 -0
  35. data/docs/cookbook/index.md +289 -0
  36. data/docs/cookbook/saas.md +481 -0
  37. data/docs/getting-started/index.md +56 -0
  38. data/docs/getting-started/installation.md +146 -0
  39. data/docs/getting-started/tutorial/01-setup.md +118 -0
  40. data/docs/getting-started/tutorial/02-first-resource.md +180 -0
  41. data/docs/getting-started/tutorial/03-authentication.md +246 -0
  42. data/docs/getting-started/tutorial/04-authorization.md +170 -0
  43. data/docs/getting-started/tutorial/05-custom-actions.md +202 -0
  44. data/docs/getting-started/tutorial/06-nested-resources.md +147 -0
  45. data/docs/getting-started/tutorial/07-customizing-ui.md +254 -0
  46. data/docs/getting-started/tutorial/index.md +64 -0
  47. data/docs/guides/adding-resources.md +420 -0
  48. data/docs/guides/authentication.md +551 -0
  49. data/docs/guides/authorization.md +468 -0
  50. data/docs/guides/creating-packages.md +380 -0
  51. data/docs/guides/custom-actions.md +523 -0
  52. data/docs/guides/index.md +45 -0
  53. data/docs/guides/multi-tenancy.md +302 -0
  54. data/docs/guides/nested-resources.md +411 -0
  55. data/docs/guides/search-filtering.md +266 -0
  56. data/docs/guides/theming.md +321 -0
  57. data/docs/index.md +67 -26
  58. data/docs/public/CLAUDE.md +64 -21
  59. data/docs/reference/assets/index.md +496 -0
  60. data/docs/reference/controller/index.md +363 -0
  61. data/docs/reference/definition/actions.md +400 -0
  62. data/docs/reference/definition/fields.md +350 -0
  63. data/docs/reference/definition/index.md +252 -0
  64. data/docs/reference/definition/query.md +342 -0
  65. data/docs/reference/generators/index.md +469 -0
  66. data/docs/reference/index.md +49 -0
  67. data/docs/reference/interaction/index.md +445 -0
  68. data/docs/reference/model/features.md +248 -0
  69. data/docs/reference/model/index.md +219 -0
  70. data/docs/reference/policy/index.md +385 -0
  71. data/docs/reference/portal/index.md +382 -0
  72. data/docs/reference/views/forms.md +396 -0
  73. data/docs/reference/views/index.md +479 -0
  74. data/gemfiles/rails_7.gemfile +9 -2
  75. data/gemfiles/rails_7.gemfile.lock +146 -111
  76. data/gemfiles/rails_8.0.gemfile +20 -0
  77. data/gemfiles/rails_8.0.gemfile.lock +417 -0
  78. data/gemfiles/rails_8.1.gemfile +20 -0
  79. data/gemfiles/rails_8.1.gemfile.lock +419 -0
  80. data/lib/generators/pu/gem/dotenv/templates/.env +2 -0
  81. data/lib/generators/pu/gem/dotenv/templates/config/initializers/001_ensure_required_env.rb +3 -1
  82. data/lib/generators/pu/lib/plutonium_generators/model_generator_base.rb +13 -16
  83. data/lib/generators/pu/pkg/portal/USAGE +65 -0
  84. data/lib/generators/pu/pkg/portal/portal_generator.rb +22 -9
  85. data/lib/generators/pu/res/conn/USAGE +71 -0
  86. data/lib/generators/pu/res/model/USAGE +106 -110
  87. data/lib/generators/pu/res/model/templates/model.rb.tt +6 -2
  88. data/lib/generators/pu/res/scaffold/USAGE +85 -0
  89. data/lib/generators/pu/rodauth/install_generator.rb +2 -6
  90. data/lib/generators/pu/rodauth/templates/config/initializers/url_options.rb +17 -0
  91. data/lib/generators/pu/skills/sync/USAGE +14 -0
  92. data/lib/generators/pu/skills/sync/sync_generator.rb +66 -0
  93. data/lib/plutonium/action_policy/sti_policy_lookup.rb +1 -1
  94. data/lib/plutonium/core/controller.rb +2 -2
  95. data/lib/plutonium/interaction/base.rb +1 -0
  96. data/lib/plutonium/package/engine.rb +2 -2
  97. data/lib/plutonium/query/adhoc_block.rb +6 -2
  98. data/lib/plutonium/query/model_scope.rb +1 -1
  99. data/lib/plutonium/railtie.rb +4 -0
  100. data/lib/plutonium/resource/controllers/crud_actions/index_action.rb +1 -1
  101. data/lib/plutonium/resource/query_object.rb +38 -8
  102. data/lib/plutonium/ui/table/components/scopes_bar.rb +39 -34
  103. data/lib/plutonium/version.rb +1 -1
  104. data/lib/tasks/release.rake +19 -4
  105. data/package.json +1 -1
  106. metadata +76 -39
  107. data/brakeman.ignore +0 -28
  108. data/docs/api-examples.md +0 -49
  109. data/docs/guide/claude-code-guide.md +0 -74
  110. data/docs/guide/deep-dive/authorization.md +0 -189
  111. data/docs/guide/deep-dive/multitenancy.md +0 -256
  112. data/docs/guide/deep-dive/resources.md +0 -390
  113. data/docs/guide/getting-started/01-installation.md +0 -165
  114. data/docs/guide/index.md +0 -28
  115. data/docs/guide/introduction/01-what-is-plutonium.md +0 -211
  116. data/docs/guide/introduction/02-core-concepts.md +0 -440
  117. data/docs/guide/tutorial/01-project-setup.md +0 -75
  118. data/docs/guide/tutorial/02-creating-a-feature-package.md +0 -45
  119. data/docs/guide/tutorial/03-defining-resources.md +0 -90
  120. data/docs/guide/tutorial/04-creating-a-portal.md +0 -101
  121. data/docs/guide/tutorial/05-customizing-the-ui.md +0 -128
  122. data/docs/guide/tutorial/06-adding-custom-actions.md +0 -101
  123. data/docs/guide/tutorial/07-implementing-authorization.md +0 -90
  124. data/docs/markdown-examples.md +0 -85
  125. data/docs/modules/action.md +0 -244
  126. data/docs/modules/authentication.md +0 -236
  127. data/docs/modules/configuration.md +0 -599
  128. data/docs/modules/controller.md +0 -443
  129. data/docs/modules/core.md +0 -316
  130. data/docs/modules/definition.md +0 -1308
  131. data/docs/modules/display.md +0 -759
  132. data/docs/modules/form.md +0 -495
  133. data/docs/modules/generator.md +0 -400
  134. data/docs/modules/index.md +0 -167
  135. data/docs/modules/interaction.md +0 -642
  136. data/docs/modules/package.md +0 -151
  137. data/docs/modules/policy.md +0 -176
  138. data/docs/modules/portal.md +0 -710
  139. data/docs/modules/query.md +0 -297
  140. data/docs/modules/resource_record.md +0 -618
  141. data/docs/modules/routing.md +0 -690
  142. data/docs/modules/table.md +0 -301
  143. data/docs/modules/ui.md +0 -631
@@ -1,165 +0,0 @@
1
- # Installation and Setup
2
-
3
- ::: tip VERSION REQUIREMENTS
4
- - Ruby 3.2.2 or higher
5
- - Rails 7.1 or higher
6
- - Node.js and Yarn
7
- :::
8
-
9
- ## Quick Start
10
-
11
- Get up and running with Plutonium in seconds:
12
-
13
- ::: code-group
14
- ```bash [New App]
15
- rails new plutonium_app -a propshaft -j esbuild -c tailwind \
16
- -m https://radioactive-labs.github.io/plutonium-core/templates/plutonium.rb
17
- ```
18
-
19
- ```bash [Existing App]
20
- bin/rails app:template \
21
- LOCATION=https://radioactive-labs.github.io/plutonium-core/templates/base.rb
22
- ```
23
- :::
24
-
25
- ## Detailed Installation Guide
26
-
27
- 1. Add Plutonium to your Gemfile:
28
-
29
- ::: code-group
30
- ```ruby [Gemfile]
31
- gem "plutonium"
32
- ```
33
-
34
- ```bash [Terminal]
35
- bundle install
36
- ```
37
- :::
38
-
39
- 2. Run the installation generator:
40
-
41
- ```bash
42
- rails generate pu:core:install
43
- ```
44
-
45
- This will:
46
- - Set up the basic Plutonium structure
47
- - Create necessary configuration files
48
- - Configure your application for Plutonium
49
-
50
- ### Project Structure
51
-
52
- After installation, your project will have the following new directories and files:
53
-
54
- ```
55
- my_rails_app/
56
- ├── app/
57
- │ ├── controllers/
58
- │ │ ├── plutonium_controller.rb # Base controller for Plutonium
59
- │ │ └── resource_controller.rb # Base controller for resources
60
- │ ├── definitions/
61
- │ │ └── resource_definition.rb # Base class for resource definitions
62
- │ ├── interactions/
63
- │ │ └── resource_interaction.rb # Base class for resource interactions
64
- │ ├── models/
65
- │ │ └── resource_record.rb # Base module for resource models
66
- │ ├── policies/
67
- │ │ └── resource_policy.rb # Base class for resource policies
68
- │ └── views/
69
- │ └── layouts/
70
- │ └── resource.html.erb # Base layout for resources
71
- ├── config/
72
- │ ├── initializers/
73
- │ │ └── plutonium.rb # Main configuration
74
- │ └── packages.rb # Package registration
75
- └── packages/ # Directory for modular features
76
- └── .keep
77
- ```
78
-
79
- ## Configuration
80
-
81
- ### Basic Configuration
82
-
83
- Configure Plutonium in `config/initializers/plutonium.rb`:
84
-
85
- ```ruby
86
- Plutonium.configure do |config|
87
- # Load default configuration for version 1.0
88
- config.load_defaults 1.0
89
-
90
- # Asset configuration
91
- config.assets.stylesheet = "plutonium.css" # Default stylesheet
92
- config.assets.script = "plutonium.js" # Default JavaScript
93
- config.assets.logo = "plutonium.png" # Default logo
94
- end
95
- ```
96
-
97
- ### Authentication Setup
98
-
99
- Plutonium supports multiple authentication strategies. Here's how to set up the recommended Rodauth integration:
100
-
101
- 1. Install Rodauth:
102
-
103
- ```bash
104
- rails generate pu:rodauth:install
105
- ```
106
-
107
- 2. Create an authentication account:
108
-
109
- ::: code-group
110
- ```bash [Basic Setup]
111
- rails generate pu:rodauth:account user
112
- ```
113
-
114
- ```bash [Custom Setup]
115
- # Include selected authentication features
116
- rails generate pu:rodauth:account admin --no-defaults \
117
- --login --logout --remember --lockout \
118
- --create-account --verify-account --close-account \
119
- --change-password --reset-password --reset-password-notify \
120
- --active-sessions --password-grace-period --otp \
121
- --recovery-codes --audit-logging --internal-request
122
- ```
123
- :::
124
-
125
- 3. Configure the authentication controller:
126
-
127
- ```ruby
128
- # app/controllers/resource_controller.rb
129
- class ResourceController < PlutoniumController
130
- include Plutonium::Resource::Controller
131
- include Plutonium::Auth::Rodauth(:user)
132
- end
133
- ```
134
-
135
- ::: tip
136
- You can use your existing authentication system by implementing the `current_user` method in `ResourceController`.
137
- :::
138
-
139
- ## Optional Enhancements
140
-
141
- ### Database Performance
142
-
143
- For PostgreSQL/MySQL users, add these recommended gems:
144
-
145
- ```ruby
146
- group :development, :test do
147
- # N+1 query detection
148
- gem "prosopite"
149
- end
150
-
151
- # Automatic eager loading
152
- gem "goldiloader"
153
- ```
154
-
155
- ### Development Tools
156
-
157
- Add helpful development gems:
158
-
159
- ```ruby
160
- # Generate model annotations
161
- rails generate pu:gem:annotated
162
-
163
- # Set up environment variables
164
- rails generate pu:gem:dotenv
165
- ```
data/docs/guide/index.md DELETED
@@ -1,28 +0,0 @@
1
- ---
2
- layout: home
3
- title: Plutonium Documentation
4
- hero:
5
- name: Plutonium Documentation
6
- text: A RAD toolkit for Rails
7
- tagline: Build better applications, faster.
8
- actions:
9
- - theme: brand
10
- text: Get Started
11
- link: /guide/introduction/01-what-is-plutonium
12
- - theme: alt
13
- text: View on GitHub
14
- link: https://github.com/radioactive-labs/plutonium
15
- features:
16
- - title: Introduction
17
- details: Learn about the core concepts and architecture of Plutonium.
18
- link: /guide/introduction/01-what-is-plutonium
19
- - title: Tutorial
20
- details: A step-by-step guide to building your first application.
21
- link: /guide/tutorial/01-project-setup
22
- - title: Deep Dive Guides
23
- details: In-depth explanations of specific Plutonium features.
24
- link: /guide/deep-dive/resources
25
- - title: Module Documentation
26
- details: Detailed documentation for each Plutonium module.
27
- link: /modules/
28
- ---
@@ -1,211 +0,0 @@
1
- # What is Plutonium?
2
-
3
- Plutonium is a Rapid Application Development (RAD) toolkit that extends Rails with powerful conventions, patterns, and tools to accelerate application development while maintaining flexibility and maintainability.
4
-
5
- It acts as a higher-level abstraction on top of Rails, providing ready-to-use solutions for common application needs while preserving Rails' elegance.
6
-
7
- ## Core Architecture
8
-
9
- ### Rails-Native Design
10
-
11
- Plutonium integrates seamlessly with Rails, extending its conventions rather than replacing them:
12
-
13
- ```ruby
14
- # Plutonium controllers inherit from your ApplicationController
15
- class ResourceController < ApplicationController
16
- include Plutonium::Resource::Controller
17
- end
18
-
19
- # Plutonium controllers are Rails controllers
20
- class ProductsController < ResourceController
21
- # Enhanced with resource capabilities
22
- def custom_action
23
- # Regular Rails code works just fine
24
- respond_to do |format|
25
- format.html
26
- format.json
27
- end
28
- end
29
- end
30
- ```
31
-
32
- ### Resource-Oriented Architecture
33
-
34
- Resources are the building blocks of Plutonium applications:
35
-
36
- ```ruby
37
- class ProductDefinition < ResourceDefinition
38
- # Declarative field definitions
39
- field :name, as: :string
40
- field :description, as: :markdown
41
- field :price_cents, as: :money
42
-
43
- # Resource-level search
44
- search do |scope, query|
45
- scope.where("name LIKE ?", "%#{query}%")
46
- end
47
-
48
- # Business actions
49
- action :publish, interaction: PublishProduct
50
- action :archive, interaction: ArchiveProduct
51
- end
52
- ```
53
-
54
- ### Modular by Design
55
-
56
- Plutonium's packaging system helps organize code into focused, reusable modules:
57
-
58
- ```ruby
59
- # Generate different types of packages
60
- rails generate pu:pkg:portal admin
61
- rails generate pu:pkg:package inventory
62
-
63
- # Packages are isolated and focused
64
- module AdminPortal
65
- class Engine < Rails::Engine
66
- include Plutonium::Portal::Engine
67
- end
68
- end
69
-
70
- AdminPortal::Engine.routes.draw do
71
- register_resource ::Product
72
- end
73
- ```
74
-
75
- ### Progressive Enhancement
76
-
77
- Built on modern web technologies like Hotwire, delivering rich interactivity without sacrificing simplicity:
78
-
79
- ```ruby
80
- class PublishProduct < ResourceInteraction
81
- attribute :schedule_for, :datetime
82
- attribute :notify_users, :boolean
83
-
84
- def execute
85
- resource.publish!(schedule_for:)
86
- notify_users! if notify_users
87
-
88
- success(resource)
89
- .with_message("Product scheduled for publishing")
90
- .with_render_response(NotificationComponent.new)
91
- end
92
- end
93
- ```
94
-
95
- ## Use Cases
96
-
97
- ### Business Applications
98
-
99
- ::: details Enterprise Resource Planning (ERP)
100
- ```ruby
101
- class InvoiceDefinition < ResourceDefinition
102
- # Rich field handling
103
- field :line_items, as: :nested, limit: 20
104
- field :attachments, as: :document, multiple: true
105
-
106
- # Business actions
107
- action :submit_for_approval, interaction: SubmitForApproval
108
- action :approve, interaction: ApproveInvoice
109
- action :reject, interaction: RejectInvoice
110
-
111
- # Workflow states
112
- scope :draft
113
- scope :pending_approval
114
- scope :approved
115
- end
116
- ```
117
- :::
118
-
119
- ::: details Multi-tenant SaaS
120
- ```ruby
121
- module CustomerPortal
122
- class Engine < Rails::Engine
123
- include Plutonium::Package::Engine
124
- # Automatic tenant isolation
125
- scope_to_entity Organization
126
- end
127
- end
128
- ```
129
- :::
130
-
131
- ### Administrative Systems
132
-
133
- ::: details Back-office Applications
134
- ```ruby
135
- class OrderDefinition < ResourceDefinition
136
- # Advanced filtering
137
- filter :status, with: SelectFilter, choices: Order.statuses
138
- filter :created_at, with: DateRangeFilter
139
-
140
- # Bulk actions
141
- action :process_batch, interaction: ProcessPendingOrders
142
- action :export_to_csv, interaction: ExportOrders
143
-
144
- # Complex displays
145
- display :summary do |field|
146
- OrderSummaryComponent.new(field)
147
- end
148
- end
149
- ```
150
- :::
151
-
152
- ::: details Content Management
153
- ```ruby
154
- class ArticleDefinition < ResourceDefinition
155
- field :content, as: :markdown
156
- field :featured_image, as: :image
157
-
158
- # Publishing workflow
159
- action :publish, interaction: PublishArticle
160
- action :schedule, interaction: ScheduleArticle
161
-
162
- # Content organization
163
- scope :draft
164
- scope :published
165
- scope :scheduled
166
- end
167
- ```
168
- :::
169
-
170
- ## Key Benefits
171
-
172
- ### Accelerated Development
173
- - Pre-built components for common functionality
174
- - Smart generators for boilerplate code
175
- - Convention-based resource handling
176
- - Integrated authentication and authorization
177
-
178
- ### Maintainable Architecture
179
- - Clear separation of concerns through packages
180
- - Consistent patterns across the application
181
- - Deep Rails integration
182
- - Progressive enhancement
183
-
184
- ### Enterprise Ready
185
- - Flexible and robust access control
186
- - Multi-tenancy support
187
- - Extensible component system
188
- - Mobile-friendly by default
189
-
190
- ## Best For
191
-
192
- ::: tip IDEAL USE CASES
193
- - Complex business applications
194
- - Multi-tenant SaaS platforms
195
- - Administrative systems
196
- - Content management systems
197
- - Resource management systems
198
- :::
199
-
200
- ::: warning MIGHT NOT BE THE BEST FIT
201
- - Simple blogs or brochure sites
202
- - Basic CRUD applications
203
- - Pure API-only services
204
- :::
205
-
206
- ## Prerequisites
207
-
208
- - Ruby 3.2.2 or higher
209
- - Rails 7.1 or higher
210
- - Node.js and Yarn
211
- - Basic understanding of Ruby on Rails