Skip to content

Commit

Permalink
refactor: Rename project
Browse files Browse the repository at this point in the history
  • Loading branch information
esdete2 committed Dec 25, 2024
1 parent 4443320 commit a2b44ed
Show file tree
Hide file tree
Showing 21 changed files with 100 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .air.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/mjml-dev"
cmd = "templ generate && go build -o ./tmp/mjml-dev ."
bin = "./tmp/envelopr"
cmd = "templ generate && go build -o ./tmp/envelopr ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor"]
exclude_file = []
Expand Down
6 changes: 3 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"github.com/networkteam/slogutils"
"github.com/urfave/cli/v2"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/mjml-dev/handler"
"github.com/esdete2/envelopr/config"
"github.com/esdete2/envelopr/handler"
)

func BuildCmd() *cli.Command {
Expand All @@ -18,7 +18,7 @@ func BuildCmd() *cli.Command {
Name: "config",
Aliases: []string{"c"},
Usage: "Path to config file",
Value: "mjml-dev.yaml",
Value: "envelopr.yaml",
},
},
Action: func(c *cli.Context) error {
Expand Down
8 changes: 4 additions & 4 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/networkteam/slogutils"
"github.com/urfave/cli/v2"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/envelopr/config"
)

type initAnswers struct {
Expand All @@ -35,14 +35,14 @@ func InitCmd() *cli.Command {

// Default values
answers := initAnswers{
ConfigPath: "mjml-dev.yaml",
ConfigPath: "envelopr.yaml",
DocumentsDir: "documents",
PartialsDir: "partials",
OutputDir: "output",
}

// Skip wizard if --no-input flag is set
if !c.Bool("no-input") {
// Skip wizard if --yes flag is set
if !c.Bool("yes") {
questions := []*survey.Question{
{
Name: "configPath",
Expand Down
9 changes: 5 additions & 4 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/urfave/cli/v2"
)

//nolint:gochecknoglobals
var (
toolVersion string
goVersion string
Expand All @@ -19,14 +20,14 @@ func VersionCmd() *cli.Command {
Name: "version",
Aliases: []string{"v"},
Usage: "Print version information",
Action: func(c *cli.Context) error {
Action: func(_ *cli.Context) error {
version := GetVersionInfo()

fmt.Printf("Version %s\n", version.toolVersion)
fmt.Printf("Go version: %s\n", version.goVersion)
fmt.Printf("envelopr Version %s\n", version.toolVersion) //nolint:forbidigo
fmt.Printf("Go version: %s\n", version.goVersion) //nolint:forbidigo

if len(buildTimestamp) != 0 {
fmt.Printf("Build time: %s\n", buildTimestamp)
fmt.Printf("Build time: %s\n", buildTimestamp) //nolint:forbidigo
}
return nil
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/friendsofgo/errors"
"github.com/urfave/cli/v2"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/mjml-dev/handler"
"github.com/esdete2/mjml-dev/web"
"github.com/esdete2/envelopr/config"
"github.com/esdete2/envelopr/handler"
"github.com/esdete2/envelopr/web"
)

func WatchCmd() *cli.Command {
Expand All @@ -24,7 +24,7 @@ func WatchCmd() *cli.Command {
Name: "config",
Aliases: []string{"c"},
Usage: "Path to config file",
Value: "mjml-dev.yaml",
Value: "envelopr.yaml",
},
&cli.StringFlag{
Name: "host",
Expand Down
10 changes: 5 additions & 5 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (

"github.com/stretchr/testify/require"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/envelopr/config"
)

func TestLoadConfig(t *testing.T) {
t.Run("valid config", func(t *testing.T) {
r := require.New(t)

// Create temp config file
tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down Expand Up @@ -46,7 +46,7 @@ template:
newsletter:
title: Latest Updates
`
configPath := filepath.Join(tmpDir, "mjml-dev.yaml")
configPath := filepath.Join(tmpDir, "envelopr.yaml")
err = os.WriteFile(configPath, []byte(configContent), 0644)
r.NoError(err)

Expand Down Expand Up @@ -92,7 +92,7 @@ template:
t.Run("invalid yaml", func(t *testing.T) {
r := require.New(t)

tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand All @@ -115,7 +115,7 @@ invalid_yaml:
t.Run("empty config", func(t *testing.T) {
r := require.New(t)

tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down
6 changes: 3 additions & 3 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"shell": {
"scripts": {
"dev": [
"go run github.com/air-verse/[email protected] watch -c testdata/mjml-dev.yaml"
"go run github.com/air-verse/[email protected] watch -c testdata/envelopr.yaml"
],
"test": [
"go test ./..."
],
"build": [
"go run . build -c testdata/mjml-dev.yaml"
"go run . build -c testdata/envelopr.yaml"
],
"watch": [
"go run . watch -c testdata/mjml-dev.yaml"
"go run . watch -c testdata/envelopr.yaml"
],
"lint": [
"golangci-lint run --out-format tab"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/esdete2/mjml-dev
module github.com/esdete2/envelopr

go 1.23.3

Expand Down
2 changes: 1 addition & 1 deletion handler/fileloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/friendsofgo/errors"

"github.com/esdete2/mjml-dev/template"
"github.com/esdete2/envelopr/template"
)

type FileLoader struct {
Expand Down
10 changes: 5 additions & 5 deletions handler/fileloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/esdete2/mjml-dev/handler"
"github.com/esdete2/envelopr/handler"
)

func TestFileLoader_LoadDocuments(t *testing.T) {
Expand All @@ -33,7 +33,7 @@ func TestFileLoader_LoadDocuments(t *testing.T) {
r := require.New(t)

// Create empty temp directory
tmpDir, err := os.MkdirTemp("", "mjml-dev-test-empty")
tmpDir, err := os.MkdirTemp("", "envelopr-test-empty")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand All @@ -46,7 +46,7 @@ func TestFileLoader_LoadDocuments(t *testing.T) {
t.Run("directory with files", func(t *testing.T) {
r := require.New(t)

tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down Expand Up @@ -101,7 +101,7 @@ func TestFileLoader_LoadPartials(t *testing.T) {
t.Run("empty but existing directory", func(t *testing.T) {
r := require.New(t)

tmpDir, err := os.MkdirTemp("", "mjml-dev-test-empty")
tmpDir, err := os.MkdirTemp("", "envelopr-test-empty")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand All @@ -114,7 +114,7 @@ func TestFileLoader_LoadPartials(t *testing.T) {
t.Run("directory with files", func(t *testing.T) {
r := require.New(t)

tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down
4 changes: 2 additions & 2 deletions handler/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/friendsofgo/errors"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/mjml-dev/template"
"github.com/esdete2/envelopr/config"
"github.com/esdete2/envelopr/template"
)

type Processor struct {
Expand Down
12 changes: 6 additions & 6 deletions handler/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/bradleyjkemp/cupaloy/v2"
"github.com/stretchr/testify/require"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/mjml-dev/handler"
"github.com/esdete2/envelopr/config"
"github.com/esdete2/envelopr/handler"
)

func TestProcessor(t *testing.T) {
r := require.New(t)

// Create temp test directories
tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down Expand Up @@ -124,7 +124,7 @@ func TestProcessor_Errors(t *testing.T) {
})

t.Run("invalid template syntax", func(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down Expand Up @@ -158,7 +158,7 @@ func TestProcessor_Errors(t *testing.T) {
})

t.Run("non-writable output directory", func(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down Expand Up @@ -198,7 +198,7 @@ func TestProcessor_Configuration(t *testing.T) {
r := require.New(t)

t.Run("minification settings", func(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "mjml-dev-test")
tmpDir, err := os.MkdirTemp("", "envelopr-test")
r.NoError(err)
defer os.RemoveAll(tmpDir)

Expand Down
2 changes: 1 addition & 1 deletion handler/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/fsnotify/fsnotify"
"github.com/networkteam/slogutils"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/envelopr/config"
)

type Watcher struct {
Expand Down
50 changes: 50 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
set -e

# Configuration
BINARY_NAME="envelopr"
GITHUB_REPO="esdete2/envelopr"
INSTALL_DIR="/usr/local/bin"

# Detect OS and architecture
OS=$(uname -s)
ARCH=$(uname -m)

if [ "$OS" = "Darwin" ]; then
if [ "$ARCH" = "arm64" ]; then
PACKAGE="envelopr_Darwin_arm64.tar.gz"
else
PACKAGE="envelopr_Darwin_x86_64.tar.gz"
fi
elif [ "$OS" = "Linux" ]; then
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
PACKAGE="envelopr_Linux_arm64.tar.gz"
else
PACKAGE="envelopr_Linux_x86_64.tar.gz"
fi
else
echo "Unsupported operating system: $OS"
exit 1
fi

# Create temporary directory
TMP_DIR=$(mktemp -d)
trap 'rm -rf $TMP_DIR' EXIT

# Download latest release
echo "Downloading $PACKAGE..."
RELEASE_URL="https://github.com/$GITHUB_REPO/releases/latest/download/$PACKAGE"
curl -sL "$RELEASE_URL" | tar xz -C "$TMP_DIR"

# Install binary
echo "Installing to $INSTALL_DIR..."
if [ ! -w "$INSTALL_DIR" ]; then
sudo mv "$TMP_DIR/$BINARY_NAME" "$INSTALL_DIR/"
sudo chmod +x "$INSTALL_DIR/$BINARY_NAME"
else
mv "$TMP_DIR/$BINARY_NAME" "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/$BINARY_NAME"
fi

echo "Successfully installed $BINARY_NAME"
echo "Run 'envelopr --help' to get started"
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"github.com/networkteam/slogutils"
"github.com/urfave/cli/v2"

"github.com/esdete2/mjml-dev/cmd"
"github.com/esdete2/envelopr/cmd"
)

func main() {
app := &cli.App{
Name: "mjml-dev",
Name: "envelopr",
Usage: "MJML template development tool",
Flags: []cli.Flag{
&cli.IntFlag{
Expand Down
2 changes: 1 addition & 1 deletion template/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/Boostport/mjml-go"
"github.com/friendsofgo/errors"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/envelopr/config"
)

type Compiler struct {
Expand Down
4 changes: 2 additions & 2 deletions template/compiler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/bradleyjkemp/cupaloy/v2"
"github.com/stretchr/testify/require"

"github.com/esdete2/mjml-dev/config"
"github.com/esdete2/mjml-dev/template"
"github.com/esdete2/envelopr/config"
"github.com/esdete2/envelopr/template"
)

func TestCompiler(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion template/renderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/esdete2/mjml-dev/template"
"github.com/esdete2/envelopr/template"
)

func TestRenderer(t *testing.T) {
Expand Down
File renamed without changes.
Loading

0 comments on commit a2b44ed

Please sign in to comment.