diff --git a/.vscode/settings.json b/.vscode/settings.json index 4b81810..bda89df 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -32,6 +32,7 @@ "govet", "graffico", "ineffassign", + "interstella", "jibberjabber", "linters", "lintv", diff --git a/src/app/command/bootstrap.go b/src/app/command/bootstrap.go index 37e6dd6..b13f7f2 100644 --- a/src/app/command/bootstrap.go +++ b/src/app/command/bootstrap.go @@ -67,7 +67,7 @@ type Bootstrap struct { type ConfigureOptionsInfo struct { Detector LocaleDetector - Executor proxy.Executor + Program proxy.Executor Config ConfigInfo } @@ -81,7 +81,7 @@ func (b *Bootstrap) Root(options ...ConfigureOptionFn) *cobra.Command { b.optionsInfo = ConfigureOptionsInfo{ Detector: &Jabber{}, - Executor: &ProgramExecutor{ + Program: &ProgramExecutor{ Name: "magick", }, Config: ConfigInfo{ @@ -92,9 +92,9 @@ func (b *Bootstrap) Root(options ...ConfigureOptionFn) *cobra.Command { }, } - if _, err := b.optionsInfo.Executor.Look(); err != nil { - b.optionsInfo.Executor = &DummyExecutor{ - Name: b.optionsInfo.Executor.ProgName(), + if _, err := b.optionsInfo.Program.Look(); err != nil { + b.optionsInfo.Program = &DummyExecutor{ + Name: b.optionsInfo.Program.ProgName(), } } @@ -106,7 +106,7 @@ func (b *Bootstrap) Root(options ...ConfigureOptionFn) *cobra.Command { // JUST TEMPORARY: make the executor the dummy for safety // - b.optionsInfo.Executor = &DummyExecutor{ + b.optionsInfo.Program = &DummyExecutor{ Name: "magick", } @@ -129,7 +129,7 @@ func (b *Bootstrap) Root(options ...ConfigureOptionFn) *cobra.Command { // ---> execute root core // - return proxy.EnterRoot(inputs, b.optionsInfo.Executor, b.optionsInfo.Config.Viper) + return proxy.EnterRoot(inputs, b.optionsInfo.Program, b.optionsInfo.Config.Viper) }, }, ) diff --git a/src/app/command/bootstrap_test.go b/src/app/command/bootstrap_test.go index d2fd656..11793b6 100644 --- a/src/app/command/bootstrap_test.go +++ b/src/app/command/bootstrap_test.go @@ -60,7 +60,7 @@ var _ = Describe("Bootstrap", Ordered, func() { bootstrap := command.Bootstrap{} rootCmd := bootstrap.Root(func(co *command.ConfigureOptionsInfo) { co.Detector = &DetectorStub{} - co.Executor = &ExecutorStub{ + co.Program = &ExecutorStub{ Name: "magick", } co.Config.Name = helpers.PixaConfigTestFilename diff --git a/src/app/command/root-cmd_test.go b/src/app/command/root-cmd_test.go index c282d9c..5571951 100644 --- a/src/app/command/root-cmd_test.go +++ b/src/app/command/root-cmd_test.go @@ -44,7 +44,7 @@ var _ = Describe("RootCmd", Ordered, func() { Args: []string{"./"}, Root: bootstrap.Root(func(co *command.ConfigureOptionsInfo) { co.Detector = &DetectorStub{} - co.Executor = &ExecutorStub{ + co.Program = &ExecutorStub{ Name: "magick", } co.Config.Name = helpers.PixaConfigTestFilename diff --git a/src/app/command/shrink-cmd.go b/src/app/command/shrink-cmd.go index 3b07b9f..39ae0b6 100644 --- a/src/app/command/shrink-cmd.go +++ b/src/app/command/shrink-cmd.go @@ -124,7 +124,7 @@ func (b *Bootstrap) buildShrinkCommand(container *assistant.CobraContainer) *cob appErr = proxy.EnterShrink( inputs, - b.optionsInfo.Executor, + b.optionsInfo.Program, b.optionsInfo.Config.Viper, ) } else { diff --git a/src/app/command/shrink-cmd_test.go b/src/app/command/shrink-cmd_test.go index bb41f3f..7f4c541 100644 --- a/src/app/command/shrink-cmd_test.go +++ b/src/app/command/shrink-cmd_test.go @@ -41,7 +41,7 @@ func expectValidShrinkCmdInvocation(entry *shrinkTE) { Args: append(options, entry.args...), Root: bootstrap.Root(func(co *command.ConfigureOptionsInfo) { co.Detector = &DetectorStub{} - co.Executor = &ExecutorStub{ + co.Program = &ExecutorStub{ Name: helpers.ProgName, } co.Config.Name = helpers.PixaConfigTestFilename diff --git a/src/app/proxy/config_test.go b/src/app/proxy/config_test.go index 77a85a3..0038f71 100644 --- a/src/app/proxy/config_test.go +++ b/src/app/proxy/config_test.go @@ -34,7 +34,7 @@ func expectValidShrinkCmdInvocation(entry *configTE) { Args: append(options, entry.args...), Root: bootstrap.Root(func(co *command.ConfigureOptionsInfo) { co.Detector = &helpers.DetectorStub{} - co.Executor = &helpers.ExecutorStub{ + co.Program = &helpers.ExecutorStub{ Name: helpers.ProgName, } co.Config.Name = helpers.PixaConfigTestFilename diff --git a/src/app/proxy/runner-registry.go b/src/app/proxy/runner-registry.go index 68f68bd..ca74495 100644 --- a/src/app/proxy/runner-registry.go +++ b/src/app/proxy/runner-registry.go @@ -36,6 +36,7 @@ func NewRunnerRegistry(params *NewRunnerParams) *RunnerRegistry { shared: &SharedRunnerInfo{ Type: params.Type, Options: params.Options, + program: params.Program, }, }, } diff --git a/src/app/proxy/sampler-runner_test.go b/src/app/proxy/sampler-runner_test.go index 38f0baa..d0d8a93 100644 --- a/src/app/proxy/sampler-runner_test.go +++ b/src/app/proxy/sampler-runner_test.go @@ -18,11 +18,11 @@ import ( ) type runnerTE struct { - given string - should string - args []string - profile string - directory string + given string + should string + args []string + profile string + relative string } type samplerTE struct { @@ -35,7 +35,7 @@ var _ = Describe("SamplerRunner", Ordered, func() { repo string l10nPath string configPath string - scientist string + root string config configuration.ViperConfig nfs storage.VirtualFS ) @@ -50,8 +50,9 @@ var _ = Describe("SamplerRunner", Ordered, func() { configPath = filepath.Join(repo, "test", "data", "configuration") Expect(matchers.AsDirectory(configPath)).To(matchers.ExistInFS(nfs)) - scientist = helpers.Scientist() - Expect(matchers.AsDirectory(scientist)).To(matchers.ExistInFS(nfs)) + root = helpers.Scientist() + Expect(matchers.AsDirectory(root)).To(matchers.ExistInFS(nfs)) + }) BeforeEach(func() { @@ -88,8 +89,9 @@ var _ = Describe("SamplerRunner", Ordered, func() { DescribeTable("sampler", func(entry *samplerTE) { + directory := helpers.Path(root, entry.relative) options := []string{ - helpers.ShrinkCommandName, scientist, + helpers.ShrinkCommandName, directory, // "--sample-files", "3" // "--sample-folders", "3" "--dry-run", @@ -102,7 +104,7 @@ var _ = Describe("SamplerRunner", Ordered, func() { Args: append(options, entry.args...), Root: bootstrap.Root(func(co *command.ConfigureOptionsInfo) { co.Detector = &helpers.DetectorStub{} - co.Executor = &helpers.ExecutorStub{ + co.Program = &helpers.ExecutorStub{ Name: helpers.ProgName, } co.Config.Name = helpers.PixaConfigTestFilename @@ -121,12 +123,13 @@ var _ = Describe("SamplerRunner", Ordered, func() { ) }, - XEntry(nil, &samplerTE{ + FEntry(nil, &samplerTE{ runnerTE: runnerTE{ - given: "foo", - should: "bar", + given: "scheme", + should: "bar", + relative: "nasa/interstellar/Dark Energy Explorers/sessions/scan-01", args: []string{ - "--strip", "--interlace", "plane", "--quality", "85", "--cpu", + "--strip", "--interlace", "plane", "--quality", "85", }, }, }), diff --git a/test/data/storage/citizen-scientist-index.xml b/test/data/storage/citizen-scientist-index.xml index d6ca508..2810c48 100644 --- a/test/data/storage/citizen-scientist-index.xml +++ b/test/data/storage/citizen-scientist-index.xml @@ -124,7 +124,7 @@ - +