Open tuh8888 opened 5 years ago
Actually I think a script replacing source username with destination username is the wrong approach to solve this problem. Despite that, here's a one-liner that will do the job. Not sure if this is the level of automation that you are looking for, but the links from callahantiff to the new username can quickly be replaced with a combination of find
& sed
The solution depends on the version of find
and sed
you have.
For those on Linux or those that have GNU versions:
find . -type f -exec sed -i 's/callahantiff/{username}/g' {} +
git diff
# if everything looks good, then commit
git commit -a
For those on using macOS/BSD find
& sed
use the following. Note, while this works, it does change some line endings
find . -type f -name '*.md' -exec sed -i '' s/callahantiff/{username}/g {} +
Alternatively macOS users can use Homebrew to install the GNU version of find
and sed
:
brew install findutils
brew install gnu-sed
gfind . -type f -exec gsed -i 's/callahantiff/{username}/g' {} +
It would be better to actually modify the links in the repository and wiki to be relative so they don't need to be modified.
In Main repo:
https://github.com/magic-lantern/Abra-Collaboratory/wiki/Using-GitHub-as-a-Reproducible-Research-Platform
../../wiki/Using-GitHub-as-a-Reproducible-Research-Platform
<img src="https://github.com/magic-lantern/Abra-Collaboratory/blob/master/resources/documentation/images/wiki/collaborator-email.png">
<img src="resources/documentation/images/wiki/collaborator-email.png">
In wiki:
[Tutorial](https://github.com/magic-lantern/Abra-Collaboratory/wiki/Using-GitHub-as-a-Reproducible-Research-Platform)
[[Tutorial|Using-GitHub-as-a-Reproducible-Research-Platform]]
<img align="left" src="https://github.com/magic-lantern/Abra-Collaboratory/blob/master/resources/documentation/images/wiki/trouble_for_science.png" width="300" height="500">
<img align="left" src="raw/master/resources/documentation/images/wiki/trouble_for_science.png" width="300" height="500">
Was there a reason for not using relative links? If there isn't a good reason to avoid relative links, I recommend updating all links to be relative (could do with find
and sed
) so then forkers (is that a real word?) don't have to update any URLs.
Thanks for your advice @tuh8888 and @magic-lantern! 👏 😺
I agree with using relative links and have successfully updated all links except the image links in the wiki, which required a small modification:
<img src="https://github.com/callahantiff/Abra-Collaboratory/blob/master/resources/documentation/images/wiki/GitHub_settings.png">
<img src="../raw/master/resources/documentation/images/wiki/GitHub_settings.png">
@magic-lantern can you make suggested edits to @tuh8888's script here?
@callahantiff - Thanks for updating all the links. Guess I messed up on that Wiki image link pattern.
I see that New_Collaborators_Invitation_Email.md still has some full links that need updating - I'm happy to do that if you're ok with it.
I'm confused about what you mean by suggested edits to the script, please clarify. @tuh8888 has already included using GNU/Linux version of find
and sed
statements. After reviewing it, and including your recent changes, I have a few suggested edits to that script that I'm happy to make:
callahantiff
in the wikicallahantiff
as the default assignee.callahantiff
as the default assignee.@magic-lantern sorry for the delay in responding. I should be able to be much more responsive going forward.
I'm confused about what you mean by suggested edits to the script, please clarify. @tuh8888 has already included using GNU/Linux version of
find
andsed
statements.You are right, nothing to do there.
After reviewing it, and including your recent changes, I have a few suggested edits to that script that I'm happy to make:
- Script is only updating/replacing
callahantiff
in the wiki- The links to img.shields.io (excluding the .md file mentioned earlier) would likely be removed as people would customize their README.md for their project, so maybe don't need to worry about those.
- The issue templates have
callahantiff
as the default assignee.- Some pages (in repo and wiki) have links to opening issues with
callahantiff
as the default assignee.These changes sound great to me, I have not checked your pull request (doing that next), so if you have already made these changes, thank you very much! If not, I am fully in support of them :D.
After forking the wiki, the links still lead back to this repository.