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

Local overrides (was: Shards Link) #152

Closed
crisward opened this issue Feb 14, 2017 · 20 comments
Closed

Local overrides (was: Shards Link) #152

crisward opened this issue Feb 14, 2017 · 20 comments

Comments

@crisward
Copy link

Npm, bower and other package manages have the concept of linking dependencies. This is useful when developing app dependencies. Allowing you to have two projects in different folders, then one is sym-linked into the libs folder of the other.

I think it'd be useful to have this in shards. What do you think?

@ysbaddaden
Copy link
Contributor

Maybe use the path resolver?

@RX14
Copy link
Contributor

RX14 commented Feb 14, 2017

The problem with the path resolver is that you need to run shards update to copy the new source code every time you make a change. It also required you to modify the shard.yml every time you want to bugfix in a dependency.

@ysbaddaden
Copy link
Contributor

Huh? AFAIK path creates a symlink...

@RX14
Copy link
Contributor

RX14 commented Feb 14, 2017

@ysbaddaden Oh, I thought it didn't. I should have checked, sorry.

@crisward
Copy link
Author

What is the path resolver?

@ysbaddaden
Copy link
Contributor

Instead of using a git ot github, you may:

dependencies:
  my_shard_name:
    path: /absolute/path/to/dependency

@crisward
Copy link
Author

got it. Thanks.

@crisward
Copy link
Author

Still not quite as nice as the link option, with link I don't have to remember to change by path before pushing live... Maybe I could add that to a deploy script..

@RX14
Copy link
Contributor

RX14 commented Feb 14, 2017

Just tried using path on a transitive dependency, it didn't work:

dependencies:
  db:
    github: crystal-lang/crystal-db
    path: /data/programming/crystal-db/
  pg:
    github: will/crystal-pg
    version: ~> 0.13.1

This links crystal-db from github like usual, whichever way I order the listings.

@bcardiff
Copy link
Member

In bundler this is done by local overrides. It was discussed a bit in #105. I do manual link in ./lib/shard_name. It is error prone but it has been working for me until now.

@ysbaddaden
Copy link
Contributor

@RX14 you can't have multiple resolvers for the same dependency. You must drop/comment the github line.

@RX14
Copy link
Contributor

RX14 commented Feb 15, 2017

@ysbaddaden Apparently i'm so used to keeping github: and changing branch:, version: or commit: I didn't even think about it! Thanks for pointing out my mistake, it works great now.

@jhass
Copy link
Member

jhass commented Feb 15, 2017

+1 for something like this, bundler's way seems most appropriate for us. Having a dirty shard.yml and paying attention to not accidentally committing it is just too much of a PITA.

Additionally we obviously should fail hard and early if there's more than one resolver given.

@RX14
Copy link
Contributor

RX14 commented Feb 15, 2017

Very much 👍 to my mistake failing hard.

@ysbaddaden
Copy link
Contributor

@jhass the current solution ain't great. I never had the need for that, so I admit I didn't search much to address the issue.

Maybe local overrides, so we could keep git: in shard.yml but have a path: locally, which could be automated with shards link /path/to/dependency for example, only applying to the current project, with warnings to the check, install and update commands that it's using a local override.

@ysbaddaden ysbaddaden changed the title Shards Link Local overrides (was: Shards Link) Oct 6, 2017
@watzon
Copy link

watzon commented Oct 22, 2017

Anyone put more thought into this? This is definitely a feature that's missing.

@ysbaddaden
Copy link
Contributor

I haven't.

I needed this the other day, and I simply changed git: to path: and ran shards update. Tested things out, then ran git checkout shard.*. No big deal.

Having a different, git ignored, source for dependencies, such as local overrides has always been confusing in my experience.

@anamba
Copy link

anamba commented Apr 6, 2019

To add another data point, I still feel the pain of this quite often. Updating a Gemfile and running bundle is more or less instant, but running shards update typically takes 30-40 seconds (~1s per repo), so I actively avoid using shards when possible. I made a shell script to symlink dependencies into lib when I need to test something.

I did notice that once, when I tried running shards from an EC2 instance located in the US, it was astonishingly quick. Is that is how it works for other people normally??

@ysbaddaden
Copy link
Contributor

You can use --local in the 0.9.0 beta release to make commands instant, as long as the cache is up to date, as is the case here.

@straight-shoota
Copy link
Member

This was resolved by #422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants