Can't create new project with uppercase letters

Hi, I’m trying to create a project with uppercase letters but it seems I’m unable to explicitly define it.

First, tried: mix phx.new ABC, which informs:

** (Mix) Application name must start with a letter and have only lowercase letters, numbers and underscore, got: “ABC”. The application name is inferred from the path, if you’d like to explicitly name the application then use the --app APP option.

Then tried: mix phx.new abc --app ABC

** (Mix) Application name must start with a letter and have only lowercase letters, numbers and underscore, got: “ABC”

I’ve read this solution, but it seems my elixir version is up to date. I’m running Windows 10 and my setup info is:

Elixir:

Erlang/OTP 22 [erts-10.5] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.9.2 (compiled with Erlang/OTP 20)

Phoenix:

Phoenix v1.4.10

While it is possible to use name that is upper case, as specs do not disallow that it is discouraged as the atoms in Erlang are generally lowercase. Is there any reason why you want upper case letters in the application name?

“ABC” dies start with a letter, yes, but that letter is not lowercase. Even though technically valid and possible to create such an application through altering the mix.exs after the fact, I’d strictly discourage that, as it will not work pretty well with all the tooling that only assume lower case letters and numbers in an application name.

@hauleth I’m aware of that it is discouraged, not why (thought it was mainly about convention).
The reason is that the name of my application is composed initials, so I don’t want the module name to be capitalized like a noun (eg: HTML as Html, XML as Xml, YAML as Yaml, etc).

@NobbZ When you say “application name” I think you’re referring to the folder name of the application, right? Your input about tooling is very relevant, but In that case, I’m not changing the folder structure, so I think I’ll be fine (if I understood it correctly).

But that is completely orthogonal, you can create application using:

$ mix phx.new app --module ABC

And it will work as expected. It will create application with lower case, folder with lower case, but the “core” module will be using upper cased name, like you want.

3 Likes

@hauleth Well, that seems to solve what I was trying to achieve then - I’m actually learning everything right now and getting accustomed to the tooling… So, since the default behavior is to capitalize the application name, I tried, naturally, to uppercase the whole thing :grin:

Even though this “solves it” for me; the question remains: If it’s really possible to create applications with uppercase letters why it’s not working? Is it blocking that the default in phoenix?

No it is not possible. Mix also disallows such applications. In theory you should be able to create the application with lower case, and then change :app entry in project definition, but I do not know how this will work.

3 Likes