Skip to content

Commit

Permalink
Merge pull request #1610 from qri-io/transform-pkg
Browse files Browse the repository at this point in the history
refactor(transform): Create transform package, move startf into it
  • Loading branch information
b5 authored Jan 19, 2021
2 parents 6ede26b + 843e3d3 commit 1401638
Show file tree
Hide file tree
Showing 28 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/test_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/qri-io/qri/repo/gen"
reporef "github.com/qri-io/qri/repo/ref"
repotest "github.com/qri-io/qri/repo/test"
"github.com/qri-io/qri/startf"
"github.com/qri-io/qri/transform/startf"
"github.com/spf13/cobra"
)

Expand Down
3 changes: 2 additions & 1 deletion lib/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/qri-io/qri/fsi/linkfile"
"github.com/qri-io/qri/repo"
reporef "github.com/qri-io/qri/repo/ref"
"github.com/qri-io/qri/transform"
)

// DatasetMethods encapsulates business logic for working with Datasets on Qri
Expand Down Expand Up @@ -623,7 +624,7 @@ func (m *DatasetMethods) Save(p *SaveParams, res *dataset.Dataset) error {
loader := NewParseResolveLoadFunc("", m.inst.defaultResolver(), m.inst)

// apply the transform
err := base.TransformApply(ctx, ds, r, loader, str, scriptOut, secrets)
err := transform.Apply(ctx, ds, r, loader, str, scriptOut, secrets)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion lib/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/qri-io/dataset"
"github.com/qri-io/qri/base"
"github.com/qri-io/qri/dsref"
"github.com/qri-io/qri/transform"
)

// TransformMethods encapsulates business logic for transforms
Expand Down Expand Up @@ -88,7 +89,7 @@ func (m *TransformMethods) Apply(p *ApplyParams, res *ApplyResult) error {
loader := NewParseResolveLoadFunc("", m.inst.defaultResolver(), m.inst)

scriptOut := p.ScriptOutput
err = base.TransformApply(ctx, ds, r, loader, str, scriptOut, p.Secrets)
err = transform.Apply(ctx, ds, r, loader, str, scriptOut, p.Secrets)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions base/transform_apply.go → transform/apply.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package base
package transform

import (
"context"
Expand All @@ -10,13 +10,13 @@ import (
"github.com/qri-io/ioes"
"github.com/qri-io/qri/dsref"
"github.com/qri-io/qri/repo"
"github.com/qri-io/qri/startf"
"github.com/qri-io/qri/transform/startf"
)

// TODO(dustmop): Tests. Especially once the `apply` command exists.

// TransformApply applies the transform script to order to modify the changing dataset
func TransformApply(
// Apply applies the transform script to order to modify the changing dataset
func Apply(
ctx context.Context,
ds *dataset.Dataset,
r repo.Repo,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions startf/transform.go → transform/startf/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"github.com/qri-io/qfs"
"github.com/qri-io/qri/dsref"
"github.com/qri-io/qri/repo"
skyctx "github.com/qri-io/qri/startf/context"
skyds "github.com/qri-io/qri/startf/ds"
skyqri "github.com/qri-io/qri/startf/qri"
skyctx "github.com/qri-io/qri/transform/startf/context"
skyds "github.com/qri-io/qri/transform/startf/ds"
skyqri "github.com/qri-io/qri/transform/startf/qri"
"github.com/qri-io/qri/version"
"github.com/qri-io/starlib"
"go.starlark.net/resolve"
Expand Down
File renamed without changes.

0 comments on commit 1401638

Please sign in to comment.