azukaar/GuPM

Cater for environment switch

Opened this issue · 0 comments

When reading configuration or dependency lists, gupm should read the GUPM_ENV environment variable, and choose a config to override the default one.

{
   "config" | "dependencies": {
      "default" : {
         "brew://node": "9"
      },
      "ci" : {
         "brew://node": "11"
      },
      "dev": {
         "brew://node": "12"
      }
   }
}

With this configuration, this will install node@12 :

g env GUPM_ENV=dev g make 

The differents values are: default, overwritten by :

  • ci
  • dev
  • integration
  • production

OS

You can also switch by OS:

{
   "config" | "dependencies": {
      "default" : {
         "brew://node": "9"
      },
      "windows" : {
         "brew://node": "11"
      },
}

And finally, by OS, by env:

{
   "config" | "dependencies": {
      "default" : {
         "brew://node": "9"
      },
      "dev@windows" : {
         "brew://node": "11"
      },
}

The order of overwrite follows the rule of most-precise-first :

  • default
  • dev
  • windows_dev