clone模版repo
()
| 130 | |
| 131 | // clone模版repo |
| 132 | func templatesClone() error { |
| 133 | templatePath := filepath.Join(config.SmartIdeHome, golbalModel.TMEPLATE_DIR_NAME) |
| 134 | templateGitPath := filepath.Join(templatePath, ".git") |
| 135 | templatesGitIsExist := common.IsExist(templateGitPath) |
| 136 | |
| 137 | // 通过判断.git目录存在,执行git pull,保持最新 |
| 138 | if templatesGitIsExist { |
| 139 | err := common.EXEC.Realtime(` |
| 140 | git checkout -- * |
| 141 | git pull |
| 142 | `, templatePath) |
| 143 | if err != nil { |
| 144 | return err |
| 145 | } |
| 146 | |
| 147 | } else { |
| 148 | err := os.RemoveAll(templatePath) |
| 149 | if err != nil { |
| 150 | return err |
| 151 | } |
| 152 | |
| 153 | command := fmt.Sprintf("git clone %v %v", config.GlobalSmartIdeConfig.TemplateActualRepoUrl, templatePath) |
| 154 | err = common.EXEC.Realtime(command, "") |
| 155 | if err != nil { |
| 156 | return err |
| 157 | } |
| 158 | |
| 159 | } |
| 160 | |
| 161 | return nil |
| 162 | } |
| 163 | |
| 164 | // 打印 service 列表 |
| 165 | func printTemplates(newType []templateModel.TemplateTypeInfo) { |
no test coverage detected