ninenines / erlang.mk

A build tool for Erlang that just works.
https://erlang.mk
ISC License
578 stars 241 forks source link

Add advice on project directory naming rule on `creating_a_folder_for_your_project` tutorial #984

Open yskelg opened 1 year ago

yskelg commented 1 year ago

Would it be better to advice on project directory names for those just starting out? I'm guessing that there are someone naming project directory wrong.

bootstrap:
# ...
        $(eval p := $(PROJECT))
        $(if $(shell echo $p | LC_ALL=C grep -x "[a-z0-9_]*"),,\
                $(error Error: Invalid characters in the application name))

bootstrap-lib:
# ...
        $(eval p := $(PROJECT))
        $(if $(shell echo $p | LC_ALL=C grep -x "[a-z0-9_]*"),,\
                $(error Error: Invalid characters in the application name))

For example,

~/erlang/hello-erlang-mk$ make -f erlang.mk bootstrap
...
make[1]: Leaving directory '/home/emniuyk/erlang/hello-erlang-mk/.erlang.mk.build'
cp .erlang.mk.build/erlang.mk ./erlang.mk
rm -rf .erlang.mk.build
erlang.mk:5458: *** Error: Invalid characters in the application name.  Stop.
essen commented 1 year ago

Perhaps. Patch welcome!

yskelg commented 1 year ago

OK, Project names are allowed only alphabet, numbers and _

$ cat test.txt
hello
hello()
hello-
hello_
3hello

# Allowed naming keyword are shown.
$ grep -x "[a-z0-9_]*" test.txt 
hello
hello_
3hello