Skip to content

Commit

Permalink
feat: fast-forward latest commits done in secondary host machine, tag…
Browse files Browse the repository at this point in the history
…=0.2.7
  • Loading branch information
MassiGy committed Jul 2, 2024
1 parent 3b2c9d4 commit 4411732
Show file tree
Hide file tree
Showing 21 changed files with 1,461 additions and 1,319 deletions.
30 changes: 17 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Binary
bin/*

# Envs
.env
.env.local

# Test files
test.txt

# Debug files
*debug*
cmd/*debug*
# Binary
bin/*

# Envs
.env
.env.local

# Test files
test.txt

# Debug files
*debug*
cmd/*debug*

# releases
releases/*/*
releases/*.zip
221 changes: 151 additions & 70 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,70 +1,151 @@
VERSION:=$(shell cat ./VERSION)
BINARY_NAME:=$(shell cat ./BINARY_NAME)
CONFIG_DIR:=${HOME}/.config/${BINARY_NAME}-${VERSION}
SHARED_DIR:=${HOME}/.local/share/${BINARY_NAME}-${VERSION}
AUTHOR:="Massiles Ghernaout"

info:
bash ./scripts/update_version_using_git_tags.sh
$(eval VERSION=$(shell cat ./VERSION))

@echo "Project: ${BINARY_NAME}@${VERSION}"
@echo "Author: ${AUTHOR}"

clean:
rm -rf bin/*

binary:
rm -rf bin/*

bash ./scripts/update_version_using_git_tags.sh
$(eval VERSION=$(shell cat ./VERSION))

@echo "Building a the executable..."
go build -ldflags "-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME}" -o bin/${BINARY_NAME} cmd/*.go


run:
./bin/${BINARY_NAME}

runsrc:
ENV=dev DEBUG=true go run ./cmd/main.go

make_bin_shared:
bash ./scripts/update_version_using_git_tags.sh
$(eval VERSION=$(shell cat ./VERSION))
$(eval SHARED_DIR=${HOME}/.local/share/${BINARY_NAME}-${VERSION})

cp $(shell pwd)/bin/${BINARY_NAME} ${SHARED_DIR}/${BINARY_NAME};
@echo "The ${BINARY_NAME} binary file can be found in ${SHARED_DIR}";
@echo ""
bash ./scripts/setup_aliases.sh;
@echo "Added ${BINARY_NAME} aliases to .bashrc|.bash_aliases|.zshrc|.zsh_aliases";
@echo "you can run the program by using this command: ${BINARY_NAME}"

setup:
@echo ""
@echo "Setting up the config and local shared directories, and the appropriate files."

bash ./scripts/setup_config_dir.sh
bash ./scripts/setup_shared_dir.sh

bash ./scripts/setup_about_file.sh

install: setup make_bin_shared

rm_local_bin:
bash ./scripts/update_version_using_git_tags.sh
$(eval VERSION=$(shell cat ./VERSION))
$(eval SHARED_DIR=${HOME}/.local/share/${BINARY_NAME}-${VERSION})

rm -rf ${SHARED_DIR}/${BINARY_NAME}

uninstall: rm_local_bin
bash ./scripts/update_version_using_git_tags.sh
$(eval VERSION=$(shell cat ./VERSION))
$(eval CONFIG_DIR=${HOME}/.config/${BINARY_NAME}-${VERSION})
$(eval SHARED_DIR=${HOME}/.local/share/${BINARY_NAME}-${VERSION})

rm -rf ${CONFIG_DIR}
rm -rf ${SHARED_DIR}
BINARY_NAME:=$(shell cat ./BINARY_NAME)
AUTHOR:="Massiles Ghernaout"

TAG=$(shell git tag | tail -1)
ifneq ($(TAG),)
VERSION:=${TAG}
else
VERSION:=$(shell cat ./VERSION)
endif


ifeq ($(OS),Windows_NT)
MACHINE = windows
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
ARCH = amd64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
ARCH = 386
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
MACHINE = linux
endif
ifeq ($(UNAME_S),Darwin)
MACHINE = darwin
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
ARCH = amd64
endif
ifneq ($(filter %86,$(UNAME_P)),)
ARCH = 386
endif
ifneq ($(filter arm%,$(UNAME_P)),)
ARCH = arm
endif
endif




# [ PRODUCTION ]
info:
@echo "Project: ${BINARY_NAME}@${VERSION}"
@echo "Author: ${AUTHOR}"
@echo "Current OS: ${MACHINE}"
@echo "Current architecture: ${ARCH}"

binary:

rm -rf bin/*
@echo "Building the executable..."

ifeq ($(OS),Windows_NT)
GOOS=${MACHINE} GOARCH=${ARCH} \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME}.exe -extldflags=-static"\
-o bin/${BINARY_NAME}.exe \
cmd/*.go
else
GOOS=${MACHINE} GOARCH=${ARCH} \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME} -extldflags=-static"\
-o bin/${BINARY_NAME} \
cmd/*.go
endif



# [ RELEASES ]

win32_x86_release:
rm -rf releases/win32_x86/*

GOOS=windows GOARCH=386 \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME}.exe -extldflags=-static" \
-o releases/win32_x86/${BINARY_NAME}.exe \
cmd/*.go

zip -r releases/win32_x86.zip releases/win32_x86/*


win32_amd64_release:
rm -rf releases/win32_amd64/*

GOOS=windows GOARCH=amd64 \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME}.exe -extldflags=-static" \
-o releases/win32_amd64/${BINARY_NAME}.exe \
cmd/*.go

zip -r releases/win32_amd64.zip releases/win32_amd64/*


linux_x86_release:
rm -rf releases/linux_x86/*

GOOS=linux GOARCH=386 \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME} -extldflags=-static" \
-o releases/linux_x86/${BINARY_NAME} \
cmd/*.go

zip -r releases/linux_x86.zip releases/linux_x86/*

linux_amd64_release:
rm -rf releases/linux_amd64/*

GOOS=linux GOARCH=amd64 \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME} -extldflags=-static" \
-o releases/linux_amd64/${BINARY_NAME} \
cmd/*.go

zip -r releases/linux_amd64.zip releases/linux_amd64/*

# https://stackoverflow.com/questions/65881808/how-can-i-cross-compile-to-darwin-386-from-linux
# darwin/32bit support was dropped since go 1.15, if you want to get this release, use a go version prior to 1.14
osx_x86_release:
rm -rf releases/osx_x86/*

GOOS=darwin GOARCH=386 \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME} -extldflags=-static"\
-o releases/osx_x86/${BINARY_NAME} \
cmd/*.go

zip -r releases/osx_x86.zip releases/osx_x86/*

osx_amd64_release:
rm -rf releases/osx_amd64/*

GOOS=darwin GOARCH=amd64 \
go build -ldflags \
"-X main.version=${VERSION} -X main.binary_name=${BINARY_NAME} -extldflags=-static" \
-o releases/osx_amd64/${BINARY_NAME} \
cmd/*.go

zip -r releases/osx_amd64.zip releases/osx_amd64/*

releases: win32_x86_release win32_amd64_release linux_x86_release linux_amd64_release osx_amd64_release

# [ DEVELOPEMENT ]
clean:
rm -rf bin/*
run:
./bin/${BINARY_NAME}
runsrc:
GOOS=${MACHINE} GOARCH=amd64 ENV=dev DEBUG=true go run ./cmd/main.go
112 changes: 36 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,36 @@
# Eddy - A minimal text editor



## Motivation & Aims

Eddy was a small project that helped me learn more about how games work. I wanted to explore this realm, and since I love text editors
( I use vim btw ), I thought it would be great to create one.

**But why creating a text editor to learn how games work ?** Well they are very similar, basically you have a setup function that prepares
everything that the program/interface might need as resources, then you'll have the main loop in which you catch user input and update
the current state (update & rerendering).

So that is why a text editor is not much diffrent then a game. You draw the editor interface, you enter your main loop, you listen for
user input and you redraw to the screen the updated state.

## Screenshot

- Eddy v0.2.x screenshot, ( a very minimal editor, not designed for mainstream use, only experimental )

![Eddy screenshot](./eddy_screenshot.png "Eddy v0.2.x")



## Setup & Installation ( Using Go tools )

```sh

# make sure to install figlet (for some use these commands)
[[ "$HOSTNAME" == "debian" ]] && sudo apt install figlet
[[ "$HOSTNAME" == "ubuntu" ]] && sudo apt install figlet
[[ "$HOSTNAME" == "fedora" ]] && sudo dnf install figlet


# build the binary (this requires Go to be installed )
make build

# setup the environment and mv the binary to ~/.local/share
make install

# (Optional) you can create a symlink to the binary
# to /usr/local/bin, or directly copy the binary to it.

```

## Setup & Installation ( Without Go tools )

First, download from Github the latest release.

```sh

# clone the repo
git clone <repo_url>

# download from github the latest release

# move the binary of the release to the project /bin directory

# run make install
make install

```


## Uninstall

```sh

# just run the following command to remove all the used
# directroies and the ~/.local/share binary.
make uninstall

# (NOTE) extra setup from your part should be undone by
# yourself.

```
# Eddy - A minimal text editor


## Motivation & Aims

Eddy was a small project that helped me learn more about how games work. I wanted to explore this realm, and since I love text editors
( I use vim btw ), I thought it would be great to create one.

**But why creating a text editor to learn how games work ?** Well they are very similar, basically you have a setup function that prepares
everything that the program/interface might need as resources, then you'll have the main loop in which you catch user input and update
the current state (update & rerendering).

So that is why a text editor is not much diffrent then a game. You draw the editor interface, you enter your main loop, you listen for
user input and you redraw to the screen the updated state.

## Screenshot

- Eddy v0.2.x screenshot, ( a very minimal editor, not designed for mainstream use, only experimental )

![Eddy screenshot](./eddy_screenshot.png "Eddy v0.2.x")


## Setup & Installation ( Without Go tools )

- First, download from Github the latest release.
- for Linux and OSX(MAC), download the eddy binary.
- for Windows, download the eddy.exe binary.
- Add it to your PATH env variable, and run it.

**NOTE:** For those of you that are using windows and really want to change the code and build the program by themselves, it would be better to use MS-Powershell instead of DOS-CMD, since Powershell supports better POSIX commands (the makefile will run better on it).


## Uninstall

- Delete the binary file.
- Remove the binary from your PATH env variable.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.1
test
Loading

0 comments on commit 4411732

Please sign in to comment.