Giter Site home page Giter Site logo

asdf-vars's Introduction

asdf-vars

An asdf extension that safely sets global and per-project environment variables, based upon rbenv

This is basically a port of the rbenv-vars plugin.

Install

Make sure you already have asdf installed before following these steps.

asdf plugin add vars https://github.com/excid3/asdf-vars

Add the following to ~/.asdf/lib/commands/command-exec.bash before it executes the shim.

eval "$($ASDF_DIR/bin/asdf vars)"
with_shim_executable "$shim_name" exec_shim || exit $?

Usage

Define environment variables in an .asdf-vars file in your project, one variable per line, in the format VAR=value. For example:

RUBY_GC_MALLOC_LIMIT=50000000
RUBY_HEAP_MIN_SLOTS=15000
RUBY_FREE_MIN=4096

You can perform variable substitution with the traditional $ syntax. For example, to append to GEM_PATH:

GEM_PATH=$GEM_PATH:/u/shared/gems

Spaces are allowed in values; quoting is not necessary. Expansion and command substitution are not allowed. Lines beginning with # or any lines not in the format VAR=value will be ignored.

Variables specified in the ~/.asdf/vars file will be set first. Then variables specified in .asdf-vars files in any parent directories of the current directory will be set. Variables from the .asdf-vars file in the current directory are set last.

Author

License

© 2018-2020 Chris Oliver. Released under the MIT license. See LICENSE for details.

asdf-vars's People

Contributors

excid3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asdf-vars's Issues

.asdf-vars aren't exported after upgrading to ASDF v0.11.2

Issue

After upgrading asdf to v0.11.2 using Brew, asdf-vars isn't exporting my .asdf-vars file anymore.
Do you have any pointers as to ways I can debug this further?

System

Macbook Pro M2 (Ventura 13.0.1)

Steps to reproduce

  1. Start with only two plugins:
~ MBP project-directory % asdf plugin list                                        
postgres
ruby
  1. Add asdf-vars:
~ MBP project-directory % asdf plugin add vars https://github.com/excid3/asdf-vars
~ MBP project-directory % asdf plugin list
postgres
ruby
vars
  1. Add command-exec:
~ MBP project-directory % cat ~/.asdf/lib/commands/command-exec.bash 
eval "$($ASDF_DIR/bin/asdf vars)"
with_shim_executable "$shim_name" exec_shim || exit $?
  1. Create .asdf-vars file in project directory:
~ MBP project-directory % cat .asdf-vars 
DATABASE_DEV_URL=postgres://chris@localhost/dev-project-db
  1. [Restart terminal as sanity check]

  2. Confirm asdf-vars recognises it:

~ MBP project-directory % asdf vars
# /Users/chris/Projects/project-directory/.asdf-vars
export DATABASE_DEV_URL='postgres://chris@localhost/dev-project-db'
  1. Witness that the var has not been exported:
~ MBP project-directory % echo $DATABASE_DEV_URL

~ MBP project-directory % 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.