def find_commands(management_dir): ''' Given a path to a management directory, returns a list of all the command names that are available. Returns an empty list if no commands are defined. ''' return find_in_dir(management_dir, 'commands')
def get_bundle_from_path(path, bundle_directory, package): ''' This method tries to instance every bundle using the given directory. When a bundle is able to identify the files present in the directory the instance of that bundle is returned to the caller. ''' LOGGER.debug('Path: %s will be processed.', path) bundles = find_in_dir(relative_path(__file__, bundle_directory), get_last_package_from_name(package)) for bundle_name in bundles: bundle = load_bundle(bundle_name, path, package) if bundle.can_identify(): return bundle else: LOGGER.info('Directory %s is not a %s bundle.', path, bundle.get_name()) return None