Commit 1b496d91e1749770b07c32021f20520dfdc7ef9b
1 parent
5ac7c3bd
兼容mac
Showing
1 changed file
with
12 additions
and
13 deletions
yudao-server/src/test/java/cn/iocoder/yudao/ProjectReactor.java
| ... | ... | @@ -31,10 +31,10 @@ public class ProjectReactor { |
| 31 | 31 | String projectBaseDir = getProjectBaseDir(); |
| 32 | 32 | |
| 33 | 33 | // ========== 配置,需要你手动修改 ========== |
| 34 | - String groupIdNew = "cn.huwing.boot"; // TODO @seeker:这几个参数改回去原来的哈。 | |
| 35 | - String artifactIdNew = "zdm"; | |
| 36 | - String packageNameNew = "cn.huwing.zdm"; | |
| 37 | - String titleNew = "测试名管理系统"; | |
| 34 | + String groupIdNew = "cn.star.gg"; | |
| 35 | + String artifactIdNew = "star"; | |
| 36 | + String packageNameNew = "cn.start.pp"; | |
| 37 | + String titleNew = "土豆管理系统"; | |
| 38 | 38 | String projectBaseDirNew = projectBaseDir + "-new"; // 一键改名后,“新”项目所在的目录 |
| 39 | 39 | log.info("[main][新项目路径地址]projectBaseDirNew: " + projectBaseDirNew); |
| 40 | 40 | |
| ... | ... | @@ -47,24 +47,23 @@ public class ProjectReactor { |
| 47 | 47 | String content = replaceFileContent(file, groupIdNew, artifactIdNew, packageNameNew, titleNew); |
| 48 | 48 | writeFile(file, content, projectBaseDir, projectBaseDirNew, packageNameNew, artifactIdNew); |
| 49 | 49 | }); |
| 50 | - long end = System.currentTimeMillis(); // TODO @seeker:直接减,不用增加变量 | |
| 51 | - log.info("[main][重写完成]共耗时:" + (end - start) / 1000 + "秒"); // TODO @seeker:logger 不要拼接字符串,用占位符 | |
| 50 | + log.info("[main][重写完成]共耗时:{} 秒", (System.currentTimeMillis() - start) / 1000); | |
| 52 | 51 | } |
| 53 | 52 | |
| 54 | 53 | private static String getProjectBaseDir() { |
| 55 | - return StrUtil.subBefore(new File(ProjectReactor.class.getClassLoader().getResource(File.separator).getFile()).getPath(), "\\yudao-server", false); | |
| 54 | + return StrUtil.subBefore(new File(ProjectReactor.class.getClassLoader().getResource(File.separator).getFile()).getPath(), File.separator + "yudao-server", false); | |
| 56 | 55 | } |
| 57 | 56 | |
| 58 | 57 | private static Collection<File> listFiles(String projectBaseDir) { |
| 59 | 58 | Collection<File> files = FileUtils.listFiles(new File(projectBaseDir), null, true); |
| 60 | 59 | // 移除 IDEA Git GitHub 自身的文件; Node 编译出来的文件 |
| 61 | 60 | files = files.stream() |
| 62 | - .filter(file -> !file.getPath().contains("\\target\\") // TODO @seeker:使用 File.separator,也要考虑 mac | |
| 63 | - && !file.getPath().contains("\\node_modules\\") | |
| 64 | - && !file.getPath().contains("\\.idea\\") | |
| 65 | - && !file.getPath().contains("\\.git\\") | |
| 66 | - && !file.getPath().contains("\\.github\\") | |
| 67 | - && !file.getPath().contains("\\dist\\") | |
| 61 | + .filter(file -> !file.getPath().contains(File.separator + "target" + File.separator) | |
| 62 | + && !file.getPath().contains(File.separator + "node_modules" + File.separator) | |
| 63 | + && !file.getPath().contains(File.separator + ".idea" + File.separator) | |
| 64 | + && !file.getPath().contains(File.separator + ".git" + File.separator) | |
| 65 | + && !file.getPath().contains(File.separator + ".github" + File.separator) | |
| 66 | + && !file.getPath().contains(File.separator + "dist" + File.separator) | |
| 68 | 67 | && !file.getPath().contains(".iml") |
| 69 | 68 | && !file.getPath().contains(".html.gz")) |
| 70 | 69 | .collect(Collectors.toList()); | ... | ... |