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

Automatic use of local version when requires: .. is used #170

Open
jayvdb opened this issue Jan 17, 2019 · 2 comments
Open

Automatic use of local version when requires: .. is used #170

jayvdb opened this issue Jan 17, 2019 · 2 comments
Projects
Milestone

Comments

@jayvdb
Copy link
Member

jayvdb commented Jan 17, 2019

With a mobanfile containing

requires:
  - https://github.com/django-mobans/docker-mobans

- configuration:
    configuration: .moban.yaml
    template_dir:
      - 'docker-mobans:.moban.dt/'

If I want to test an un-merged change to docker-mobans, I need to edit the mobanfile to look for a local version

- configuration:
    configuration: .moban.yaml
    template_dir:
      - ../docker-mobans/.moban.dt/

It would be nice to have a way to do that change without editing the mobanfile.

The way that would be most suitable for the way we have been setting up repos recently is to convert

'docker-mobans:.moban.dt/' -> ../docker-mobans/.moban.dt/

however iirc pyexcel often has the local version as submodules so that would mean

'docker-mobans:.moban.dt/' -> ./docker-mobans/.moban.dt/

This use of a local version could be triggered with a cli flag like --local-requires

Ideally any modified target includes a header comment describing the different source which was used, but moban doesnt know how to do comments in every language, so that needs to be a separate enhancement, and there are a few quite-old issues which relate to this.

@jayvdb jayvdb added this to the 0.5.0 milestone Jan 24, 2019
@jayvdb
Copy link
Member Author

jayvdb commented Feb 15, 2019

One way to achieve this is to allow some template_dir: to be optional, and/or the same requires to have multiple resolutions

requires:
  - https://github.com/django-mobans/docker-mobans
  - docker-mobans-pkg

configuration:
  template_dir:
    - ../docker-mobans/templates
    - docker-mobans:/templates
    - docker-mobans-pkg:/templates
requires:
  docker-mobans:
    - ../docker-mobans
    - https://github.com/django-mobans/docker-mobans
    - docker-mobans-pkg

The former is more powerful, and keeps the fallback resolution to be only occurring within template_dir.

And the solution could be as simple as allowing any template_dir beginning with ../ to be missing, emit a warning maybe, as an error will occur if the template isnt found in a subsequent template_dir.

However, if using template_dir to include alternatives, that creates a problem for layered template names as hoped in #17 .

@chfw chfw added this to back-log in 0.7.x Mar 8, 2019
@chfw
Copy link
Member

chfw commented Sep 9, 2019

Please try the following configuration as you have proposed. With version 0.6.0, it should work automatically, given that ../docker-mobans/templates exists. Jinja2-FSLoader(MultiFS) should stop at ../docer-mobans/templates/ if the file is found.

configuration:
  template_dir:
    - ../docker-mobans/templates
    - docker-mobans:/templates
    - docker-mobans-pkg:/templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
0.7.x
back-log
Development

No branches or pull requests

2 participants