1 Star 0 Fork 20

scottQ/keycloak-justauth

forked from justauth/keycloak-justauth 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gen-code.py 2.03 KB
一键复制 编辑 原始数据 按行查看 历史
yanfeiwuji 提交于 2021-11-09 21:22 . fix weword alipay coding temp ext
import os
codePath = "/Users/yanfeiwuji/IdeaProjects/keycloak-justauth/src/main/java/com/yfwj/justauth/social"
needTempPath = "/Users/yanfeiwuji/IdeaProjects/keycloak-justauth/temp"
codeTempPath = "/Users/yanfeiwuji/IdeaProjects/keycloak-justauth/gen-temp/WeChatOpenIdentityProviderFactory.java"
jpath = "/Users/yanfeiwuji/IdeaProjects/keycloak-justauth/src/main/java/com/yfwj/justauth/social/common/JustAuthKey.java"
def printO(result):
for r in result:
print("com.yfwj.justauth.social." +
r["c"] + 'IdentityProviderFactory')
def printKicon(result):
for r in result:
print("kcLogoIdP-" +
r["o"] + '=')
def getR():
result = []
with open(jpath) as f:
for line in f.readlines():
if ("\"" in line) and (not ("//" in line)):
result.append(
{
"o": line.split("\"")[1],
"c": line.split("\"")[1].title().replace("_", ""),
"j": line.split("(")[0]
}
)
return result
def genClass(result):
for r in result:
with open(codeTempPath) as temp, open(codePath+"/" + r["c"] + 'IdentityProviderFactory.java', "w", encoding='utf-8') as need:
for line in temp:
new_line = line.replace("${C}", r["c"]).replace("${J}", r["j"])
need.write(new_line)
def genTemp(result):
need = """<div data-ng-include data-src="resourceUrl + '/partials/realm-identity-provider-social.html'"></div>"""
for r in result:
p = needTempPath + "/realm-identity-provider-" + r['o'] + ".html"
open(p, mode="w+", encoding="utf-8")
with open(needTempPath+"/realm-identity-provider-"+r['o']+".html", mode="w", encoding='utf-8') as t1, open(needTempPath+"/realm-identity-provider-"+r["o"]+"-ext.html", mode="w", encoding='utf-8') as t2:
t1.write(need)
if __name__ == "__main__":
result = getR()
#genClass(result)
#genTemp(result)
#printO(result)
#printKicon(result)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ScottyQee/keycloak-justauth.git
git@gitee.com:ScottyQee/keycloak-justauth.git
ScottyQee
keycloak-justauth
keycloak-justauth
master

搜索帮助