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

Add dependency support. #558

Closed
wants to merge 8 commits into from
Closed

Add dependency support. #558

wants to merge 8 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 17, 2015

@jdevera
Copy link
Contributor

jdevera commented Feb 17, 2015

Without going into the change itself, which is appreciated, there is the question of this depends.txt file. Where does this come from? Is there any other plugin manager using this format and name? Are there any plugins out there that require dependencies and are using this file?

I had read of a json file that VAM uses with some metadata. And since it's been there for ages, there is a change a few plugins are using it. I always imagined we would use whatever plugins were using already. Otherwise http://xkcd.com/927/ 😄

@ghost
Copy link
Author

ghost commented Feb 17, 2015

Dang, forgot about xkcd/927!

Yes, there are a few plugins that use addon-info.json.
I rewrote vundle#scripts#getdeps() to use that format instead.

@ghost
Copy link
Author

ghost commented Feb 18, 2015

I read issue #384 and added one last commit to fix it. (Should be able to push in 5 hours.)

@dbarnett
Copy link

If I'm reading the code right, the dependency names have to be Vundle plugin identifiers, which are incompatible with addon-info.json keys (but in some cases can be translated). I'm very +1 for using the addon-info.json format, but unless/until vim-pi support is added to Vundle, you'd need to translate entries and ignore some of them to avoid forking a "Vundle addon-info.json format".

A bare name in Vundle points to vim-scripts.org, but in addon-info.json it's a vim-pi plugin name. So "L9" fetches the same plugin in both, but many names will exist in one and not the other, or point to one plugin on vim-scripts.org and a different plugin in vim-pi.

Plugins can be specified by github URL in both Vundle and addon-info.json, but the syntax is different. Where in Vundle you would install 'tpope/vim-fugitive', in an addon-info.json file that name is meaningless and you would need to have something like this instead:

"dependencies": {
  "fugitive": {
    "type": "git",
    "url": "git://github.com/tpope/vim-fugitive"
  }
}

So I would recommend in v1 you detect the special case of github paths like this and translate them into Vundle plugin handles, and ignore everything else for now. That would only work for explicit repo details (for names that exist in vim-pi like "fugitive", it's common to omit the repo details to have them looked up in vim-pi), but it's a good start.

Brian Nash added 2 commits February 18, 2015 14:32
 - Closes #384
 - Users can set `g:vundle_no_deps` to disable dependency support if
   they want to.
@ghost
Copy link
Author

ghost commented Feb 18, 2015

@dbarnett: Now I know why this hasn't been done in 4 years. I shall make it so! (probably)

@ghost
Copy link
Author

ghost commented Feb 19, 2015

There we go!

  • As before, it should be trivial to add support for other formats.
  • Supports any git URL.

@ghost
Copy link
Author

ghost commented Feb 19, 2015

If you want, I'll squash the commits, but I am not sure how GitHub will react to a git push -f that overwrites a pull request.

if !empty(glob(a:bundle['rtpath'] . '/addon-info.json'))
let true = 1
let false = 0
let null = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

These three variables seem unused

Copy link
Author

Choose a reason for hiding this comment

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

@jdevera: AFAIK they are constants in JSON, so they need to be defined when vim parses it.

@jdevera
Copy link
Contributor

jdevera commented Feb 19, 2015

I added some comments to the commits, not just the pull request.

let null = ''
let dependencyentries = get(eval(join(readfile(a:bundle['rtpath'] . '/addon-info.json'), '')), 'dependencies', {})
let bundles_needed = []
for information in keys(dependencyentries)
Copy link
Contributor

Choose a reason for hiding this comment

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

information is really one plugin, maybe it could have a more descriptive name

let null = ''
let dependencyentries = get(eval(join(readfile(a:bundle['rtpath'] . '/addon-info.json'), '')), 'dependencies', {})
let bundles_needed = []
for dep_name in keys(dependencyentries)

Choose a reason for hiding this comment

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

You could shorten the dependencyentries[dep_name]s everywhere and make the code more readable if you assigned the value to a variable, too:

for [depname, depinfo] in items(dependencyentries)

Copy link
Author

Choose a reason for hiding this comment

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

@dbarnett: Good idea. I didn't know vim could do that!

@ghost
Copy link
Author

ghost commented Feb 20, 2015

Yeah... This isn't going to work without rewriting vim-addon-manager inside of Vundle.

@ghost ghost closed this Feb 20, 2015
@ghost ghost deleted the issue-7 branch February 20, 2015 02:26
@ghost ghost restored the issue-7 branch February 20, 2015 02:26
@dbarnett
Copy link

Well, I don't think installing dependencies by name will work without a bunch of changes, but installing by git URL looked fine. Why not start with that to get things moving on dependency support?

@jdevera
Copy link
Contributor

jdevera commented Feb 20, 2015

So, what didn't work?

@ghost
Copy link
Author

ghost commented Feb 20, 2015

@jdevera: Adding full dependency support for the addon-info.json format would require rewriting vim-addon-manager inside of Vundle. It would be easier to just use VAM instead at the moment.

@dbarnett: I set up a better pull request at #560, it includes the non-standard depends.txt format (users might make one to simplify things), and git-url-only support for the addon-info.json format.

@ghost ghost deleted the issue-7 branch February 20, 2015 17:19
This pull request was closed.
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.

Support plugin dependencies
2 participants