UploadFiles is used by Push to push the user-generated files to the hosting provider
()
| 272 | |
| 273 | // UploadFiles is used by Push to push the user-generated files to the hosting provider |
| 274 | func (p *Provider) UploadFiles() error { |
| 275 | _ = os.RemoveAll(p.getDownloadDir()) |
| 276 | _ = os.Mkdir(p.getDownloadDir(), 0755) |
| 277 | |
| 278 | if p.FilesPushCommand.Command == "" { |
| 279 | util.Warning("No files_push_command provided, so skipping files push") |
| 280 | return nil |
| 281 | } |
| 282 | |
| 283 | s := p.FilesPushCommand.Service |
| 284 | if s == "" { |
| 285 | s = "web" |
| 286 | } |
| 287 | err := p.app.ExecOnHostOrService(s, p.injectedEnvironment()+"; "+p.FilesPushCommand.Command) |
| 288 | if err != nil { |
| 289 | return fmt.Errorf("failed to exec %s on %s: %v", p.FilesPushCommand.Command, s, err) |
| 290 | } |
| 291 | return nil |
| 292 | } |
| 293 | |
| 294 | // prepDownloadDir ensures the download cache directories are created and writeable. |
| 295 | func (p *Provider) prepDownloadDir() { |
no test coverage detected