Skip to content

Commit

Permalink
fix resource path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarroll committed Oct 25, 2016
1 parent b971cc1 commit 5067dbd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
18 changes: 9 additions & 9 deletions aura.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var cmdAura = &Command{
Usage: "aura",
Short: "force aura push -resourcepath=<filepath>",
Short: "force aura push -f <filepath>",
Long: `
The aura command needs context to work. If you execute "aura get"
it will create a folder structure that provides the context for
Expand Down Expand Up @@ -53,8 +53,8 @@ var cmdAura = &Command{

func init() {
cmdAura.Run = runAura
cmdAura.Flag.Var(&resourcepath, "p", "fully qualified file name for entity")
cmdAura.Flag.Var(&resourcepath, "f", "fully qualified file name for entity")
cmdAura.Flag.Var(&resourcepaths, "p", "fully qualified file name for entity")
cmdAura.Flag.Var(&resourcepaths, "f", "fully qualified file name for entity")
cmdAura.Flag.StringVar(&metadataType, "entitytype", "", "fully qualified file name for entity")
cmdAura.Flag.StringVar(&auraentityname, "entityname", "", "fully qualified file name for entity")
cmdAura.Flag.StringVar(&metadataType, "t", "", "fully qualified file name for entity")
Expand Down Expand Up @@ -107,14 +107,14 @@ func runAura(cmd *Command, args []string) {
fmt.Println(bundle["DeveloperName"])
}
case "push":
// absPath, _ := filepath.Abs(resourcepath[0])
runPushAura(cmd, resourcepath)
// absPath, _ := filepath.Abs(resourcepaths[0])
runPushAura(cmd, resourcepaths)
}
}

func runDeleteAura() {
absPath, _ := filepath.Abs(resourcepath[0])
//resourcepath = absPath
absPath, _ := filepath.Abs(resourcepaths[0])
//resourcepaths = absPath

if InAuraBundlesFolder(absPath) {
info, err := os.Stat(absPath)
Expand Down Expand Up @@ -189,8 +189,8 @@ func deleteAuraDefinitionBundle(manifest BundleManifest) {
if err != nil {
ErrorAndExit(err.Error())
}
os.Remove(filepath.Join(resourcepath[0], ".manifest"))
os.Remove(resourcepath[0])
os.Remove(filepath.Join(resourcepaths[0], ".manifest"))
os.Remove(resourcepaths[0])
}

func deleteAuraDefinition(manifest BundleManifest, key int) {
Expand Down
9 changes: 1 addition & 8 deletions fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,7 @@ func persistBundles(bundles AuraDefinitionBundleResult, definitions AuraDefiniti

var defRecords = definitions.Records
root, err := GetSourceDir()
if mdbase == "aura" {
root = filepath.Join(targetDirectory, root, "aura")
} else {
root = filepath.Join(targetDirectory, root, mdbase, "aura")
}
if err := os.MkdirAll(root, 0755); err != nil {
ErrorAndExit(err.Error())
}
root = filepath.Join(root, "aura")

for key, value := range bundleMap {
if err := os.MkdirAll(filepath.Join(root, value), 0755); err != nil {
Expand Down
3 changes: 1 addition & 2 deletions push.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ Deployment Options
var (
namePaths = make(map[string]string)
byName = false
resourcepaths string
metaName string
resourcepaths metaName
metaFolder string
)

Expand Down
10 changes: 5 additions & 5 deletions pushAura.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var cmdPushAura = &Command{

func init() {
cmdPushAura.Run = runPushAura
cmdPushAura.Flag.Var(&resourcepath, "f", "fully qualified file name for entity")
cmdPushAura.Flag.Var(&resourcepaths, "f", "fully qualified file name for entity")
cmdPushAura.Flag.StringVar(&metadataType, "t", "", "Type of entity or bundle to create")
cmdPushAura.Flag.StringVar(&metadataType, "type", "", "Type of entity or bundle to create")
}
Expand All @@ -31,11 +31,11 @@ func runPushAura(cmd *Command, args []string) {
// For some reason, when called from sublime, the quotes are included
// in the resourcepath argument. Quoting is needed if you have blank spaces
// in the path name. So need to strip them out.
if strings.Contains(resourcepath[0], "\"") || strings.Contains(resourcepath[0], "'") {
resourcepath[0] = strings.Replace(resourcepath[0], "\"", "", -1)
resourcepath[0] = strings.Replace(resourcepath[0], "'", "", -1)
if strings.Contains(resourcepaths[0], "\"") || strings.Contains(resourcepaths[0], "'") {
resourcepaths[0] = strings.Replace(resourcepaths[0], "\"", "", -1)
resourcepaths[0] = strings.Replace(resourcepaths[0], "'", "", -1)
}
absPath, _ := filepath.Abs(resourcepath[0])
absPath, _ := filepath.Abs(resourcepaths[0])
if _, err := os.Stat(absPath); os.IsNotExist(err) {
fmt.Println(err.Error())
ErrorAndExit("File does not exist\n" + absPath)
Expand Down

0 comments on commit 5067dbd

Please sign in to comment.