Skip to content

Commit

Permalink
Remove variant selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Yethal committed Jun 2, 2024
1 parent 5c19c1e commit f07545b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 98 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nu_plugins:
- nu_plugin_inc
- nu_plugin_query
- nu_plugin_formats
min_glibc_version: '2.29'
- nu_plugin_polars
config_urls:
- name: config.nu
url: "https://raw.githubusercontent.com/nushell/nushell/{{ _nushell_version }}/crates/nu-utils/src/sample_config/default_config.nu"
Expand Down
11 changes: 0 additions & 11 deletions molecule/full/converge.yml

This file was deleted.

25 changes: 0 additions & 25 deletions molecule/full/molecule.yml

This file was deleted.

38 changes: 0 additions & 38 deletions molecule/full/verify.yml

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
ansible.builtin.lineinfile:
path: "{{ item.homedir }}/{{ nushell_config_path }}/env.nu"
regexp: "^.*PROMPT_INDICATOR.*$"
line: "{{ '$env.' if '0.83.0' is version(_nushell_version, '<=') else 'let-env ' }}PROMPT_INDICATOR = '({{ inventory_hostname }})〉'"
line: "{{ '$env.' if _nushell_version is version('0.83.0', '>=') else 'let-env ' }}PROMPT_INDICATOR = '({{ inventory_hostname }})〉'"
validate: "{{ nushell_binary_path }}/nu -n -c 'source %s; $env'"
when: add_hostname_to_prompt|bool
loop: "{{ home_dirs }}"
Expand Down
7 changes: 6 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
ansible.builtin.set_fact:
libc_flavor: "{{ 'gnu' if libc.stdout is version(min_glibc_version, '>=') else 'musl' }}"


- name: Set package variant as fact
ansible.builtin.set_fact:
nu_plugins: "{{ nu_plugins if (_nushell_version is version('0.93.0', '>=')) else (nu_plugins | difference(['nu_plugin_polars'])) }}"

- name: Set package name as fact
ansible.builtin.set_fact:
nushell_package: "nu-{{ _nushell_version }}-{{ arch_map[ansible_architecture] | default(ansible_architecture) }}-{{ package_map['linux'][libc_flavor][nushell_variant] if ansible_system == 'Linux' else package_map['darwin'][nushell_variant] }}"
nushell_package: "nu-{{ _nushell_version }}-{{ arch_map[ansible_architecture] | default(ansible_architecture) }}-{{ 'unknown-linux-' + libc_flavor if ansible_system == 'Linux' else 'apple-darwin' }}"

- name: Extract package
ansible.builtin.unarchive:
Expand Down
11 changes: 2 additions & 9 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,13 @@
register: installed
changed_when: False

- name: Check installed nushell variant
ansible.builtin.command:
cmd: "{{ nushell_binary_path }}/nu -c 'version|get features'"
register: features
changed_when: false

- name: Set installed nushell version and variant as fact
ansible.builtin.set_fact:
installed_version: "{{ installed.stdout }}"
installed_variant: "{{ 'full' if 'dataframe' in features.stdout else 'default' }}"

- name: Install nushell version {{ _nushell_version + ' variant ' + nushell_variant }}
- name: Install nushell version {{ _nushell_version }}
ansible.builtin.include_tasks: install.yml
when: (not nushell_status.stat.exists) or (_nushell_version != installed_version) or (nushell_variant != installed_variant)
when: (not nushell_status.stat.exists) or (_nushell_version != installed_version)
register: install_status

- name: Install nushell configs
Expand Down
13 changes: 1 addition & 12 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
---
nushell_binary_path: /usr/local/bin
nushell_config_path: "{{ 'Library/Application Support/nushell' if ansible_system == 'Darwin' else '.config/nushell' }}"
releases_endpoint: https://api.github.com/repos/nushell/nushell/releases
min_glibc_version: '2.29'
arch_map:
arm64: aarch64
armhf: armv7
package_map:
linux:
musl:
default: unknown-linux-musl
full: linux-musl-full
gnu:
default: unknown-linux-gnu
full: linux-gnu-full
darwin:
default: apple-darwin
full: darwin-full

0 comments on commit f07545b

Please sign in to comment.