Skip to content

Commit

Permalink
initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
juantascon committed Sep 22, 2023
1 parent 1e58b3f commit fc50584
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# @see http://editorconfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

# md
[*.md]
indent_size = 4
27 changes: 27 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Main workflow

on:
push:
paths-ignore:
- '**.md'
- '.all-contributorsrc'
pull_request:
paths-ignore:
- '**.md'
- '.all-contributorsrc'
schedule:
- cron: '0 0 * * 5'

jobs:
plugin_test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v1
with:
command: 'which elixir-ls'
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# asdf-elixir-ls
asdf plugin for elixir-ls

[![GitHub Actions Status](https://github.com/juantascon/asdf-elixir-ls/workflows/Main%20workflow/badge.svg?branch=master)](https://github.com/juantascon/asdf-elixir-ls/actions)
[![GitHub license](https://img.shields.io/github/license/juantascon/asdf-elixir-ls?style=plastic)](https://github.com/juantascon/asdf-elixir-ls/blob/master/LICENSE)

## Install

```bash
asdf plugin-add elixir https://github.com/juantascon/asdf-elixir-ls
```

## Use

Check out the [asdf](https://github.com/asdf-vm/asdf) readme for instructions on how to install and manage versions of elixir-ls.

40 changes: 40 additions & 0 deletions bin/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

set -euo pipefail

[[ -z ${ASDF_INSTALL_TYPE+x} ]] && echo "ASDF_INSTALL_TYPE is required" && exit 1
[[ -z ${ASDF_INSTALL_VERSION+x} ]] && echo "ASDF_INSTALL_VERSION is required" && exit 1
[[ -z ${ASDF_INSTALL_PATH+x} ]] && echo "ASDF_INSTALL_PATH is required" && exit 1

function install() {
local install_type=$1
local version=$2
local install_path=$3

[ "$install_type" != "version" ] && echo "intall type, $install_type, is not supported" && exit 1

local tmp_download_dir=$(mktemp -d)
local repo="elixir-lsp/elixir-ls"
local download_filename="elixir-ls-v${version}.zip"
local download_url="https://github.com/${repo}/releases/download/v${version}/${download_filename}"

mkdir -p "${tmp_download_dir}"
pushd "${tmp_download_dir}" >/dev/null

echo "Downloading from ${download_url}"
curl -fLsS -H "Accept: application/octet-stream" -o "${download_filename}" "${download_url}"

mkdir -p unzip
pushd unzip >/dev/null

unzip "${tmp_download_dir}/${download_filename}"
mkdir -p ./bin
ln -s ../language_server.sh ./bin/elixir-ls
ln -s ../debugger.sh ./bin/elixir-ls-debugger
cp -fpr * "${install_path}"

popd >/dev/null
popd >/dev/null
}

install "${ASDF_INSTALL_TYPE}" "${ASDF_INSTALL_VERSION}" "${ASDF_INSTALL_PATH}"
16 changes: 16 additions & 0 deletions bin/list-all
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

releases_path=https://api.github.com/repos/elixir-lsp/elixir-ls/releases
cmd="curl -sL"
if [ -n "$GITHUB_API_TOKEN" ]; then
cmd="$cmd -H 'Authorization: token $GITHUB_API_TOKEN'"
fi
cmd="$cmd $releases_path"

function sort_versions() {
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' |
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}'
}

eval "$cmd" | grep -oE "tag_name\": \".{1,15}\"," | sed 's/tag_name\": \"v//;s/\",//' | sort_versions | xargs echo

0 comments on commit fc50584

Please sign in to comment.