Skip to content

feat: project-local rocktrees#64

Merged
vhyrro merged 7 commits intomasterfrom
push-tsxzyvpzrorv
Sep 14, 2024
Merged

feat: project-local rocktrees#64
vhyrro merged 7 commits intomasterfrom
push-tsxzyvpzrorv

Conversation

@vhyrro
Copy link
Member

@vhyrro vhyrro commented Sep 14, 2024

This is a draft implementation of project-local rock trees. If rocks detects it's in a project, it will always interact with the project-local rock tree first. Pass --no-project to prevent these interactions.

Base automatically changed from push-knvxwztywson to master September 14, 2024 11:31
@vhyrro
Copy link
Member Author

vhyrro commented Sep 14, 2024

Some of this code is not really clean, I'll be honest. The next step will be to finish off the project functionality (with even more hacky code), write tests for everything and then start aggressively refactoring :)

let lua_version = LuaVersion::try_from(&rockspec)?;
// TODO(vhyrro): Create a unified way of accessing the Lua version with centralized error
// handling.
let lua_version = config.lua_version.clone().or(rockspec.lua_version()).ok_or_eyre("lua version not set! Please provide a version through `--lua-version <ver>`")?;
Copy link
Member

Choose a reason for hiding this comment

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

question: what if the rockspec's lua version is incompatible with the config's lua version?
Would it be better if the rockspec took precedence here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think conflicts should result in an error. If a user explicitly requires Lua 5.1, but their project is in conflict, then allowing it could only cause problems down the line (think about executing in scripts, for example, where a user downloads a 5.1 package only to find out it has ended up in 5.3 instead). Supplying a Lua version is an explicit action, so we're doing the user a favour by letting them know about conflicts.

Copy link
Member

Choose a reason for hiding this comment

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

right, I was thinking of how luarocks lets you specify the default lua version in a global config file.

Copy link
Member Author

Choose a reason for hiding this comment

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

In the case of a global config then these shouldn't clash, you're right. I've been considering calling the future config value preferred_lua_version for this reason :)

@vhyrro vhyrro marked this pull request as ready for review September 14, 2024 19:52
@vhyrro
Copy link
Member Author

vhyrro commented Sep 14, 2024

Okay I think everything is done for this PR.

@vhyrro vhyrro merged commit 2954a27 into master Sep 14, 2024
@mrcjkb mrcjkb deleted the push-tsxzyvpzrorv branch October 9, 2024 06:55
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