Skip to content
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

Get rid of the workspace.Locate behavior and comms package #696

Merged
merged 12 commits into from
Aug 7, 2018

Conversation

kytrinyx
Copy link
Member

@kytrinyx kytrinyx commented Aug 5, 2018

This is big in the sense that it deletes a lot of code, but the core of the PR is three small simplifications:

Once all of those were simplified, we no longer used SolutionPath, IsSolutionPath, ResolveSolutionPath, or Locate, and could delete all of the functions and their associated tests. And the entire comms package!

This removes the behavior of adding a numeric suffix when downloading an exercise if the exercise already exists, which is the first step in fixing #661
The second step is to make the download command more robust so it doesn't clobber existing solution files: #697

Katrina Owen added 10 commits August 5, 2018 09:51
This no longer accepts just an exercise name. It mirrors the behavior of
the submit command where you pass the path to the exercise you want to
open in the browser.

In the future we can expand this to take --exercise, --track, and --team.
We determine the exact exercise directory based on the filepaths.
Since we have the directory, we don't need to do complicated guessing,
we can just load in the exercise metadata directly.
We were overloading the variable, which makes it confusing.
We're going to want to ensure that the directory exists.
For the moment, this directory is the same as the exercise directory,
but we're working towards putting this in a subdirectory to match
common industry conventions.
We've moved the idea of the exercise metadata path onto the Exercise type.
@kytrinyx kytrinyx changed the title Get rid of the workspace.Locate behavior Get rid of the workspace.Locate behavior and comms package Aug 5, 2018
cmd/download.go Outdated
return errors.New("need an --exercise name or a solution --uuid")
}

var slug string
var param string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is param supposed to represent an exercise iteration?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

param is the param to the URL that we're calling on the API. It's either the string latest, or an actual UUID.

cmd/download.go Outdated
return errors.New("need an --exercise name or a solution --uuid")
}

var slug string
var param string
if uuid == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yon can simplify this a bit

param := "latest"
if uuid != "" {
 param = uuid
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Yeah, that's much better. Updated.

Simplify a conditional.
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good to go.

@nywilken nywilken merged commit 1bb612f into master Aug 7, 2018
@nywilken nywilken deleted the rm-locate branch August 7, 2018 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants