Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to pass cli settings to frameworks - just the temp path #417

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions framework/ccm_pyactr/ccm_pyactr.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/asmaloney/gactar/actr"
"github.com/asmaloney/gactar/framework"

"github.com/asmaloney/gactar/util/cli"
"github.com/asmaloney/gactar/util/executil"
"github.com/asmaloney/gactar/util/filesystem"
"github.com/asmaloney/gactar/util/issues"
Expand Down Expand Up @@ -51,9 +50,9 @@ type CCMPyACTR struct {
className string
}

// New simply creates a new CCMPyACTR instance and sets the tmp path.
func New(settings *cli.Settings) (c *CCMPyACTR, err error) {
c = &CCMPyACTR{tmpPath: settings.TempPath}
// New creates a new CCMPyACTR instance and sets the temp path.
func New(tempPath string) (c *CCMPyACTR, err error) {
c = &CCMPyACTR{tmpPath: tempPath}

err = framework.Setup(&Info)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion framework/ccm_pyactr/ccm_pyactr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestCodeGeneration(t *testing.T) {
t.Fatal(err)
}

fw, err := New(ctx)
fw, err := New(ctx.TempPath)

if fw == nil {
fmt.Println(err.Error())
Expand Down
7 changes: 3 additions & 4 deletions framework/pyactr/pyactr.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/asmaloney/gactar/actr"
"github.com/asmaloney/gactar/framework"

"github.com/asmaloney/gactar/util/cli"
"github.com/asmaloney/gactar/util/executil"
"github.com/asmaloney/gactar/util/filesystem"
"github.com/asmaloney/gactar/util/issues"
Expand Down Expand Up @@ -48,9 +47,9 @@ type PyACTR struct {
className string
}

// New simply creates a new PyACTR instance and sets the tmp path from the context.
func New(settings *cli.Settings) (p *PyACTR, err error) {
p = &PyACTR{tmpPath: settings.TempPath}
// New creates a new PyACTR instance and sets the temp path.
func New(tempPath string) (p *PyACTR, err error) {
p = &PyACTR{tmpPath: tempPath}

err = framework.Setup(&Info)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion framework/pyactr/pyactr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestCodeGeneration(t *testing.T) {
t.Fatal(err)
}

fw, err := New(ctx)
fw, err := New(ctx.TempPath)

if fw == nil {
fmt.Println(err.Error())
Expand Down
7 changes: 3 additions & 4 deletions framework/vanilla_actr/vanilla_actr.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/asmaloney/gactar/actr"
"github.com/asmaloney/gactar/framework"

"github.com/asmaloney/gactar/util/cli"
"github.com/asmaloney/gactar/util/executil"
"github.com/asmaloney/gactar/util/filesystem"
"github.com/asmaloney/gactar/util/issues"
Expand Down Expand Up @@ -65,10 +64,10 @@ type VanillaACTR struct {
printStatementCount int
}

// New simply creates a new VanillaACTR instance and sets some paths from the context.
func New(settings *cli.Settings) (v *VanillaACTR, err error) {
// New creates a new VanillaACTR instance and sets some paths.
func New(tempPath string) (v *VanillaACTR, err error) {
v = &VanillaACTR{
tmpPath: settings.TempPath,
tmpPath: tempPath,
envPath: os.Getenv("VIRTUAL_ENV"),
}

Expand Down
2 changes: 1 addition & 1 deletion framework/vanilla_actr/vanilla_actr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestCodeGeneration(t *testing.T) {
t.Fatal(err)
}

fw, err := New(ctx)
fw, err := New(ctx.TempPath)
if fw == nil {
fmt.Println(err.Error())
t.Skip("vanilla framework not active")
Expand Down
6 changes: 3 additions & 3 deletions util/frameworkutil/frameworkutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func CreateFrameworks(settings *cli.Settings, names []string) (list framework.Li

switch f {
case "ccm":
fw, err = ccm_pyactr.New(settings)
fw, err = ccm_pyactr.New(settings.TempPath)

case "pyactr":
fw, err = pyactr.New(settings)
fw, err = pyactr.New(settings.TempPath)

case "vanilla":
fw, err = vanilla_actr.New(settings)
fw, err = vanilla_actr.New(settings.TempPath)

default:
chalk.PrintErrStr("unknown framework:", f)
Expand Down
Loading