[POLL] How do you use `crystal init`?

There was some discussion in the past about the crystal init tool and its features: CircleCI config on init tool · Issue #8532 · crystal-lang/crystal · GitHub . Some suggested to keep it as-is, adding new features like having other CIs, or removing the tool from the compiler.

The tool has not changed since quite a lot of time, that’s why the goal of this poll is to have an idea of its usage and what the Crystal users would like.

How do you use crystal init?
  • I use it, and it is fine as-is
  • I use it without Travis CI, and that’s fine
  • I use it, but I wish it had more features (CIs, licenses…)
  • I don’t use it, or prefer using third party tools [1]

0 voters

[1] A third party tool example is @oprypin’s Configurator - install-crystal action

Another relevant issue on that topic: Revisit `crystal init` · Issue #8844 · crystal-lang/crystal · GitHub

1 Like

oh, I read that wrong. I don’t use Travis, but I’d be ok with there being either no CI generated, or a way to configure which CI stuff is generated (and whatever other options)

For Lucky, when you generate a new app, we actually run crystal init first, then just slap some new files on top. But all new Lucky apps are generated with both travis and Github Actions now by default.

1 Like

There is also shard init with a smaller template.

And this topic Proposal: Download project templates with crystal init

I would personally like to see some cli that could be used as init & generator that could be used for different frameworks and types of projects. But I am not sure what is the ideal design of such tool to allow project template, and expansions on existing code bases.

Without such a tool I think that any improvement to crystal init is not a real game changer.

I know there will always be guides here and there for how to do X, but crystal init serves that directly to the user and it reduce the burden.

Although Github Action is a very attractive option for github repos the setup for travis is still the simplest one to start with.

1 Like

But a CI is not needed at all to get started with Crystal. Is it really used by beginners when they try locally to have a working Crystal program?

CI, license, README are welcome, are a good practice of course, but not essential to get started.
In a sense, all of this could even create noise when the goal is to have a minimal working project.

1 Like

It’s very easy to delete those files. It’s a bit harder to write them from scratch.

2 Likes

If it’s easy to delete files, why use the tool at all? Just copy another project of yours and delete some files.
(And I’m not even sarcastic, that’s what I do, anyway)

If it’s your first project you don’t have another one to copy from.

It’s just very convenient to get a src dir, a spec dir, a shards.yml and a readme. And it’s not much more than that either.

I don’t disagree. But then we’re back to this

But a CI is not needed at all to get started with Crystal. Is it really used by beginners when they try locally to have a working Crystal program?

I know, but it doesn’t brother either.

Thanks to everyone for your participation! :slight_smile:

As a basic summary, what we can know from the poll:

  • people use crystal init (as expected)
  • for most people, the command does not fit exactly their needs (fine or not with it)
  • roughly half the people are fine with the tool in its current state
  • roughly half the people are not really fine with the tool for its lack of features

Overall, adding more features can be beneficial for most of us, if the current ones are still present to satisfy those being fine with the current situation.


What’s remaining to decide is the hardest part: what to do? It can prove to be a challenge to have a more complex tool, yet still simple, remaining inside the compiler (or not, like shards?).

Several options:

1 Like

Maybe this is “childish”, but crystal initactually opened me the world of unit tests and CI. If, hypothetically, there would be a configurable tool, that asked me for exact features i want to use in project, then my answers (from the time I first met Crystal) would be “Mercurial VCS/GPL license/test framework:none/CI:none”.
But the crystal init didn’t ask, so i started to use github because it was already configured, started to write tests because it created a dir with the files, and then started to use CI because it wasn’t a strange combination of words anymore, but already configured thing and i just have to do few clicks in web interface to make it work.
That’s why I consider not giving a choice as a good thing for newbies. More advanced tools that allow to select any aspect could be useful, but crystal init that is shipped with language and is a default choice for any tutorial imho is good as is - just works without asking single question.

4 Likes

If we continue your logic, this would be better to provide a GitHub Actions template than a Travis CI one, because working out-of-the-box in GitHub (most Crystalers use it rather than Travis for their new project on GitHub).

We can’t say that git is “better” than mercurial or MIT is “better” than GPL. In a way, mercurial is even more user-friendly than git.

Also, as I said above, having good defaults and advanced features can perfectly fit on a same tool.


There is also something lacking on the current tool which is very useful and widely used: API docs generation deployed in gh-pages.

1 Like

I would try to keep the compiler tool as minimal as possible. The current scope is pretty neat. It could use some refinements to improve some aspects. But I don’t think big changes would be good.
I wouldn’t want to introduce complex features like templates. That should better be a separate tool.
Yes, it could go into one, but focusing on small feature sets (aka Unix philosophy) is probably better.

@konovod Thank you for your comment. I think that perfectly summons the most important purpose of the init tool :+1:

2 Likes

The tool could be on a separate project then, like crystal depsshards? Clearly, as we can see from this poll, people are seeking additional features. I agree with you not to bloat the compiler with unrelated things from the language itself. If it was only me, it will remain only the compiler and the formatter (like in most languages out there, except the later) :laughing:

I don’t see major disadvantages of having a dedicated command vs a subcomand, only one more package to install.