27 |
|
# copy(location) : make a copy of the current area at the |
28 |
|
# specified location - return an object |
29 |
|
# representing the area |
30 |
– |
# linkarea(oref) : link area with another |
30 |
|
|
31 |
|
package Configuration::ConfigArea; |
32 |
|
use ActiveDoc::ActiveDoc; |
33 |
|
require 5.004; |
34 |
|
use Utilities::AddDir; |
35 |
|
use ObjectUtilities::ObjectStore; |
36 |
+ |
use Configuration::ConfigStore; |
37 |
|
use Cwd; |
38 |
|
@ISA=qw(ActiveDoc::ActiveDoc ObjectUtilities::StorableObject); |
39 |
|
|
50 |
|
"", $self, "",$self); |
51 |
|
$self->addurltags("setup"); |
52 |
|
$self->addtag("setup","use",\&Use_Start,$self, "", $self, "",$self); |
53 |
+ |
|
54 |
+ |
# data init |
55 |
+ |
$self->{admindir}=".SCRAM"; |
56 |
|
} |
57 |
|
|
58 |
|
|
59 |
|
sub defaultdirname { |
60 |
|
my $self=shift; |
61 |
< |
my $name=$self->name(); |
62 |
< |
my $vers=$self->version(); |
63 |
< |
$vers=~s/^$name_//; |
64 |
< |
$name=$name."_".$vers; |
65 |
< |
return $name; |
66 |
< |
|
61 |
> |
my $name=$self->name(); |
62 |
> |
my $vers=$self->version(); |
63 |
> |
$vers=~s/^$name_//; |
64 |
> |
$name=$name."_".$vers; |
65 |
> |
return $name; |
66 |
> |
|
67 |
|
} |
68 |
|
|
69 |
|
sub setup { |
96 |
|
$self->parse("setup"); |
97 |
|
|
98 |
|
# --- store bootstrap info |
99 |
< |
$self->store($self->location()."/.SCRAM/ConfigArea.dat"); |
99 |
> |
$self->store($self->location()."/".$self->{admindir}."/ConfigArea.dat"); |
100 |
|
|
101 |
|
# --- store self in original database |
102 |
|
$self->parentconfig()->store($self,"ConfigArea",$self->name(), |
106 |
|
sub _setupstore { |
107 |
|
my $self=shift; |
108 |
|
|
109 |
< |
# --- make a new ActiveStore at the location and add it to the db list |
110 |
< |
my $ad=ActiveDoc::ActiveConfig->new($self->location()."/\.SCRAM"); |
109 |
> |
# --- make a new ConfigStore at the location and add it to the db list |
110 |
> |
my $ad=Configuration::ConfigStore->new($self->location(). |
111 |
> |
"/".$self->{admindir}); |
112 |
|
|
113 |
|
$self->parentconfig($self->config()); |
114 |
|
# $self->config(Configuration::ConfigureStore->new()); |
127 |
|
} |
128 |
|
print "Found top ".$self->location()."\n"; |
129 |
|
$self->_setupstore(); |
130 |
< |
$self->restore($self->location()."/.SCRAM/ConfigArea.dat"); |
130 |
> |
$self->restore($self->location()."/".$self->{admindir}. |
131 |
> |
"/ConfigArea.dat"); |
132 |
|
} |
133 |
|
|
134 |
|
sub parentconfig { |
169 |
|
my $newarea=ref($self)->new($self->parentconfig()); |
170 |
|
$newarea->bootstrapfromlocation($destination); |
171 |
|
# save it with the new location info |
172 |
< |
$newarea->store($self->location()."/.SCRAM/ConfigArea.dat"); |
172 |
> |
$newarea->store($self->location()."/".$self->{admindir}."/ConfigArea.dat"); |
173 |
|
} |
174 |
|
|
175 |
|
sub restore { |
211 |
|
} |
212 |
|
elsif ( ! defined $self->{location} ) { |
213 |
|
# try and find the release location |
214 |
< |
$self->{location}=$self->searchlocation(); |
214 |
> |
#$self->{location}=$self->searchlocation(); |
215 |
|
} |
216 |
|
return $self->{location}; |
217 |
|
} |
229 |
|
Sloop:{ |
230 |
|
do { |
231 |
|
# print "Searching $thispath\n"; |
232 |
< |
if ( -e "$thispath/.SCRAM" ) { |
232 |
> |
if ( -e "$thispath/".$self->{admindir} ) { |
233 |
|
# print "Found\n"; |
234 |
|
$rv=1; |
235 |
|
last Sloop; |
259 |
|
my $docref=$self->activatedoc($url); |
260 |
|
# Set up the document |
261 |
|
$docref->setup(); |
262 |
+ |
$docref->save(); |
263 |
|
# $self->config()->storepolicy("local"); |
264 |
|
} |
265 |
|
|