Skip to content

Commit

Permalink
Merge 47bc25a into 4e6e5b4
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Jun 23, 2018
2 parents 4e6e5b4 + 47bc25a commit aca17a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
3 changes: 0 additions & 3 deletions common/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ const (

// Stream is a constant used in HTTP GET query strings
Stream = "stream"

// DaemonProjectPath is the path the daemon uses for the deployed project
DaemonProjectPath = "/app/host/project"
)

// UpRequest is the configurable body of a UP request to the daemon.
Expand Down
24 changes: 21 additions & 3 deletions deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"path"
"path/filepath"
"strings"

"github.com/ubclaunchpad/inertia/common"
Expand Down Expand Up @@ -84,6 +85,7 @@ Run 'inertia [REMOTE] init' to gather this information.`,
cmd.AddCommand(ssh)

send := deepCopy(cmdDeploymentSendFile)
send.Flags().StringP("dest", "d", "", "Path relative from project root to send file to")
send.Flags().StringP("permissions", "p", "0655", "Permissions settings for file")
cmd.AddCommand(send)

Expand Down Expand Up @@ -372,8 +374,24 @@ deployment. Provide a relative path to your file.`,
log.Fatal(err.Error())
}

// Destination path
remotePath := path.Join(common.DaemonProjectPath, args[0])
// Get flag for destination
dest, err := cmd.Flags().GetString("dest")
if err != nil {
log.Fatal(err.Error())
}
if dest != "" {
// If path is defined, dest = [path]/[filename], with the user-provided
// path to the source file stripped out
dest = path.Join(dest, filepath.Base(args[0]))
} else {
// Otherwise, dest = [filepath], where [filepath] is what the user
// provided to the command
dest = args[0]
}

// Destination path - todo: allow config
projectPath := "/app/host/inertia/project"
remotePath := path.Join(projectPath, dest)

// Initiate copy
session := client.NewSSHRunner(deployment.RemoteVPS)
Expand All @@ -382,7 +400,7 @@ deployment. Provide a relative path to your file.`,
log.Fatal(err.Error())
}

fmt.Println("File", args[0], "has been copied to", common.DaemonProjectPath, "on remote", remoteName)
fmt.Println("File", args[0], "has been copied to", remotePath, "on remote", remoteName)
},
}

Expand Down

0 comments on commit aca17a3

Please sign in to comment.