toInstall method

Future<String> toInstall()

Generates a script to install the package.

The script is generated based on the current operating system and package manager.

Implementation

Future<String> toInstall() async {
  await boot();

  final bestFor = await best(to: 'install');

  final dynamicCode = await this.dynamicCode();

  final baseScriptContents = await this.baseScriptContents();

  final packageScriptContents = await packageScript.contents();

  String togetherContents =
      '''
#!/usr/bin/env bash

$dynamicCode

$baseScriptContents

$packageScriptContents

${Global.updateCommand}

$bestFor
''';

  final togetherFile = await writeThisBeast(togetherContents);

  return togetherFile.path;
}