GitBook: [#141] No subject
BIN
.gitbook/assets/CleanupSubCategory.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
.gitbook/assets/CommitDialogue.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
.gitbook/assets/CommitSelected.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
.gitbook/assets/CommonStaticAnalysis.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
.gitbook/assets/DryRun.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
.gitbook/assets/GitHubLogin.png
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
.gitbook/assets/JavaCategory.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
.gitbook/assets/ModerneCatalog.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
.gitbook/assets/ModerneCatalog2.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
.gitbook/assets/OpenRewriteFilter.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
.gitbook/assets/RecipeDiff.png
Normal file
|
After Width: | Height: | Size: 53 KiB |
BIN
.gitbook/assets/RecipeResults.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
.gitbook/assets/RemoveRepositories.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
.gitbook/assets/SelectedRepositories.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
@@ -1,91 +1,96 @@
|
||||
# Quick Start: Running your first recipe
|
||||
|
||||
To help orient you to Moderne, let's run a couple of recipes on some open source projects that we have imported into Moderne.
|
||||
To help orient you to Moderne, let's walk through how to run a [recipe ](https://docs.openrewrite.org/v1beta/recipes)on some open source projects that we have imported into Moderne.
|
||||
|
||||
In this guide, we will
|
||||
In this guide, we will:
|
||||
|
||||
* [ ] **Login with GitHub**
|
||||
* [ ] **Find a recipe to search across multiple repositories**
|
||||
* [ ] **Examine the results of our recipe**
|
||||
* [ ] **Narrow our focus and run a recipe to transform a repository based on the search**
|
||||
* [ ] **Verify the results and issue a Pull Request to transform the code**
|
||||
* [ ] ****[**Login with GitHub**](running-your-first-recipe.md#step-2-sign-in-with-github)****
|
||||
* [ ] ****[**Find a recipe to run**](running-your-first-recipe.md#step-4-selecting-a-recipe)****
|
||||
* [ ] ****[**Filter the recipe to only run on specific repositories**](running-your-first-recipe.md#step-5-selecting-repositories)****
|
||||
* [ ] ****[**Run a recipe**](running-your-first-recipe.md#step-6-running-a-recipe)****
|
||||
* [ ] ****[**Examine the results**](running-your-first-recipe.md#step-7-viewing-results)****
|
||||
* [ ] ****[**Commit the changes**](running-your-first-recipe.md#step-8-creating-a-branch-and-pull-request)****
|
||||
|
||||
## Step 1: Go to [public.moderne.io](https://public.moderne.io/) and _login_
|
||||
|
||||
__ (1).png>)__
|
||||

|
||||
|
||||
## Step 2: Sign in with GitHub
|
||||
|
||||
The first time you sign in to Moderne through GitHub, you are presented with an authorization prompt for a few permissions to help enhance your experience.
|
||||
The first time you sign in to Moderne through GitHub, you will be presented with an authorization prompt for a few permissions to help enhance your experience.
|
||||
|
||||
{% hint style="info" %}
|
||||
For a better understanding of the permissions requested, please see [GitHub Permissions](../references/github-permissions.md#oauth-permission).
|
||||
{% endhint %}
|
||||
|
||||

|
||||
<figure><img src="../.gitbook/assets/authentication-github-signin.png" alt="GitHub login permissions"><figcaption><p>GitHub permission request</p></figcaption></figure>
|
||||
|
||||
## Step 3: Exploring the recipe catalog
|
||||
## Step 3: Navigate to the recipe catalog
|
||||
|
||||
Let's start by exploring recipes organized by language. As you navigate down into the catalog, you'll find different topical categories of recipes.
|
||||
After you've logged in and granted the appropriate permissions, you'll arrive at the [Moderne home page](https://public.moderne.io/). To explore the catalog of recipes, click on `Catalog` on the left side of the screen:
|
||||
|
||||
.png>)
|
||||
<figure><img src="../.gitbook/assets/ModerneCatalog.png" alt="Moderne Home Page"><figcaption><p>Moderne home page</p></figcaption></figure>
|
||||
|
||||
## Step 4: Selecting a recipe
|
||||
This will take you to a page that lists all of the recipe categories:
|
||||
|
||||
<figure><img src="../.gitbook/assets/ModerneCatalog2.png" alt="Moderne Catalog"><figcaption><p>Moderne recipe catalog</p></figcaption></figure>
|
||||
|
||||
## Step 4: Select a recipe
|
||||
|
||||
Let's find a good recipe to start from to help illustrate how to search across multiple repositories.
|
||||
|
||||
1. Select [_Browse_](https://app.moderne.io/browse) \_\_from the left-hand menu
|
||||
2. Then select [_Java_](https://app.moderne.io/recipes/org.openrewrite.java) \_\_ from the list of languages
|
||||
3. Select the [_Cleanup_](https://app.moderne.io/catalog/org.openrewrite.java.cleanup) category
|
||||
4. Click on [_Common static analysis issues_](https://app.moderne.io/recipes/org.openrewrite.java.cleanup.CommonStaticAnalysis) and then click _More Details_ \_\_ to go to the recipe details
|
||||
1. From the [Catalog ](https://public.moderne.io/catalog)page, click on [Java ](https://public.moderne.io/catalog/org.openrewrite.java)from the list of categories.
|
||||
2. Select the [Cleanup ](https://public.moderne.io/catalog/org.openrewrite.java.cleanup)sub-category.
|
||||
3. Click on the [Common static analysis issues](https://public.moderne.io/catalog/org.openrewrite.java.cleanup) recipe.
|
||||
|
||||
## Step 5: Selecting repositories
|
||||
## Step 5: Select specific repositories
|
||||
|
||||
To narrow our scope a little bit, from the Recipe details page for _SpringBoot 2.x Best Practices:_
|
||||
By default, all of the repositories are selected. Let's change that so we only run our recipe on the OpenRewrite repositories.  
|
||||
|
||||
* Click the _Select Repositories_ button
|
||||
* In the search dropdown field, add an organization filter.
|
||||
* Use the transfer list buttons to add and remove repositories from your filter.
|
||||
1. Click on the _Select Repositories_ button.
|
||||
2. Click on the `<<` arrows at the bottom to clear the selected repositories. 
|
||||
3. Press the _Add Filter_ button.
|
||||
4. Enter _openrewrite_ in the text box. 
|
||||
5. Press the `>>` arrows at the top to select all of the OpenRewrite repositories.
|
||||
6. You should now see all of the OpenRewrite repositories listed under _Selected repositories.___
|
||||
7. Click anywhere outside of the filter box to confirm your selection.
|
||||
|
||||
<img src="../.gitbook/assets/image (15).png" alt="" data-size="original">
|
||||
## Step 6: Run the recipe
|
||||
|
||||
Now we should see a number in the _Select Repositories_ button indicating how many repositories we to search.
|
||||
Click _Dry Run_ to start the recipe. You might be asked for additional GitHub permissions after you click this button.
|
||||
|
||||
## Step 6: Running a recipe
|
||||

|
||||
|
||||
Click _Dry Run_ to start the recipe.
|
||||
On the results page, you will see a summary of your recipe criteria and an indication of progress.
|
||||
|
||||
 (1).png>)
|
||||
Each result shows the number of files searched and how many changes were detected.
|
||||
|
||||
On the results page, you see a summary of your recipe criteria and an indication of progress.
|
||||
|
||||
.png>)
|
||||
|
||||
Each result for a repository shows files searched and changes detected.
|
||||
|
||||
Click on either  button or the name of the repository (e.g. _spring-cloud/spring-cloud-aws_) to view the proposed changes.
|
||||
To see the proposed changes, click on either the  button under `Actions` or the name of the repository (e.g. _openrewrite/rewrite_).
|
||||
|
||||
## Step 7: Viewing results
|
||||
|
||||
The resulting diff allows you to preview the changes from the recipe and then decide what to do.
|
||||
The resulting diff allows you to preview the changes from the recipe before you decide what you want to do.
|
||||
|
||||
.png>)
|
||||

|
||||
|
||||
As an example, the screenshot above illustrates how this recipe converts `@RequestMapping(…)` to the more specific HTTP Verb `@GetMapping(…)`.
|
||||
If you're unsure why something changed, you can click on the three dots (`...`) at the top right of any file and select `Why did this change?`
|
||||
|
||||
## Step 8: Creating a Branch & Pull Request
|
||||
For instance, in the above example, `= false` was removed due to the [Explicit initialization rule](https://public.moderne.io/recipes/org.openrewrite.java.cleanup.ExplicitInitialization). 
|
||||
|
||||
The next course of action is to commit the changes.
|
||||
## Step 8: Commit your changes
|
||||
|
||||
* In the results view, select the repositories you want to commit.
|
||||
* Click _Commit Selected \_\__. This will open a prompt allowing you to select different actions like committing directly, opening a pull request, etc.
|
||||
Once you've confirmed you want to make the changes, the next course of action is to commit everything. 
|
||||
|
||||
.png>)
|
||||
In the results view, select the repositories you want to commit and then click _Commit Selected_.
|
||||
|
||||
From this prompt, you can customize either the _Branch Name_ or _Commit Message_ to match the contributing guidelines of a particular repository.
|
||||
This will open a prompt that allows you to select different actions such as committing directly, opening a pull request, etc.
|
||||
|
||||
 
|
||||
|
||||
From this prompt, you can customize either the _Branch Name_ or the _Commit Message_ to match the contributing guidelines of a particular repository.
|
||||
|
||||
{% hint style="info" %}
|
||||
If you have committer access to the repository, create a branch directly on the project.
|
||||
You will need to have [specific permissions](https://docs.moderne.io/references/github-permissions) depending on the commit strategy you decide to go with.
|
||||
{% endhint %}
|
||||
|
||||
## Step 9: 🎉 Profit
|
||||
|
||||
@@ -18,7 +18,7 @@ This guide will walk you through configuring a new OAuth Application in GitHub
|
||||
3. Click the `New OAuth App` button in the upper right of your screen.
|
||||
4. Supply the required fields and Register the application. (See examples below) 
|
||||
5. On your newly created application click the `Generate a new client secret` button\
|
||||

|
||||
.png>)
|
||||
6. Copy the Client ID and Client secret from this page; they will be used as arguments for the Moderne Agent.  
|
||||
|
||||
#### **Example values**
|
||||
|
||||