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

Added composure as a submodule, replaced composure.bash with a symlink #872

Closed
wants to merge 16 commits into from

Conversation

b-
Copy link

@b- b- commented Dec 29, 2016

This project incorporates composure by @erichs, so I replaced its copy of composure with a submodule linking to his composure repository. The official composure repo, however, names the main file composure.sh when bash-it is looking for composure.bash in its libs folder, so I replaced composure.bash with a symlink pointing to composure/composure.sh

- Removed "normal" file lib/composure.bash
- Symlinked lib/composure/composure.sh to lib/composure.bash
	- This allows ease of updating composure directly from git.
…nt. Including composure as a submodule means that cloning this repository must be done recursively.
@nwinkler
Copy link
Member

nwinkler commented Jan 3, 2017

Thanks for contributing!

I like the idea of this, but have a couple of questions:

  • What will this mean for people that already have an existing copy of Bash-it? How will they have to upgrade to this version so that they get the new submodule without breaking their existing installation?
  • The Travis build failed since it wasn't able to clone the submodule repo. Would it be possible to use an HTTPS URL instead of the SSH one? This would probably also be easier for people who are behind a firewall/proxy and can only use HTTP(S), but not SSH with GitHub.

@b-
Copy link
Author

b- commented Jan 3, 2017

Hm the HTTPS idea sounds good. I was wondering why it wouldn't build on Travis, but switching it over to HTTPS should fix it. (This was my first time contributing to something tracked by travis, though, so I'm hoping we're right on that).

I am not 150% sure if a straight git pull or merge would add the submodule properly (I'm also somewhat new to git), but I'm pretty sure it would be relatively simple. I know a new clone would simply need to be done with --recursive. I should do some testing there to see what happens.

Worst case though, except for someone who customized bash-it's composure.bash file it would only require an extra one or two git commands. The reason I made a symlink composure.bash to the "real" composure/composure.sh in my PR is for compatibility — bash-it sources composure.bash, and the symlink there will redirect it to the submodule.

b- added 2 commits January 3, 2017 12:00
Changed composure remote origin to https://github.com/erichs/composure.git
    (hopefully travis likes https)
…modules.

(*really* changed the submodule URL)
@b-
Copy link
Author

b- commented Jan 3, 2017

I just created a "test" branch on my repo identical to your "master" branch, added a new user to my box (to start fresh), installed bash-it for that user from my "test" branch, merged my "master" branch into "test" to simulate the merging of this pull request with your master, and updated bash-it against that branch. Everything worked fine, as I expected. I actually did not even need to use any recursive or submodule commands with git — it knew what to do with the new submodule. It should be fine.

As far as I can see it, the only way someone would be able to modify their own copy of bash-it in such a way that this change would break their install would be if they actually customized composure.bash itself. (Which makes no sense, since it's just a function library).

And even if someone actually did mess with their local copy of the composure library, I think git would realize the hashes don't match and not update composure.bash itself (simply adding the submodule and not the symlink). If that's not the case, that's the fault of git pull --rebase (as used in bash-it update / _bash-it_update) anyway and this change wouldn't make a difference there.

Also, I think the reason that the SSH URL was failing on travis-ci is because if a GitHub user is logged into an account with SSH keys on file, clicking a clone button gives you a link that uses those keys — I agree with you that HTTPS makes sense in case of firewalls, etc., but I'm glad I figured out what the problem with Travis is.

@nwinkler
Copy link
Member

nwinkler commented Jan 4, 2017

Sorry, you'll have to fix one more thing... The Travis build is showing green, but it's not executing any of the test cases: https://travis-ci.org/Bash-it/bash-it/builds/188593255

There's a composure.bats file in test/lib, which is running some checks on the composure functionality, and it looks like the submodule or the symbolic link broke that test (and all of the other tests). Can you try to run the tests locally to see whether you get the same issue?

@b-
Copy link
Author

b- commented Jan 4, 2017 via email

@nwinkler
Copy link
Member

nwinkler commented Jan 4, 2017

It is using this for the tests: https://github.com/sstephenson/bats

@b-
Copy link
Author

b- commented Jan 4, 2017 via email

@b-
Copy link
Author

b- commented Jan 23, 2017

I see why it's failing. So, bats likes neither symlinks, nor a stub composure.bash that simply contains . composure/composure.sh, and it doesn't allow you to load a file that doesn't end in .bash (I'm guessing this is why all the bash-it scripts do). I submitted a pull request to sstephenson/bats to allow an explicit file extension (and then changed composure.bats to refer to composure/composure.sh), and in the meantime this PR should probably not be merged.

@nwinkler
Copy link
Member

Thanks for trying to get this to work! Let me know when you feel that this is ready for another look...

Merge with bash-it/bash-it head
@ahmadassaf
Copy link
Contributor

ahmadassaf commented Sep 26, 2020

If this is to be picked up again, there are few more changes that need to be done

for func in $(typeset_functions)

for func in $(typeset_functions)

have to be changed to _typeset_functions

letterpress "$about" $func >> $grouplist.$group

to _letterpress

@buhl buhl mentioned this pull request Jan 31, 2021
5 tasks
@buhl
Copy link
Contributor

buhl commented Feb 4, 2021

@nwinkler @b- @ahmadassaf I think we can close this PR after the merge of #1820

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.

None yet

5 participants