diff --git a/nodeenv.py b/nodeenv.py old mode 100755 new mode 100644 index 4465b04..ba64aa8 --- a/nodeenv.py +++ b/nodeenv.py @@ -106,6 +106,7 @@ def _load(cls, configfiles, verbose=False): """ Load configuration from the given files in reverse order, if they exist and have a [nodeenv] section. + Additionally, load version from .node-version if file exists. """ for configfile in reversed(configfiles): configfile = os.path.expanduser(configfile) @@ -133,6 +134,10 @@ def _load(cls, configfiles, verbose=False): os.path.basename(configfile), attr, val)) setattr(cls, attr, val) + if os.path.exists(".node-version"): + with open(".node-version", "r") as v_file: + setattr(cls, "node", v_file.readlines(1)[0].strip()) + @classmethod def _dump(cls): """