-
Notifications
You must be signed in to change notification settings - Fork 5
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
Push command #256
Push command #256
Conversation
This reverts commit 828d1b0.
# Conflicts: # pkg/content/content.go # pkg/content_manager.go # pkg/package_manager.go
pkg/content_manager.go
Outdated
opts.PID = fmt.Sprintf("aemc:content-download:%s-SNAPSHOT", timex.FileTimestampForNow()) | ||
func (cm *ContentManager) Download(localFile string, packageOpts PackageCreateOpts) error { | ||
if packageOpts.PID == "" { | ||
packageOpts.PID = fmt.Sprintf("aemc:content-pull:%s-SNAPSHOT", timex.FileTimestampForNow()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method has a 'download' in its name so package name was accurate; if this should be dynamic then maybe put something (pkg kind or sth) inside PackageCreateOpts
pkg/package_manager.go
Outdated
@@ -204,6 +204,35 @@ func (pm *PackageManager) Create(opts PackageCreateOpts) (string, error) { | |||
return "", err | |||
} | |||
} | |||
if opts.PushContent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm this is rather internal indicator right?
pkg/package_manager.go
Outdated
@@ -268,6 +293,9 @@ func (pm *PackageManager) Copy(remotePath string, destInstance *Instance) error | |||
} | |||
|
|||
func (pm *PackageManager) tmpDir() string { | |||
if !pm.instance.manager.aem.config.TemplateFileExists() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
give this expression a name config.TemplateFileExists()
func (a *AEM) Detached() bool {
return !a.config.TemplateFileExists()
}
pkg/content/zipper.go
Outdated
"path/filepath" | ||
) | ||
|
||
func Archive(sourcePath, targetFile string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zipper should Zip()
:) use single naming consequently; update errors/log messages accordingly
pkg/content_manager.go
Outdated
"path/filepath" | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
const ( | ||
NamespacePattern = "^_([a-z]+)_" | ||
NamespacePattern = "_([a-z]+)_" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you changing it again and again? :)
@@ -36,14 +37,17 @@ func (cm *ContentManager) pkgMgr() *PackageManager { | |||
} | |||
|
|||
func (cm *ContentManager) tmpDir() string { | |||
if cm.instance.manager.aem.Detached() { | |||
return os.TempDir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
pkg/content/zipper.go
Outdated
@@ -0,0 +1,133 @@ | |||
package content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to explain why extra zipper/archiver is needed here and why mholt cannot be used here.
pkg/content/zipper.go
Outdated
return nil | ||
} | ||
|
||
func compress(src string, dest string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zip
?
pkg/content/zipper.go
Outdated
return err | ||
} | ||
|
||
func extract(src string, dest string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unzip
?
pkg/package_manager.go
Outdated
@@ -204,7 +200,29 @@ func (pm *PackageManager) Create(opts PackageCreateOpts) (string, error) { | |||
return "", err | |||
} | |||
} | |||
if err = filex.Archive(tmpDir, tmpFile); err != nil { | |||
if opts.ContentPath != "" { | |||
contentPath := opts.ContentPath |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
203-224 block should be an extracted method with the name explaining what is done here
# Conflicts: # pkg/content_manager.go
# Conflicts: # pkg/content/content.go
No description provided.