plutonium 0.10.0 → 0.10.2
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/README.md +2 -0
 - data/app/assets/javascripts/turbo/index.js +1 -1
 - data/app/views/application/_resource_header.html.erb +12 -12
 - data/app/views/layouts/resource.html.erb +1 -0
 - data/app/views/layouts/rodauth.html.erb +4 -4
 - data/app/views/resource/_nav_user.html.erb +1 -1
 - data/app/views/resource/index.rabl +1 -1
 - data/brakeman.ignore +1 -1
 - data/config/initializers/rabl.rb +2 -0
 - data/css.manifest +1 -1
 - data/js.manifest +2 -2
 - data/lib/generators/pu/core/install/templates/config/initializers/plutonium.rb +0 -3
 - data/lib/generators/pu/gen/pug/pug_generator.rb +6 -0
 - data/lib/generators/pu/gen/pug/templates/pug.rb.tt +1 -1
 - data/lib/generators/pu/pkg/app/templates/config/routes.rb.tt +3 -3
 - data/lib/plutonium/config.rb +1 -11
 - data/lib/plutonium/core/autodiscovery/input_discoverer.rb +1 -1
 - data/lib/plutonium/core/autodiscovery/renderer_discoverer.rb +1 -1
 - data/lib/plutonium/core/controllers/base.rb +13 -3
 - data/lib/plutonium/core/controllers/queryable.rb +3 -1
 - data/lib/plutonium/pkg/app.rb +6 -0
 - data/lib/plutonium/railtie.rb +15 -0
 - data/lib/plutonium/reloader.rb +99 -0
 - data/lib/plutonium/resource/controller.rb +61 -22
 - data/lib/plutonium/resource/policy.rb +56 -9
 - data/lib/plutonium/resource/presenter.rb +44 -12
 - data/lib/plutonium/resource/query_object.rb +186 -73
 - data/lib/plutonium/resource/record.rb +213 -119
 - data/lib/plutonium/rodauth/controller_methods.rb +7 -0
 - data/lib/plutonium/version.rb +1 -1
 - data/lib/plutonium.rb +50 -12
 - data/package-lock.json +174 -0
 - data/package.json +2 -0
 - data/public/plutonium-assets/plutonium-app-6WILQCTT.js +39 -0
 - data/public/plutonium-assets/plutonium-app-6WILQCTT.js.map +7 -0
 - data/public/plutonium-assets/plutonium-logo-original.png +0 -0
 - data/public/plutonium-assets/plutonium-logo-white.png +0 -0
 - data/public/plutonium-assets/plutonium-logo.png +0 -0
 - data/public/plutonium-assets/plutonium.2d4f0c333cd000051d3b.css +3424 -0
 - data/public/plutonium-assets/plutonium.ico +0 -0
 - metadata +10 -4
 - data/lib/plutonium/reactor/core.rb +0 -78
 - data/public/plutonium-assets/logo.png +0 -0
 
| 
         Binary file 
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: plutonium
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.10. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.10.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Stefan Froelich
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-05-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: zeitwerk
         
     | 
| 
         @@ -1050,8 +1050,8 @@ files: 
     | 
|
| 
       1050 
1050 
     | 
    
         
             
            - lib/plutonium/preserved__/field.rb.bk
         
     | 
| 
       1051 
1051 
     | 
    
         
             
            - lib/plutonium/preserved__/input.rb.bk
         
     | 
| 
       1052 
1052 
     | 
    
         
             
            - lib/plutonium/railtie.rb
         
     | 
| 
       1053 
     | 
    
         
            -
            - lib/plutonium/reactor/core.rb
         
     | 
| 
       1054 
1053 
     | 
    
         
             
            - lib/plutonium/refinements/parameter_refinements.rb
         
     | 
| 
      
 1054 
     | 
    
         
            +
            - lib/plutonium/reloader.rb
         
     | 
| 
       1055 
1055 
     | 
    
         
             
            - lib/plutonium/resource/context.rb
         
     | 
| 
       1056 
1056 
     | 
    
         
             
            - lib/plutonium/resource/controller.rb
         
     | 
| 
       1057 
1057 
     | 
    
         
             
            - lib/plutonium/resource/interaction.rb
         
     | 
| 
         @@ -1072,10 +1072,16 @@ files: 
     | 
|
| 
       1072 
1072 
     | 
    
         
             
            - public/plutonium-assets/application.js
         
     | 
| 
       1073 
1073 
     | 
    
         
             
            - public/plutonium-assets/fonts/bootstrap-icons.woff
         
     | 
| 
       1074 
1074 
     | 
    
         
             
            - public/plutonium-assets/fonts/bootstrap-icons.woff2
         
     | 
| 
       1075 
     | 
    
         
            -
            - public/plutonium-assets/logo.png
         
     | 
| 
       1076 
1075 
     | 
    
         
             
            - public/plutonium-assets/plutonium-app-36KN5FVJ.js
         
     | 
| 
       1077 
1076 
     | 
    
         
             
            - public/plutonium-assets/plutonium-app-36KN5FVJ.js.map
         
     | 
| 
      
 1077 
     | 
    
         
            +
            - public/plutonium-assets/plutonium-app-6WILQCTT.js
         
     | 
| 
      
 1078 
     | 
    
         
            +
            - public/plutonium-assets/plutonium-app-6WILQCTT.js.map
         
     | 
| 
      
 1079 
     | 
    
         
            +
            - public/plutonium-assets/plutonium-logo-original.png
         
     | 
| 
      
 1080 
     | 
    
         
            +
            - public/plutonium-assets/plutonium-logo-white.png
         
     | 
| 
      
 1081 
     | 
    
         
            +
            - public/plutonium-assets/plutonium-logo.png
         
     | 
| 
      
 1082 
     | 
    
         
            +
            - public/plutonium-assets/plutonium.2d4f0c333cd000051d3b.css
         
     | 
| 
       1078 
1083 
     | 
    
         
             
            - public/plutonium-assets/plutonium.50232e35b5495f5ad90d.css
         
     | 
| 
      
 1084 
     | 
    
         
            +
            - public/plutonium-assets/plutonium.ico
         
     | 
| 
       1079 
1085 
     | 
    
         
             
            - sig/plutonium.rbs
         
     | 
| 
       1080 
1086 
     | 
    
         
             
            - tailwind.config.js
         
     | 
| 
       1081 
1087 
     | 
    
         
             
            - templates/base.rb
         
     | 
| 
         @@ -1,78 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # Be sure to restart your server when you modify this file.
         
     | 
| 
       2 
     | 
    
         
            -
            # This is a glorified initializer
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Plutonium
         
     | 
| 
       5 
     | 
    
         
            -
              module Reactor
         
     | 
| 
       6 
     | 
    
         
            -
                class Core
         
     | 
| 
       7 
     | 
    
         
            -
                  def self.achieve_criticality!
         
     | 
| 
       8 
     | 
    
         
            -
                    # Eager load the framework
         
     | 
| 
       9 
     | 
    
         
            -
                    # Plutonium::ZEITWERK_LOADER.eager_load
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                    # Load view components
         
     | 
| 
       12 
     | 
    
         
            -
                    load Plutonium.root.join("app", "views", "components", "base.rb")
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                    # Load initializers
         
     | 
| 
       15 
     | 
    
         
            -
                    Dir.glob(Plutonium.root.join("config", "initializers", "**", "*.rb")) { |file| load file }
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
                    start_reloader!
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  def self.start_reloader!
         
     | 
| 
       21 
     | 
    
         
            -
                    # TODO: see which parts of this can be moved into zeitwerk
         
     | 
| 
       22 
     | 
    
         
            -
                    return unless Plutonium::Config.enable_hotreload
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                    # GLORIOUS hotreload!!!
         
     | 
| 
       25 
     | 
    
         
            -
                    @listener ||= begin
         
     | 
| 
       26 
     | 
    
         
            -
                      require "listen"
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                      reload_paths = []
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                      if Plutonium::Config.development
         
     | 
