Skip to content

Latest commit

 

History

History
104 lines (72 loc) · 4.67 KB

File metadata and controls

104 lines (72 loc) · 4.67 KB

Project Setup

Setup Walkthrough

Requirements

  • IntelliJ Idea Community Edition (Download)
  • Java SDK (JDK)
    • If JDK is missing, don't worry, IntelliJ will assist you installing JDK from the IDE. See troubleshooting.

Steps

Clone Repo

Clone repo with your favorite tool, or with CLI using following command

git clone https://github.com/hossain-khan/github-stats.git

Open in IntelliJ

Open the checked out directory in IntelliJ IDEA

ℹ️ Instead of using IntelliJ, you can use Gradle command after configuring local.properties ./gradlew run

IntelliJ open

Select dir

Once project is synced using gradle, you should see the project load like following

Setup local.properties

Option 1: Using the initialization script (Recommended)

Run the provided script to automatically create local.properties with date ranges set:

./local-prop-init.sh

This will:

  • Copy local_sample.properties to local.properties
  • Set date_limit_after to one month ago
  • Set date_limit_before to today's date

Then update the following required values in local.properties:

  • api_client_type - Choose RETROFIT (default) or GH_CLI. See API Clients Guide for details.
  • access_token - Generate a token (only required for RETROFIT)
  • repository_owner - Your GitHub org/user name
  • repository_id - Your repository name
  • authors - Comma-separated list of GitHub user IDs

Option 2: Manual setup

Rename the provided local_sample.properties to local.properties.

Generate token and update other configurations as appropriate

Generate stats using Main.kt

Once configuration is in place, all you need to do is open the Main.kt and ▶️ run it.

Run using gradle command

You can also use following gradle command to run the stats generator

./gradlew run

See troubleshooting section if you encounter issue.

Preview Stats

Once the generator app finishes running, you will see report in the project root directory that contains both ASCII and CSV report.
Here is sample snapshot of reports from different repositories:

Generated files and folders

Troubleshooting

If you see following error, it could be your token is not setup, or you have exceeded API rate limit.

Exception in thread "main" retrofit2.HttpException: HTTP 401 

To see detailed API request information, you can modify BuildConfig and set DEBUG_HTTP_REQUESTS to true, then rebuild the project. This is a compile-time constant that enables detailed HTTP request/response logging.


Missing ▶️ run button, or JDK missing - in this case, take a look at top right corner of the IntelliJ IDEA that will suggest you to install a JDK. Click on the install link and wait for it to complete.

Finally, click on the gradle sync button (🐘🔁) and wait for the sync to complete. If everything went well you should see the ▶️ icon beside main() in the Main.kt file.