2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

98_Installer: sorting order

git-svn-id: https://svn.fhem.de/fhem/trunk@18855 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-03-11 00:41:35 +00:00
parent 602c446873
commit 51b32b6749
2 changed files with 117 additions and 15 deletions

View File

@ -209,14 +209,17 @@ sub Notify($$) {
return; return;
} }
#TODO
# - filter out FHEM command modules from FHEMWEB view (+attribute) -> difficult as not pre-loaded
# - disable FHEM automatic link to device instances in output
sub Get($$@) { sub Get($$@) {
my ( $hash, $name, @aa ) = @_; my ( $hash, $name, @aa ) = @_;
my ( $cmd, @args ) = @aa; my ( $cmd, @args ) = @aa;
if ( $cmd eq 'showModuleInfo' ) { if ( lc($cmd) eq 'showmoduleinfo' ) {
return "usage: $cmd <MODULE>" if ( @args != 1 ); return "usage: $cmd MODULE" if ( @args != 1 );
my $ret = CreateMetadataList( $hash, $cmd, $args[0] ); my $ret = CreateMetadataList( $hash, $cmd, $args[0] );
return $ret; return $ret;
@ -224,7 +227,7 @@ sub Get($$@) {
else { else {
my $fhemModules; my $fhemModules;
foreach ( sort keys %modules ) { foreach ( sort { "\L$a" cmp "\L$b" } keys %modules ) {
next if ( $_ eq 'Global' ); next if ( $_ eq 'Global' );
$fhemModules .= ',' if ($fhemModules); $fhemModules .= ',' if ($fhemModules);
$fhemModules .= $_; $fhemModules .= $_;
@ -831,6 +834,14 @@ sub WriteReadings($$) {
&& !defined( $decode_json->{error} ) ); && !defined( $decode_json->{error} ) );
} }
#TODO
# - show master/slave dependencies
# - show parent/child dependencies
# - show other dependant/related modules
# - show community and commercial support
# - aligned with bugtracker
# - fill empty keywords
# - Get Community Support URL from MAINTAINERS.txt
sub CreateMetadataList ($$$) { sub CreateMetadataList ($$$) {
my ( $hash, $getCmd, $modName ) = @_; my ( $hash, $getCmd, $modName ) = @_;
$modName = 'Global' if ( uc($modName) eq 'FHEM' ); $modName = 'Global' if ( uc($modName) eq 'FHEM' );
@ -923,6 +934,49 @@ sub CreateMetadataList ($$$) {
foreach my $mAttr (@mAttrs) { foreach my $mAttr (@mAttrs) {
next next
if ( $mAttr eq 'copyright' && !defined( $modMeta->{x_copyright} ) ); if ( $mAttr eq 'copyright' && !defined( $modMeta->{x_copyright} ) );
next
if (
$mAttr eq 'description'
&& ( !defined( $modMeta->{description} )
|| $modMeta->{description} eq 'n/a'
|| $modMeta->{description} eq '' )
);
next
if (
$mAttr eq 'bugtracker'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{bugtracker} ) )
);
next
if (
$mAttr eq 'homepage'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{homepage} ) )
);
next
if (
$mAttr eq 'wiki'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_wiki} ) )
);
next
if (
$mAttr eq 'command_reference'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_commandref} ) )
);
next
if (
$mAttr eq 'community_support'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_support_community} ) )
);
next
if (
$mAttr eq 'commercial_support'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_support_commercial} ) )
);
next next
if ( if (
$mAttr eq 'privacy' $mAttr eq 'privacy'
@ -1033,8 +1087,7 @@ sub CreateMetadataList ($$$) {
? $modMeta->{resources}{x_commandref}{title} ? $modMeta->{resources}{x_commandref}{title}
: ( : (
$modMeta->{resources}{x_commandref}{web} =~ $modMeta->{resources}{x_commandref}{web} =~
m/^(?:https?:\/\/)?fhem\.de/i m/^(?:https?:\/\/)?fhem\.de/i ? 'Public'
? 'FHEM Public Command Reference'
: '' : ''
); );
@ -1087,6 +1140,52 @@ sub CreateMetadataList ($$$) {
'<a href="' . $url . '" target="_blank">' . $title . '</a>'; '<a href="' . $url . '" target="_blank">' . $title . '</a>';
} }
elsif ($mAttr eq 'community_support'
&& defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{x_support_community} )
&& defined( $modMeta->{resources}{x_support_community}{web} ) )
{
my $title =
defined(
$modMeta->{resources}{x_support_community}{x_web_title} )
? $modMeta->{resources}{x_support_community}{x_web_title}
: (
$modMeta->{resources}{x_support_community}{web} =~
m/^(?:https?:\/\/)?forum\.fhem\.de/i ? 'FHEM Forum'
: ''
);
$title = 'FHEM Forum: ' . $title
if ( $title ne ''
&& $title !~ m/^FHEM Forum/i
&& $modMeta->{resources}{x_support_community}{web} =~
m/^(?:https?:\/\/)?forum\.fhem\.de/i );
$l .=
'<a href="'
. $modMeta->{resources}{x_support_community}{web}
. '" target="_blank">'
. $title . '</a>';
}
elsif ($mAttr eq 'commercial_support'
&& defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{x_support_commercial} )
&& defined( $modMeta->{resources}{x_support_commercial}{web} ) )
{
my $title =
defined(
$modMeta->{resources}{x_support_commercial}{x_web_title} )
? $modMeta->{resources}{x_support_commercial}{x_web_title}
: $modMeta->{resources}{x_support_commercial}{web};
$l .=
'<a href="'
. $modMeta->{resources}{x_support_commercial}{web}
. '" target="_blank">'
. $title . '</a>';
}
elsif ($mAttr eq 'bugtracker' elsif ($mAttr eq 'bugtracker'
&& defined( $modMeta->{resources} ) && defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{bugtracker} ) && defined( $modMeta->{resources}{bugtracker} )
@ -1469,7 +1568,7 @@ sub CreateMetadataList ($$$) {
} }
else { else {
push @ret, push @ret,
'Metadata does not contain any prerequisites.' . "\n" 'Module metadata do not contain any prerequisites.' . "\n"
. 'For automatic source code analysis, please install Perl::PrereqScanner::NotQuiteLite .' . 'For automatic source code analysis, please install Perl::PrereqScanner::NotQuiteLite .'
. $lb . $lb
. $lb; . $lb;

View File

@ -847,14 +847,6 @@ m/(^#\s+(?:\d{1,2}\.\d{1,2}\.(?:\d{2}|\d{4})\s+)?[^v\d]*(v?(?:\d{1,3}\.\d{1,3}(?
} }
} }
unless ( defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{bugtracker} ) )
{
if ( defined( $modMeta->{x_vcs} ) ) {
$modMeta->{resources}{bugtracker}{web} = 'https://forum.fhem.de/';
}
}
unless ( defined( $modMeta->{resources} ) unless ( defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{x_wiki} ) ) && defined( $modMeta->{resources}{x_wiki} ) )
{ {
@ -1177,7 +1169,7 @@ sub __SetXVersion {
"metadata", "metadata",
"meta" "meta"
], ],
"version": "v0.1.3", "version": "v0.1.4",
"release_status": "testing", "release_status": "testing",
"author": [ "author": [
"Julian Pawlowski <julian.pawlowski@gmail.com>" "Julian Pawlowski <julian.pawlowski@gmail.com>"
@ -1328,6 +1320,17 @@ sub __SetXVersion {
"x_fhem_maintainer": [ "x_fhem_maintainer": [
"rudolfkoenig" "rudolfkoenig"
], ],
"x_fhem_dependant_modules": [
],
"x_fhem_parent_modules": [
],
"x_fhem_child_modules": [
"apptime", "backup", "cmdalias", "configdb", "copy", "count", "CULflash", "fhemdebug", "fheminfo", "IF", "MSG", "notice", "restore", "setuuid", "template", "update", "uptime", "version", "XmlList"
],
"x_fhem_master_modules": [
],
"x_fhem_slave_modules": [
],
"prereqs": { "prereqs": {
"runtime": { "runtime": {
"requires": { "requires": {