Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
LingZhaoHui | 3943de1696 | |
LingZhaoHui | a71bde4a04 | |
LingZhaoHui | 46a0faca8a | |
LingZhaoHui | a04540e6f2 | |
LingZhaoHui | 9a70b76324 | |
LingZhaoHui | d3a78d414a | |
LingZhaoHui | 30d46c56b9 | |
LingZhaoHui | 4b7d53d2dc |
|
@ -1,5 +1,6 @@
|
||||||
## 跟新个人主页
|
## 跟新个人主页
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone ssh://git@git.zeekling.cn:222/zeekling/github_zeekling.git
|
git clone ssh://git@git.zeekling.cn:222/zeekling/github_zeekling.git
|
||||||
cd github_zeekling
|
cd github_zeekling
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class BlogUpdateServiceImpl implements BlogUpdateService {
|
||||||
bodyBuilder.append("\n\n");
|
bodyBuilder.append("\n\n");
|
||||||
|
|
||||||
String ret = "### Hey \uD83D\uDC4B, I'm [${title}](${home})! \n" +
|
String ret = "### Hey \uD83D\uDC4B, I'm [${title}](${home})! \n" +
|
||||||
"\n![Github Stats](https://github-readme-stats.vercel.app/api?username=${username}&show_icons=true) \n\n" +
|
"\n![Github Stats](https://github-readme-stats-zeekling.vercel.app/api?username=${username}&show_icons=true) \n\n" +
|
||||||
"### 我在博客[${title}](${home})的近期动态\n" +
|
"### 我在博客[${title}](${home})的近期动态\n" +
|
||||||
"⭐️ Star [个人主页](https://github.com/${username}) 后会自动更新" +
|
"⭐️ Star [个人主页](https://github.com/${username}) 后会自动更新" +
|
||||||
"\n\n<p align=\"center\"><img alt=\"${title}\" src=\"${favicon}\"></p>" +
|
"\n\n<p align=\"center\"><img alt=\"${title}\" src=\"${favicon}\"></p>" +
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.zeekling.util;
|
||||||
|
|
||||||
import com.zeekling.blog.BlogUpdateService;
|
import com.zeekling.blog.BlogUpdateService;
|
||||||
import com.zeekling.blog.BlogUpdateServiceImpl;
|
import com.zeekling.blog.BlogUpdateServiceImpl;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -15,7 +16,7 @@ import org.testng.annotations.Test;
|
||||||
public class GitHubsTest {
|
public class GitHubsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAll() {
|
public void genGitHubInfo() {
|
||||||
String configPath = "/home/zeekling/project/ling/github_zeekling/src/main/resources/blog.properties";
|
String configPath = "/home/zeekling/project/ling/github_zeekling/src/main/resources/blog.properties";
|
||||||
BlogUpdateService updateService = new BlogUpdateServiceImpl(configPath);
|
BlogUpdateService updateService = new BlogUpdateServiceImpl(configPath);
|
||||||
JSONArray result = updateService.getGitHubRepos();
|
JSONArray result = updateService.getGitHubRepos();
|
||||||
|
@ -45,6 +46,32 @@ public class GitHubsTest {
|
||||||
compatibleResult.put(compatibleObject);
|
compatibleResult.put(compatibleObject);
|
||||||
}
|
}
|
||||||
System.out.println(compatibleResult);
|
System.out.println(compatibleResult);
|
||||||
|
|
||||||
|
final StringBuilder contentBuilder = new StringBuilder();
|
||||||
|
String stats = "\n![Github Stats](https://github-readme-stats.vercel.app/api?username={username}&show_icons=true) \n\n";
|
||||||
|
stats = stats.replace("{username}", "zeekling");
|
||||||
|
contentBuilder.append("![GitHub Repo](/images/github_repo.jpg)\n\n");
|
||||||
|
contentBuilder.append("## Github Stats\n").append(stats);
|
||||||
|
contentBuilder.append("## 所有开源项目\n");
|
||||||
|
contentBuilder.append("| 仓库 | 项目简介 | 收藏数 | fork数 | 项目主页 | 主要编程语言 |\n | ---- | ---- | ---- | ---- | ---- | ---- |\n");
|
||||||
|
for (int i = 0; i < compatibleResult.length(); i++) {
|
||||||
|
final JSONObject repo = compatibleResult.optJSONObject(i);
|
||||||
|
final String url = repo.optString("githubrepoHTMLURL");
|
||||||
|
final String desc = repo.optString("githubrepoDescription");
|
||||||
|
final String name = repo.optString("githubrepoName");
|
||||||
|
final String stars = repo.optString("githubrepoStargazersCount");
|
||||||
|
final String forks = repo.optString("githubrepoForksCount");
|
||||||
|
final String lang = repo.optString("githubrepoLanguage");
|
||||||
|
final String hp = repo.optString("githubrepoHomepage");
|
||||||
|
contentBuilder.append("| [").append(name).append("](").append(url).append(") | ")
|
||||||
|
.append(desc).append(" | ")
|
||||||
|
.append(stars).append(" | ")
|
||||||
|
.append(forks).append(" | ")
|
||||||
|
.append(hp).append(" | ")
|
||||||
|
.append(lang).append("|\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
FileUtils.saveDataToFile("/tmp/GITHUB.md", contentBuilder.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue