Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
forge001
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
forge001
Commits
32f28cdf
Commit
32f28cdf
authored
11 years ago
by
gg
Browse files
Options
Downloads
Patches
Plain Diff
allow --edit without working config; minor typos discovered on CentOS
parent
a542466b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
textarchive/lib/TA/ObjReg.pm
+16
-4
16 additions, 4 deletions
textarchive/lib/TA/ObjReg.pm
textarchive/vlib001.pl
+16
-7
16 additions, 7 deletions
textarchive/vlib001.pl
with
32 additions
and
11 deletions
textarchive/lib/TA/ObjReg.pm
+
16
−
4
View file @
32f28cdf
...
@@ -60,13 +60,25 @@ sub new
...
@@ -60,13 +60,25 @@ sub new
=cut
=cut
sub
_get_project_paths
{
my
$proj_name
=
shift
;
my
$proj_cfg_dir
=
join
('
/
',
$ENV
{'
TABASE
'},
'
projects
',
$proj_name
);
my
$proj_cfg_fnm
=
join
('
/
',
$proj_cfg_dir
,
'
config.json
');
return
(
$proj_cfg_dir
,
$proj_cfg_fnm
);
}
sub
get_project
sub
get_project
{
{
my
$obj
=
shift
;
my
$obj
=
shift
;
my
$proj_name
=
$obj
->
{'
project
'};
my
$proj_name
=
$obj
->
{'
project
'};
$obj
->
{'
proj_cfg_dir
'}
=
my
$proj_cfg_dir
=
join
('
/
',
$ENV
{'
TABASE
'},
'
projects
',
$proj_name
);
my
(
$proj_cfg_dir
,
$proj_cfg_fnm
)
=
_get_project_paths
(
$proj_name
);
$obj
->
{'
proj_cfg_fnm
'}
=
my
$proj_cfg_fnm
=
join
('
/
',
$proj_cfg_dir
,
'
config.json
');
$obj
->
{'
proj_cfg_dir
'}
=
$proj_cfg_dir
;
$obj
->
{'
proj_cfg_fnm
'}
=
$proj_cfg_fnm
;
my
$proj_cfg
;
my
$proj_cfg
;
unless
(
$proj_cfg
=
TA::Util::
slurp_file
(
$proj_cfg_fnm
,
'
json
'))
unless
(
$proj_cfg
=
TA::Util::
slurp_file
(
$proj_cfg_fnm
,
'
json
'))
...
@@ -822,7 +834,7 @@ sub ta_match
...
@@ -822,7 +834,7 @@ sub ta_match
my
$all_reg
=
shift
;
my
$all_reg
=
shift
;
my
$search
=
shift
;
my
$search
=
shift
;
my
@k
=
keys
$search
;
my
@k
=
keys
%
$search
;
my
@e
=
@
{
$all_reg
->
{'
entries
'}};
my
@e
=
@
{
$all_reg
->
{'
entries
'}};
REG:
for
(
my
$i
=
0
;
$i
<=
$#e
;
$i
++
)
REG:
for
(
my
$i
=
0
;
$i
<=
$#e
;
$i
++
)
{
{
...
@@ -848,7 +860,7 @@ sub ta_filter
...
@@ -848,7 +860,7 @@ sub ta_filter
my
$all_reg
=
shift
;
my
$all_reg
=
shift
;
my
$search
=
shift
;
my
$search
=
shift
;
my
@k
=
keys
$search
;
my
@k
=
keys
%
$search
;
my
@e
=
@
{
$all_reg
->
{'
entries
'}};
my
@e
=
@
{
$all_reg
->
{'
entries
'}};
my
@m
=
();
my
@m
=
();
my
@n
=
();
my
@n
=
();
...
...
This diff is collapsed.
Click to expand it.
textarchive/vlib001.pl
+
16
−
7
View file @
32f28cdf
...
@@ -86,6 +86,14 @@ unless (defined ($project))
...
@@ -86,6 +86,14 @@ unless (defined ($project))
}
}
# &usage ('no store specified') unless (defined ($store));
# &usage ('no store specified') unless (defined ($store));
if
(
$op_mode
eq
'
edit
')
{
my
(
$proj_cfg_dir
,
$proj_cfg_fnm
)
=
TA::ObjReg::
_get_project_paths
(
$project
);
system
("
\$
EDITOR '
$proj_cfg_fnm
'
");
# print "store_cfg: ", Dumper ($store_cfg);
exit
;
}
my
$objreg
=
new
TA::
ObjReg
('
project
'
=>
$project
,
'
store
'
=>
$store
,
'
key
'
=>
'
md5
');
my
$objreg
=
new
TA::
ObjReg
('
project
'
=>
$project
,
'
store
'
=>
$store
,
'
key
'
=>
'
md5
');
&usage
('
no config found
')
unless
(
defined
(
$objreg
));
&usage
('
no config found
')
unless
(
defined
(
$objreg
));
print
"
objreg:
",
Dumper
(
$objreg
)
if
(
$DEBUG
||
$STOP
);
print
"
objreg:
",
Dumper
(
$objreg
)
if
(
$DEBUG
||
$STOP
);
...
@@ -112,13 +120,6 @@ elsif ($op_mode eq 'verify')
...
@@ -112,13 +120,6 @@ elsif ($op_mode eq 'verify')
{
{
$objreg
->
verify_toc
(
\
&verify_toc_item
,
\
@hdr
);
$objreg
->
verify_toc
(
\
&verify_toc_item
,
\
@hdr
);
}
}
elsif
(
$op_mode
eq
'
edit
')
{
print
"
objreg:
",
Dumper
(
$objreg
);
my
$proj_cfg_fnm
=
$objreg
->
{'
proj_cfg_fnm
'};
system
("
\$
EDITOR '
$proj_cfg_fnm
'
");
# print "store_cfg: ", Dumper ($store_cfg);
}
elsif
(
$op_mode
eq
'
lookup
')
elsif
(
$op_mode
eq
'
lookup
')
{
{
foreach
my
$key
(
@PAR
)
foreach
my
$key
(
@PAR
)
...
@@ -405,3 +406,11 @@ __END__
...
@@ -405,3 +406,11 @@ __END__
file metadata in one place and let other hashes point to that
file metadata in one place and let other hashes point to that
place.
place.
=head1 BUGS
option --edit fails when when config is broken:
$ vlib001.pl -p ph001 --edit
debug level: 0 , or } expected while parsing object/hash, at character
offset 74 (before ""backend": "MongoDB"...") at /home/gg/perl/TA/Util.pm
line 38.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment