This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
222 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ yarn-error.log* | |
|
||
vuex-store.data | ||
/laradock-manager | ||
/build/laradock-manager | ||
/build/ | ||
/vendor/ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
wails build -ldflags="-s -w" | ||
# upx build/laradock-manager | ||
go run ./cmd/package |
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-170 KB
build/laradock-manager-0.4.1/opt/laradock-manager/laradock-manager.png
Binary file not shown.
10 changes: 0 additions & 10 deletions
10
build/laradock-manager-0.4.1/usr/share/applications/laradock-manager.desktop
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
"io/ioutil" | ||
"os" | ||
"os/exec" | ||
"path" | ||
) | ||
|
||
//Version app version | ||
var Version string | ||
|
||
//Project is the project json | ||
var Project project | ||
|
||
type project struct { | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Author struct { | ||
Name string `json:"name"` | ||
Email string `json:"email"` | ||
} `json:"author"` | ||
Version string `json:"version"` | ||
Binaryname string `json:"binaryname"` | ||
Frontend struct { | ||
Dir string `json:"dir"` | ||
Install string `json:"install"` | ||
Build string `json:"build"` | ||
Bridge string `json:"bridge"` | ||
Serve string `json:"serve"` | ||
} `json:"frontend"` | ||
WailsVersion string `json:"WailsVersion"` | ||
} | ||
|
||
func main() { | ||
loadProjectFile() | ||
deleteBuildFolder() | ||
createBuildFolder() | ||
pack() | ||
} | ||
|
||
func getMainPath() string { | ||
v := getVersion() | ||
return path.Join("build", "laradock-manager-"+v) | ||
} | ||
|
||
func loadProjectFile() { | ||
jsonFile, err := os.Open("./project.json") | ||
defer jsonFile.Close() | ||
|
||
if err != nil { | ||
println("Probably not called this in a wrong working dir, try calling it in the laradock-manager's root!") | ||
println(err.Error()) | ||
} | ||
j, _ := ioutil.ReadAll(jsonFile) | ||
json.Unmarshal(j, &Project) | ||
} | ||
|
||
func getVersion() string { | ||
if Version != "" { | ||
return Version | ||
} | ||
|
||
Version = Project.Version | ||
return Version | ||
} | ||
|
||
func deleteBuildFolder() { | ||
err := os.RemoveAll(getMainPath()) | ||
check(err) | ||
} | ||
|
||
func createBuildFolder() { | ||
writeControlFile() | ||
writeDesktop() | ||
copyIcon() | ||
copyBin() | ||
} | ||
|
||
func writeControlFile() { | ||
//Control file | ||
fp := path.Join(getMainPath(), "DEBIAN") | ||
err := os.MkdirAll(fp, os.ModePerm) | ||
check(err) | ||
|
||
cont := | ||
`Package: ` + Project.Binaryname + ` | ||
Version: ` + getVersion() + ` | ||
Section: devel | ||
Priority: optional | ||
Architecture: amd64 | ||
Installed-Size: 4800 | ||
Maintainer: ` + Project.Author.Name + ` <` + Project.Author.Email + `> | ||
Homepage: https://github.com/Lyimmi/laradock-manager | ||
Description: ` + Project.Name + ` | ||
A simple application for managing laradock containers. | ||
Developed and tested only on Ubuntu 20.04/19.04/18.04 | ||
. | ||
Made with https://wails.app/ (go & vue.js & vuetify) | ||
. | ||
Usage | ||
In order to use this your current user need to be able to access docker without sudo | ||
Create the docker group: $ sudo groupadd docker | ||
Add your user to the docker group: $ sudo usermod -aG docker $USER | ||
Log out and log back in so that your group membership is re-evaluated. ($ newgrp docker) | ||
` | ||
|
||
f, err := os.Create(path.Join(fp, "control")) | ||
check(err) | ||
_, err = f.WriteString(cont) | ||
check(err) | ||
f.Close() | ||
} | ||
|
||
func writeDesktop() { | ||
fp := path.Join(getMainPath(), "usr", "share", "applications") | ||
err := os.MkdirAll(fp, os.ModePerm) | ||
check(err) | ||
|
||
cont := `[Desktop Entry] | ||
Version=1.1 | ||
Type=Application | ||
Name=Laradock Manager | ||
Comment=Simple application for managing laradock containers | ||
Icon=/opt/laradock-manager/laradock-manager.png | ||
Exec=/opt/laradock-manager/laradock-manager | ||
Actions= | ||
Categories=Development; | ||
StartupNotify=true` | ||
|
||
f, err := os.Create(path.Join(fp, "laradock-manager.desktop")) | ||
check(err) | ||
_, err = f.WriteString(cont) | ||
check(err) | ||
f.Close() | ||
} | ||
|
||
func copyIcon() { | ||
var err error | ||
//Menu icon | ||
fp := path.Join(getMainPath(), "opt", "laradock-manager") | ||
err = os.MkdirAll(fp, os.ModePerm) | ||
check(err) | ||
src := "assets/laradock-manager.png" | ||
dst := path.Join(fp, "laradock-manager.png") | ||
_, err = copy(src, dst) | ||
check(err) | ||
} | ||
|
||
func copyBin() { | ||
var err error | ||
fp := path.Join(getMainPath(), "opt", "laradock-manager") | ||
err = os.MkdirAll(fp, os.ModePerm) | ||
check(err) | ||
dst := path.Join(fp, "laradock-manager") | ||
_, err = copy("build/laradock-manager", dst) | ||
|
||
c := exec.Command("chmod", "+x", dst) | ||
err = c.Run() | ||
check(err) | ||
|
||
} | ||
|
||
func copy(src, dst string) (int64, error) { | ||
sourceFileStat, err := os.Stat(src) | ||
if err != nil { | ||
return 0, err | ||
} | ||
|
||
if !sourceFileStat.Mode().IsRegular() { | ||
return 0, fmt.Errorf("%s is not a regular file", src) | ||
} | ||
|
||
source, err := os.Open(src) | ||
if err != nil { | ||
return 0, err | ||
} | ||
defer source.Close() | ||
|
||
destination, err := os.Create(dst) | ||
if err != nil { | ||
return 0, err | ||
} | ||
defer destination.Close() | ||
nBytes, err := io.Copy(destination, source) | ||
return nBytes, err | ||
} | ||
|
||
func pack() { | ||
var err error | ||
var out []byte | ||
|
||
cmd := exec.Command("dpkg-deb", "--build", "build/laradock-manager-"+getVersion()) | ||
// cmd.Dir = d | ||
out, err = cmd.CombinedOutput() | ||
fmt.Println(string(out)) | ||
check(err) | ||
} | ||
|
||
func check(e error) { | ||
if e != nil { | ||
panic(e) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
74bde6ed1300a2b503647a26546f3273 | ||
213334c6d33a8d755af08d98d1e722ca |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"name": "laradock-manager", | ||
"name": "Laradock Manager", | ||
"description": "A simple desktop application for managing laradock containers", | ||
"author": { | ||
"name": "Zámbó, Levente", | ||
"email": "[email protected]" | ||
}, | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"binaryname": "laradock-manager", | ||
"frontend": { | ||
"dir": "frontend", | ||
|
@@ -14,5 +14,5 @@ | |
"bridge": "src", | ||
"serve": "npm run serve" | ||
}, | ||
"WailsVersion": "v1.7.1" | ||
} | ||
"WailsVersion": "v1.8" | ||
} |