This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app/scriptpack: scriptpack-rebuild command
- Loading branch information
Showing
3 changed files
with
105 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"io/ioutil" | ||
"os" | ||
"path/filepath" | ||
|
||
sp "{{ working_gopath }}" | ||
) | ||
|
||
func main() { | ||
// Logs don't matter for this since it should always work. If it | ||
// doesn't, it will show up in the error output. | ||
log.SetOutput(ioutil.Discard) | ||
path := filepath.Join("{{ path.working }}", "_staging") | ||
if err := os.RemoveAll(path); err !=nil { | ||
fmt.Fprintf(os.Stderr, err.Error()+"\n") | ||
os.Exit(1) | ||
} | ||
|
||
if err := os.MkdirAll(path, 0755); err != nil { | ||
fmt.Fprintf(os.Stderr, err.Error()+"\n") | ||
os.Exit(1) | ||
} | ||
|
||
if err := sp.ScriptPack.Write(path); err !=nil { | ||
fmt.Fprintf(os.Stderr, err.Error()+"\n") | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters