Skip to content

Commit

Permalink
chore: fix caching handling for groovycs
Browse files Browse the repository at this point in the history
  • Loading branch information
maxandersen committed Dec 24, 2021
1 parent d124ccf commit 727bc3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions itests/cache.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Feature: cache
Scenario: clear cache default
When command('jbang cache clear')
* match exit == 0
* match err == "[jbang] Clearing cache for urls\n[jbang] Clearing cache for jars\n[jbang] Clearing cache for scripts\n[jbang] Clearing cache for stdins\n[jbang] Clearing cache for deps\n"
* match err == "[jbang] Clearing cache for urls\n[jbang] Clearing cache for jars\n[jbang] Clearing cache for kotlincs\n[jbang] Clearing cache for groovycs\n[jbang] Clearing cache for scripts\n[jbang] Clearing cache for stdins\n[jbang] Clearing cache for deps\n"

Scenario: clear cache default
When command('jbang cache clear --all')
* match exit == 0
* match err == "[jbang] Clearing cache for urls\n[jbang] Clearing cache for jars\n[jbang] Clearing cache for jdks\n[jbang] Clearing cache for kotlincs\n[jbang] Clearing cache for groovycs\n[jbang] Clearing cache for projects\n[jbang] Clearing cache for scripts\n[jbang] Clearing cache for stdins\n[jbang] Clearing cache for deps\n"

Scenario: clear cache default
When command('jbang cache clear --all --no-jdk --no-url --no-jar --no-project --no-script --no-stdin --no-deps --no-kotlinc')
When command('jbang cache clear --all --no-jdk --no-url --no-jar --no-project --no-script --no-stdin --no-deps --no-kotlinc --groovyc')
* match exit == 0
* match err == ""

6 changes: 6 additions & 0 deletions src/main/java/dev/jbang/cli/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public Integer clear(
"--jdk" }, description = "clear JDK cache only", negatable = true) Boolean jdks,
@CommandLine.Option(names = {
"--kotlinc" }, description = "clear kotlinc cache only", negatable = true) Boolean kotlincs,
@CommandLine.Option(names = {
"--groovyc" }, description = "clear groovyc cache only", negatable = true) Boolean groovys,
@CommandLine.Option(names = {
"--project" }, description = "clear temporary projects cache only", negatable = true) Boolean projects,
@CommandLine.Option(names = {
Expand All @@ -38,13 +40,16 @@ public Integer clear(
&& jars == null
&& jdks == null
&& kotlincs == null
&& groovys == null
&& projects == null
&& scripts == null
&& stdins == null
&& deps == null) {
// add the default (safe) set
classes.add(dev.jbang.Cache.CacheClass.urls);
classes.add(dev.jbang.Cache.CacheClass.jars);
classes.add(dev.jbang.Cache.CacheClass.kotlincs);
classes.add(dev.jbang.Cache.CacheClass.groovycs);
classes.add(dev.jbang.Cache.CacheClass.scripts);
classes.add(dev.jbang.Cache.CacheClass.stdins);
classes.add(dev.jbang.Cache.CacheClass.deps);
Expand All @@ -55,6 +60,7 @@ public Integer clear(
toggleCache(jars, dev.jbang.Cache.CacheClass.jars, classes);
toggleCache(jdks, dev.jbang.Cache.CacheClass.jdks, classes);
toggleCache(kotlincs, dev.jbang.Cache.CacheClass.kotlincs, classes);
toggleCache(kotlincs, dev.jbang.Cache.CacheClass.groovycs, classes);
toggleCache(deps, dev.jbang.Cache.CacheClass.deps, classes);
toggleCache(projects, dev.jbang.Cache.CacheClass.projects, classes);
toggleCache(scripts, dev.jbang.Cache.CacheClass.scripts, classes);
Expand Down

0 comments on commit 727bc3f

Please sign in to comment.