Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
best-practical
rt-extension-jsgantt
Commits
fb54f3f9
Commit
fb54f3f9
authored
Feb 06, 2014
by
sunnavy
Browse files
update inc/
parent
e9047cd5
Changes
1
Hide whitespace changes
Inline
Side-by-side
inc/Module/Install/RTx.pm
View file @
fb54f3f9
...
...
@@ -8,13 +8,13 @@ no warnings 'once';
use
Module::Install::
Base
;
use
base
'
Module::Install::Base
';
our
$VERSION
=
'
0.2
9
';
our
$VERSION
=
'
0.
3
2
';
use
FindBin
;
use
File::
Glob
();
use
File::
Basename
();
my
@DIRS
=
qw(etc lib html bin sbin po var)
;
my
@DIRS
=
qw(etc lib html
static
bin sbin po var)
;
my
@INDEX_DIRS
=
qw(lib bin sbin)
;
sub
RTx
{
...
...
@@ -62,10 +62,11 @@ sub RTx {
unshift
@INC
,
"
$RT
::LocalPath/lib
"
if
$
RT::
LocalPath
;
unshift
@INC
,
$lib_path
;
$
RT::
LocalVarPath
||=
$
RT::
VarPath
;
$
RT::
LocalPoPath
||=
$
RT::
LocalLexiconPath
;
$
RT::
LocalHtmlPath
||=
$
RT::
MasonComponentRoot
;
$
RT::
LocalLibPath
||=
"
$RT
::LocalPath/lib
";
$
RT::
LocalVarPath
||=
$
RT::
VarPath
;
$
RT::
LocalPoPath
||=
$
RT::
LocalLexiconPath
;
$
RT::
LocalHtmlPath
||=
$
RT::
MasonComponentRoot
;
$
RT::
LocalStaticPath
||=
$
RT::
StaticPath
;
$
RT::
LocalLibPath
||=
"
$RT
::LocalPath/lib
";
my
$with_subdirs
=
$ENV
{
WITH_SUBDIRS
};
@ARGV
=
grep
{
/WITH_SUBDIRS=(.*)/
?
(
(
$with_subdirs
=
$
1
),
0
)
:
1
}
...
...
@@ -129,23 +130,13 @@ install ::
my %has_etc;
if ( File::Glob::bsd_glob(
"
$
FindBin::
Bin
/etc/sc
hema
.*
"
) ) {
# got schema, load factory module
$has_etc
{schema}++;
$self
->load('RTxFactory');
$self
->postamble(<<
"
.
"
);
factory ::
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxFactory
(
qw($RTx $name)
)"
dropdb ::
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxFactory
(
qw($RTx $name drop)
)"
.
}
if ( File::Glob::bsd_glob(
"
$
FindBin::
Bin
/etc/acl
.*
"
) ) {
$has_etc
{acl}++;
}
if ( -e 'etc/initialdata' ) {
$has_etc
{initialdata}++; }
if ( -d 'etc/upgrade/' ) {
$has_etc
{upgrade}++; }
$self
->postamble(
"
$postamble
\
n
"
);
unless (
$subdirs
{'lib'} ) {
...
...
@@ -164,28 +155,25 @@ dropdb ::
print
"
For
first
-
time
installation
,
type
'
make initdb
'
.\
n
"
;
my
$initdb
= '';
$initdb
.= <<
"
.
"
if
$has_etc
{schema};
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(schema)
)"
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(schema
\$(NAME) \$(VERSION)
)
)"
.
$initdb
.= <<
"
.
"
if
$has_etc
{acl};
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(acl)
)"
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(acl
\$(NAME) \$(VERSION)
)
)"
.
$initdb
.= <<
"
.
"
if
$has_etc
{initialdata};
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(insert)
)"
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(insert
\$(NAME) \$(VERSION)
)
)"
.
$self
->postamble(
"
initdb
::\
n$initdb
\
n
"
);
$self
->postamble(
"
initialize
-
database
::\
n$initdb
\
n
"
);
if (
$has_etc
{upgrade}) {
print
"
To
upgrade
from
a
previous
version
of
this
extension
,
use
'
make upgrade-database
'
\
n
"
;
my
$upgradedb
= qq|
\t\$
(NOECHO)
\$
(PERL) -Ilib -I
"
$local_lib_path
"
-I
"
$lib_path
"
-Minc::Module::Install -e
"
RTxInitDB
(
qw(upgrade \$(NAME) \$(VERSION))
)"
\n
|;
$self
->postamble(
"
upgrade
-
database
::\
n$upgradedb
\
n
"
);
$self
->postamble(
"
upgradedb
::\
n$upgradedb
\
n
"
);
}
}
}
sub RTxInit {
unshift
@INC
, substr( delete(
$INC
{'RT.pm'} ), 0, -5 ) if
$INC
{'RT.pm'};
require RT;
RT::LoadConfig();
RT::ConnectToDatabase();
die
"
Cannot
load
RT
"
unless
$RT
::Handle and
$RT
::DatabaseType;
}
# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
{ my %word = (
a => -4,
...
...
@@ -228,4 +216,4 @@ sub requires_rt {
__END__
#line 3
48
#line 3
36
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment