<commit_before>import 'App/Installers/BaseInstaller'

export class BaseBrewInstaller extends BaseInstaller {
	isBrewService = false
	formula = null

	get sudoerServiceFile() {
		return `/etc/sudoers.d/brew-${this.formula}`
	}

	async isInstalled() {
		const output = await this.exec('brew list').then(result => result.stdout.toLowerCase().split(/\s+/))
		return output.indexOf(this.formula) >= 0
	}

	async install() {
		if(this.isBrewService) {
			await this.writeFile(this.sudoerServiceFile, [
				`Cmnd_Alias BREW_START = /usr/local/bin/brew services start ${this.formula}`,
				`Cmnd_Alias BREW_STOP = /usr/local/bin/brew services stop ${this.formula}`,
				`Cmnd_Alias BREW_RESTART = /usr/local/bin/brew services restart ${this.formula}`,
				'%admin ALL=(root) NOPASSWD: BREW_START',
				'%admin ALL=(root) NOPASSWD: BREW_STOP',
				'%admin ALL=(root) NOPASSWD: BREW_RESTART'
			])
		}

		return this.exec(`brew install ${this.formula}`)
	}

	async uninstall() {
		if(this.isBrewService) {
			await this.removeFile(this.sudoerServiceFile)
		}

		return this.exec(`brew remove ${this.formula}`)
	}

	isService() {
		return this.isBrewService
	}

	isRunning() {
		return this.exec(`brew services list | grep ${this.formula}`).then(result =>
			result.stdout.toLowerCase().indexOf('started') >= 0
		)
	}

	start() {
		return this.sudo(`brew services start ${this.formula}`)
	}

	stop() {
		return this.sudo(`brew services stop ${this.formula}`)
	}

}<commit_msg>Fixed BaseBrewInstaller.isRunning()<commit_after>import 'App/Installers/BaseInstaller'

export class BaseBrewInstaller extends BaseInstaller {
	isBrewService = false
	formula = null

	get sudoerServiceFile() {
		return `/etc/sudoers.d/brew-${this.formula}`
	}

	async isInstalled() {
		const output = await this.exec('brew list').then(result => result.stdout.toLowerCase().split(/\s+/))
		return output.indexOf(this.formula) >= 0
	}

	async install() {
		if(this.isBrewService) {
			await this.writeFile(this.sudoerServiceFile, [
				`Cmnd_Alias BREW_START = /usr/local/bin/brew services start ${this.formula}`,
				`Cmnd_Alias BREW_STOP = /usr/local/bin/brew services stop ${this.formula}`,
				`Cmnd_Alias BREW_RESTART = /usr/local/bin/brew services restart ${this.formula}`,
				'%admin ALL=(root) NOPASSWD: BREW_START',
				'%admin ALL=(root) NOPASSWD: BREW_STOP',
				'%admin ALL=(root) NOPASSWD: BREW_RESTART'
			])
		}

		return this.exec(`brew install ${this.formula}`)
	}

	async uninstall() {
		if(this.isBrewService) {
			await this.removeFile(this.sudoerServiceFile)
		}

		return this.exec(`brew remove ${this.formula}`)
	}

	isService() {
		return this.isBrewService
	}

	isRunning() {
		return this.exec('brew services list').then(result => {
			const content = result.stdout.toLowerCase().split(/\n+/).filter(
				line => line.indexOf(this.formula) >= 0
			).join(`\n`)

			return content.indexOf('started') >= 0
		})
	}

	start() {
		return this.sudo(`brew services start ${this.formula}`)
	}

	stop() {
		return this.sudo(`brew services stop ${this.formula}`)
	}

}
{'fraction_non_alphanumeric': 0.15583989501312337, 'fraction_numerical': 0.0016404199475065617, 'mean_word_length': 4.141652613827993, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1539194', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1067, 'n_words': 203}