Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

major: new Osm_Project application #2

Merged
merged 1 commit into from Sep 2, 2021
Merged

major: new Osm_Project application #2

merged 1 commit into from Sep 2, 2021

Conversation

osmianski
Copy link
Member

Problem

A typical Osm Framework-based project contains several applications:

  • Osm_App is the main application that you eventually host on the Web.
  • My_Samples is a superset of Osm_App used in unit tests. It may contain additional modules that are only used in tests.
  • Osm_Tools is an auxiliary application used to develop and manage the main application.

Each application has intimate knowledge about its modules and classes.

However, in some cases, it's useful to introspect all modules and classes of the project regardless to which application they belong. It is especially useful in code generation.

Solution

It's written in present tense, as if the change is already implemented, on purpose. It makes it easier to update the framework documentation with new features.

New Osm_Project application allows to introspect all modules and classes of
the project regardless to which application they belong.

Use it as follows:

use Osm\Project\App;
...

$result = [];

Apps::run(Apps::create(App::class), function (App $app) use (&$result) {
    // use $app->modules and $app->classes to introspect 
    // all modules and classes of the projects and its 
    // installed dependencies
    
    // put the introspection data you need into `$result`. Don't reference
    // objects of the `Osm_Project` application, as they'll won't work 
    // outside this closure. Instead, create plain PHP objects and arrays, 
    // and fill them as needed 
});

Notice. This application is for introspection only. Invoking user code in context of this application may produce unexpected results.

@osmianski osmianski merged commit d951494 into osmphp:v0.9 Sep 2, 2021
@osmianski
Copy link
Member Author

It's a major change, all projects should compile the Osm_Project app in
the gulpfile.js:

global.config = {
    'Osm_Tools': [],
    'Osm_Project': [], // NEW
    'Osm_App': ['_front__tailwind']
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant