diff --git a/cmd/aem/content.go b/cmd/aem/content.go index 252f47c..ca30329 100644 --- a/cmd/aem/content.go +++ b/cmd/aem/content.go @@ -17,7 +17,6 @@ func (c *CLI) contentCmd() *cobra.Command { } cmd.AddCommand(c.contentCleanCmd()) cmd.AddCommand(c.contentPullCmd()) - cmd.AddCommand(c.contentPushCmd()) cmd.AddCommand(c.contentDownloadCmd()) cmd.AddCommand(c.contentCopyCmd()) return cmd @@ -157,50 +156,6 @@ func (c *CLI) contentPullCmd() *cobra.Command { return cmd } -func (c *CLI) contentPushCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "push", - Aliases: []string{"ps"}, - Short: "Push content from JCR root directory or local file to running instance", - Run: func(cmd *cobra.Command, args []string) { - instance, err := c.aem.InstanceManager().One() - if err != nil { - c.Error(err) - return - } - dir, err := determineContentDir(cmd) - if err != nil { - c.Error(err) - return - } - file, err := determineContentFile(cmd) - if err != nil { - c.Error(err) - return - } - if err = instance.ContentManager().Push(pkg.PackageCreateOpts{ - PushContent: true, - ContentDir: dir, - ContentFile: file, - }); err != nil { - c.Error(err) - return - } - if dir != "" { - c.SetOutput("dir", dir) - } else if file != "" { - c.SetOutput("file", file) - } - c.Changed("content pushed") - }, - } - cmd.Flags().StringP("dir", "d", "", "JCR root path") - cmd.Flags().StringP("file", "f", "", "Local file path") - cmd.Flags().StringP("path", "p", "", "JCR root path or local file path") - cmd.MarkFlagsOneRequired("dir", "file", "path") - return cmd -} - func (c *CLI) contentCopyCmd() *cobra.Command { cmd := &cobra.Command{ Use: "copy", diff --git a/pkg/content_manager.go b/pkg/content_manager.go index 4051a78..b42bcb6 100644 --- a/pkg/content_manager.go +++ b/pkg/content_manager.go @@ -141,20 +141,6 @@ func determineCleanFile(file string) string { return file } -func (cm *ContentManager) Push(packageOpts PackageCreateOpts) error { - remotePath, err := cm.pkgMgr().Create(packageOpts) - if err != nil { - return err - } - defer func() { - _ = cm.pkgMgr().Delete(remotePath) - }() - if err = cm.pkgMgr().Install(remotePath); err != nil { - return err - } - return nil -} - func (cm *ContentManager) Copy(destInstance *Instance, clean bool, pkgOpts PackageCreateOpts) error { var pkgFile = pathx.RandomFileName(cm.tmpDir(), "content_copy", ".zip") defer func() { _ = pathx.DeleteIfExists(pkgFile) }() diff --git a/pkg/package_manager.go b/pkg/package_manager.go index 774e3bb..9c6ab0d 100644 --- a/pkg/package_manager.go +++ b/pkg/package_manager.go @@ -170,7 +170,6 @@ type PackageCreateOpts struct { PID string FilterRoots []string FilterFile string - PushContent bool ContentDir string ContentFile string } @@ -206,36 +205,6 @@ func (pm *PackageManager) Create(opts PackageCreateOpts) (string, error) { return "", err } } - if len(opts.FilterRoots) == 0 && opts.FilterFile == "" && opts.PushContent { - if opts.ContentDir != "" { - _, after, _ := strings.Cut(opts.ContentDir, content.JCRRoot) - if err = pathx.Ensure(filepath.Join(tmpDir, content.JCRRoot, after)); err != nil { - return "", err - } - if err = filex.CopyDir(opts.ContentDir, filepath.Join(tmpDir, content.JCRRoot, after)); err != nil { - return "", err - } - } else if opts.ContentFile != "" { - dir := filepath.Dir(opts.ContentFile) - _, after, _ := strings.Cut(dir, content.JCRRoot) - if err = pathx.Ensure(filepath.Join(tmpDir, content.JCRRoot, after)); err != nil { - return "", err - } - _, after, _ = strings.Cut(opts.ContentFile, content.JCRRoot) - if err = filex.Copy(opts.ContentFile, filepath.Join(tmpDir, content.JCRRoot, after), true); err != nil { - return "", err - } - if strings.HasSuffix(opts.ContentFile, content.JCRContentFile) { - dir = strings.ReplaceAll(opts.ContentFile, content.JCRContentNode, content.JCRContentDirName) - _, after, _ = strings.Cut(dir, content.JCRRoot) - if pathx.Exists(dir) { - if err = filex.CopyDir(dir, filepath.Join(tmpDir, content.JCRRoot, after)); err != nil { - return "", err - } - } - } - } - } if err = filex.Archive(tmpDir, tmpFile); err != nil { return "", err }