mirror of
https://github.com/EnumeratedDev/bpm-utils.git
synced 2026-09-16 02:56:11 +00:00
Add gitignore template
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
# Exclude bpm archives
|
||||
*.bpm
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
bpmutilsshared "bpm-utils-shared"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -163,5 +164,21 @@ func createDirectory() {
|
||||
if err != nil {
|
||||
log.Fatalf("Error: could not initialize git repository: %s", err)
|
||||
}
|
||||
|
||||
// Copy default gitignore
|
||||
defaultGitignoreFile, err := os.Open("/etc/bpm-utils/gitignore.default")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer defaultGitignoreFile.Close()
|
||||
newGitignoreFile, err := os.OpenFile(path.Join(*directory, ".gitignore"), os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
log.Fatalf("Error: could not create .gitignore file: %s", err)
|
||||
}
|
||||
|
||||
_, err = io.Copy(newGitignoreFile, defaultGitignoreFile)
|
||||
if err != nil {
|
||||
log.Fatalf("Error: could not copy data to .gitignore file: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user