How to run tapioca when files changes in my Ruby project? - ruby

I have write a custom dsl compiler in my Ruby project with Sorbet.
Every time I create or edit a file that uses this custom dsl I have to run
bin/tapioca dsl in the console.
How I could automatize this process?

Related

Is there a way to generate custom extensions in Gradle via plugin to use in build script?

I have a use case where I need to generate custom extensions just like the ones generated for libs.versions.toml but for completely different purpose. So I wonder if I can make Gradle generate them via plugin.
I searched in Gradle docs but did not find any clue.

Why does the gradle-clojure plugin skip the compileClojure task?

I'm trying to write a plugin for Intellij in Clojure. To that end I want to implement some extension endpoints with Clojure's :gen-class functionality. I've added the gradle-clojure plugin and placed some Clojure code in src/main/clojure. But when I build the project it says
> Task :compileClojure SKIPPED
Why is that?
Also, on a related note: If I add the expression (throw (Exception. "abort")) to the Clojure code on the top level, I can crash the build. This doesn't make sense to me. Why would Clojure code get executed during the build?
In Clojure, pre-compilation is not required. The source code can be compiled when running for the first time, as long as the source is bundled in the .jar file.
For gradle-clojure specifically, the default build task will run checkClojure, which will call the Clojure load function on each source directory, which loads all the namespaces. When you load a namespace, its expressions are executed in order. Normally you'd only put def or defn which would just define global variables. This is done to ensure there's no compiler errors before bundling in the .jar.
The gradle-clojure compileClojure task will only compile the namespaces that are configured with the aotNamespaces or all of them if using aotAll(). In that case it will call the Clojure compile on each namespace. See the gradle-clojure documentation for more info.
For more detail about Clojure compilation, see this documentation

Can I have gradle support in IDEA without importing it?

I have quite big IDEA project which we incrementally migrate to gradle. I don't want to "import" newly migrated parts right now, but I do want to have IDEA support (syntax highlighting, code completion, etc) for writing gradle scripts. From brief searching it is still not obvious how to get it. Is it possible it all?
As long you have the Groovy plugin installed and enabled, and have *.gradle listed as a Registered Pattern for "Groovy" in Settings > Editor > File Types you should get groovy features when editing a build.gradle file.

Why does the gradle wrapper need a specific setting to enable code completion?

If I simply import a gradle project (without wrapper) into IntelliJ IDEA, code completion works fine. The docs for the wrapper say:
use the -all distribution to enable your IDE to enable code-completion
Why is this necessary?
NB The gradle wrapper directory is checked into source control, so it presumably doesn't change frequently... but that in turn means that it can't be storing some kind of index of your source code.
It's not about your source code but about Gradle source code.
The doc says :
Let’s assume the following use case to illustrate the use of the
command line options. You would like to generate the Wrapper with
version 4.0 and use the -all distribution to enable your IDE to enable
code-completion and being able to navigate to the Gradle source code
The code completion concerns only Gradle files

How do I make a custom gradle template?

https://github.com/townsfolk/gradle-templates
After much reading in forums, gradle's jira, and githubs, it seems the above plugin is the popular choice for getting maven archetype-like functionality in Gradle.
It comes with multiple templates to choose from, but how do I make my own?
Is there a guide or something that can kick start me into making my own template?
I have a setup I made to generate a new application with all the boiler plate pieces my company requires. I was able to generate this from an existing project using maven archetypes. I want to accomplish the same in Gradle so I can also take advantage of the ability to run groovy scripts when the generation occurs.
So far it looks like the only way to do this is to fork that project and make my own plugin with added template files and such.
Know this is a old question, but there is a wiki page on how to create your own templates:
https://github.com/townsfolk/gradle-templates/wiki/Template-Customization

Resources