haghish / github

a module for building, searching, installing, managing, and mining Stata packages from GitHub
http://haghish.github.io/github/
100 stars 41 forks source link

Fix package name/repo name mismatch errors #27

Closed simpar1471 closed 2 months ago

simpar1471 commented 10 months ago

The issue

The github install command was failing to download stable/release versions of packages where the package name and repository name were not the same.

Specifics

The command would download a zipped folder, which contains the repository source code in a folder named after the repository and suffixed with the version number in use. For example, the command

github install my_account/my_repo, package(my_pkg) version(X.Y.Z) 

would download a zipped folder called my_pkg-X.Y.Z.zip, within which you'd find a folder named my_repo-X.Y.Z. The command would unzip my_pkg-X.Y.Z.zip correctly, but would then try to move the working directory to my_pkg-X.Y.Z instead of my_repo-X.Y.Z. This would fail, causing the installation process to terminate.

The fix

To fix this, I changed the command to move working directory to my_repo-X.Y.Z, which didn't break installation of any packages I tried it with. It did, however, let me install specific versions of packages where the repo/package names are different.

haghish commented 2 months ago

Hi Simon,

This sounds all good, but I had different concerns when I programmed GitHub. The GitHub package is doing what is intended. In fact, it was intended that the package name and the repository name to be identical. Otherwise, some users would use a single repository to dump many packages in it. The consequence would be reduced transparency of the software. So GitHub package somehow avoids such practices and requires the user to define a repository particularly for that package. In fact, it also requires a specific structure for the repo. Your solution is correct, but this is not something I wish to implement. My main concern is that GitHub repositories should be as transparent and simplistic as possible and different Stata packages should follow that mentality, which I assume to be beneficial for the community.

That said, I appreciate the effort you put to program this feature.