func IsDirectoryExists(directory string) bool {
	_, err := os.Stat(GetHomeDirectory() + "/" + directory)
	if os.IsNotExist(err) {
		return false
	}
	return true
}
IsDirectoryExists function is used to prove if a passed string stands for a directory
package utils
import (
	"fmt"
	"io"
	"log"
	"os"
	"github.com/mitchellh/go-homedir"
)
func generateStdin(in *os.File) *os.File {
	if in == nil {
		in = os.Stdin
	}
	return in
}
func askBasicQuestions(in *os.File, variable string, textToAsk string) string {
	in = generateStdin(in)
	fmt.Println(textToAsk)
	if _, err := fmt.Fscanf(in, "%s", &variable); err != nil {
		log.Fatal("Error message: Empty response, please enter a value!\n")
	}
	return variable
}
func AskWorkingDirectory(in *os.File) string {
	var workingDir string
	return askBasicQuestions(in, workingDir, "\nEnter the working directory (Enter a dot (.) for the current directory):")
}
func AskRubocop(in *os.File) string {
	var isRubocop string
	return askBasicQuestions(in, isRubocop, "\nWill you use Rubocop as a linter? Enter y for yes or any other key for no")
}
func AskGithub(in *os.File) string {
	var isGithub string
	return askBasicQuestions(in, isGithub, "\nWill you use github as a collaboration tool? Enter y for yes or any other key for no")
}
func AskDatabase(in *os.File) string {
	in = generateStdin(in)
	var database string
	var tmpDb int
	fmt.Println("\nSelect Enter the number corresponding to the database you want to use: ")
	fmt.Println("\n1.sqlite3\n2.postgresql\n3.mysql\n4.oracle\n5.frontbase\n6.db2(ibm_db)\n7.sqlserver\n8.jdbcmysql\n9.jdbcpostgresql\n10.jdbcsqlite3\n11.jdbc")
	if _, err := fmt.Fscanf(in, "%d", &tmpDb); err != nil {
		log.Fatal(err)
	}
	switch tmpDb {
	case 1:
		database = "sqlite3"
	case 2:
		database = "postgresql"
	case 3:
		database = "mysql"
	case 4:
		database = "oracle"
	case 5:
		database = "frontbase"
	case 6:
		database = "ibm_db"
	case 7:
		database = "sqlserver"
	case 8:
		database = "jdbcmysql"
	case 9:
		database = "jdbcpostgresql"
	case 10:
		database = "jdbcsqlite3"
	case 11:
		database = "jdbc"
	default:
		fmt.Println(`The database you choose is not supported by rails yet!
		So, I will create for you a rails app with a default database which is sqlite3`)
		database = "sqlite3"
	}
	return database
}
func AskProjectName(in *os.File) string {
	var projectName string
	return askBasicQuestions(in, projectName, "\n\nWhat is the project name you want to use?")
}
func Copy(src, dst string) {
	source, _ := os.Open(src)
	defer source.Close()
	destination, _ := os.Create(dst)
	defer destination.Close()
	if _, err := io.Copy(destination, source); err != nil {
		log.Fatal(err)
	}
}
func WriteToFile(file, stringToWrite string) {
	mFile, _ := os.OpenFile(file, os.O_APPEND|os.O_WRONLY, 0644)
	fmt.Fprintln(mFile, stringToWrite)
	mFile.Close()
}
func GetHomeDirectory() string {
	homeDirectory, _ := homedir.Dir()
	return homeDirectory
}