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

Tool specs and fetch/install/pin refactoring #234

Merged
merged 14 commits into from
Jan 17, 2019

Conversation

mikrostew
Copy link
Contributor

@mikrostew mikrostew commented Jan 10, 2019

I was planning to only do #173, but some of that was also tangled up with #174, so I combined both into this PR.

Notes

First thing I implemented was tool::ToolSpec, to encapsulate a tool (Node/Yarn/Npm/Npx/Package) and a VersionSpec. This makes it easy to use for fetch/install/pin, which I abstracted to general-purpose functions instead of having things like install_node and install_yarn and install_xxx. That in turn made the command implementation simpler, since they no longer have to parse out the tool and figure out which function to call.

I also initially implemented a tool::Tool enum (like in #173), but didn't need it for anything so I took it back out.

I didn't move the shim code into tool::ToolSpec as mentioned in #173. It didn't seem to fit at this point, but that may need to be part of #175.

Bonus

Fixed a bug in notion-core/src/toolchain/mod.rs where the platform file had been changed to using JSON (in #220), but saving an empty platform instance would result in [platform] being written to the file.

Closes #173
Closes #174
Closes #87

@mikrostew mikrostew changed the title [WIP] Tool specs and fetch/install/pin refactoring Tool specs and fetch/install/pin refactoring Jan 10, 2019
Copy link
Contributor

@charlespierce charlespierce left a comment

Choose a reason for hiding this comment

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

Looks great! So much tool-specific code deleted!

Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

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

Awesome work! I have a few questions about some of the type structure. It might help to chat about some of them -- ping me on discord whenever.

crates/notion-core/src/distro/mod.rs Show resolved Hide resolved
crates/notion-core/src/distro/mod.rs Outdated Show resolved Hide resolved
crates/notion-core/src/inventory/mod.rs Show resolved Hide resolved
crates/notion-core/src/project.rs Outdated Show resolved Hide resolved
crates/notion-core/src/session.rs Outdated Show resolved Hide resolved
crates/notion-core/src/tool/mod.rs Outdated Show resolved Hide resolved
@dherman
Copy link
Collaborator

dherman commented Jan 15, 2019

@mikrostew and I spent some time thinking about how to make it more static and it was nonobvious enough that I think it's better to go with the enum for now and file a code quality issue for making it more static later.

Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

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

Looks great!

crates/notion-core/src/inventory/mod.rs Show resolved Hide resolved
@dherman dherman merged commit 72968e5 into volta-cli:master Jan 17, 2019
@mikrostew mikrostew deleted the tool-specs branch January 18, 2019 16:57
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.

3 participants