Update the ae catalog support to properly consider <publisher>/<name>

This commit is contained in:
R. Tyler Croy 2017-01-24 23:22:21 -08:00
parent 40f5eb58ba
commit 1f1a24066c
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
2 changed files with 14 additions and 8 deletions

18
bin/ae
View File

@ -100,13 +100,19 @@ class FileCatalog:
def load(self): def load(self):
path = re.split('file:\/\/', self.uri)[1] path = re.split('file:\/\/', self.uri)[1]
catalog_dir = os.path.join(path, 'catalog') catalog_dir = os.path.join(path, 'catalog')
if os.path.isdir(catalog_dir): if not os.path.isdir(catalog_dir):
for schematic in os.listdir(catalog_dir): return
if not schematic.endswith('.yaml'):
for root, dirs, files in os.walk(catalog_dir):
for f in files:
if not f.endswith('.yaml'):
continue continue
name = re.sub('\.yaml', '', schematic) publisher = os.path.basename(root)
schematic = os.path.join(catalog_dir, schematic) name = re.sub('\.yaml', '', f)
self.schematics[name] = yaml.load(file(schematic)) qualified_name = '/'.join([publisher, name])
self.schematics[qualified_name] = yaml.load(file(os.path.join(root, f)))
def has_schematic(self, schematic): def has_schematic(self, schematic):
if self.schematics.has_key(schematic): if self.schematics.has_key(schematic):

View File

@ -1,5 +1,5 @@
catalogs: catalogs:
- file:///home/tyler/source/github/berriedale/schematics - file:///home/tyler/source/github/berriedale/schematics
schematics: schematics:
- aws - adacore/aws
- gtkada - adacore/gtkada