Skip to content

Commit

Permalink
Remove YAML files from export.zip
Browse files Browse the repository at this point in the history
  • Loading branch information
benpate committed Sep 24, 2024
1 parent eedbf35 commit a1a17b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 43 deletions.
39 changes: 0 additions & 39 deletions build/step_Export.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package build
import (
"archive/zip"
"io"
"log"
"os"

"github.com/benpate/derp"
)
Expand Down Expand Up @@ -51,40 +49,3 @@ func (step StepExport) Get(builder Builder, buffer io.Writer) PipelineBehavior {
func (step StepExport) Post(builder Builder, _ io.Writer) PipelineBehavior {
return Continue()
}

func (step StepExport) test() {

// Create a buffer to write our archive to.
buf, err := os.OpenFile("./test-example.zip", os.O_WRONLY|os.O_CREATE, 0644)

if err != nil {
log.Fatal(err)
}

// Create a new zip archive.
w := zip.NewWriter(buf)

// Add some files to the archive.
var files = []struct {
Name, Body string
}{
{"readme.txt", "This archive contains some text files."},
{"gopher.txt", "Gopher names:\nGeorge\nGeoffrey\nGonzo"},
{"todo.txt", "Get animal handling licence.\nWrite more examples."},
}
for _, file := range files {
f, err := w.Create(file.Name)
if err != nil {
log.Fatal(err)
}
_, err = f.Write([]byte(file.Body))
if err != nil {
log.Fatal(err)
}
}

// Make sure to check the error on Close.
if err := w.Close(); err != nil {
log.Fatal(err)
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ require (
golang.org/x/crypto v0.27.0
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
golang.org/x/oauth2 v0.22.0
gopkg.in/yaml.v3 v3.0.1
willnorris.com/go/microformats v1.2.0
willnorris.com/go/webmention v0.0.0-20220108183051-4a23794272f0
)
Expand Down Expand Up @@ -123,5 +124,4 @@ require (
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
5 changes: 2 additions & 3 deletions service/stream_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/EmissarySocial/emissary/tools/counter"
"github.com/benpate/derp"
"github.com/benpate/rosetta/list"
"gopkg.in/yaml.v3"
)

func (service *Stream) ExportZip(writer *zip.Writer, stream *model.Stream, prefix string, depth int, withAttachments bool) error {
Expand Down Expand Up @@ -52,7 +51,7 @@ func (service *Stream) ExportZip(writer *zip.Writer, stream *model.Stream, prefi
}
}

// EXPORT A YAML FILE
/* EXPORT A YAML FILE
{
filenameJSON := filename.PushTail("yaml")
Expand All @@ -74,7 +73,7 @@ func (service *Stream) ExportZip(writer *zip.Writer, stream *model.Stream, prefi
if _, err := fileWriter.Write(streamYAML); err != nil {
return derp.Wrap(err, location, "Error writing YAML file")
}
}
}*/

// Export attachments, if requested
if withAttachments {
Expand Down

0 comments on commit a1a17b4

Please sign in to comment.