Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
core-perl6
core-perl6
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 0
    • Merge Requests 0
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pheix-pool
  • core-perl6core-perl6
  • Issues
  • #106

Closed
Open
Opened Nov 20, 2020 by Konstantin Narkhov@pheixOwner

New modules (addons) — integration notes

Basics

New modules (addons) are extensions points to add extra functionality to Pheix. Technically speaking addons should be just Raku modules.

Addon generic requirements:

  1. Installation as Raku module via zef;
  2. Configuration in config.json file;
  3. Each addon should provide Pheix::Addons::ModuleName and Pheix::Addons::ModuleName::API.

Breaking changes

Add $addon optional argument to fill_seodata() method:
method fill_seodata(Str :$pg_addon, Str $pg_type) {
    ...
    given $pg_type {
        when 'debug' {
            ;
        }
        when '404' {
            %h.append({m => 'Pheix' !!, t => '404'});
        }
        default {
            %h.append(
                {
                     m => ($pg_addon eq q{}) ?? 'Pheix' !! $pg_addon,
                     t => $pg_type
                }
            );
        }
    }
    ...
}
Update show_pg method for Phiex::View::Pages:
  1. Add $pg_addon optional argument fill_seodata() method:
method show_pg(
    Str  :$pg_addon,
    Str  :$pg_type!,
    Str  :$pg_route!,
    Str  :$pg_content,
         :%pg_env
) returns Str { ... }
  1. Call fill_seodata() method with $pg_addon argument:
self.fill_seodata(:pg_addon($pg_addon // 'Pheix'), :pg_type($pg_type));
Update given block at show_pg() method in Phiex::View::Pages:
  • Make current default block as when 'debug' { ... };
  • Make when 'index' { ... } block as default { ... };
  • Update debug calls to show_pg method (grep -rwn "show_pg"):
    • lib/Pheix/Controller/Basic.rakumod:76;
    • lib/Pheix/Controller/Basic.rakumod:94;
    • lib/Pheix/Controller/Basic.rakumod:114;
    • t/18-pages.t:74;
    • t/18-pages.t:97.
Update Phiex::Model::JSON:

Add :conf() arg to group getters:

method get_setting(Str $addon, Str $setting, Str $key, Bool $nocache?, Str :$conf) returns Cool { ... };
method get_group_setting(Str $addon, Str $group, Str $setting, Str $key, Str :$conf) returns Cool { ... };
method get_all_settings_for_group_member(Str $addon, Str $group, Str $setting, Str :$conf) returns Hash { ... };

Module structure

Each addon should has:

  1. sharedobj attr (type Hash) as a container for sharedobj from Pheix::Controller::Basic;
  2. name attr (type Str):
has $.name = 'Weblog';
  1. jsonobj attr (type Pheix::Model::JSON) with module readonly configuration;
has $.jsonob = Pheix::Model::JSON.new(:addonpath('conf/addons')).set_entire_config(:addon($!name));
  1. genesis attr (type Hash) with module readonly configuration:
has %.genesis =
    version  => 0.0.1,
    routes   => $!jsonob.get_all_settings_for_group_member($!name, 'routing', 'routes')
;
  1. Handler methods (see routes config) for API rendering.
  2. Method for SEO tag import to configuration at initialization stage

Sample

https://gitlab.com/pheix-pool/core-perl6/-/blob/2a32436706e15b102e787f6cbad1be6ad0775234/lib/Pheix/Addons/Embedded/User.rakumod

Private database, SEO tags

Do we need conf/system/module.tnk?

More details: #106 (comment 459550707)

Edited Dec 21, 2020 by Konstantin Narkhov
Assignee
Assign to
Public beta version
Milestone
Public beta version (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: pheix-pool/core-perl6#106