| 
       31 
     | 
    
         
            -
                        reload_paths << Plutonium.lib_root.to_s
         
     | 
| 
       32 
     | 
    
         
            -
                        reload_paths << Plutonium.root.join("app", "views", "components").to_s
         
     | 
| 
       33 
     | 
    
         
            -
                        reload_paths << Plutonium.root.join("config", "initializers").to_s
         
     | 
| 
       34 
     | 
    
         
            -
                      end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                      # we want to always watch packages for changes to engines
         
     | 
| 
       37 
     | 
    
         
            -
                      packages_dir = Rails.root.join("packages/").to_s
         
     | 
| 
       38 
     | 
    
         
            -
                      reload_paths << packages_dir if File.directory?(packages_dir)
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
                      listener = Listen.to(*reload_paths, only: /\.rb$/) do |modified, added, removed|
         
     | 
| 
       41 
     | 
    
         
            -
                        (modified + added).each do |file|
         
     | 
| 
       42 
     | 
    
         
            -
                          next if file == __FILE__ # reloading this file does nothing
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                          if file.starts_with?(packages_dir)
         
     | 
| 
       45 
     | 
    
         
            -
                            # if package file was added, ignore it
         
     | 
| 
       46 
     | 
    
         
            -
                            # otherwise rails gets mad at us since engines cannot be loaded after initial boot
         
     | 
| 
       47 
     | 
    
         
            -
                            # TODO: check if guard has apis to control reloading dynamically
         
     | 
| 
       48 
     | 
    
         
            -
                            next if added.include? file
         
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                            case File.basename(file)
         
     | 
| 
       51 
     | 
    
         
            -
                            when "engine.rb"
         
     | 
| 
       52 
     | 
    
         
            -
                              # rails engines are loaded once,
         
     | 
| 
       53 
     | 
    
         
            -
                              # so in order to detect resource registration changes, we need to handle reloads ourselves
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
                              # load the engine and reload routes to pick up any registration changes
         
     | 
| 
       56 
     | 
    
         
            -
                              Rails.logger.debug "\nplutonium: reloaded #{file}\n"
         
     | 
| 
       57 
     | 
    
         
            -
                              load file
         
     | 
| 
       58 
     | 
    
         
            -
                              Rails.application.reload_routes!
         
     | 
| 
       59 
     | 
    
         
            -
                            else
         
     | 
| 
       60 
     | 
    
         
            -
                              # non engine package files are reloaded by rails automatically
         
     | 
| 
       61 
     | 
    
         
            -
                            end
         
     | 
| 
       62 
     | 
    
         
            -
                          else
         
     | 
| 
       63 
     | 
    
         
            -
                            Plutonium::ZEITWERK_LOADER.reload
         
     | 
| 
       64 
     | 
    
         
            -
                            load Plutonium.root.join("app", "views", "components", "base.rb")
         
     | 
| 
       65 
     | 
    
         
            -
                            load file # this just a lazy way to ensure we load files that do not contain constants like initializers
         
     | 
| 
       66 
     | 
    
         
            -
                          end
         
     | 
| 
       67 
     | 
    
         
            -
                          Rails.logger.debug "\n\nplutonium: reload #{file}\n"
         
     | 
| 
       68 
     | 
    
         
            -
                        rescue => e
         
     | 
| 
       69 
     | 
    
         
            -
                          Rails.logger.error "\n\nplutonium: reload failed #{file}\n\n#{e}\n"
         
     | 
| 
       70 
     | 
    
         
            -
                        end
         
     | 
| 
       71 
     | 
    
         
            -
                      end
         
     | 
| 
       72 
     | 
    
         
            -
                      listener.start
         
     | 
| 
       73 
     | 
    
         
            -
                      listener
         
     | 
| 
       74 
     | 
    
         
            -
                    end
         
     | 
| 
       75 
     | 
    
         
            -
                  end
         
     | 
| 
       76 
     | 
    
         
            -
                end
         
     | 
| 
       77 
     | 
    
         
            -
              end
         
     | 
| 
       78 
     | 
    
         
            -
            end
         
     | 
| 
         Binary file 
     |