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

Allow running offline without specified version #166

Merged
merged 4 commits into from
May 13, 2020
Merged

Allow running offline without specified version #166

merged 4 commits into from
May 13, 2020

Conversation

vknabel
Copy link
Contributor

@vknabel vknabel commented Mar 20, 2020

When the version cannot be resolved while being offline, this PR will try to find locally installed versions. It will try to use the latest version.
This fixes #164

@yonaskolb
Copy link
Owner

Could you please rebase off master @vknabel. That should fix the tests.

Not sure if you want to integrate some of the work that was just done in #170, about access the local packages via the Cache. I haven't investigated closely if it will help your code, but it should

@vknabel
Copy link
Contributor Author

vknabel commented Apr 18, 2020

@yonaskolb yes of course!

I replaced the path logic to determine currently installed versions with the cache of #170, but I am not sure if this part is fine.

Comment on lines 176 to 185
let metadata = try readMetadata()
let linkedExecutables = getLinkedExecutables()
let cache = try Cache(path: packagesPath, metadata: metadata, linkedExecutables: linkedExecutables)

guard let installedVersions = cache.packages
.first(where: { $0.gitRepo == package.repo })?
.versionDirs.map({ $0.version }),
let fallbackVersion = installedVersions.first else {
throw MintError.repoNotFound(package.gitPath)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now this logic relies on the changes of #170. Is it fine to instantiate the Cache in here?

It’s more likely to be the latest version
@yonaskolb
Copy link
Owner

@vknabel could you add a changelog entry as well

@vknabel
Copy link
Contributor Author

vknabel commented May 13, 2020

@yonaskolb oh yes, of course!

@yonaskolb yonaskolb merged commit 31e3984 into yonaskolb:master May 13, 2020
@vburojevic
Copy link

This doesn't seem to work in the latest version. If I run it locally the command fails @vknabel @yonaskolb.

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.

How do I min run an installed package offline?
4 participants