<commit_before>package mavendeploy

import (
	"encoding/pem"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
)

// GpgCmd wraps the GnuPG command line util to create a temporary keychain for
type GpgCmd struct {
	GPG GPG

	tempDir     string
	PublicRing  string
	SecretRing  string
	SecretKeyID string
}

func (g *GpgCmd) Setup() error {
	tmpdir, err := ioutil.TempDir("", "drone-mvn-keydir")
	if err != nil {
		return err
	}
	g.tempDir = tmpdir
	g.SecretRing = filepath.Join(tmpdir, "secret.gpg")
	g.PublicRing = filepath.Join(tmpdir, "public.gpg")
	err = g.importKeys()
	if err != nil {
		return err
	}

	return nil<commit_msg>Always teardown after if key import fails<commit_after>package mavendeploy

import (
	"encoding/pem"
	"fmt"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
)

// GpgCmd wraps the GnuPG command line util to create a temporary keychain for
type GpgCmd struct {
	GPG GPG

	tempDir     string
	PublicRing  string
	SecretRing  string
	SecretKeyID string
}

func (g *GpgCmd) Setup() error {
	tmpdir, err := ioutil.TempDir("", "drone-mvn-keydir")
	if err != nil {
		return err
	}
	g.tempDir = tmpdir
	g.SecretRing = filepath.Join(tmpdir, "secret.gpg")
	g.PublicRing = filepath.Join(tmpdir, "public.gpg")
	err = g.importKeys()
	if err != nil {
		g.Teardown()
		return err
	}
	return nil
{'fraction_non_alphanumeric': 0.12074074074074075, 'fraction_numerical': 0.0, 'mean_word_length': 3.6909722222222223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6229677', 'n_tokens_mistral': 560, 'n_tokens_neox': 540, 'n_words': 142}