Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
loit-build-common
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
loit-Infrastructure
loit-build-common
Commits
39b278fd
提交
39b278fd
authored
12月 16, 2021
作者:
chenshiying
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[新增] 统计代码开发行数
上级
fb7623ea
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
115 行增加
和
0 行删除
+115
-0
GeneratorGitTjScript.java
...ain/java/com/loit/common/script/GeneratorGitTjScript.java
+105
-0
deployInfo-统计代码开发行数.xlsx
...ld-deploy-env/src/main/resources/deployInfo-统计代码开发行数.xlsx
+0
-0
gittj.ftl
...ploy-env/src/main/resources/template/sh/product/gittj.ftl
+10
-0
没有找到文件。
loit-build-component/loit-build-deploy-env/src/main/java/com/loit/common/script/GeneratorGitTjScript.java
0 → 100644
浏览文件 @
39b278fd
package
com
.
loit
.
common
.
script
;
import
com.loit.common.script.dto.*
;
import
com.loit.common.utils.ListUtil
;
import
com.loit.common.utils.StringUtils
;
import
com.loit.common.utils.excel.ImportExcel
;
import
com.loit.common.utils.file.FileUtils
;
import
com.loit.common.utils.freemarker.FreeMarkerUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.entity.ContentType
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
public
class
GeneratorGitTjScript
{
protected
static
String
root_path
=
"F:\\9Git140\\loit-build-common\\loit-build-component\\loit-build-deploy-env\\src\\main\\resources\\bin"
;
/**
* 构建环境 生产或者 准生产
* TODO 构建前需修改环境
*/
private
static
BuildEnvEnum
buildEnvEnum
=
BuildEnvEnum
.
PRODUCT
;
protected
static
String
root_path_full
=
root_path
+
"\\server"
+
"\\"
+
buildEnvEnum
.
getCode
()
;
private
static
Map
<
String
,
FrontInstanceDto
>
frontInstanceDtoMap
=
new
LinkedHashMap
<>();
public
static
void
main
(
String
[]
args
)
{
try
{
//String filePathStr = Thread.currentThread().getContextClassLoader().getResource("deployInfo.xlsx").getPath();
String
filePathStr
=
"F:\\9Git140\\loit-build-common\\loit-build-component\\loit-build-deploy-env\\src\\main\\resources\\deployInfo.xlsx"
;
File
pdfFile
=
new
File
(
filePathStr
);
FileInputStream
fileInputStream
=
new
FileInputStream
(
pdfFile
);
MultipartFile
multipartFile
=
new
MockMultipartFile
(
pdfFile
.
getName
(),
pdfFile
.
getName
(),
ContentType
.
APPLICATION_OCTET_STREAM
.
toString
(),
fileInputStream
);
ImportExcel
ei
=
new
ImportExcel
(
multipartFile
,
1
,
0
);
List
<
DeployInfoDataDTO
>
grayVersionDataDTOList
=
ei
.
getDataList
(
DeployInfoDataDTO
.
class
);
if
(
ListUtil
.
isEmpty
(
grayVersionDataDTOList
))
{
return
;
}
for
(
DeployInfoDataDTO
grayVersionDataDTO
:
grayVersionDataDTOList
)
{
if
(
"no"
.
equals
(
grayVersionDataDTO
.
getDeployPath
()))
{
continue
;
}
buildInitEnv
(
grayVersionDataDTO
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
/**
* 生成InitEnv
*
* @throws IOException
*/
private
static
void
buildInitEnv
(
DeployInfoDataDTO
grayVersionDataDTO
)
throws
IOException
{
File
folder
=
new
File
(
root_path_full
);
if
(!
folder
.
exists
())
{
folder
.
mkdirs
();
}
String
fixedIp
=
grayVersionDataDTO
.
getFixedIp
();
if
(
StringUtils
.
isEmpty
(
fixedIp
))
{
return
;
}
String
floatingIp
=
grayVersionDataDTO
.
getFloatingIp
();
String
replace
=
floatingIp
.
replaceAll
(
"39.100.254.140"
,
"127.0.0.1"
);
Map
model
=
new
HashMap
();
model
.
put
(
"fl"
,
grayVersionDataDTO
.
getFixedIp
());
model
.
put
(
"giturl"
,
replace
);
String
nginxConfigShFileName
=
root_path_full
+
"\\gitTJ.sh"
;
String
nginxConfigShResult
=
FreeMarkerUtils
.
process
(
"sh"
+
"\\"
+
buildEnvEnum
.
getCode
()
+
"\\gittj.ftl"
,
model
);
FileUtils
.
appendNewLine
(
nginxConfigShFileName
,
nginxConfigShResult
);
FileUtils
.
appendNewLine
(
nginxConfigShFileName
,
"########"
);
}
}
loit-build-component/loit-build-deploy-env/src/main/resources/deployInfo-统计代码开发行数.xlsx
0 → 100644
浏览文件 @
39b278fd
File added
loit-build-component/loit-build-deploy-env/src/main/resources/template/sh/product/gittj.ftl
0 → 100644
浏览文件 @
39b278fd
cd /root/loitsrc
git clone ${giturl}
cd ${fl}
git checkout -b dev origin/dev
cd /usr/local/src/gitstats
python gitstats.py /root/loitsrc/${fl} /root/test/${fl}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论