Use emojis for icons

This commit is contained in:
Ettore Di Giacinto
2019-11-16 14:16:44 +01:00
parent b59256337a
commit 602f5c68d5
7 changed files with 35 additions and 30 deletions

View File

@@ -109,7 +109,7 @@ var buildCmd = &cobra.Command{
if err != nil {
Fatal("Error: " + err.Error())
}
Info("📦 Selecting ", p.GetName(), p.GetVersion())
Info(":package: Selecting ", p.GetName(), p.GetVersion())
compilerSpecs.Add(spec)
}
}

1
go.mod
View File

@@ -11,6 +11,7 @@ require (
github.com/ghodss/yaml v1.0.0
github.com/hashicorp/go-version v1.2.0
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
github.com/kyokomi/emoji v2.1.0+incompatible
github.com/logrusorgru/aurora v0.0.0-20190417123914-21d75270181e
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-isatty v0.0.10 // indirect

2
go.sum
View File

@@ -142,6 +142,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kyokomi/emoji v2.1.0+incompatible h1:+DYU2RgpI6OHG4oQkM5KlqD3Wd3UPEsX8jamTo1Mp6o=
github.com/kyokomi/emoji v2.1.0+incompatible/go.mod h1:mZ6aGCD7yk8j6QY6KICwnZ2pxoszVseX1DNoGtU2tBA=
github.com/logrusorgru/aurora v0.0.0-20190417123914-21d75270181e h1:yRWBTwWfMy5YPjT14Jr+p12ygqLpM9K5ojbbNPSd8hI=
github.com/logrusorgru/aurora v0.0.0-20190417123914-21d75270181e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=

View File

@@ -45,40 +45,40 @@ func (*SimpleDocker) BuildImage(opts compiler.CompilerBackendOptions) error {
dockerfileName := opts.DockerFileName
buildarg := []string{"build", "-f", dockerfileName, "-t", name, "."}
Debug(" 🐋 Building image " + name)
Debug(":whale2: Building image " + name)
cmd := exec.Command("docker", buildarg...)
cmd.Dir = path
out, err := cmd.CombinedOutput()
if err != nil {
return errors.Wrap(err, "Failed building image: "+string(out))
}
Info(" 🐋 Building image " + name + " done")
Info(":whale: Building image " + name + " done")
//Info(string(out))
return nil
}
func (*SimpleDocker) CopyImage(src, dst string) error {
Debug(" 🐋 Tagging image:", src, "->", dst)
Debug(":whale: Tagging image:", src, "->", dst)
cmd := exec.Command("docker", "tag", src, dst)
out, err := cmd.CombinedOutput()
if err != nil {
return errors.Wrap(err, "Failed tagging image: "+string(out))
}
Info(" 🐋 Tagged image:", src, "->", dst)
Info(":whale: Tagged image:", src, "->", dst)
return nil
}
func (*SimpleDocker) DownloadImage(opts compiler.CompilerBackendOptions) error {
name := opts.ImageName
buildarg := []string{"pull", name}
Debug(" 🐋 Downloading image " + name)
Debug(":whale: Downloading image " + name)
cmd := exec.Command("docker", buildarg...)
out, err := cmd.CombinedOutput()
if err != nil {
return errors.Wrap(err, "Failed building image: "+string(out))
}
Info(" 🐋 Downloaded image:", name)
Info(":whale: Downloaded image:", name)
return nil
}
@@ -89,7 +89,7 @@ func (*SimpleDocker) RemoveImage(opts compiler.CompilerBackendOptions) error {
if err != nil {
return errors.Wrap(err, "Failed removing image: "+string(out))
}
Info(" 🐋 Removed image:", name)
Info(":whale: Removed image:", name)
//Info(string(out))
return nil
}
@@ -112,13 +112,13 @@ func (*SimpleDocker) ExportImage(opts compiler.CompilerBackendOptions) error {
path := opts.Destination
buildarg := []string{"save", name, "-o", path}
Debug(" 🐋 Saving image " + name)
Debug(":whale: Saving image " + name)
out, err := exec.Command("docker", buildarg...).CombinedOutput()
if err != nil {
return errors.Wrap(err, "Failed exporting image: "+string(out))
}
Info(" 🐋 Exported image:", name)
Info(":whale: Exported image:", name)
return nil
}

View File

@@ -70,7 +70,7 @@ func (cs *LuetCompiler) CompileWithReverseDeps(concurrency int, keepPermissions
return artifacts, err
}
Info("🌲 Resolving reverse dependencies")
Info(":ant: Resolving reverse dependencies")
toCompile := NewLuetCompilationspecs()
for _, a := range artifacts {
w, asserterr := cs.Tree().World()
@@ -113,7 +113,7 @@ func (cs *LuetCompiler) CompileWithReverseDeps(concurrency int, keepPermissions
uniques := toCompile.Unique().Remove(ps)
for _, u := range uniques.All() {
Info(" ", u.GetPackage().GetName(), "🍃", u.GetPackage().GetVersion(), "(", u.GetPackage().GetCategory(), ")")
Info(" :arrow_right_hook:", u.GetPackage().GetName(), "🍃", u.GetPackage().GetVersion(), "(", u.GetPackage().GetCategory(), ")")
}
artifacts2, err := cs.CompileParallel(concurrency, keepPermissions, uniques)
@@ -259,7 +259,7 @@ func (cs *LuetCompiler) Prepare(concurrency int) error {
return nil
}
func (cs *LuetCompiler) packageFromImage(p CompilationSpec, tag string, keepPermissions bool) (Artifact, error) {
pkgTag := "📦 " + p.GetPackage().GetName()
pkgTag := ":package: " + p.GetPackage().GetName()
Info(pkgTag, " 🍩 Build starts 🔨 🔨 🔨 ")
@@ -300,7 +300,7 @@ func (cs *LuetCompiler) packageFromImage(p CompilationSpec, tag string, keepPerm
return nil, errors.Wrap(err, "Error met while creating package archive")
}
Info(pkgTag, " 🎉 Done")
Info(pkgTag, " :white_check_mark: Done")
artifact := NewPackageArtifact(p.Rel(p.GetPackage().GetFingerPrint() + ".package.tar"))
artifact.SetCompileSpec(p)
return artifact, nil
@@ -358,7 +358,7 @@ func (cs *LuetCompiler) Compile(concurrency int, keepPermissions bool, p Compila
}
func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p CompilationSpec) (Artifact, error) {
Info("📦 Compiling", p.GetPackage().GetName(), "version", p.GetPackage().GetVersion(), ".... ")
Info(":package: Compiling", p.GetPackage().GetName(), "version", p.GetPackage().GetVersion(), ".... :coffee:")
if len(p.GetPackage().GetRequires()) == 0 && p.GetImage() == "" {
Error("Package with no deps and no seed image supplied, bailing out")
@@ -387,17 +387,17 @@ func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p Compila
depsN := 0
currentN := 0
Info("🌲 Build dependencies for " + p.GetPackage().GetName())
Info(":deciduous_tree: Build dependencies for " + p.GetPackage().GetName())
for _, assertion := range dependencies { //highly dependent on the order
depsN++
Info(" ", assertion.Package.GetName(), "🍃", assertion.Package.GetVersion(), "(", assertion.Package.GetCategory(), ")")
Info(" :arrow_right_hook:", assertion.Package.GetName(), ":leaves:", assertion.Package.GetVersion(), "(", assertion.Package.GetCategory(), ")")
}
for _, assertion := range dependencies { //highly dependent on the order
currentN++
pkgTag := fmt.Sprintf("📦 %d/%d %s ⤑ %s", currentN, depsN, p.GetPackage().GetName(), assertion.Package.GetName())
Info(pkgTag, " 🏗 Building dependency")
pkgTag := fmt.Sprintf(":package: %d/%d %s ⤑ %s", currentN, depsN, p.GetPackage().GetName(), assertion.Package.GetName())
Info(pkgTag, " :zap: Building dependency")
compileSpec, err := cs.FromPackage(assertion.Package)
if err != nil {
return nil, errors.New("Error while generating compilespec for " + assertion.Package.GetName())
@@ -406,8 +406,8 @@ func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p Compila
buildImageHash := "luet/cache:" + assertion.Hash.BuildHash
currentPackageImageHash := "luet/cache:" + assertion.Hash.PackageHash
Debug(pkgTag, " ⤷ 🐋 Builder image name", buildImageHash)
Debug(pkgTag, " ⤷ 🐋 Package image name", currentPackageImageHash)
Debug(pkgTag, " :arrow_right_hook: :whale: Builder image name", buildImageHash)
Debug(pkgTag, " :arrow_right_hook: :whale: Package image name", currentPackageImageHash)
lastHash = currentPackageImageHash
if compileSpec.GetImage() != "" {
@@ -422,14 +422,14 @@ func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p Compila
continue
}
Debug(pkgTag, " 🍰 Compiling "+compileSpec.GetPackage().GetFingerPrint()+" from image 🐋")
Debug(pkgTag, " :wrench: Compiling "+compileSpec.GetPackage().GetFingerPrint()+" from image")
artifact, err := cs.compileWithImage(compileSpec.GetImage(), buildImageHash, currentPackageImageHash, concurrency, keepPermissions, compileSpec)
if err != nil {
deperrs = append(deperrs, err)
break // stop at first error
}
departifacts = append(departifacts, artifact)
Info(pkgTag, "💥 Done")
Info(pkgTag, ":white_check_mark: Done")
continue
}
@@ -440,9 +440,9 @@ func (cs *LuetCompiler) compile(concurrency int, keepPermissions bool, p Compila
// break // stop at first error
}
departifacts = append(departifacts, artifact)
Info(pkgTag, "💥 Done")
Info(pkgTag, ":collision: Done")
}
Info("📦", p.GetPackage().GetName(), "🌪 Building package target from:", lastHash)
Info(":package:", p.GetPackage().GetName(), ":cyclone: Building package target from:", lastHash)
artifact, err := cs.compileWithImage(lastHash, "", "", concurrency, keepPermissions, p)
if err != nil {
return artifact, err

View File

@@ -5,9 +5,9 @@ import (
"os"
"time"
. "github.com/logrusorgru/aurora"
"github.com/briandowns/spinner"
"github.com/kyokomi/emoji"
. "github.com/logrusorgru/aurora"
)
var s *spinner.Spinner = spinner.New(spinner.CharSets[22], 100*time.Millisecond)
@@ -45,15 +45,17 @@ func msg(level string, msg ...interface{}) {
var levelMsg string
switch level {
case "warning":
levelMsg = Bold(Yellow("🌩 " + message)).BgBlack().String()
levelMsg = Bold(Yellow(":construction: " + message)).BgBlack().String()
case "debug":
levelMsg = White(message).BgBlack().String()
case "info":
levelMsg = Bold(White(message)).BgBlack().String()
case "error":
levelMsg = Bold(Red("💣 " + message + "🔥")).BgBlack().String()
levelMsg = Bold(Red(":bomb: " + message + ":fire:")).BgBlack().String()
}
levelMsg = emoji.Sprint(levelMsg)
//if s.Active() {
// SpinnerText(levelMsg, "")
// return

View File

@@ -41,7 +41,7 @@ type Solver struct {
// NewSolver accepts as argument two lists of packages, the first is the initial set,
// the second represent all the known packages.
func NewSolver(init []pkg.Package, w []pkg.Package , db pkg.PackageDatabase) PackageSolver {
func NewSolver(init []pkg.Package, w []pkg.Package, db pkg.PackageDatabase) PackageSolver {
for _, v := range init {
pkg.NormalizeFlagged(v)
}