<commit_before>package ruby

import (
	"os/exec"
	"runtime"
	"strings"

	"github.com/markelog/eclectica/cmd/print"
)

var (
	dependencies = []string{
		"autoconf", "bison", "build-essential",
		"libssl-dev", "libyaml-dev", "libreadline6-dev",
		"zlib1g-dev", "libncurses5-dev", "libffi-dev",
		"libgdbm3", "libgdbm-dev",
	}
)

func checkDependencies() (has bool, deps []string, err error) {
	if runtime.GOOS != "linux" {
		return
	}

	out, err := exec.Command("dpkg", "-l").Output()
	if err != nil {
		return
	}

	output := string(out)

	for _, dep := range dependencies {
		if strings.Contains(output, dep) == false {
			deps = append(deps, dep)
		}
	}

	if len(deps) > 0 {
		has = true
	}

	return
}

func dealWithShell() error {
	has, deps, err := checkDependencies()

	if err != nil {
		return err
	}

	if has == false {
		return nil
	}

	start := `Ruby has been installed, but it requires global dependencies which weren't found on your system,
  please execute following command to complete installation (you would need to do it only`
	middle := " once"
	end := "):"
	command := "sudo apt-get install " + strings.Join(deps, " ")<commit_msg>Add small clarification for ruby install<commit_after>package ruby

import (
	"os/exec"
	"runtime"
	"strings"

	"github.com/markelog/eclectica/cmd/print"
)

var (
	dependencies = []string{
		"autoconf", "bison", "build-essential",
		"libssl-dev", "libyaml-dev", "libreadline6-dev",
		"zlib1g-dev", "libncurses5-dev", "libffi-dev",
		"libgdbm3", "libgdbm-dev", "libpq-dev",
	}
)

func checkDependencies() (has bool, deps []string, err error) {
	if runtime.GOOS != "linux" {
		return
	}

	out, err := exec.Command("dpkg", "-l").Output()
	if err != nil {
		return
	}

	output := string(out)

	for _, dep := range dependencies {
		if strings.Contains(output, dep) == false {
			deps = append(deps, dep)
		}
	}

	if len(deps) > 0 {
		has = true
	}

	return
}

func dealWithShell() error {
	has, deps, err := checkDependencies()

	if err != nil {
		return err
	}

	if has == false {
		return nil
	}

	start := `Ruby has been installed, but it requires global dependencies which weren't found on your system,
  please execute following command to complete installation (you would need to do it only`
	middle := " once"
	end := "):"
	command := "sudo apt-get update && apt-get install -y " + strings.Join(deps, " ")
{'fraction_non_alphanumeric': 0.15384615384615385, 'fraction_numerical': 0.004249893752656183, 'mean_word_length': 3.6338582677165356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5178133', 'n_tokens_mistral': 916, 'n_tokens_neox': 848, 'n_words': 239}