call static method

Future<bool> call(
  1. DesignPattern designPattern
)

Implementation

static Future<bool> call(
  DesignPattern designPattern,
) async {
  var path = _replaceWordsInFile(
    designPattern.path(),
  );
  var nameFile = _replaceWordsInFile(
    designPattern.nameFile(),
  );
  var templete = _replaceWordsInFile(
    designPattern.template(),
  );
  var extension = designPattern.extension();

  var completePath = p.normalize(
    '${GlobalVariable.path}/$path/$nameFile.$extension',
  );

  await DirectoryUtils.create(
    p.normalize(GlobalVariable.path + '/' + path),
  );

  if (File(completePath).existsSync()) {
    error('exist file: $nameFile.$extension....');
    throw FileExistsError(innerException: Exception());
  }

  warn('generating $nameFile.$extension....');

  File(completePath).writeAsStringSync(templete);
  warn('create file $completePath....');

  await applyTriggersIfNecessary(designPattern);

  return true;
}