Git Product home page Git Product logo

dotbot-asdf's Introduction

dotbot-asdf

Install asdf plugins and programming languages with dotbot.

Prerequirements

This plugin requires dotbot to be installed.

Also, at runtime this plugin requires asdf command to be installed.

Installation

  1. Run:
git submodule add https://github.com/sobolevn/dotbot-asdf.git
  1. Modify your ./install with new plugin directory:
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" --plugin-dir dotbot-asdf -c "${CONFIG}" "${@}"

Usage

Add required options to your install.conf.yaml:

# This example uses python, nodejs and ruby plugins:

- asdf:
  - plugin: python
    url: https://github.com/tuvistavie/asdf-python.git
  - plugin: nodejs
    url: https://github.com/asdf-vm/asdf-nodejs.git
  - plugin: ruby
    url: https://github.com/asdf-vm/asdf-ruby.git

Plugins can also be specified with just a name for known plugins:

# This example uses python, nodejs and ruby plugins:

- asdf:
  - plugin: python
  - plugin: nodejs
  - plugin: ruby

You can even install desired versions of languages and the global version:

# This example installs python 3.7.4, nodejs 12.10 and ruby 2.6.4:

- asdf:
  - plugin: python
    url: https://github.com/tuvistavie/asdf-python.git
    global: 3.7.4
    versions:
      - 3.7.4
  - plugin: nodejs
    url: https://github.com/asdf-vm/asdf-nodejs.git
    global: 12.10
    versions:
      - 12.10
  - plugin: ruby
    url: https://github.com/asdf-vm/asdf-ruby.git
    global: 2.6.4
    versions:
      - 2.6.4

It's also possible to configure the location for asdf in case asdf itself was installed as part of the dotbot install process. This will cause the plugin to source the provided script before every asdf command.

Only the first instance of asdf_path in the configuration will be respected.

- asdf:
  - asdf_path: /opt/asdf-vm/asdf.sh
  - plugin: python
    global: 3.10.4
    versions:
      - 3.10.4

That's it!

License

MIT. See LICENSE for more details.

dotbot-asdf's People

Contributors

bjornsnoen avatar jamesstidard avatar klane avatar pecigonzalo avatar sobolevn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotbot-asdf's Issues

`asdf` install not on PATH

Hi,

I've written a dotfiles configuration that installs asdf and then declares the doubt-asdf configuration. My initial install will always fail however because the newly installed asdf isn't available on the machine's PATH and updates made during the configuration script don't appear to effect things executed later. I made a ticket about this on the dotbot issues to look for suggestions.

I was wondering if you happened to know a way to get around this.

Thanks.

Plugin installs fail when `asdf_path` is set

Hi! First off, thanks for making this great plugin!

I am using this to bootstrap my system using asdf as part of my dotbot install script.
With the below code in my install.conf.yaml,

- asdf:
  - asdf_path: $HOME/.asdf/asdf.sh
  - plugin: awscli
    url: https://github.com/MetricMike/asdf-awscli.git
    global: 2.13.7
    versions:
      - 2.13.7

I get this error:

/bin/sh: 1: source not found
Unknown plugin: aws-vault
Please provide URL

I think this is because in

dotbot-asdf/asdf.py

Lines 111 to 112 in 3153c94

if self.asdf_location:
command = "source %s && %s" % (self.asdf_location, command)
the code assumes you are running in a shell which has the source command available, but in
p = subprocess.Popen(command, cwd=self.cwd, shell=True, **kwargs)
subprocess.Popen uses the sh shell by default, which does not have source.

This could be fixed by specifying the shell executable directly, e.g. for bash:

 p = subprocess.Popen(command, cwd=self.cwd, shell=True, executable="/bin/bash", **kwargs) 

I'm happy to make a PR to fix this, but wanted to check with you how you would prefer to fix this. Should we let the user specify a shell somehow?

Incidentally, I think this is the same issue the poster in #5 was having, and this fix should fix their issue too. Thanks!

Global Version not set correctly

Given

- asdf:
    - plugin: terraform
      global: 0.11.14
      versions:
        - 0.11.14
        - 0.12.21

I get

Installing terraform
Installing terraform plugin
Plugin named terraform already added
Installing terraform 0.11.14
terraform 0.11.14 is already installed
Installing terraform 0.12.21
terraform 0.12.21 is already installed
Setting global terraform 0.12.21

I believe its due to this section

 if "global" in plugin:
                self._run_command(
                    "asdf global {} {}".format(language, version),
                    "Setting global {} {}".format(language, version),
                    "Failed setting global: {} {}".format(language, version),
                )

Not actually getting the version from the global parameter as described in the documentation.

Way to remove unspecified version

Can we add a way to remove unspecified version of a package.
For example, let's say I start with this

  - plugin: python
    url: https://github.com/danhper/asdf-python.git
    global: 3.10.0
    versions:
      - 3.10.0

and later change it to

  - plugin: python
    url: https://github.com/danhper/asdf-python.git
    global: 3.10.4
    versions:
      - 3.10.4

Now I'll have two packages, 3.10.0 and 3.10.4. I can manually remove it using asdf but would be easy for this package to check which versions are specified and only keep them?

Global option

Hi,

Just wondering if you'd be open to adding / accepting a pull request to also set the global asdf version?

Something like:

- asdf:
  - plugin: python
    url: https://github.com/tuvistavie/asdf-python.git
    global: 3.7.4
    versions:
      - 3.7.4

Thanks for the plugin.

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.