Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Recipe Catalog #161

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

fabapp2
Copy link
Collaborator

@fabapp2 fabapp2 commented Feb 5, 2024

Add a simple Recipe Catalog as YAML in src/main/resources.
The catalog declares one recipe AddLicenseHeader which can be applied by spring recipe-catalog apply <recipe-id> <params> <path>.

@fabapp2 fabapp2 linked an issue Feb 5, 2024 that may be closed by this pull request
Optional<Recipe> recipeFound = recipeCatalog.lookup(recipeId, parameterMap);
if (recipeFound.isPresent()) {
Recipe recipe = recipeFound.get();
rewriteRecipeLauncher.run(recipe, path);
Copy link
Collaborator Author

@fabapp2 fabapp2 Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to TerminalMessage the user here in an else block.
"Could not find recipe..."

@jvalkeal
Copy link
Collaborator

jvalkeal commented Feb 6, 2024

Some files are missing license header. There's a lot of space instead of tabs we should use.

@fabapp2
Copy link
Collaborator Author

fabapp2 commented Feb 6, 2024

Some files are missing license header. There's a lot of space instead of tabs we should use.

Cries for Spring Java Format & some license-check plugin?

@markpollack
Copy link
Member

markpollack commented Feb 15, 2024

the point was more so to pick a simple OR recipe...but I get the point.

@markpollack
Copy link
Member

markpollack commented Feb 15, 2024

when I run the app, it just exits. I don't have this issue in the main branch.

$ git checkout fabapp2-recipe-catalog
Switched to branch 'fabapp2-recipe-catalog'

 (fabapp2-recipe-catalog) ~/projects/spring-cli
$ 

 (fabapp2-recipe-catalog) ~/projects/spring-cli
$ ./gradlew clean build

$ java -jar /home/mark/projects/spring-cli/build/libs/spring-cli-0.9.0-SNAPSHOT.jar

 (fabapp2-recipe-catalog) ~/projects/spring-cli
$

Enabled logging and got the error that a bean was not found. Adding @Component to RecipeParameterParser enabled startup

@markpollack
Copy link
Member

not sure how to run this.. tried

$ spring recipe-catalog apply --recipeId AddLicenseHeader
Range [0, -1) out of bounds for length 8
 /tmp/spring/myapp
$ spring recipe-catalog apply --recipeId AddLicenseHeader --parameters licenseText=Copyright
Could not find recipe 'AddLicenseHeader,--parameters,licenseText=Copyright' in catalog.
 /tmp/spring/myapp

@pk-218
Copy link

pk-218 commented May 13, 2024

Hey @fabapp2, is this still being worked on?
I too would like an easier way to pass params to the recipe and can help out here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Execute OpenRewrite from Catalog
4 participants