2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2024-11-22 02:59:49 +00:00

98_Installer: fix x_copyright and x_privacy; add x_raw to visual rendering

git-svn-id: https://svn.fhem.de/fhem/trunk@19190 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-04-15 14:41:53 +00:00
parent 64d68e6a2f
commit 5ec28cb793
2 changed files with 230 additions and 93 deletions

View File

@ -2175,9 +2175,6 @@ sub CreateMetadataList ($$$) {
&& ( !defined( $modMeta->{release_status} )
|| $modMeta->{release_status} eq 'stable' )
);
next
if ( $mAttr eq 'copyright'
&& !defined( $modMeta->{x_copyright} ) );
next
if (
$mAttr eq 'abstract'
@ -2204,6 +2201,18 @@ sub CreateMetadataList ($$$) {
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{homepage} ) )
);
next
if (
$mAttr eq 'copyright'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_copyright} ) )
);
next
if (
$mAttr eq 'privacy'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_privacy} ) )
);
next
if (
$mAttr eq 'wiki'
@ -2222,12 +2231,6 @@ sub CreateMetadataList ($$$) {
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_support_commercial} ) )
);
next
if (
$mAttr eq 'privacy'
&& ( !defined( $modMeta->{resources} )
|| !defined( $modMeta->{resources}{x_privacy} ) )
);
next
if (
$mAttr eq 'keywords'
@ -2277,22 +2280,19 @@ sub CreateMetadataList ($$$) {
}
elsif ( $mAttr eq 'copyright' ) {
my $copyName;
my $copyEmail;
my $copyName = '© ';
my $copyEmail =
defined( $modMeta->{resources}{x_copyright}{mailto} )
? $modMeta->{resources}{x_copyright}{mailto}
: '';
my $copyWeb;
my $copyNameContact;
if ( $modMeta->{x_copyright} =~
m/^([^<>\n\r]+)(?:\s+(?:<(.*)>))?$/ )
{
if ( defined( $modMeta->{x_vcs} ) ) {
$copyName = '© ' . $modMeta->{x_vcs}[8] . ' ' . $1;
}
else {
$copyName = '© ' . $1;
}
$copyEmail = $2;
}
$copyName .= $modMeta->{x_vcs}[8] . ' '
if ( defined( $modMeta->{x_vcs} ) );
$copyName .=
$modMeta->{resources}{x_copyright}{title};
if ( defined( $modMeta->{resources} )
&& defined( $modMeta->{resources}{x_copyright} )
&& defined( $modMeta->{resources}{x_copyright}{web} ) )
@ -2544,33 +2544,86 @@ sub CreateMetadataList ($$$) {
)
{
my $bName = $modMeta->{resources}{repository}{x_branch};
$bName .= ' (prod)'
$bName = 'production'
if ( $modMeta->{resources}{repository}{x_branch} eq
$modMeta->{resources}{repository}{x_dev}{x_branch}
);
# master entry
# webview: master entry
$l .=
'View online source code: <a href="'
. $url
. '" target="_blank">'
. $bName . '</a>';
# dev link
# webview: dev link
$bName =
$modMeta->{resources}{repository}{x_dev}{x_branch};
$bName .= ' (dev)'
$bName = 'development'
if ( $modMeta->{resources}{repository}{x_branch} eq
$modMeta->{resources}{repository}{x_dev}{x_branch}
);
$url = $modMeta->{resources}{repository}{x_dev}{web};
# dev entry
# webview: dev entry
$l .=
' | <a href="'
. $url
. '" target="_blank">'
. $bName . '</a>';
# raw: master entry
if (
defined( $modMeta->{resources}{repository}{x_raw} )
)
{
$bName =
$modMeta->{resources}{repository}{x_branch};
$bName = 'production'
if (
$modMeta->{resources}{repository}{x_branch} eq
$modMeta->{resources}{repository}{x_dev}
{x_branch} );
$url = $modMeta->{resources}{repository}{x_raw};
$l .=
$lb
. 'Download raw file: <a href="'
. $url
. '" target="_blank" download="'
. $modMeta->{x_file}[2] . '">'
. $bName . '</a>';
# raw: dev link
if (
defined(
$modMeta->{resources}{repository}{x_dev}
{x_raw}
)
)
{
$bName =
$modMeta->{resources}{repository}{x_dev}
{x_branch};
$bName = 'development'
if (
$modMeta->{resources}{repository}{x_branch}
eq
$modMeta->{resources}{repository}{x_dev}
{x_branch} );
$url =
$modMeta->{resources}{repository}{x_dev}
{x_raw};
# raw: dev entry
$l .=
' | <a href="'
. $url
. '" target="_blank" download="'
. $modMeta->{x_file}[2] . '">'
. $bName . '</a>';
}
}
}
# master entry
@ -2579,46 +2632,108 @@ sub CreateMetadataList ($$$) {
'<a href="'
. $url
. '" target="_blank">View online source code</a>';
if (
defined( $modMeta->{resources}{repository}{x_raw} )
)
{
$l .=
$lb
. '<a href="'
. $modMeta->{resources}{repository}{x_raw}
. '" target="_blank" download="'
. $modMeta->{x_file}[2]
. '">Download raw file</a>';
}
}
$l .= $lb;
}
# VCS link
my $url =
$modMeta->{resources}{repository}{url};
my $urlPrefix = (
$modMeta->{resources}{repository}{url} =~
/^$modMeta->{resources}{repository}{type}/i
? ''
: lc( $modMeta->{resources}{repository}{type} ) . '+'
);
$l .=
uc( $modMeta->{resources}{repository}{type} )
. ' repository: '
. $modMeta->{resources}{repository}{url};
. '<a href="'
. $urlPrefix
. $modMeta->{resources}{repository}{url}
. '" target="_blank">'
. $urlPrefix
. $modMeta->{resources}{repository}{url} . '</a>';
if (
defined(
$modMeta->{resources}{repository}{x_branch_master}
)
)
{
$l .=
$lb
. 'Main branch: '
. $modMeta->{resources}{repository}{x_branch_master};
if ( defined( $modMeta->{resources}{repository}{x_branch} ) ) {
if (
lc( $modMeta->{resources}{repository}{type} ) eq 'svn' )
{
$l .=
$lb
. 'Main branch: '
. '<a href="'
. $urlPrefix
. $modMeta->{resources}{repository}{url} . '/'
. (
$modMeta->{resources}{repository}{x_branch} eq
'trunk'
? 'trunk'
: 'branches/'
. $modMeta->{resources}{repository}{x_branch}
)
. '" target="_blank">'
. $modMeta->{resources}{repository}{x_branch}
. '</a>';
}
else {
$l .=
$lb
. 'Main branch: '
. $modMeta->{resources}{repository}{x_branch};
}
}
if (
defined(
$modMeta->{resources}{repository}{x_branch_master}
)
defined( $modMeta->{resources}{repository}{x_branch} )
&& defined( $modMeta->{resources}{repository}{x_dev} )
&& defined(
$modMeta->{resources}{repository}{x_branch_dev} )
&& $modMeta->{resources}{repository}{x_branch_master} ne
$modMeta->{resources}{repository}{x_branch_dev}
$modMeta->{resources}{repository}{x_dev}{x_branch}
)
&& $modMeta->{resources}{repository}{x_branch} ne
$modMeta->{resources}{repository}{x_dev}{x_branch}
)
{
$l .=
$lb
. 'Dev branch: '
. $modMeta->{resources}{repository}{x_branch_dev};
if (
lc( $modMeta->{resources}{repository}{x_dev}{type} ) eq
'svn' )
{
$l .=
$lb
. 'Dev branch: '
. '<a href="'
. $urlPrefix
. $modMeta->{resources}{repository}{url} . '/'
. (
$modMeta->{resources}{repository}{x_branch} eq
'trunk'
? 'trunk'
: 'branches/'
. $modMeta->{resources}{repository}{x_branch}
)
. '" target="_blank">'
. $modMeta->{resources}{repository}{x_dev}{x_branch}
. '</a>';
}
else {
$l .=
$lb
. 'Dev branch: '
. $modMeta->{resources}{repository}{x_dev}{x_branch};
}
}
}
else {
@ -3723,10 +3838,21 @@ sub LoadInstallStatusPerl(;$) {
if ( $type eq 'module' ) {
$modMeta->{prereqs}
{runtime}{$mAttr}{$missing} = 0;
push @{ $modMeta->{prereqs}{runtime}
{x_inherited}{$missing} },
$pkg;
}
else {
$packages{$modName}{META}{prereqs}
{runtime}{$mAttr}{$missing} = 0;
push
@{ $packages{$modName}{META}{prereqs}
{runtime}{x_inherited}{$missing}
},
$pkg;
}
}
}
@ -4038,19 +4164,19 @@ sub __aUniq {
Installer
</h3>
<ul>
<u><strong>Installer - Module to update FHEM, install 3rd-party FHEM modules and manage system prerequisites</strong></u><br>
<br>
<br>
<a name="Installerdefine" id="Installerdefine"></a><strong>Define</strong><br>
<u><strong>Installer - Module to update FHEM, install 3rd-party FHEM modules and manage system prerequisites</strong></u><br />
<br />
<br />
<a name="Installerdefine" id="Installerdefine"></a><strong>Define</strong><br />
<ul>
<code>define &lt;name&gt; Installer</code><br>
<br>
Example:<br>
<code>define &lt;name&gt; Installer</code><br />
<br />
Example:<br />
<ul>
<code>define fhemInstaller Installer</code><br>
</ul><br>
</ul><br>
<br>
<code>define fhemInstaller Installer</code><br />
</ul><br />
</ul><br />
<br />
<a name="Installerget" id="Installerget"></a><strong>Get</strong>
<ul>
<li>checkPrereqs - list all missing prerequisites. If no parameter was given, the running live system will be inspected. If the parameter is a FHEM cfg file, inspection will be based on devices from this file. If the parameter is a list of module names, those will be used for inspection.
@ -4065,8 +4191,8 @@ sub __aUniq {
</li>
<li>zzGetPackageMETA.json - prints raw meta information of a FHEM package in JSON format
</li>
</ul><br>
<br>
</ul><br />
<br />
<a name="Installerattribut" id="Installerattribut"></a><strong>Attributes</strong>
<ul>
<li>disable - disables the device

View File

@ -28,32 +28,32 @@
myModule
</h3>
<ul>
Long description about what this module does and what it is for.<br>
<br>
Long description about what this module does and what it is for.<br />
<br />
<a name="myModuledefine" id="myModuledefine"></a><b>Define</b>
<ul>
<code>define &lt;name&gt; myModule</code><br>
<br>
Describe a little bit what this define command will do and how the device instance will behave afterwards.<br>
</ul><br>
<code>define &lt;name&gt; myModule</code><br />
<br />
Describe a little bit what this define command will do and how the device instance will behave afterwards.<br />
</ul><br />
<a name="myModuleset" id="myModuleset"></a><b>Set</b>
<ul>
<li>setCommand1<br>
<li>setCommand1<br />
This command does xyz.
</li>
<li>setCommand2 &lt;parameter&gt;<br>
<li>setCommand2 &lt;parameter&gt;<br />
This command does abc and requires a parameter. Example:
<ul>
<code>get myModule getCommand1 on</code>
</ul>
</li>
</ul><br>
</ul><br />
<a name="myModuleget" id="myModuleget"></a><b>Get</b>
<ul>
<li>getCommand1<br>
<li>getCommand1<br />
This command does xyz.
</li>
<li>getCommand2 &lt;parameter&gt;<br>
<li>getCommand2 &lt;parameter&gt;<br />
This command does abc and requires a parameter. Example:
<ul>
<code>get myModule getCommand1 on</code>
@ -62,9 +62,9 @@
</ul><a name="myModuleattr" id="myModuleattr"></a><b>Attributes</b>
<ul>
<a name="myAttribute1" id="myAttribute1"></a>
<li>myAttribute1<br>
<li>myAttribute1<br />
This attribute configures xyz.
</li><br>
</li><br />
</ul>
</ul>
@ -77,32 +77,32 @@
myModule
</h3>
<ul>
Längere Beschreibung, was dieses Modul macht und wofür es gut ist.<br>
<br>
Längere Beschreibung, was dieses Modul macht und wofür es gut ist.<br />
<br />
<a name="myModuledefine" id="myModuledefine"></a><b>Define</b>
<ul>
<code>define &lt;name&gt; myModule</code><br>
<br>
Kurze Beschreibung, was dieses define Kommando genau macht und wie die Device Instanz sich anschließend verhalten wird.<br>
</ul><br>
<code>define &lt;name&gt; myModule</code><br />
<br />
Kurze Beschreibung, was dieses define Kommando genau macht und wie die Device Instanz sich anschließend verhalten wird.<br />
</ul><br />
<a name="myModuleset" id="myModuleset"></a><b>Set</b>
<ul>
<li>setCommand1<br>
<li>setCommand1<br />
Dieses Kommando macht xyz.
</li>
<li>setCommand2 &lt;parameter&gt;<br>
<li>setCommand2 &lt;parameter&gt;<br />
Dieses Kommando macht abc und benötigt einen Parameter. Beispiel:
<ul>
<code>get myModule getCommand1 on</code>
</ul>
</li>
</ul><br>
</ul><br />
<a name="myModuleget" id="myModuleget"></a><b>Get</b>
<ul>
<li>getCommand1<br>
<li>getCommand1<br />
Dieses Kommando macht xyz.
</li>
<li>getCommand2 &lt;parameter&gt;<br>
<li>getCommand2 &lt;parameter&gt;<br />
Dieses Kommando macht abc und benötigt einen Parameter. Beispiel:
<ul>
<code>get myModule getCommand1 on</code>
@ -111,9 +111,9 @@
</ul><a name="myModuleattr" id="myModuleattr"></a><b>Attributes</b>
<ul>
<a name="myAttribute1" id="myAttribute1"></a>
<li>myAttribute1<br>
<li>myAttribute1<br />
Dieses Attribut konfiguriert xyz.
</li><br>
</li><br />
</ul>
</ul>
@ -209,6 +209,7 @@
"x_web_title": "Github Issues for fhem/myModule"
},
"homepage": "https://myModuleHasAhomepage.com",
"x_homepage_title": "myModuleHasAhomepage",
"license": [
"https://github.com/fhem/myModule/blob/master/LICENSE"
],
@ -223,19 +224,29 @@
"web": "https://github.com/fhem/myModule/blob/dev/subdir/00_myModule.pm",
"x_branch": "dev",
"x_filepath": "subdir/",
"x_raw": "https://raw.githubusercontent.com/fhem/myModule/dev/subdir/00_myModule.pm"
"x_raw": "https://github.com/fhem/myModule/raw/dev/subdir/00_myModule.pm"
},
"x_filepath": "subdir/",
"x_raw": "https://raw.githubusercontent.com/fhem/myModule/master/subdir/00_myModule.pm"
"x_raw": "https://github.com/fhem/myModule/raw/master/subdir/00_myModule.pm"
},
"x_commandref" : {
"title" : "I want to name it differently, not 'Online version'",
"web" : "https://myModuleHasAhomepage.com/myModuleHasAnExternalOnlineCommandRef.html"
},
"x_copyright": {
"mailto": "contact@example.com",
"title": "My Company Inc.",
"web": "https://www.example.com/legal"
},
"x_privacy": {
"mailto": "dataprivacy@example.com",
"title": "About data privacy",
"web": "https://www.example.com/privacy"
},
"x_support_commercial": {
"mailto": "support@mycompany.com",
"mailto": "support@example.com",
"title": "My Company",
"web": "https://support.mycompany.com"
"web": "https://support.example.com"
},
"x_support_community": {
"rss": "https://forum.fhem.de/index.php?action=.xml;type=rss;board=19",