-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for VS Code Insiders builds (#151)
For those who want to help test the latest features.
- Loading branch information
Showing
22 changed files
with
205 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
|
||
pre_tasks: | ||
- name: create test users | ||
become: yes | ||
user: | ||
name: '{{ item }}' | ||
state: present | ||
home: '/home/{{ item }}' | ||
createhome: yes | ||
with_items: | ||
- test_usr | ||
- test_usr2 | ||
- test_usr3 | ||
|
||
- name: install gnupg2 (apt) | ||
become: yes | ||
apt: | ||
name: gnupg2 | ||
state: present | ||
when: ansible_pkg_mgr == 'apt' | ||
|
||
- name: install extension cli dependencies (zypper) | ||
become: yes | ||
zypper: | ||
name: libX11-xcb1 | ||
state: present | ||
when: ansible_pkg_mgr == 'zypper' | ||
|
||
- name: install extension cli dependencies (apt) | ||
become: yes | ||
apt: | ||
name: libx11-xcb1 | ||
state: present | ||
when: ansible_pkg_mgr == 'apt' | ||
|
||
roles: | ||
- role: ansible-role-visual-studio-code | ||
users: | ||
- username: test_usr | ||
visual_studio_code_extensions: | ||
- ms-python.python | ||
- wholroyd.jinja | ||
visual_studio_code_settings: { | ||
"editor.rulers": [80, 100, 120], | ||
"editor.renderWhitespace": true, | ||
"files.associations": { | ||
"Vagrantfile": "ruby" | ||
} | ||
} | ||
- username: test_usr2 | ||
visual_studio_code_extensions: [] | ||
visual_studio_code_settings: {} | ||
- username: test_usr3 | ||
|
||
post_tasks: | ||
- name: install which | ||
package: | ||
name: which | ||
state: present | ||
when: ansible_pkg_mgr in ('yum', 'dnf', 'zypper') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
|
||
import testinfra.utils.ansible_runner | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') | ||
|
||
|
||
def test_visual_studio_code(host): | ||
assert host.run('which code').rc == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
import pytest | ||
|
||
import testinfra.utils.ansible_runner | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') | ||
|
||
|
||
@pytest.mark.parametrize('extension', [ | ||
'ms-python.python', | ||
'wholroyd.jinja' | ||
]) | ||
def test_visual_studio_code(host, extension): | ||
output = host.check_output('sudo --user test_usr -H code %s %s', | ||
'--install-extension', extension) | ||
assert 'already installed' in output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
|
||
import testinfra.utils.ansible_runner | ||
|
||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( | ||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') | ||
|
||
|
||
def test_settings(host): | ||
settings_file = host.file('/home/test_usr/.config/Code/User/settings.json') | ||
|
||
assert settings_file.exists | ||
assert settings_file.is_file | ||
assert settings_file.user == 'test_usr' | ||
assert settings_file.group == 'test_usr' | ||
assert settings_file.mode == 0o600 | ||
assert settings_file.contains('"Vagrantfile": "ruby"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
- name: install VS Code (brew-cask) | ||
homebrew_cask: | ||
name: visual-studio-code | ||
name: visual-studio-{{ visual_studio_code_package }} | ||
state: present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
--- | ||
# The name of the directory where the config is stored for this build | ||
visual_studio_code_config_dirname: "{{ (visual_studio_code_build == 'insiders') | ternary('Code-Insiders', 'Code') }}" | ||
|
||
# Directory under $HOME where where VS Code config is stored | ||
visual_studio_code_config_path: "{{ (ansible_distribution == 'MacOSX') | ternary('Library/Application Support', '.config') }}/Code" | ||
visual_studio_code_config_path: "{{ (ansible_distribution == 'MacOSX') | ternary('Library/Application Support', '.config') }}/{{ visual_studio_code_config_dirname }}" | ||
|
||
# The package name to install | ||
visual_studio_code_package: "{{ (visual_studio_code_build == 'insiders') | ternary('code-insiders', 'code') }}" | ||
|
||
# The CLI executable | ||
visual_studio_code_exe: "{{ (visual_studio_code_build == 'insiders') | ternary('code-insiders', 'code') }}" |