Skip to content

Tool specs and fetch/install/pin refactoring - #234

Merged
dherman merged 14 commits into
volta-cli:masterfrom
mikrostew:tool-specs
Jan 17, 2019
Merged

Tool specs and fetch/install/pin refactoring#234
dherman merged 14 commits into
volta-cli:masterfrom
mikrostew:tool-specs

Conversation

@mikrostew

@mikrostew mikrostew commented Jan 10, 2019

Copy link
Copy Markdown
Contributor

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

Comment thread crates/notion-core/src/inventory/mod.rs Outdated
@mikrostew mikrostew changed the title [WIP] Tool specs and fetch/install/pin refactoring Tool specs and fetch/install/pin refactoring Jan 10, 2019

@charlespierce charlespierce left a comment

Copy link
Copy Markdown
Contributor

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!

@dherman dherman left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread crates/notion-core/src/distro/mod.rs
Comment thread crates/notion-core/src/distro/mod.rs Outdated
Comment thread crates/notion-core/src/inventory/mod.rs
Comment thread crates/notion-core/src/project.rs Outdated
Comment thread crates/notion-core/src/session.rs Outdated
Comment thread crates/notion-core/src/tool/mod.rs Outdated
@dherman

dherman commented Jan 15, 2019

Copy link
Copy Markdown
Collaborator

@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.

@dherman dherman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great!

Comment thread crates/notion-core/src/inventory/mod.rs
@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