Examples of dub use needed

Guido via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 21 08:02:01 PDT 2016


On Tuesday, 21 June 2016 at 08:58:59 UTC, Dicebot wrote:
> On 06/21/2016 10:24 AM, poliklosio wrote:
>> Wow, really?
>> Then what is the fetch command for? I started using dub a 
>> recently (2
>> months ago) and totally didn't notice that there is any other 
>> purpose of
>> the fetch command. I even installed dcd, dfmt and dscanner 
>> through dub
>> fetch, only to find out these were older versions which didn't 
>> work.
>> So what is the purpose of dub fetch?
>
> Apart from `--cache=local` version, one of intended use case is 
> to get various small utility tools needed only during 
> development and not needing to be distributed to the end user, 
> like dfmt. After `dub fetch dfmt` one can run `dub run dfmt 
> <args>` to invoke such tool without knowing where dub cache is 
> located.
>
> But it is indeed supposed to be rare case and I do recommend to 
> install such tools via system package manager instead whenever 
> possible. So yes, you don't need `dub fetch` at all for most 
> part.

Thanks for the replies. This really clears things up.

I'm the sort of person who learns by example, and what I was 
saying is that there aren't enough examples online of how dub is 
used in a practical setting.

I'm also the sort of person who doesn't trust toolchains that 
need to download things every time from the internet just to 
compile. Is this what dub is doing? In other words, when a 
project is built using dub, does it use the local cache from the 
last build by default, check for later versions, pull things from 
the internet, etc? Or do I need -cache=local for that?


More information about the Digitalmars-d mailing list