From b38d605efdee8d47977901e0de608e5bbd7dc102 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2019 01:00:14 +0000 Subject: [PATCH 001/105] docs: update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 378a63d8..ccd74b51 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Chef ruby_rbenv Cookbook +[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors) [![Cookbook Version](https://img.shields.io/cookbook/v/ruby_rbenv.svg)](https://supermarket.chef.io/cookbooks/ruby_rbenv) [![Build Status](https://img.shields.io/circleci/project/github/sous-chefs/ruby_rbenv/master.svg)](https://circleci.com/gh/sous-chefs/ruby_rbenv) @@ -166,6 +167,11 @@ Pull requests are very welcome! Make sure your patches are well tested. ## Contributors + + +
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
+ + This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) ### Backers From d41aaf15da74f073669f972719bde3f2564a1fb8 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2019 01:00:15 +0000 Subject: [PATCH 002/105] docs: create .all-contributorsrc --- .all-contributorsrc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .all-contributorsrc diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 00000000..64c846a2 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,25 @@ +{ + "files": [ + "README.md" + ], + "imageSize": 100, + "commit": false, + "contributors": [ + { + "login": "taqtiqa-mark", + "name": "Mark Van de Vyver", + "avatar_url": "https://avatars1.githubusercontent.com/u/1468258?v=4", + "profile": "http://blog.taqtiqa.com", + "contributions": [ + "infra", + "test", + "code" + ] + } + ], + "contributorsPerLine": 7, + "projectName": "jlenv-cookbook", + "projectOwner": "taqtiqa-mark", + "repoType": "github", + "repoHost": "https://github.com" +} From 3120fc360bda26eeb25d2514afbf4c6ea778ed87 Mon Sep 17 00:00:00 2001 From: taqtiqa-admin Date: Tue, 2 Jul 2019 15:25:43 +1000 Subject: [PATCH 003/105] Port group install for jlenv --- .../test/recipes/custom_group_install.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/fixtures/cookbooks/test/recipes/custom_group_install.rb b/test/fixtures/cookbooks/test/recipes/custom_group_install.rb index a8ed4c7f..118b578f 100644 --- a/test/fixtures/cookbooks/test/recipes/custom_group_install.rb +++ b/test/fixtures/cookbooks/test/recipes/custom_group_install.rb @@ -1,5 +1,5 @@ -# Install rbenv and makes it avilable to the selected user -version = '2.4.1' +# Install jlenv and makes it avilable to the selected user +version = '1.0.1' # Make sure that Vagarant user is on the box for dokken include_recipe 'test::dokken' @@ -8,21 +8,22 @@ members 'vagrant' end -# Keeps the rbenv install upto date -rbenv_user_install 'vagrant' do +# Keeps the jlenv install upto date +jlenv_user_install 'vagrant' do user 'vagrant' group 'new-group' end -rbenv_plugin 'ruby-build' do - git_url 'https://github.com/rbenv/ruby-build.git' +# Install plugin to build Julia +jlenv_plugin 'julia-build' do + git_url 'https://github.com/HiroakiMikami/julia-build.git' user 'vagrant' end -rbenv_ruby '2.4.1' do +jlenv_ruby '1.0.1' do user 'vagrant' end -rbenv_global version do +jlenv_global version do user 'vagrant' end From 61c0dc827e461829b08a44a3b3e1bdc9dc7a1931 Mon Sep 17 00:00:00 2001 From: taqtiqa-admin Date: Tue, 2 Jul 2019 16:05:45 +1000 Subject: [PATCH 004/105] Add Pkg recipe test fixtures --- .kitchen.yml | 4 +- test/fixtures/cookbooks/test/recipes/gem.rb | 53 -------- test/fixtures/cookbooks/test/recipes/pkg.rb | 129 ++++++++++++++++++++ 3 files changed, 131 insertions(+), 55 deletions(-) delete mode 100644 test/fixtures/cookbooks/test/recipes/gem.rb create mode 100644 test/fixtures/cookbooks/test/recipes/pkg.rb diff --git a/.kitchen.yml b/.kitchen.yml index 1132c5a5..593c9ede 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -21,8 +21,8 @@ platforms: - name: opensuse-leap suites: -- name: gem - run_list: recipe[test::gem] +- name: pkg + run_list: recipe[test::pkg] includes: [centos-7] - name: global run_list: recipe[test::global] diff --git a/test/fixtures/cookbooks/test/recipes/gem.rb b/test/fixtures/cookbooks/test/recipes/gem.rb deleted file mode 100644 index 21acbc3e..00000000 --- a/test/fixtures/cookbooks/test/recipes/gem.rb +++ /dev/null @@ -1,53 +0,0 @@ -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' - -# System Install -rbenv_system_install 'system' -# Install several Rubies to a system wide location -rbenv_ruby '2.4.1' do - verbose true -end - -rbenv_ruby '2.3.1' do - verbose true -end - -# Set System global version -rbenv_global '2.4.1' - -rbenv_gem 'mail' do - version '2.6.5' - options '--no-rdoc --no-ri' - rbenv_version '2.3.1' -end - -rbenv_gem 'mail' do - version '2.6.5' - options '--no-rdoc --no-ri' - rbenv_version '2.4.1' -end - -rbenv_gem 'mail' do - version '2.6.5' - rbenv_version '2.4.1' - action :remove -end - -# User Install -rbenv_user_install 'vagrant' - -# Install a Ruby to a user directory -rbenv_ruby '2.3.1' do - user 'vagrant' -end - -# Set the vagrant global version -rbenv_global '2.3.1' do - user 'vagrant' -end - -rbenv_gem 'bundler' do - version '1.15.4' - user 'vagrant' - rbenv_version '2.3.1' -end diff --git a/test/fixtures/cookbooks/test/recipes/pkg.rb b/test/fixtures/cookbooks/test/recipes/pkg.rb new file mode 100644 index 00000000..e77c0e3f --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/pkg.rb @@ -0,0 +1,129 @@ +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +# System Install +jlenv_system_install 'system' +# Install several Julias to a system wide location +jlenv_julia '1.0.4' do + verbose true +end + +jlenv_julia '1.1.0' do + verbose true +end + +# Set System global version +jlenv_global '1.0.4' + +##################################################################### +# +# JuliaRegistries/General Hosted Repository +# +##################################################################### + +# Default is latest from default registry to global Julia +jlenv_pkg 'DataFrames' + +jlenv_pkg 'DataFrames' do + action :remove +end + +# Registry add by version numbers +jlenv_pkg 'DataFrames' do + version '0.15.2' + jlenv_version '1.1.0' + action :add +end + +# Registry remove action +jlenv_pkg 'DataFrames' do + version '0.15.2' + jlenv_version '1.0.4' + action :remove +end + +# Registry by UUID numbers +jlenv_pkg 'DataFrames' do + uuid 'a93c6f00-e57d-5684-b7b6-d8193f3e46c0' + jlenv_version '1.0.4' +end + +# Registry by branch name +jlenv_pkg 'DataFrames' do + branch 'master' + jlenv_version '1.1.0' +end + +# Registry hash +jlenv_pkg 'DataFrames' do + hash '279baa63' + jlenv_version '1.1.0' +end + +# Registry version +jlenv_pkg 'General Registry Data Frames' do + name 'DataFrames' + version '0.15.1' + jlenv_version '1.1.0' +end + +# Registry nomination +jlenv_pkg 'DataFrames' do + registry 'https://github.com/JuliaRegistries/General' + version '0.15.2' + jlenv_version '1.1.0' +end + +##################################################################### +# +# Git Hosted Repository +# +##################################################################### + +# Remote git branch. +jlenv_pkg 'Free Text' do + repo 'https://github.com/JuliaData/DataFrames.jl' + branch 'master' + jlenv_version '1.1.0' +end + +# Remote git version. +jlenv_pkg 'Free Text' do + url 'https://github.com/JuliaData/DataFrames.jl' + version '0.18.2' + jlenv_version '1.1.0' +end + +# Remote git version. +jlenv_pkg 'Free Text' do + url 'https://github.com/JuliaData/DataFrames.jl' + hash '279baa6358fd5e944deccab88434f69c74cfc722' + jlenv_version '1.1.0' +end + +# Local (bare) git branch +jlenv_pkg 'Free Text' do + repo 'file:///src/DataFrames.jl.git' + branch 'master' + jlenv_version '1.1.0' +end + +# Local (bare) git hash +jlenv_pkg 'Bare repository' do + repo 'file:///src/DataFrames.jl.git' + hash '3891a62fd843662af9f78f25bdd415530b9b9c1e' + jlenv_version '1.1.0' +end + +# Install latest for specific user +jlenv_user_install 'vagrant' + +# Install a Julia to a user directory +jlenv_julia '1.1.0' do + user 'vagrant' +end + +# Set the vagrant global version +jlenv_global '1.1.0' do + user 'vagrant' +end From 095cf31e2b38ddc56fb03c07478e6f3c8e2f2bc7 Mon Sep 17 00:00:00 2001 From: taqtiqa-admin Date: Tue, 2 Jul 2019 16:07:11 +1000 Subject: [PATCH 005/105] Add Julia global install test fixtures --- test/fixtures/cookbooks/test/recipes/global.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/fixtures/cookbooks/test/recipes/global.rb b/test/fixtures/cookbooks/test/recipes/global.rb index 152a2c4d..40f030b3 100644 --- a/test/fixtures/cookbooks/test/recipes/global.rb +++ b/test/fixtures/cookbooks/test/recipes/global.rb @@ -1,14 +1,14 @@ -global_version = '2.4.1' +global_version = '1.0.3' -# Install Rbenv Globally -rbenv_system_install 'system' +# Install Jlenv Globally +jlenv_system_install 'system' -rbenv_ruby global_version do +jlenv_julia global_version do verbose true end # Make sure that Vagarant user is on the box for dokken include_recipe 'test::dokken' -# Set that Ruby as the global Ruby -rbenv_global global_version +# Set that Julia as the global Julia +jlenv_global global_version From d2c74068f30de69405b282a037f363c9d096a1d6 Mon Sep 17 00:00:00 2001 From: taqtiqa-admin Date: Tue, 2 Jul 2019 17:15:12 +1000 Subject: [PATCH 006/105] Add jlenv recipe test fixtures. --- test/fixtures/cookbooks/test/metadata.rb | 2 +- .../test/recipes/custom_group_install.rb | 2 +- .../fixtures/cookbooks/test/recipes/plugin.rb | 22 +++++++++---------- .../fixtures/cookbooks/test/recipes/rehash.rb | 2 +- .../cookbooks/test/recipes/system_install.rb | 6 ++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb index 6832f9a7..d300c691 100644 --- a/test/fixtures/cookbooks/test/metadata.rb +++ b/test/fixtures/cookbooks/test/metadata.rb @@ -1,4 +1,4 @@ name 'test' version '0.99.0' -depends 'ruby_rbenv' +depends 'chef-jlenv' diff --git a/test/fixtures/cookbooks/test/recipes/custom_group_install.rb b/test/fixtures/cookbooks/test/recipes/custom_group_install.rb index 118b578f..15db2dac 100644 --- a/test/fixtures/cookbooks/test/recipes/custom_group_install.rb +++ b/test/fixtures/cookbooks/test/recipes/custom_group_install.rb @@ -20,7 +20,7 @@ user 'vagrant' end -jlenv_ruby '1.0.1' do +jlenv_julia '1.0.1' do user 'vagrant' end diff --git a/test/fixtures/cookbooks/test/recipes/plugin.rb b/test/fixtures/cookbooks/test/recipes/plugin.rb index 1bdb6fd0..6b0b6f7e 100644 --- a/test/fixtures/cookbooks/test/recipes/plugin.rb +++ b/test/fixtures/cookbooks/test/recipes/plugin.rb @@ -1,28 +1,28 @@ -version = '2.4.1' +version = '1.0.1' # Make sure that Vagarant user is on the box for dokken include_recipe 'test::dokken' -rbenv_user_install 'vagrant' +jlenv_user_install 'vagrant' -rbenv_system_install 'system' +jlenv_system_install 'system' -rbenv_ruby version do - install_ruby_build false +jlenv_julia version do + install_julia_build false user 'vagrant' end -rbenv_global version do +jlenv_global version do user 'vagrant' end -rbenv_plugin 'ruby-build' do - git_url 'https://github.com/rbenv/ruby-build.git' +jlenv_plugin 'julia-build' do + git_url 'https://github.com/HiroakiMikami/julia-build.git' user 'vagrant' end # This should get installed to the system_install -rbenv_plugin 'user-gems' do - git_url 'git@github.com:mislav/rbenv-user-gems.git' - git_ref 'v1.0.1' +jlenv_plugin 'julia-build' do + git_url 'git@github.com:HiroakiMikami/julia-build.git' + git_ref 'bb86c68' end diff --git a/test/fixtures/cookbooks/test/recipes/rehash.rb b/test/fixtures/cookbooks/test/recipes/rehash.rb index e7596e3e..31560f04 100644 --- a/test/fixtures/cookbooks/test/recipes/rehash.rb +++ b/test/fixtures/cookbooks/test/recipes/rehash.rb @@ -1 +1 @@ -rbenv_rehash 'defaultness' +jlenv_rehash 'defaultness' diff --git a/test/fixtures/cookbooks/test/recipes/system_install.rb b/test/fixtures/cookbooks/test/recipes/system_install.rb index 1d62923e..870e46f9 100644 --- a/test/fixtures/cookbooks/test/recipes/system_install.rb +++ b/test/fixtures/cookbooks/test/recipes/system_install.rb @@ -1,4 +1,4 @@ -# Install Rbenv to the system path e.g. /usr/local/rbenv -rbenv_system_install 'system' do - update_rbenv false +# Install Jlenv to the system path e.g. /usr/local/jlenv +jlenv_system_install 'system' do + update_jlenv false end From f65dd6a6820386b7a1c59715aa75e002d80d2450 Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Wed, 3 Jul 2019 09:11:53 +1000 Subject: [PATCH 007/105] Add Julia recipe test fixtures. --- .../cookbooks/test/recipes/julia_uninstall.rb | 20 +++++++++++++++++++ .../cookbooks/test/recipes/ruby_uninstall.rb | 20 ------------------- .../fixtures/cookbooks/test/recipes/script.rb | 5 +++-- .../cookbooks/test/recipes/user_install.rb | 16 +++++++-------- 4 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 test/fixtures/cookbooks/test/recipes/julia_uninstall.rb delete mode 100644 test/fixtures/cookbooks/test/recipes/ruby_uninstall.rb diff --git a/test/fixtures/cookbooks/test/recipes/julia_uninstall.rb b/test/fixtures/cookbooks/test/recipes/julia_uninstall.rb new file mode 100644 index 00000000..7c709ea8 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/julia_uninstall.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +system_version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +# System Install +jlenv_system_install 'system' + +# Install system wide Julia +jlenv_julia system_version + +# Set System global version +jlenv_global system_version + +# Uninstall Julia +jlenv_julia system_version do + jlenv_action 'uninstall' +end diff --git a/test/fixtures/cookbooks/test/recipes/ruby_uninstall.rb b/test/fixtures/cookbooks/test/recipes/ruby_uninstall.rb deleted file mode 100644 index c6f32216..00000000 --- a/test/fixtures/cookbooks/test/recipes/ruby_uninstall.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -system_version = '2.5.1' - -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' - -# System Install -rbenv_system_install 'system' - -# Install system wide Ruby -rbenv_ruby system_version - -# Set System global version -rbenv_global system_version - -# Uninstall Ruby -rbenv_ruby system_version do - rbenv_action 'uninstall' -end diff --git a/test/fixtures/cookbooks/test/recipes/script.rb b/test/fixtures/cookbooks/test/recipes/script.rb index 67619d85..68ab9116 100644 --- a/test/fixtures/cookbooks/test/recipes/script.rb +++ b/test/fixtures/cookbooks/test/recipes/script.rb @@ -1,3 +1,4 @@ -rbenv_script 'not-much' do - code 'rake nadda' +# Make is Julia's build orchestration +jlenv_script 'not-much' do + code 'make nadda' end diff --git a/test/fixtures/cookbooks/test/recipes/user_install.rb b/test/fixtures/cookbooks/test/recipes/user_install.rb index e2eac8f9..ae2117a2 100644 --- a/test/fixtures/cookbooks/test/recipes/user_install.rb +++ b/test/fixtures/cookbooks/test/recipes/user_install.rb @@ -1,21 +1,21 @@ -# Install rbenv and makes it avilable to the selected user -version = '2.4.1' +# Install jlenv and makes it avilable to the selected user +version = '1.0.1' # Make sure that Vagarant user is on the box for dokken include_recipe 'test::dokken' -# Keeps the rbenv install upto date -rbenv_user_install 'vagrant' +# Keeps the jlenv install upto date +jlenv_user_install 'vagrant' -rbenv_plugin 'ruby-build' do - git_url 'https://github.com/rbenv/ruby-build.git' +jlenv_plugin 'julia-build' do + git_url 'https://github.com/jlenv/julia-build.git' user 'vagrant' end -rbenv_ruby '2.4.1' do +jlenv_julia '1.0.4' do user 'vagrant' end -rbenv_global version do +jlenv_global version do user 'vagrant' end From c318df3384c8b26fbb13bbcedaf8c4a1d7e9b6e8 Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Wed, 3 Jul 2019 14:11:08 +1000 Subject: [PATCH 008/105] Add mass Julia refactor. --- .circleci/config.yml | 10 +- .github/CODEOWNERS | 2 +- .gitignore | 6 +- .kitchen.yml | 4 +- CHANGELOG.md | 8 ++ README.md | 93 +++++++++---------- libraries/helpers.rb | 30 +++--- libraries/package_deps.rb | 14 +-- metadata.rb | 14 +-- resources/global.rb | 22 +++-- resources/{ruby.rb => julia.rb} | 38 ++++---- resources/{gem.rb => pkg.rb} | 36 +++---- resources/plugin.rb | 12 ++- resources/rehash.rb | 14 +-- resources/script.rb | 12 ++- resources/system_install.rb | 32 ++++--- resources/user_install.rb | 32 ++++--- templates/rbenv.sh.erb | 16 ++-- .../custom_group_install/controls/default.rb | 32 +++---- .../custom_group_install/inspec.yml | 6 +- test/integration/gem/controls/gem_install.rb | 20 ++-- test/integration/gem/inspec.yml | 4 +- .../global/controls/global_install.rb | 12 +-- test/integration/global/inspec.yml | 6 +- .../ruby_uninstall/controls/ruby_uninstall.rb | 8 +- test/integration/ruby_uninstall/inspec.yml | 4 +- .../system_install/controls/system_install.rb | 14 +-- test/integration/system_install/inspec.yml | 6 +- .../user_install/controls/user_install.rb | 30 +++--- test/integration/user_install/inspec.yml | 6 +- test/unit/default_spec.rb | 2 +- test/unit/system_install_spec.rb | 2 +- test/unit/system_spec.rb | 2 +- test/unit/user_install_spec.rb | 2 +- test/unit/user_spec.rb | 2 +- 35 files changed, 287 insertions(+), 266 deletions(-) rename resources/{ruby.rb => julia.rb} (70%) rename resources/{gem.rb => pkg.rb} (86%) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3020fb1f..a712fb7d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: sous-chefs/kitchen@1.0.1 + kitchen: jlenv/kitchen@1.0.1 workflows: kitchen: @@ -57,13 +57,13 @@ workflows: platform: centos-7 requires: [lint, danger] - kitchen/dokken-single: - name: gem - suite: gem + name: pkg + suite: pkg platform: centos-7 requires: [lint, danger] - kitchen/dokken-single: - name: ruby-uninstall - suite: ruby-uninstall + name: julia-uninstall + suite: julia-uninstall platform: ubuntu-1804 requires: [lint, danger] - kitchen/dokken-single: diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 92151e07..9f3e9181 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* sous-chefs/ruby_rbenv +* jlenv/jlenv-cookbook diff --git a/.gitignore b/.gitignore index ef781459..d71bc47b 100644 --- a/.gitignore +++ b/.gitignore @@ -21,9 +21,9 @@ _Store *.bk *.bkup -# ruby/bundler files -.ruby-version -.ruby-gemset +# julia/bundler files +.julia-version +.julia-gemset .rvmrc Gemfile.lock .bundle diff --git a/.kitchen.yml b/.kitchen.yml index 593c9ede..d2a74fdb 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -26,8 +26,8 @@ suites: includes: [centos-7] - name: global run_list: recipe[test::global] -- name: ruby_uninstall - run_list: recipe[test::ruby_uninstall] +- name: julia_uninstall + run_list: recipe[test::julia_uninstall] includes: [ubuntu-18.04] - name: system_install run_list: recipe[test::system_install] diff --git a/CHANGELOG.md b/CHANGELOG.md index 77f35396..df27c10b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ This file is used to list changes made in each version of the ruby_rbenv cookbook. +## 0.1.0 (2019-07-03) + +### NOTICE: Cookbook has been ported to Julia + +- Renamed to jlenv-cookbook and uploaded to Supermarket. +- Updated Circle-CI config to run integration tests using kitchen-docker + + ## 2.1.2 (2018-11-09) - Fix `TypeError: no implicit conversion of nil into String` for `mac_os_x` platforms diff --git a/README.md b/README.md index ccd74b51..db7afe7f 100755 --- a/README.md +++ b/README.md @@ -1,19 +1,16 @@ -# Chef ruby_rbenv Cookbook -[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors) +# Chef Jlenv Cookbook -[![Cookbook Version](https://img.shields.io/cookbook/v/ruby_rbenv.svg)](https://supermarket.chef.io/cookbooks/ruby_rbenv) -[![Build Status](https://img.shields.io/circleci/project/github/sous-chefs/ruby_rbenv/master.svg)](https://circleci.com/gh/sous-chefs/ruby_rbenv) -[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) -[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) +[![Cookbook Version](https://img.shields.io/cookbook/v/jlenv-cookbook.svg)](https://supermarket.chef.io/cookbooks/jlenv-cookbook) +[![Build Status](https://img.shields.io/circleci/project/github/jlenv/jlenv-cookbook/master.svg)](https://circleci.com/gh/jlenv/jlenv-cookbook) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) ## Description -Manages [rbenv][rbenv_site] and its installed Rubies. +Manages [jlenv][https://github.com/jlenv] and its installed Julias. ## Maintainers -This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). +This cookbook is maintained by volunteers. Contributions and bug reports are welcome. ## Requirements @@ -35,57 +32,57 @@ This cookbook requires Chef 13.0+. Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. -A `rbenv_system_install` or `rbenv_user_install` is required to be set so that rbenv knows which version you want to use, and is installed on the system. +A `jlenv_system_install` or `jlenv_user_install` is required to be set so that jlenv knows which version you want to use, and is installed on the system. -System wide installations of rbenv are supported by this cookbook, but discouraged by the rbenv maintainer, see [these][rbenv_issue_38] [two][rbenv_issue_306] issues in the rbenv repository. +System wide installations of jlenv are supported by this cookbook, but discouraged by the jlenv maintainer, see [these][https://github.com/rbenv/rbenv/issues/38] [two][https://github.com/rbenv/rbenv/issues/306] issues in the rbenv repository. ## Gem -Used to install a gem into the selected rbenv environment. +Used to install a package into the selected jlenv environment. -```ruby -rbenv_gem 'gem_name' do - options # Optional: Options to pass to the gem command e.g. '--no-rdoc --no-ri' +```julia +jlenv_package 'pkg_name' do + options # Optional: Options to pass to the packagecommand e.g. '--no-rdoc --no-ri' source # Optional: source URL/location for gem. timeout # Optional: Gem install timeout version # Optional: Gem version to install response_file # Optional: response file to reconfigure a gem - rbenv_version # Required: Which rbenv version to install the gem to. - user # Which user to install gem to. REQUIRED if you're using rbenv_user_install + jlenv_version # Required: Which jlenv version to install the packageto. + user # Which user to install packageto. REQUIRED if you're using jlenv_user_install end ``` ## Global -Sets the global ruby version. The name of the resource is the version to set. +Sets the global julia version. The name of the resource is the version to set. -```ruby -rbenv_global '2.5.1' do +```julia +jlenv_global '2.5.1' do user # Optional: if passed sets the users global version. Leave unset, to set the system global version end ``` -If a user is passed in to this resource it sets the global version for the user, under the users `root_path` (usually `~/.rbenv/version`), otherwise it sets the system global version. +If a user is passed in to this resource it sets the global version for the user, under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the system global version. ## Plugin -Installs a rbenv plugin. +Installs a jlenv plugin. -```ruby -rbenv_plugin 'ruby-build' do +```julia +jlenv_plugin 'julia-build' do git_url # Git URL of the plugin git_ref # Git reference of the plugin - user # Optional: if passed installs to the users rbenv. Do not set, to set installs to the system rbenv. + user # Optional: if passed installs to the users jlenv. Do not set, to set installs to the system jlenv. end ``` -If user is passed in, the plugin is installed to the users install of rbenv. +If user is passed in, the plugin is installed to the users install of jlenv. ## Rehash -```ruby -rbenv_rehash 'rehash' do - user 'vagrant' # Optional: if passed rehashes the user Ruby otherwise rehashes the system rbenv +```julia +jlenv_rehash 'rehash' do + user 'vagrant' # Optional: if passed rehashes the user Ruby otherwise rehashes the system jlenv end ``` @@ -95,22 +92,22 @@ If user is passed in, the user Ruby is rehashed rather than the system Ruby. Installs a given Ruby version to the system or user location. -```ruby -rbenv_ruby '2.5.1' do - user # Optional, but recommended: If passed, the user to install rbenv to - rbenv_action # Optional: the action to perform, 'install' (default), 'uninstall' etc +```julia +jlenv_julia '2.5.1' do + user # Optional, but recommended: If passed, the user to install jlenv to + jlenv_action # Optional: the action to perform, 'install' (default), 'uninstall' etc end ``` -Shorter example `rbenv_ruby '2.5.1'` +Shorter example `jlenv_julia '2.5.1'` ## Script -Runs a rbenv aware script. +Runs a jlenv aware script. -```ruby -rbenv_script 'foo' do - rbenv_version #rbenv version to run the script against +```julia +jlenv_script 'foo' do + jlenv_version #jlenv version to run the script against environment # Optional: A Hash of environment variables in the form of ({"ENV_VARIABLE" => "VALUE"}). user # Optional: User to run as group # Optional: Group to run as @@ -120,10 +117,10 @@ end ``` Note that environment overwrites the entire variable. For example. setting the `$PATH` variable can be done like this: -```ruby -rbenv_script 'bundle package' do +```julia +jlenv_script 'bundle package' do cwd node["bundle_dir"] - environment ({"PATH" => "/usr/local/rbenv/shims:/usr/local/rbenv/bin:#{ENV["PATH"]}"}) + environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"}) code "bundle package --all" end ``` @@ -132,10 +129,10 @@ Where `#{ENV["PATH"]}` appends the existing PATH to the end of the newly set PAT ## System_install -Installs rbenv to the system location, by default `/usr/local/rbenv` +Installs jlenv to the system location, by default `/usr/local/jlenv` -```ruby -rbenv_system_install 'foo' do +```julia +jlenv_system_install 'foo' do git_url # URL of the plugin repo you want to checkout git_ref # Optional: Git reference to checkout update_rbenv # Optional: Keeps the git repo up to date @@ -144,13 +141,13 @@ end ## User_install -Installs rbenv to the user path, making rbenv available to that user only. +Installs jlenv to the user path, making jlenv available to that user only. -```ruby -rbenv_user_install 'vagrant' do - git_url # Optional: Git URL to checkout rbenv from. +```julia +jlenv_user_install 'vagrant' do + git_url # Optional: Git URL to checkout jlenv from. git_ref # Optional: Git reference to checkout e.g. 'master' - user # Which user to install rbenv to (also specified in the resources name above) + user # Which user to install jlenv to (also specified in the resources name above) end ``` diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 45fdb3b8..ad0ced20 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -1,6 +1,6 @@ # -# Cookbook:: ruby_rbenv -# Library:: Chef::Rbenv::ShellHelpers +# Cookbook:: jlenv-cookbook +# Library:: Chef::Jlenv::ShellHelpers # # Author:: Fletcher Nichol # @@ -20,13 +20,13 @@ # class Chef - module Rbenv + module Jlenv module Helpers def wrap_shim_cmd(cmd) - [%(export RBENV_ROOT="#{rbenv_root}"), - %(export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"), - %(export RBENV_VERSION="#{new_resource.rbenv_version}"), - %($RBENV_ROOT/shims/#{cmd}), + [%(export JLENV_ROOT="#{jlenv_root}"), + %(export PATH="$JLENV_ROOT/bin:$JLENV_ROOT/shims:$PATH"), + %(export JLENV_VERSION="#{new_resource.jlenv_version}"), + %($JLENV_ROOT/shims/#{cmd}), ].join(' && ') end @@ -46,23 +46,23 @@ def which_rbenv def binary prefix = new_resource.user ? "sudo -u #{new_resource.user} " : '' - "#{prefix}#{root_path}/versions/#{new_resource.rbenv_version}/bin/gem" + "#{prefix}#{root_path}/versions/#{new_resource.jlenv_version}/bin/gem" end def script_code script = [] - script << %(export RBENV_ROOT="#{root_path}") - script << %(export PATH="${RBENV_ROOT}/bin:$PATH") - script << %{eval "$(rbenv init -)"} - if new_resource.rbenv_version - script << %(export RBENV_VERSION="#{new_resource.rbenv_version}") + script << %(export JLENV_ROOT="#{root_path}") + script << %(export PATH="${JLENV_ROOT}/bin:$PATH") + script << %{eval "$(jlenv init -)"} + if new_resource.jlenv_version + script << %(export JLENV_VERSION="#{new_resource.jlenv_version}") end script << new_resource.code script.join("\n").concat("\n") end def script_environment - script_env = { 'RBENV_ROOT' => root_path } + script_env = { 'JLENV_ROOT' => root_path } script_env.merge!(new_resource.environment) if new_resource.environment @@ -93,7 +93,7 @@ def package_prerequisites end end - def ruby_installed? + def julia_installed? if Array(new_resource.action).include?(:reinstall) return false elsif ::File.directory?(::File.join(root_path, 'versions', new_resource.version)) diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index 96dfe26f..1349023e 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -1,29 +1,29 @@ class Chef - module Rbenv + module Jlenv module PackageDeps - def install_ruby_dependencies + def install_julia_dependencies case ::File.basename(new_resource.version) - when /^jruby-/ - package jruby_package_deps + when /^jjulia-/ + package jjulia_package_deps else package_deps.each do |deps| package deps end end - ensure_java_environment if new_resource.version =~ /^jruby-/ + ensure_java_environment if new_resource.version =~ /^jjulia-/ end def ensure_java_environment resource_collection.find( - 'ruby_block[update-java-alternatives]' + 'julia_block[update-java-alternatives]' ).run_action(:create) rescue Chef::Exceptions::ResourceNotFound # have pity on my soul Chef::Log.info 'The java cookbook does not appear to in the run_list.' end - def jruby_package_deps + def jjulia_package_deps case node['platform_family'] when 'rhel', 'fedora', 'amazon' %w(make gcc-c++) diff --git a/metadata.rb b/metadata.rb index 8be0ceaf..eb020a94 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,12 +1,12 @@ -name 'ruby_rbenv' -maintainer 'Sous Chefs' -maintainer_email 'help@sous-chefs.org' -issues_url 'https://github.com/sous-chefs/ruby_rbenv/issues' -source_url 'https://github.com/sous-chefs/ruby_rbenv' +name 'jlenv-cookbook' +maintainer 'Mark Van de Vyver' +maintainer_email 'mark@taqtiqa.com' +issues_url 'https://github.com/jlenv/jlenv-cookbook/issues' +source_url 'https://github.com/jlenv/jlenv-cookbook' license 'Apache-2.0' -description 'Manages rbenv and installs Rbenv based Rubies' +description 'Manages jlenv and plugins for Julia installations.' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '2.1.2' +version '0.1.0' chef_version '>= 13.0' supports 'ubuntu' diff --git a/resources/global.rb b/resources/global.rb index 50c6d657..9960e79f 100644 --- a/resources/global.rb +++ b/resources/global.rb @@ -1,12 +1,14 @@ # -# Cookbook:: ruby_rbenv +# Cookbook:: jlenv-cookbook # Resource:: global # # Author:: Fletcher Nichol -# Author:: Dan Webb +# Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2011-2018, Fletcher Nichol # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,9 +26,9 @@ # Check for the user or system global verison # If we pass in a user check that users global -provides :rbenv_global +provides :jlenv_global -property :rbenv_version, String, name_property: true +property :jlenv_version, String, name_property: true property :user, String property :root_path, String, default: lazy { if user @@ -36,12 +38,12 @@ end } -# This sets the Global rbenv version -# e.g. "rbenv global" should return the version we set +# This sets the Global jlenv version +# e.g. "jlenv global" should return the version we set action :create do - rbenv_script "globals #{which_rbenv}" do - code "rbenv global #{new_resource.rbenv_version}" + jlenv_script "globals #{which_rbenv}" do + code "jlenv global #{new_resource.jlenv_version}" user new_resource.user if new_resource.user action :run not_if { current_global_version_correct? } @@ -49,10 +51,10 @@ end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers def current_global_version_correct? - current_global_version == new_resource.rbenv_version + current_global_version == new_resource.jlenv_version end def current_global_version diff --git a/resources/ruby.rb b/resources/julia.rb similarity index 70% rename from resources/ruby.rb rename to resources/julia.rb index c03df4e4..0ce65f02 100644 --- a/resources/ruby.rb +++ b/resources/julia.rb @@ -1,12 +1,14 @@ # -# Cookbook:: ruby_rbenv -# Resource:: ruby +# Cookbook:: jlenv-cookbook +# Resource:: julia # # Author:: Fletcher Nichol # Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2011-2018, Fletcher Nichol # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,15 +22,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # -provides :rbenv_ruby +provides :jlenv_julia property :version, String, name_property: true property :version_file, String property :user, String property :environment, Hash -property :rbenv_action, String, default: 'install' +property :jlenv_action, String, default: 'install' property :verbose, [true, false], default: false -property :ruby_build_git_url, String, default: 'https://github.com/rbenv/ruby-build.git' +property :julia_build_git_url, String, default: 'https://github.com/rbenv/julia-build.git' action :install do Chef::Log.fatal('Rubinius not supported by this cookbook') if new_resource.version =~ /rbx/ @@ -37,49 +39,49 @@ Chef::Log.info("Building Ruby #{new_resource.version}, this could take a while...") - rbenv_plugin 'ruby-build' do - git_url new_resource.ruby_build_git_url + jlenv_plugin 'julia-build' do + git_url new_resource.julia_build_git_url user new_resource.user if new_resource.user end - install_ruby_dependencies + install_julia_dependencies # TODO: ? # patch_command = "--patch < <(curl -sSL #{new_resource.patch_url})" if new_resource.patch_url # patch_command = "--patch < #{new_resource.patch_file}" if new_resource.patch_file - command = %(rbenv #{new_resource.rbenv_action}) - # From `rbenv help uninstall`: + command = %(jlenv #{new_resource.jlenv_action}) + # From `jlenv help uninstall`: # -f Attempt to remove the specified version without prompting # for confirmation. If the version does not exist, do not # display an error message. - command << ' -f' if new_resource.rbenv_action == 'uninstall' + command << ' -f' if new_resource.jlenv_action == 'uninstall' command << " #{new_resource.version}" command << ' --verbose' if new_resource.verbose - rbenv_script "#{command} #{which_rbenv}" do + jlenv_script "#{command} #{which_rbenv}" do code command user new_resource.user if new_resource.user environment new_resource.environment if new_resource.environment action :run live_stream true if new_resource.verbose - not_if { ruby_installed? && new_resource.rbenv_action != 'uninstall' } + not_if { julia_installed? && new_resource.jlenv_action != 'uninstall' } end log_message = new_resource.to_s - log_message << if new_resource.rbenv_action == 'uninstall' + log_message << if new_resource.jlenv_action == 'uninstall' ' uninstalled' else " build time was #{(Time.now - install_start) / 60.0} minutes" end Chef::Log.info(log_message) - # TODO: If there is no more Ruby installed on the system, the `version` file - # of rbenv still contains a version number which results in a warning. See + # TODO: If there is no more Julia installed on the system, the `version` file + # of jlenv still contains a version number which results in a warning. See # this issue and comment for more details: # https://github.com/rbenv/rbenv/pull/848#issuecomment-413857386 end action_class do - include Chef::Rbenv::Helpers - include Chef::Rbenv::PackageDeps + include Chef::Jlenv::Helpers + include Chef::Jlenv::PackageDeps end diff --git a/resources/gem.rb b/resources/pkg.rb similarity index 86% rename from resources/gem.rb rename to resources/pkg.rb index d3f2ad16..db43f0f7 100644 --- a/resources/gem.rb +++ b/resources/pkg.rb @@ -1,12 +1,14 @@ # -# Cookbook:: ruby_rbenv -# Resource:: gem +# Cookbook:: jlenv-cookbook +# Resource:: pkg # # Author:: Fletcher Nichol -# Author:: Dan Webb +# Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2011-2018, Fletcher Nichol # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,9 +23,9 @@ # limitations under the License. # -provides :rbenv_gem -# Standard Gem Package Options -# https://docs.chef.io/resource_gem_package.html#properties +provides :jlenv_package +# Standard Package Options +# https://docs.chef.io/resource_package.html#properties property :clear_sources, [true, false] property :include_default_source, [true, false], default: true property :ignore_failure, [true, false], default: false @@ -39,11 +41,11 @@ default_action :install action :install do - gem_package new_resource.package_name do + pkg_package new_resource.package_name do clear_sources new_resource.clear_sources if new_resource.clear_sources ignore_failure new_resource.ignore_failure if new_resource.ignore_failure include_default_source new_resource.include_default_source - gem_binary binary + pkg_binary binary options new_resource.options if new_resource.options package_name new_resource.package_name if new_resource.package_name source new_resource.source if new_resource.source @@ -54,11 +56,11 @@ end action :purge do - gem_package new_resource.package_name do + pkg_package new_resource.package_name do clear_sources new_resource.clear_sources if new_resource.clear_sources ignore_failure new_resource.ignore_failure if new_resource.ignore_failure include_default_source new_resource.include_default_source - gem_binary binary + pkg_binary binary options new_resource.options if new_resource.options package_name new_resource.package_name if new_resource.package_name source new_resource.source if new_resource.source @@ -69,11 +71,11 @@ end action :reconfig do - gem_package new_resource.package_name do + pkg_package new_resource.package_name do clear_sources new_resource.clear_sources if new_resource.clear_sources ignore_failure new_resource.ignore_failure if new_resource.ignore_failure include_default_source new_resource.include_default_source - gem_binary binary + pkg_binary binary options new_resource.options if new_resource.options package_name new_resource.package_name if new_resource.package_name source new_resource.source if new_resource.source @@ -85,11 +87,11 @@ end action :remove do - gem_package new_resource.package_name do + pkg_package new_resource.package_name do clear_sources new_resource.clear_sources if new_resource.clear_sources ignore_failure new_resource.ignore_failure if new_resource.ignore_failure include_default_source new_resource.include_default_source - gem_binary binary + pkg_binary binary options new_resource.options if new_resource.options package_name new_resource.package_name if new_resource.package_name source new_resource.source if new_resource.source @@ -100,11 +102,11 @@ end action :upgrade do - gem_package new_resource.package_name do + pkg_package new_resource.package_name do clear_sources new_resource.clear_sources if new_resource.clear_sources ignore_failure new_resource.ignore_failure if new_resource.ignore_failure include_default_source new_resource.include_default_source - gem_binary binary + pkg_binary binary options new_resource.options if new_resource.options package_name new_resource.package_name if new_resource.package_name source new_resource.source if new_resource.source @@ -115,5 +117,5 @@ end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers end diff --git a/resources/plugin.rb b/resources/plugin.rb index 8b91c3de..3d7a376a 100644 --- a/resources/plugin.rb +++ b/resources/plugin.rb @@ -1,10 +1,12 @@ # -# Cookbook:: ruby_rbenv +# Cookbook:: jlenv-cookbook # Resource:: plugin # # Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,16 +20,16 @@ # See the License for the specific language governing permissions and # limitations under the License. # -provides :rbenv_plugin +provides :jlenv_plugin property :git_url, String, required: true property :git_ref, String, default: 'master' property :user, String -# https://github.com/rbenv/rbenv/wiki/Plugins +# https://github.com/jlenv/jlenv/wiki/Plugins action :install do # If we pass in a username, we then to a plugin install to the users home_dir - # See chef_rbenv_script_helpers.rb for root_path + # See chef_jlenv_script_helpers.rb for root_path git "Install #{new_resource.name} plugin" do destination ::File.join(root_path, 'plugins', new_resource.name) repository new_resource.git_url @@ -38,5 +40,5 @@ end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers end diff --git a/resources/rehash.rb b/resources/rehash.rb index a88cf5a6..1f0b4b72 100644 --- a/resources/rehash.rb +++ b/resources/rehash.rb @@ -1,12 +1,14 @@ # -# Cookbook:: ruby_rbenv +# Cookbook:: jlenv-cookbook # Resource:: rehash # # Author:: Fletcher Nichol -# Author:: Dan Webb +# Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2011-2018, Fletcher Nichol # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,18 +22,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -provides :rbenv_rehash +provides :jlenv_rehash property :user, String action :run do - rbenv_script "rbenv rehash #{which_rbenv}" do - code %(rbenv rehash) + jlenv_script "jlenv rehash #{which_rbenv}" do + code %(jlenv rehash) user new_resource.user if new_resource.user action :run end end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers end diff --git a/resources/script.rb b/resources/script.rb index 6fb5c964..4e45e1bf 100644 --- a/resources/script.rb +++ b/resources/script.rb @@ -1,12 +1,14 @@ # -# Cookbook:: ruby_rbenv +# Cookbook:: jlenv-cookbook # Resource:: script # # Author:: Fletcher Nichol -# Author:: Dan Webb +# Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2011-2018, Fletcher Nichol # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,9 +22,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -provides :rbenv_script +provides :jlenv_script -property :rbenv_version, String +property :jlenv_version, String property :code, String property :creates, String property :cwd, String @@ -51,5 +53,5 @@ end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers end diff --git a/resources/system_install.rb b/resources/system_install.rb index e7d475c3..1e1cd97c 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -1,10 +1,12 @@ # -# Cookbook:: ruby_rbenv +# Cookbook:: jlenv-cookbook # Resource:: system_install # # Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,12 +21,12 @@ # limitations under the License. # -# Install rbenv to a system wide location -provides :rbenv_system_install +# Install jlenv to a system wide location +provides :jlenv_system_install property :git_url, String, default: 'https://github.com/rbenv/rbenv.git' property :git_ref, String, default: 'master' -property :global_prefix, String, default: '/usr/local/rbenv' +property :global_prefix, String, default: '/usr/local/jlenv' property :update_rbenv, [true, false], default: true action :install do @@ -38,9 +40,9 @@ mode '0755' end - template '/etc/profile.d/rbenv.sh' do - cookbook 'ruby_rbenv' - source 'rbenv.sh.erb' + template '/etc/profile.d/jlenv.sh' do + cookbook 'jlenv-cookbook' + source 'jlenv.sh.erb' owner 'root' mode '0755' variables(global_prefix: new_resource.global_prefix) @@ -50,8 +52,8 @@ repository new_resource.git_url reference new_resource.git_ref action :checkout if new_resource.update_rbenv == false - notifies :run, 'ruby_block[Add rbenv to PATH]', :immediately - notifies :run, 'bash[Initialize system rbenv]', :immediately + notifies :run, 'julia_block[Add jlenv to PATH]', :immediately + notifies :run, 'bash[Initialize system jlenv]', :immediately end directory "#{new_resource.global_prefix}/plugins" do @@ -59,21 +61,21 @@ mode '0755' end - # Initialize rbenv - ruby_block 'Add rbenv to PATH' do + # Initialize jlenv + julia_block 'Add jlenv to PATH' do block do ENV['PATH'] = "#{new_resource.global_prefix}/shims:#{new_resource.global_prefix}/bin:#{ENV['PATH']}" end action :nothing end - bash 'Initialize system rbenv' do - code %(PATH="#{new_resource.global_prefix}/bin:$PATH" rbenv init -) - environment('RBENV_ROOT' => new_resource.global_prefix) + bash 'Initialize system jlenv' do + code %(PATH="#{new_resource.global_prefix}/bin:$PATH" jlenv init -) + environment('JLENV_ROOT' => new_resource.global_prefix) action :nothing end end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers end diff --git a/resources/user_install.rb b/resources/user_install.rb index 27a192a5..8e2df27f 100644 --- a/resources/user_install.rb +++ b/resources/user_install.rb @@ -1,10 +1,12 @@ # -# Cookbook:: ruby_rbenv +# Cookbook:: jlenv-cookbook # Resource:: user_install # # Author:: Dan Webb +# Author:: Mark Van de Vyver # # Copyright:: 2017-2018, Dan Webb +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,15 +21,15 @@ # limitations under the License. # -# Install rbenv to a user location -provides :rbenv_user_install +# Install jlenv to a user location +provides :jlenv_user_install -property :git_url, String, default: 'https://github.com/rbenv/rbenv.git' +property :git_url, String, default: 'https://github.com/jlenv/jlenv.git' property :git_ref, String, default: 'master' property :user, String, name_property: true property :group, String, default: lazy { user } property :home_dir, String, default: lazy { ::File.expand_path("~#{user}") } -property :user_prefix, String, default: lazy { ::File.join(home_dir, '.rbenv') } +property :user_prefix, String, default: lazy { ::File.join(home_dir, '.jlenv') } property :update_rbenv, [true, false], default: true action :install do @@ -38,9 +40,9 @@ system_prefix = node.run_state['root_path']['system'] - template '/etc/profile.d/rbenv.sh' do - cookbook 'ruby_rbenv' - source 'rbenv.sh.erb' + template '/etc/profile.d/jlenv.sh' do + cookbook 'jlenv-cookbook' + source 'jlenv.sh.erb' variables(global_prefix: system_prefix) if system_prefix owner 'root' mode '0755' @@ -52,7 +54,7 @@ action :checkout if new_resource.update_rbenv == false user new_resource.user group new_resource.group - notifies :run, 'ruby_block[Add rbenv to PATH]', :immediately + notifies :run, 'julia_block[Add jlenv to PATH]', :immediately end %w(plugins shims versions).each do |d| @@ -63,17 +65,17 @@ end end - # Initialize rbenv - ruby_block 'Add rbenv to PATH' do + # Initialize jlenv + julia_block 'Add jlenv to PATH' do block do ENV['PATH'] = "#{new_resource.user_prefix}/shims:#{new_resource.user_prefix}/bin:#{ENV['PATH']}" end action :nothing end - bash "Initialize user #{new_resource.user} rbenv" do - code %(PATH="#{new_resource.user_prefix}/bin:$PATH" rbenv init -) - environment('RBENV_ROOT' => new_resource.user_prefix) + bash "Initialize user #{new_resource.user} jlenv" do + code %(PATH="#{new_resource.user_prefix}/bin:$PATH" jlenv init -) + environment('JLENV_ROOT' => new_resource.user_prefix) action :nothing subscribes :run, "git[#{new_resource.user_prefix}]", :immediately # Subscribe because it's easier to find the resource ;) @@ -81,5 +83,5 @@ end action_class do - include Chef::Rbenv::Helpers + include Chef::Jlenv::Helpers end diff --git a/templates/rbenv.sh.erb b/templates/rbenv.sh.erb index e17020d0..7ec6704e 100644 --- a/templates/rbenv.sh.erb +++ b/templates/rbenv.sh.erb @@ -1,15 +1,15 @@ # Generated by Chef for <%= node['fqdn'] %> # Local modifications will be overridden -# prefer a user rbenv over a system wide install -if [ -s "${HOME}/.rbenv/bin" ]; then - rbenv_root="${HOME}/.rbenv" +# prefer a user jlenv over a system wide install +if [ -s "${HOME}/.jlenv/bin" ]; then + jlenv_root="${HOME}/.jlenv" elif [ -s "<%= @global_prefix %>" ]; then - rbenv_root="<%= @global_prefix %>" - export RBENV_ROOT="$rbenv_root" + jlenv_root="<%= @global_prefix %>" + export JLENV_ROOT="$jlenv_root" fi -if [ -n "$rbenv_root" ]; then - export PATH="${rbenv_root}/bin:$PATH" - eval "$(rbenv init -)" +if [ -n "$jlenv_root" ]; then + export PATH="${jlenv_root}/bin:$PATH" + eval "$(jlenv init -)" fi diff --git a/test/integration/custom_group_install/controls/default.rb b/test/integration/custom_group_install/controls/default.rb index d2451feb..37dc0e06 100644 --- a/test/integration/custom_group_install/controls/default.rb +++ b/test/integration/custom_group_install/controls/default.rb @@ -1,44 +1,44 @@ # frozen_string_literal: true -global_ruby = '2.4.1' +global_julia = '2.4.1' -control 'Rbenv should be installed' do - title 'Rbenv should be installed to the users home directory' +control 'Jlenv should be installed' do + title 'Jlenv should be installed to the users home directory' - desc 'Rbenv should be installed' - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv global"') do + desc 'Jlenv should be installed' + describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv global"') do its('exit_status') { should eq 0 } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end - describe file('/home/vagrant/.rbenv/versions') do + describe file('/home/vagrant/.jlenv/versions') do it { should exist } it { should be_writable.by_user('vagrant') } its('group') { should eq 'new-group' } end - describe file('/home/vagrant/.rbenv') do + describe file('/home/vagrant/.jlenv') do it { should exist } it { should be_writable.by_user('vagrant') } its('group') { should eq 'new-group' } end end -control 'ruby-build plugin should be installed' do - title 'ruby-build should be installed to the users home directory' - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv install -l"') do +control 'julia-build plugin should be installed' do + title 'julia-build should be installed to the users home directory' + describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv install -l"') do its('exit_status') { should eq 0 } its('stdout') { should include('2.3.4') } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end end control 'Global Ruby' do - title 'Rbenv should be installed globally' + title 'Jlenv should be installed globally' - desc "Can set global Ruby version to #{global_ruby}" - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv versions --bare"') do + desc "Can set global Ruby version to #{global_julia}" + describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv versions --bare"') do its('exit_status') { should eq 0 } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end end diff --git a/test/integration/custom_group_install/inspec.yml b/test/integration/custom_group_install/inspec.yml index a82659e5..e8cb51af 100644 --- a/test/integration/custom_group_install/inspec.yml +++ b/test/integration/custom_group_install/inspec.yml @@ -1,9 +1,9 @@ -name: rbenv -title: rbenv profile +name: jlenv +title: jlenv profile maintainer: Sous Chefs copyright: Webb Agile Solutions Ltd. license: Apache-2.0 -summary: Verifies rbenv is installed correctly for a user & group +summary: Verifies jlenv is installed correctly for a user & group version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/gem/controls/gem_install.rb b/test/integration/gem/controls/gem_install.rb index 12ec7964..53e3564d 100644 --- a/test/integration/gem/controls/gem_install.rb +++ b/test/integration/gem/controls/gem_install.rb @@ -1,33 +1,33 @@ # frozen_string_literal: true -global_ruby = '2.4.1' +global_julia = '2.4.1' control 'Global Gem Install' do title 'Should install Mail Gem globally' - desc "Can set global Ruby version to #{global_ruby}" - describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do + desc "Can set global Ruby version to #{global_julia}" + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do its('exit_status') { should eq 0 } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end desc '2.3.1 Gem should have mail installed' - describe bash('/usr/local/rbenv/versions/2.3.1/bin/gem list --local mail') do + describe bash('/usr/local/jlenv/versions/2.3.1/bin/package list --local mail') do its('exit_status') { should eq 0 } its('stdout') { should include('2.6.5') } its('stdout') { should_not include('2.6.6') } end desc '2.4.1 Gem should not have any mail version installed' - describe bash('/usr/local/rbenv/versions/2.4.1/bin/gem list --local') do + describe bash('/usr/local/jlenv/versions/2.4.1/bin/package list --local') do its('exit_status') { should eq 0 } its('stdout') { should_not include('2.6.5') } its('stdout') { should_not include('2.6.6') } end - desc 'gem home should be rbenv in an rbenv directory' - describe bash('source /etc/profile.d/rbenv.sh && gem env home') do + desc 'package home should be jlenv in an jlenv directory' + describe bash('source /etc/profile.d/jlenv.sh && package env home') do its('exit_status') { should eq 0 } - its('stdout') { should include("/usr/local/rbenv/versions/#{global_ruby}/lib/ruby/gems/2.4.0") } + its('stdout') { should include("/usr/local/jlenv/versions/#{global_julia}/lib/julia/gems/2.4.0") } end end @@ -35,7 +35,7 @@ title 'Should install Bundler Gem to a user home' desc 'Gemspec file should have correct ownership' - describe file('/home/vagrant/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/specifications/bundler-1.15.4.gemspec') do + describe file('/home/vagrant/.jlenv/versions/2.3.1/lib/julia/gems/2.3.0/specifications/bundler-1.15.4.gemspec') do it { should exist } it { should be_owned_by 'vagrant' } end diff --git a/test/integration/gem/inspec.yml b/test/integration/gem/inspec.yml index a2e3c8bf..7f7299df 100644 --- a/test/integration/gem/inspec.yml +++ b/test/integration/gem/inspec.yml @@ -1,5 +1,5 @@ -name: rbenv -title: rbenv profile +name: jlenv +title: jlenv profile maintainer: Sous Chefs copyright: Webb Agile Solutions Ltd. license: Apache-2.0 diff --git a/test/integration/global/controls/global_install.rb b/test/integration/global/controls/global_install.rb index a1a96cab..58e5cde7 100644 --- a/test/integration/global/controls/global_install.rb +++ b/test/integration/global/controls/global_install.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -global_ruby = '2.4.1' +global_julia = '2.4.1' -control 'Rbenv should be installed' do - title 'Rbenv should be installed globally' +control 'Jlenv should be installed' do + title 'Jlenv should be installed globally' - desc "Can set global Ruby version to #{global_ruby}" - describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do + desc "Can set global Ruby version to #{global_julia}" + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do its('exit_status') { should eq 0 } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end end diff --git a/test/integration/global/inspec.yml b/test/integration/global/inspec.yml index 348bf277..85f6ee3f 100644 --- a/test/integration/global/inspec.yml +++ b/test/integration/global/inspec.yml @@ -1,9 +1,9 @@ -name: rbenv -title: rbenv profile +name: jlenv +title: jlenv profile maintainer: Sous Chefs copyright: Webb Agile Solutions Ltd. license: Apache-2.0 -summary: Verifies rbenv correctly sets the global Ruby version +summary: Verifies jlenv correctly sets the global Ruby version version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/ruby_uninstall/controls/ruby_uninstall.rb b/test/integration/ruby_uninstall/controls/ruby_uninstall.rb index d6371d31..4bc34e1e 100644 --- a/test/integration/ruby_uninstall/controls/ruby_uninstall.rb +++ b/test/integration/ruby_uninstall/controls/ruby_uninstall.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true -global_system_ruby = '2.5.1' +global_system_julia = '2.5.1' control 'Ruby uninstall' do title 'Ruby should be uninstalled' - desc "#{global_system_ruby} should be uninstalled" - describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do + desc "#{global_system_julia} should be uninstalled" + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do its('exit_status') { should eq 0 } - its('stdout') { should_not match(/#{Regexp.quote(global_system_ruby)}/) } + its('stdout') { should_not match(/#{Regexp.quote(global_system_julia)}/) } end end diff --git a/test/integration/ruby_uninstall/inspec.yml b/test/integration/ruby_uninstall/inspec.yml index 4ed195d7..54308715 100644 --- a/test/integration/ruby_uninstall/inspec.yml +++ b/test/integration/ruby_uninstall/inspec.yml @@ -1,5 +1,5 @@ -name: rbenv -title: rbenv profile +name: jlenv +title: jlenv profile maintainer: Sous Chefs license: Apache-2.0 summary: Verifies that Rubies can be uninstalled diff --git a/test/integration/system_install/controls/system_install.rb b/test/integration/system_install/controls/system_install.rb index 0b418885..d0896665 100644 --- a/test/integration/system_install/controls/system_install.rb +++ b/test/integration/system_install/controls/system_install.rb @@ -1,18 +1,18 @@ # frozen_string_literal: true -control 'Rbenv system install' do - title 'Rbenv should be installed system wide' +control 'Jlenv system install' do + title 'Jlenv should be installed system wide' - desc 'Rbenv should be installed and run successfully' - describe bash('source /etc/profile.d/rbenv.sh && rbenv versions --bare') do + desc 'Jlenv should be installed and run successfully' + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do its('exit_status') { should eq 0 } end end -control 'Rbenv system path' do - title 'Rbenv should be installed in the system wide location' +control 'Jlenv system path' do + title 'Jlenv should be installed in the system wide location' - describe file('/usr/local/rbenv') do + describe file('/usr/local/jlenv') do it { should exist } it { should be_directory } end diff --git a/test/integration/system_install/inspec.yml b/test/integration/system_install/inspec.yml index 2476593d..6bc361ff 100644 --- a/test/integration/system_install/inspec.yml +++ b/test/integration/system_install/inspec.yml @@ -1,9 +1,9 @@ -name: rbenv -title: rbenv profile +name: jlenv +title: jlenv profile maintainer: Sous Chefs copyright: Webb Agile Solutions Ltd. license: Apache-2.0 -summary: Verifies rbenv is installed correctly system wide +summary: Verifies jlenv is installed correctly system wide version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/user_install/controls/user_install.rb b/test/integration/user_install/controls/user_install.rb index 88c5aab1..416104df 100644 --- a/test/integration/user_install/controls/user_install.rb +++ b/test/integration/user_install/controls/user_install.rb @@ -1,37 +1,37 @@ # frozen_string_literal: true -global_ruby = '2.4.1' +global_julia = '2.4.1' -control 'Rbenv should be installed' do - title 'Rbenv should be installed to the users home directory' +control 'Jlenv should be installed' do + title 'Jlenv should be installed to the users home directory' - desc 'Rbenv should be installed' - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv global"') do + desc 'Jlenv should be installed' + describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv global"') do its('exit_status') { should eq 0 } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end - describe file('/home/vagrant/.rbenv/versions') do + describe file('/home/vagrant/.jlenv/versions') do it { should exist } it { should be_writable.by_user('vagrant') } end end -control 'ruby-build plugin should be installed' do - title 'ruby-build should be installed to the users home directory' - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv install -l"') do +control 'julia-build plugin should be installed' do + title 'julia-build should be installed to the users home directory' + describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv install -l"') do its('exit_status') { should eq 0 } its('stdout') { should include('2.3.4') } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end end control 'Global Ruby' do - title 'Rbenv should be installed globally' + title 'Jlenv should be installed globally' - desc "Can set global Ruby version to #{global_ruby}" - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/rbenv.sh && rbenv versions --bare"') do + desc "Can set global Ruby version to #{global_julia}" + describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv versions --bare"') do its('exit_status') { should eq 0 } - its('stdout') { should include(global_ruby) } + its('stdout') { should include(global_julia) } end end diff --git a/test/integration/user_install/inspec.yml b/test/integration/user_install/inspec.yml index 354eed0b..e8ffa5e3 100644 --- a/test/integration/user_install/inspec.yml +++ b/test/integration/user_install/inspec.yml @@ -1,9 +1,9 @@ -name: rbenv -title: rbenv profile +name: jlenv +title: jlenv profile maintainer: Sous Chefs copyright: Webb Agile Solutions Ltd. license: Apache-2.0 -summary: Verifies rbenv is installed correctly for a user +summary: Verifies jlenv is installed correctly for a user version: 1.0.0 supports: - os-family: linux diff --git a/test/unit/default_spec.rb b/test/unit/default_spec.rb index f0ec1437..7e5ef68b 100644 --- a/test/unit/default_spec.rb +++ b/test/unit/default_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'ruby_rbenv::default' do +describe 'jlenv-cookbook::default' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/system_install_spec.rb b/test/unit/system_install_spec.rb index e8876dcb..a1515d55 100644 --- a/test/unit/system_install_spec.rb +++ b/test/unit/system_install_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'ruby_rbenv::system_install' do +describe 'jlenv-cookbook::system_install' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/system_spec.rb b/test/unit/system_spec.rb index 075f681a..3e0653f3 100644 --- a/test/unit/system_spec.rb +++ b/test/unit/system_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'ruby_rbenv::system' do +describe 'jlenv-cookbook::system' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/user_install_spec.rb b/test/unit/user_install_spec.rb index fb4fdc25..3ac33e89 100644 --- a/test/unit/user_install_spec.rb +++ b/test/unit/user_install_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'ruby_rbenv::user_install' do +describe 'jlenv-cookbook::user_install' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/user_spec.rb b/test/unit/user_spec.rb index e5b3c2a6..f17a5996 100644 --- a/test/unit/user_spec.rb +++ b/test/unit/user_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'ruby_rbenv::user' do +describe 'jlenv-cookbook::user' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end From 8903063fbc57d289f4009a2792143af83de193d6 Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Wed, 3 Jul 2019 14:27:44 +1000 Subject: [PATCH 009/105] Add further mass Julia refactor. --- .gitignore | 2 +- README.md | 20 ++++----- resources/julia.rb | 2 +- templates/{rbenv.sh.erb => jlenv.sh.erb} | 0 .../custom_group_install/controls/default.rb | 6 +-- .../custom_group_install/inspec.yml | 4 +- test/integration/gem/controls/gem_install.rb | 42 ------------------- test/integration/gem/inspec.yml | 9 ---- .../global/controls/global_install.rb | 4 +- test/integration/global/inspec.yml | 6 +-- .../controls/julia_uninstall.rb} | 6 +-- .../inspec.yml | 4 +- test/integration/system_install/inspec.yml | 4 +- .../user_install/controls/user_install.rb | 6 +-- test/integration/user_install/inspec.yml | 4 +- 15 files changed, 34 insertions(+), 85 deletions(-) rename templates/{rbenv.sh.erb => jlenv.sh.erb} (100%) delete mode 100644 test/integration/gem/controls/gem_install.rb delete mode 100644 test/integration/gem/inspec.yml rename test/integration/{ruby_uninstall/controls/ruby_uninstall.rb => julia_uninstall/controls/julia_uninstall.rb} (75%) rename test/integration/{ruby_uninstall => julia_uninstall}/inspec.yml (57%) diff --git a/.gitignore b/.gitignore index d71bc47b..00110fec 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ _Store .julia-version .julia-gemset .rvmrc -Gemfile.lock +Pkgfile.lock .bundle *.gem diff --git a/README.md b/README.md index db7afe7f..e9b58315 100755 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ A `jlenv_system_install` or `jlenv_user_install` is required to be set so that j System wide installations of jlenv are supported by this cookbook, but discouraged by the jlenv maintainer, see [these][https://github.com/rbenv/rbenv/issues/38] [two][https://github.com/rbenv/rbenv/issues/306] issues in the rbenv repository. -## Gem +## Pkg Used to install a package into the selected jlenv environment. @@ -44,8 +44,8 @@ Used to install a package into the selected jlenv environment. jlenv_package 'pkg_name' do options # Optional: Options to pass to the packagecommand e.g. '--no-rdoc --no-ri' source # Optional: source URL/location for gem. - timeout # Optional: Gem install timeout - version # Optional: Gem version to install + timeout # Optional: Pkg install timeout + version # Optional: Pkg version to install response_file # Optional: response file to reconfigure a gem jlenv_version # Required: Which jlenv version to install the packageto. user # Which user to install packageto. REQUIRED if you're using jlenv_user_install @@ -57,7 +57,7 @@ end Sets the global julia version. The name of the resource is the version to set. ```julia -jlenv_global '2.5.1' do +jlenv_global '1.1.0' do user # Optional: if passed sets the users global version. Leave unset, to set the system global version end ``` @@ -82,24 +82,24 @@ If user is passed in, the plugin is installed to the users install of jlenv. ```julia jlenv_rehash 'rehash' do - user 'vagrant' # Optional: if passed rehashes the user Ruby otherwise rehashes the system jlenv + user 'vagrant' # Optional: if passed rehashes the user Julia otherwise rehashes the system jlenv end ``` -If user is passed in, the user Ruby is rehashed rather than the system Ruby. +If user is passed in, the user Julia is rehashed rather than the system Julia. -## Ruby +## Julia -Installs a given Ruby version to the system or user location. +Installs a given Julia version to the system or user location. ```julia -jlenv_julia '2.5.1' do +jlenv_julia '1.1.0' do user # Optional, but recommended: If passed, the user to install jlenv to jlenv_action # Optional: the action to perform, 'install' (default), 'uninstall' etc end ``` -Shorter example `jlenv_julia '2.5.1'` +Shorter example `jlenv_julia '1.1.0'` ## Script diff --git a/resources/julia.rb b/resources/julia.rb index 0ce65f02..44a3e4e1 100644 --- a/resources/julia.rb +++ b/resources/julia.rb @@ -37,7 +37,7 @@ install_start = Time.now - Chef::Log.info("Building Ruby #{new_resource.version}, this could take a while...") + Chef::Log.info("Building Julia #{new_resource.version}, this could take a while...") jlenv_plugin 'julia-build' do git_url new_resource.julia_build_git_url diff --git a/templates/rbenv.sh.erb b/templates/jlenv.sh.erb similarity index 100% rename from templates/rbenv.sh.erb rename to templates/jlenv.sh.erb diff --git a/test/integration/custom_group_install/controls/default.rb b/test/integration/custom_group_install/controls/default.rb index 37dc0e06..bd8350d7 100644 --- a/test/integration/custom_group_install/controls/default.rb +++ b/test/integration/custom_group_install/controls/default.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -global_julia = '2.4.1' +global_julia = '1.0.1' control 'Jlenv should be installed' do title 'Jlenv should be installed to the users home directory' @@ -33,10 +33,10 @@ end end -control 'Global Ruby' do +control 'Global Julia' do title 'Jlenv should be installed globally' - desc "Can set global Ruby version to #{global_julia}" + desc "Can set global Julia version to #{global_julia}" describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv versions --bare"') do its('exit_status') { should eq 0 } its('stdout') { should include(global_julia) } diff --git a/test/integration/custom_group_install/inspec.yml b/test/integration/custom_group_install/inspec.yml index e8cb51af..2f749fd8 100644 --- a/test/integration/custom_group_install/inspec.yml +++ b/test/integration/custom_group_install/inspec.yml @@ -1,7 +1,7 @@ name: jlenv title: jlenv profile -maintainer: Sous Chefs -copyright: Webb Agile Solutions Ltd. +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC license: Apache-2.0 summary: Verifies jlenv is installed correctly for a user & group version: 1.0.0 diff --git a/test/integration/gem/controls/gem_install.rb b/test/integration/gem/controls/gem_install.rb deleted file mode 100644 index 53e3564d..00000000 --- a/test/integration/gem/controls/gem_install.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true -global_julia = '2.4.1' - -control 'Global Gem Install' do - title 'Should install Mail Gem globally' - - desc "Can set global Ruby version to #{global_julia}" - describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do - its('exit_status') { should eq 0 } - its('stdout') { should include(global_julia) } - end - - desc '2.3.1 Gem should have mail installed' - describe bash('/usr/local/jlenv/versions/2.3.1/bin/package list --local mail') do - its('exit_status') { should eq 0 } - its('stdout') { should include('2.6.5') } - its('stdout') { should_not include('2.6.6') } - end - - desc '2.4.1 Gem should not have any mail version installed' - describe bash('/usr/local/jlenv/versions/2.4.1/bin/package list --local') do - its('exit_status') { should eq 0 } - its('stdout') { should_not include('2.6.5') } - its('stdout') { should_not include('2.6.6') } - end - - desc 'package home should be jlenv in an jlenv directory' - describe bash('source /etc/profile.d/jlenv.sh && package env home') do - its('exit_status') { should eq 0 } - its('stdout') { should include("/usr/local/jlenv/versions/#{global_julia}/lib/julia/gems/2.4.0") } - end -end - -control 'User Gem Install' do - title 'Should install Bundler Gem to a user home' - - desc 'Gemspec file should have correct ownership' - describe file('/home/vagrant/.jlenv/versions/2.3.1/lib/julia/gems/2.3.0/specifications/bundler-1.15.4.gemspec') do - it { should exist } - it { should be_owned_by 'vagrant' } - end -end diff --git a/test/integration/gem/inspec.yml b/test/integration/gem/inspec.yml deleted file mode 100644 index 7f7299df..00000000 --- a/test/integration/gem/inspec.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: jlenv -title: jlenv profile -maintainer: Sous Chefs -copyright: Webb Agile Solutions Ltd. -license: Apache-2.0 -summary: Verifies gems install correctly to the correct Ruby versions -version: 1.0.0 -supports: - - os-family: linux diff --git a/test/integration/global/controls/global_install.rb b/test/integration/global/controls/global_install.rb index 58e5cde7..129f3ee2 100644 --- a/test/integration/global/controls/global_install.rb +++ b/test/integration/global/controls/global_install.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -global_julia = '2.4.1' +global_julia = '1.0.1' control 'Jlenv should be installed' do title 'Jlenv should be installed globally' - desc "Can set global Ruby version to #{global_julia}" + desc "Can set global Julia version to #{global_julia}" describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do its('exit_status') { should eq 0 } its('stdout') { should include(global_julia) } diff --git a/test/integration/global/inspec.yml b/test/integration/global/inspec.yml index 85f6ee3f..d0c86de8 100644 --- a/test/integration/global/inspec.yml +++ b/test/integration/global/inspec.yml @@ -1,9 +1,9 @@ name: jlenv title: jlenv profile -maintainer: Sous Chefs -copyright: Webb Agile Solutions Ltd. +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv correctly sets the global Ruby version +summary: Verifies jlenv correctly sets the global Julia version version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/ruby_uninstall/controls/ruby_uninstall.rb b/test/integration/julia_uninstall/controls/julia_uninstall.rb similarity index 75% rename from test/integration/ruby_uninstall/controls/ruby_uninstall.rb rename to test/integration/julia_uninstall/controls/julia_uninstall.rb index 4bc34e1e..0a6f778c 100644 --- a/test/integration/ruby_uninstall/controls/ruby_uninstall.rb +++ b/test/integration/julia_uninstall/controls/julia_uninstall.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -global_system_julia = '2.5.1' +global_system_julia = '1.1.0' -control 'Ruby uninstall' do - title 'Ruby should be uninstalled' +control 'Julia uninstall' do + title 'Julia should be uninstalled' desc "#{global_system_julia} should be uninstalled" describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do diff --git a/test/integration/ruby_uninstall/inspec.yml b/test/integration/julia_uninstall/inspec.yml similarity index 57% rename from test/integration/ruby_uninstall/inspec.yml rename to test/integration/julia_uninstall/inspec.yml index 54308715..892a3454 100644 --- a/test/integration/ruby_uninstall/inspec.yml +++ b/test/integration/julia_uninstall/inspec.yml @@ -1,8 +1,8 @@ name: jlenv title: jlenv profile -maintainer: Sous Chefs +maintainer: Taqtiqa LLC license: Apache-2.0 -summary: Verifies that Rubies can be uninstalled +summary: Verifies that Julias can be uninstalled version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/system_install/inspec.yml b/test/integration/system_install/inspec.yml index 6bc361ff..3e49103a 100644 --- a/test/integration/system_install/inspec.yml +++ b/test/integration/system_install/inspec.yml @@ -1,7 +1,7 @@ name: jlenv title: jlenv profile -maintainer: Sous Chefs -copyright: Webb Agile Solutions Ltd. +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC license: Apache-2.0 summary: Verifies jlenv is installed correctly system wide version: 1.0.0 diff --git a/test/integration/user_install/controls/user_install.rb b/test/integration/user_install/controls/user_install.rb index 416104df..5b711c28 100644 --- a/test/integration/user_install/controls/user_install.rb +++ b/test/integration/user_install/controls/user_install.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -global_julia = '2.4.1' +global_julia = '1.0.1' control 'Jlenv should be installed' do title 'Jlenv should be installed to the users home directory' @@ -26,10 +26,10 @@ end end -control 'Global Ruby' do +control 'Global Julia' do title 'Jlenv should be installed globally' - desc "Can set global Ruby version to #{global_julia}" + desc "Can set global Julia version to #{global_julia}" describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv versions --bare"') do its('exit_status') { should eq 0 } its('stdout') { should include(global_julia) } diff --git a/test/integration/user_install/inspec.yml b/test/integration/user_install/inspec.yml index e8ffa5e3..7b040fa1 100644 --- a/test/integration/user_install/inspec.yml +++ b/test/integration/user_install/inspec.yml @@ -1,7 +1,7 @@ name: jlenv title: jlenv profile -maintainer: Sous Chefs -copyright: Webb Agile Solutions Ltd. +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC license: Apache-2.0 summary: Verifies jlenv is installed correctly for a user version: 1.0.0 From 6da8d4a21c6fde5d92d37009e95aa19b9e173468 Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Wed, 3 Jul 2019 15:50:47 +1000 Subject: [PATCH 010/105] Add cirleci orb by sous-chefs. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a712fb7d..2bc52b6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: jlenv/kitchen@1.0.1 + kitchen: sous-chefs/kitchen@2.0.2 workflows: kitchen: From 0186c9dc13ea986a9986632cdb623ea48bdefe78 Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Wed, 3 Jul 2019 15:59:14 +1000 Subject: [PATCH 011/105] Update cirleci orb version. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2bc52b6b..36cae2c7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: sous-chefs/kitchen@2.0.2 + kitchen: sous-chefs/kitchen@1.0.1 workflows: kitchen: From 2fd7dab00e39babea23eb14e102f6b2e8545471b Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Thu, 4 Jul 2019 10:34:23 +1000 Subject: [PATCH 012/105] Add contributors bot and docs. --- .circleci/config.yml | 2 +- CONTRIBUTING.md | 9 ++++++++- README.md | 37 ++++++++++--------------------------- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 36cae2c7..2bc52b6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: sous-chefs/kitchen@1.0.1 + kitchen: sous-chefs/kitchen@2.0.2 workflows: kitchen: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad60f136..f3eb280a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,9 +3,16 @@ We are glad you want to contribute to the sysctl cookbook! The first step is the desire to improve the project. +## Recognizing All Contributors +This project follows the [All Contributors](https://allcontributors.org/docs/en/overview) specification for recognizing contributors to an open source project in a way that recognizes different types of contributions, not just code. + +### Adding a contributor +Contributors are encouraged to add themselves to the list using the [All Contributors (Git Hub) bot](https://allcontributors.org/docs/en/bot/overview). +See the bot [usage instructions](https://allcontributors.org/docs/en/bot/usage)). + ## Quick-contribute -* Create an issue on the github [issue tracker](https://github.com/sous-chefs/sysctl/issues) +* Create an issue on the github [issue tracker](https://github.com/jlenv/jlenv/issues) * Link to your patch as a rebased git branch or pull request from the ticket We regularly review contributions and will get back to you if we have diff --git a/README.md b/README.md index e9b58315..51578167 100755 --- a/README.md +++ b/README.md @@ -3,10 +3,11 @@ [![Cookbook Version](https://img.shields.io/cookbook/v/jlenv-cookbook.svg)](https://supermarket.chef.io/cookbooks/jlenv-cookbook) [![Build Status](https://img.shields.io/circleci/project/github/jlenv/jlenv-cookbook/master.svg)](https://circleci.com/gh/jlenv/jlenv-cookbook) [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) +[![CircleCI](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook.svg?style=svg)](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook) ## Description -Manages [jlenv][https://github.com/jlenv] and its installed Julias. +Manages [jlenv][https://github.com/jlenv/jlenv] installed Julias. ## Maintainers @@ -25,6 +26,7 @@ This cookbook requires Chef 13.0+. - macOS (not currently tested) - RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux) - openSUSE and openSUSE leap +- Windows (not supported) # Usage @@ -32,9 +34,12 @@ This cookbook requires Chef 13.0+. Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. -A `jlenv_system_install` or `jlenv_user_install` is required to be set so that jlenv knows which version you want to use, and is installed on the system. +A `jlenv_user_install` is required to be set so that jlenv knows which version you want to use, and is installed on the system. -System wide installations of jlenv are supported by this cookbook, but discouraged by the jlenv maintainer, see [these][https://github.com/rbenv/rbenv/issues/38] [two][https://github.com/rbenv/rbenv/issues/306] issues in the rbenv repository. +#### NOTE: +> System wide installations of jlenv are discouraged by the jlenv maintainer. + +However they are supported by this cookbook, see [these][https://github.com/rbenv/rbenv/issues/38] [two][https://github.com/rbenv/rbenv/issues/306] issues in the rbenv repository for the reasons why. ## Pkg @@ -54,7 +59,7 @@ end ## Global -Sets the global julia version. The name of the resource is the version to set. +Sets the global Julia version. The name of the resource is the version to set. ```julia jlenv_global '1.1.0' do @@ -163,31 +168,9 @@ This cookbook takes advantage of managing profile fragments in an `/etc/profile. Pull requests are very welcome! Make sure your patches are well tested. ## Contributors -
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
-This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) - -### Backers - -Thank you to all our backers! - -![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) - -### Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. - -![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) -![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) +This project exists thanks to all the people who contribute. From 570807a8fc29e56c7b7767799539d4d52ca6a60d Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Thu, 4 Jul 2019 10:59:03 +1000 Subject: [PATCH 013/105] Add contributors bot config file. --- .all-contributorsrc.txt | 8 ++++++++ README.md | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .all-contributorsrc.txt diff --git a/.all-contributorsrc.txt b/.all-contributorsrc.txt new file mode 100644 index 00000000..de1853fb --- /dev/null +++ b/.all-contributorsrc.txt @@ -0,0 +1,8 @@ +{ + "files": ["README.md"], + "imageSize": 100, + "contributorsPerLine": 7, + "badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square)](#contributors)", + "contributorTemplate": "<%= avatarBlock %>
<%= contributions %>", + "contributors": [] +} \ No newline at end of file diff --git a/README.md b/README.md index 51578167..b5387627 100755 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ ## Description -Manages [jlenv][https://github.com/jlenv/jlenv] installed Julias. +Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. ## Maintainers -This cookbook is maintained by volunteers. Contributions and bug reports are welcome. +This cookbook is maintained by volunteers. [All contributions and bug reports are welcome](./CONTRIBUTING). ## Requirements From 48af432cd10e849f61c140b5db141b7696399a1b Mon Sep 17 00:00:00 2001 From: taqtiqa-mark Date: Thu, 4 Jul 2019 11:38:22 +1000 Subject: [PATCH 014/105] Revise circleci orb version. --- .all-contributorsrc.txt | 8 -------- .circleci/config.yml | 2 +- README.md | 2 +- TESTING.md | 2 -- libraries/helpers.rb | 4 +++- libraries/package_deps.rb | 25 ++----------------------- resources/global.rb | 2 +- resources/julia.rb | 2 +- resources/rehash.rb | 2 +- resources/system_install.rb | 4 ++-- resources/user_install.rb | 4 ++-- 11 files changed, 14 insertions(+), 43 deletions(-) delete mode 100644 .all-contributorsrc.txt diff --git a/.all-contributorsrc.txt b/.all-contributorsrc.txt deleted file mode 100644 index de1853fb..00000000 --- a/.all-contributorsrc.txt +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files": ["README.md"], - "imageSize": 100, - "contributorsPerLine": 7, - "badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square)](#contributors)", - "contributorTemplate": "<%= avatarBlock %>
<%= contributions %>", - "contributors": [] -} \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 2bc52b6b..36cae2c7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: sous-chefs/kitchen@2.0.2 + kitchen: sous-chefs/kitchen@1.0.1 workflows: kitchen: diff --git a/README.md b/README.md index b5387627..ea5d608c 100755 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ Installs jlenv to the system location, by default `/usr/local/jlenv` jlenv_system_install 'foo' do git_url # URL of the plugin repo you want to checkout git_ref # Optional: Git reference to checkout - update_rbenv # Optional: Keeps the git repo up to date + update_jlenv # Optional: Keeps the git repo up to date end ``` diff --git a/TESTING.md b/TESTING.md index 789e5e0e..47d11c59 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,5 +1,3 @@ -Please refer to -https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD # Testing Please refer to the [community cookbook documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD). diff --git a/libraries/helpers.rb b/libraries/helpers.rb index ad0ced20..5e485819 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -3,8 +3,10 @@ # Library:: Chef::Jlenv::ShellHelpers # # Author:: Fletcher Nichol +# Author:: Mark Van de Vyver # # Copyright:: 2011-2017, Fletcher Nichol +# Copyright:: 2019, Mark Van de Vyver # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,7 +42,7 @@ def root_path end end - def which_rbenv + def which_jlenv "(#{new_resource.user || 'system'})" end diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index 1349023e..ebddfe1e 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -3,37 +3,16 @@ module Jlenv module PackageDeps def install_julia_dependencies case ::File.basename(new_resource.version) - when /^jjulia-/ - package jjulia_package_deps + when /^special-julia-/ + # call another package install method else package_deps.each do |deps| package deps end end - ensure_java_environment if new_resource.version =~ /^jjulia-/ end - def ensure_java_environment - resource_collection.find( - 'julia_block[update-java-alternatives]' - ).run_action(:create) - rescue Chef::Exceptions::ResourceNotFound - # have pity on my soul - Chef::Log.info 'The java cookbook does not appear to in the run_list.' - end - - def jjulia_package_deps - case node['platform_family'] - when 'rhel', 'fedora', 'amazon' - %w(make gcc-c++) - when 'debian' - %w(make g++) - when 'freebsd' - %w(alsa-lib bash dejavu expat fixesproto fontconfig freetype2 gettext-runtime giflib indexinfo inputproto java-zoneinfo javavmwrapper kbproto libICE libSM libX11 libXau libXdmcp libXext libXfixes libXi libXrender libXt libXtst libfontenc libpthread-stubs libxcb libxml2 mkfontdir mkfontscale openjdk8 recordproto renderproto xextproto xproto) - end - end - def package_deps case node['platform_family'] when 'mac_os_x' diff --git a/resources/global.rb b/resources/global.rb index 9960e79f..7232df17 100644 --- a/resources/global.rb +++ b/resources/global.rb @@ -42,7 +42,7 @@ # e.g. "jlenv global" should return the version we set action :create do - jlenv_script "globals #{which_rbenv}" do + jlenv_script "globals #{which_jlenv}" do code "jlenv global #{new_resource.jlenv_version}" user new_resource.user if new_resource.user action :run diff --git a/resources/julia.rb b/resources/julia.rb index 44a3e4e1..6a461908 100644 --- a/resources/julia.rb +++ b/resources/julia.rb @@ -58,7 +58,7 @@ command << " #{new_resource.version}" command << ' --verbose' if new_resource.verbose - jlenv_script "#{command} #{which_rbenv}" do + jlenv_script "#{command} #{which_jlenv}" do code command user new_resource.user if new_resource.user environment new_resource.environment if new_resource.environment diff --git a/resources/rehash.rb b/resources/rehash.rb index 1f0b4b72..8a94c44b 100644 --- a/resources/rehash.rb +++ b/resources/rehash.rb @@ -27,7 +27,7 @@ property :user, String action :run do - jlenv_script "jlenv rehash #{which_rbenv}" do + jlenv_script "jlenv rehash #{which_jlenv}" do code %(jlenv rehash) user new_resource.user if new_resource.user action :run diff --git a/resources/system_install.rb b/resources/system_install.rb index 1e1cd97c..ed96b238 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -27,7 +27,7 @@ property :git_url, String, default: 'https://github.com/rbenv/rbenv.git' property :git_ref, String, default: 'master' property :global_prefix, String, default: '/usr/local/jlenv' -property :update_rbenv, [true, false], default: true +property :update_jlenv, [true, false], default: true action :install do node.run_state['root_path'] ||= {} @@ -51,7 +51,7 @@ git new_resource.global_prefix do repository new_resource.git_url reference new_resource.git_ref - action :checkout if new_resource.update_rbenv == false + action :checkout if new_resource.update_jlenv == false notifies :run, 'julia_block[Add jlenv to PATH]', :immediately notifies :run, 'bash[Initialize system jlenv]', :immediately end diff --git a/resources/user_install.rb b/resources/user_install.rb index 8e2df27f..ce6b18af 100644 --- a/resources/user_install.rb +++ b/resources/user_install.rb @@ -30,7 +30,7 @@ property :group, String, default: lazy { user } property :home_dir, String, default: lazy { ::File.expand_path("~#{user}") } property :user_prefix, String, default: lazy { ::File.join(home_dir, '.jlenv') } -property :update_rbenv, [true, false], default: true +property :update_jlenv, [true, false], default: true action :install do package package_prerequisites @@ -51,7 +51,7 @@ git new_resource.user_prefix do repository new_resource.git_url reference new_resource.git_ref - action :checkout if new_resource.update_rbenv == false + action :checkout if new_resource.update_jlenv == false user new_resource.user group new_resource.group notifies :run, 'julia_block[Add jlenv to PATH]', :immediately From 102c8685d97f36f469b3a5c51f45100b78991555 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 15 Jul 2019 18:04:54 +1000 Subject: [PATCH 015/105] Add taqtiqa's kitchen Orb. --- .circleci/config.yml | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 36cae2c7..e0a58677 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: sous-chefs/kitchen@1.0.1 + kitchen: taqtiqa/kitchen@1.1.0 workflows: kitchen: diff --git a/README.md b/README.md index ea5d608c..cb85514f 100755 --- a/README.md +++ b/README.md @@ -162,8 +162,8 @@ This cookbook takes advantage of managing profile fragments in an `/etc/profile. ## Development -- Source hosted at [GitHub][repo] -- Report issues/Questions/Feature requests on [GitHub Issues][issues] +- Source hosted at [GitHub][https://github.com/jlenv/jlenv-cookbook] +- Report issues/Questions/Feature requests on [GitHub Issues][https://github.com/jlenv/jlenv-cookbook/issues] Pull requests are very welcome! Make sure your patches are well tested. From 4a6b02008ca3ff42f373fe32b9b6de9ace934ca5 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 15 Jul 2019 18:22:21 +1000 Subject: [PATCH 016/105] Fix circleci use of lint. --- .circleci/config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e0a58677..e4839004 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,8 +9,10 @@ workflows: - kitchen/danger: name: danger context: Danger - - kitchen/lint: - name: lint + - kitchen/mdlint: + name: mdlint + - kitchen/yamllint: + name: yamllint - kitchen/dokken-single: suite: global platform: debian-8 From a1ebc1d9a91719f34683997faccee4ac3e600074 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 15 Jul 2019 18:32:54 +1000 Subject: [PATCH 017/105] Fix lint requirements. --- .circleci/config.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e4839004..214944fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,59 +17,59 @@ workflows: suite: global platform: debian-8 name: global-debian-8 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global platform: debian-9 name: global-debian-9 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global platform: centos-6 name: global-centos-6 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global platform: centos-7 name: global-centos-7 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global platform: ubuntu-1604 name: global-ubuntu-1604 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global platform: ubuntu-1804 name: global-ubuntu-1804 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global platform: opensuse-leap name: global-opensuse-leap - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: system-install suite: system-install platform: centos-7 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: user-install suite: user-install platform: centos-7 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: pkg suite: pkg platform: centos-7 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: julia-uninstall suite: julia-uninstall platform: ubuntu-1804 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: custom-group suite: custom-group-install platform: centos-7 - requires: [lint, danger] + requires: [mdlint, yamllint, danger] \ No newline at end of file From bb9d8054f8cd494467aa3ffe4ac30038b81ec01e Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 15 Jul 2019 19:43:17 +1000 Subject: [PATCH 018/105] Remove platform parameter. --- .circleci/config.yml | 56 ++++++++++---------------------------------- 1 file changed, 12 insertions(+), 44 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 214944fe..4c6f0304 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,63 +13,31 @@ workflows: name: mdlint - kitchen/yamllint: name: yamllint - - kitchen/dokken-single: + - kitchen/dokken: suite: global - platform: debian-8 - name: global-debian-8 + name: global requires: [mdlint, yamllint, danger] - kitchen/dokken-single: - suite: global - platform: debian-9 - name: global-debian-9 - requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - suite: global - platform: centos-6 - name: global-centos-6 - requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - suite: global - platform: centos-7 - name: global-centos-7 - requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - suite: global - platform: ubuntu-1604 - name: global-ubuntu-1604 - requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - suite: global - platform: ubuntu-1804 - name: global-ubuntu-1804 - requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - suite: global - platform: opensuse-leap + suite: global-opensuse-leap name: global-opensuse-leap requires: [mdlint, yamllint, danger] - kitchen/dokken-single: - name: system-install - suite: system-install - platform: centos-7 + name: system-install-centos-7 + suite: system-install-centos-7 requires: [mdlint, yamllint, danger] - kitchen/dokken-single: - name: user-install - suite: user-install - platform: centos-7 + name: user-install-centos-7 + suite: user-install-centos-7 requires: [mdlint, yamllint, danger] - kitchen/dokken-single: - name: pkg - suite: pkg - platform: centos-7 + name: pkg-centos-7 + suite: pkg-centos-7 requires: [mdlint, yamllint, danger] - kitchen/dokken-single: - name: julia-uninstall - suite: julia-uninstall - platform: ubuntu-1804 + name: julia-uninstall-ubuntu-1804 + suite: julia-uninstall-ubuntu-1804 requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: custom-group - suite: custom-group-install - platform: centos-7 + suite: custom-group-install-centos-7 requires: [mdlint, yamllint, danger] \ No newline at end of file From daa7e6e9adbe17f79e1fd97cff84d3b2a7d69a55 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 07:57:50 +1000 Subject: [PATCH 019/105] Add yaml start file decoration. --- .circleci/config.yml | 3 ++- .github/lock.yml | 1 + .kitchen.appveyor.yml | 1 + .kitchen.dokken.yml | 1 + .kitchen.yml | 1 + .rubocop.yml | 1 + appveyor.yml | 1 + test/integration/custom_group_install/inspec.yml | 1 + test/integration/global/inspec.yml | 1 + test/integration/julia_uninstall/inspec.yml | 1 + test/integration/system_install/inspec.yml | 1 + test/integration/user_install/inspec.yml | 1 + 12 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4c6f0304..fe153786 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,4 +40,5 @@ workflows: - kitchen/dokken-single: name: custom-group suite: custom-group-install-centos-7 - requires: [mdlint, yamllint, danger] \ No newline at end of file + requires: [mdlint, yamllint, danger] + \ No newline at end of file diff --git a/.github/lock.yml b/.github/lock.yml index 97037158..04daddc9 100644 --- a/.github/lock.yml +++ b/.github/lock.yml @@ -1,3 +1,4 @@ +--- # Configuration for lock-threads - https://github.com/dessant/lock-threads # Number of days of inactivity before a closed issue or pull request is locked diff --git a/.kitchen.appveyor.yml b/.kitchen.appveyor.yml index cb328cc0..a29423a8 100644 --- a/.kitchen.appveyor.yml +++ b/.kitchen.appveyor.yml @@ -1,3 +1,4 @@ +--- driver: name: proxy host: localhost diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml index ccb51566..8e8d0a56 100644 --- a/.kitchen.dokken.yml +++ b/.kitchen.dokken.yml @@ -1,3 +1,4 @@ +--- driver: name: dokken privileged: true diff --git a/.kitchen.yml b/.kitchen.yml index d2a74fdb..48777dc4 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,3 +1,4 @@ +--- driver: name: vagrant diff --git a/.rubocop.yml b/.rubocop.yml index 65620004..d88ffa9f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,4 @@ +--- AllCops: Exclude: - 'Dangerfile' diff --git a/appveyor.yml b/appveyor.yml index 32fe8264..72f5d2f3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,4 @@ +--- environment: machine_user: vagrant machine_pass: vagrant diff --git a/test/integration/custom_group_install/inspec.yml b/test/integration/custom_group_install/inspec.yml index 2f749fd8..27dea8ef 100644 --- a/test/integration/custom_group_install/inspec.yml +++ b/test/integration/custom_group_install/inspec.yml @@ -1,3 +1,4 @@ +--- name: jlenv title: jlenv profile maintainer: Taqtiqa LLC diff --git a/test/integration/global/inspec.yml b/test/integration/global/inspec.yml index d0c86de8..1a025b8e 100644 --- a/test/integration/global/inspec.yml +++ b/test/integration/global/inspec.yml @@ -1,3 +1,4 @@ +--- name: jlenv title: jlenv profile maintainer: Taqtiqa LLC diff --git a/test/integration/julia_uninstall/inspec.yml b/test/integration/julia_uninstall/inspec.yml index 892a3454..9baf31c5 100644 --- a/test/integration/julia_uninstall/inspec.yml +++ b/test/integration/julia_uninstall/inspec.yml @@ -1,3 +1,4 @@ +--- name: jlenv title: jlenv profile maintainer: Taqtiqa LLC diff --git a/test/integration/system_install/inspec.yml b/test/integration/system_install/inspec.yml index 3e49103a..8c646fbf 100644 --- a/test/integration/system_install/inspec.yml +++ b/test/integration/system_install/inspec.yml @@ -1,3 +1,4 @@ +--- name: jlenv title: jlenv profile maintainer: Taqtiqa LLC diff --git a/test/integration/user_install/inspec.yml b/test/integration/user_install/inspec.yml index 7b040fa1..a131fa3e 100644 --- a/test/integration/user_install/inspec.yml +++ b/test/integration/user_install/inspec.yml @@ -1,3 +1,4 @@ +--- name: jlenv title: jlenv profile maintainer: Taqtiqa LLC From 7acc55f132706f8afb40382e4aa5ce8de9585dbe Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:09:41 +1000 Subject: [PATCH 020/105] Add YAML lint fixes. --- .kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 48777dc4..7468c0dc 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,4 +1,4 @@ ---- + --- driver: name: vagrant From 5cf911e8f2b55b4a42cb925520821e0da88adcf7 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:09:55 +1000 Subject: [PATCH 021/105] Add YAML lint fixes. --- .circleci/config.yml | 2 +- .github/lock.yml | 3 ++- .kitchen.dokken.yml | 20 ++++++++++---------- appveyor.yml | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fe153786..6f44b4f8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,4 +41,4 @@ workflows: name: custom-group suite: custom-group-install-centos-7 requires: [mdlint, yamllint, danger] - \ No newline at end of file + \ No newline at end of file diff --git a/.github/lock.yml b/.github/lock.yml index 04daddc9..c2f55d4d 100644 --- a/.github/lock.yml +++ b/.github/lock.yml @@ -4,7 +4,8 @@ # Number of days of inactivity before a closed issue or pull request is locked daysUntilLock: 365 -# Issues and pull requests with these labels will not be locked. Set to `[]` to disable +# Issues and pull requests with these labels will not be locked. Set to `[]` +# to disable exemptLabels: [] # Label to add before locking, such as `outdated`. Set to `false` to disable diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml index 8e8d0a56..feb95a4a 100644 --- a/.kitchen.dokken.yml +++ b/.kitchen.dokken.yml @@ -1,4 +1,4 @@ ---- + --- driver: name: dokken privileged: true @@ -20,16 +20,16 @@ platforms: image: dokken/debian-8 pid_one_command: /sbin/init intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y - name: debian-9 driver: image: dokken/debian-9 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y - name: centos-6 driver: @@ -57,20 +57,20 @@ platforms: image: dokken/ubuntu-16.04 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y - name: ubuntu-18.04 driver: image: dokken/ubuntu-18.04 pid_one_command: /bin/systemd intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y - name: opensuse-leap driver: image: dokken/opensuse-leap pid_one_command: /bin/systemd intermediate_instructions: - - RUN zypper --non-interactive install sudo + - RUN zypper --non-interactive install sudo diff --git a/appveyor.yml b/appveyor.yml index 72f5d2f3..c9f91f96 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,7 @@ branches: # Do not build on tags (GitHub only) skip_tags: true -#faster cloning +# Faster cloning clone_depth: 1 # Install the latest nightly of ChefDK @@ -37,4 +37,4 @@ test_script: - delivery local all - kitchen verify -deploy: off +deploy: false From 5fd72310ce785d69406c1023237f0c3352853798 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:13:50 +1000 Subject: [PATCH 022/105] Fix kitchen YAML lint. --- .kitchen.yml | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 7468c0dc..04bc0fb4 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,41 +1,41 @@ --- -driver: - name: vagrant + driver: + name: vagrant -provisioner: - product_name: chef - product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> - install_strategy: once - deprecations_as_errors: true + provisioner: + product_name: chef + product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> + install_strategy: once + deprecations_as_errors: true -verifier: - name: inspec + verifier: + name: inspec -platforms: - - name: centos-6 - - name: centos-7 - - name: fedora-latest - - name: debian-8 - - name: debian-9 - - name: ubuntu-16.04 - - name: ubuntu-18.04 - - name: opensuse-leap + platforms: + - name: centos-6 + - name: centos-7 + - name: fedora-latest + - name: debian-8 + - name: debian-9 + - name: ubuntu-16.04 + - name: ubuntu-18.04 + - name: opensuse-leap -suites: -- name: pkg - run_list: recipe[test::pkg] - includes: [centos-7] -- name: global - run_list: recipe[test::global] -- name: julia_uninstall - run_list: recipe[test::julia_uninstall] - includes: [ubuntu-18.04] -- name: system_install - run_list: recipe[test::system_install] - includes: [centos-7] -- name: user_install - run_list: recipe[test::user_install] - includes: [centos-7] -- name: custom_group_install - run_list: recipe[test::custom_group_install] - includes: [centos-7] + suites: + - name: pkg + run_list: recipe[test::pkg] + includes: [centos-7] + - name: global + run_list: recipe[test::global] + - name: julia_uninstall + run_list: recipe[test::julia_uninstall] + includes: [ubuntu-18.04] + - name: system_install + run_list: recipe[test::system_install] + includes: [centos-7] + - name: user_install + run_list: recipe[test::user_install] + includes: [centos-7] + - name: custom_group_install + run_list: recipe[test::custom_group_install] + includes: [centos-7] From d184c644bc3f55d93339c9eb4436d1b1c46fd0eb Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:19:37 +1000 Subject: [PATCH 023/105] Add YAML lint fixes. --- .kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 04bc0fb4..226884d7 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,6 +1,6 @@ --- driver: - name: vagrant + - name: vagrant provisioner: product_name: chef From 964a885c086afd2069b044d06cfefb249204c52b Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:26:01 +1000 Subject: [PATCH 024/105] Fix YAML lint. --- .kitchen.yml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 226884d7..488eff99 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,27 +1,27 @@ --- - driver: - - name: vagrant +driver: + name: vagrant - provisioner: - product_name: chef - product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> - install_strategy: once - deprecations_as_errors: true +provisioner: + product_name: chef + product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> + install_strategy: once + deprecations_as_errors: true - verifier: - name: inspec +verifier: + name: inspec - platforms: - - name: centos-6 - - name: centos-7 - - name: fedora-latest - - name: debian-8 - - name: debian-9 - - name: ubuntu-16.04 - - name: ubuntu-18.04 - - name: opensuse-leap +platforms: + - name: centos-6 + - name: centos-7 + - name: fedora-latest + - name: debian-8 + - name: debian-9 + - name: ubuntu-16.04 + - name: ubuntu-18.04 + - name: opensuse-leap - suites: +suites: - name: pkg run_list: recipe[test::pkg] includes: [centos-7] From 9002f75a5a8a61f5bed3046f0694a1909e1b96a2 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:34:08 +1000 Subject: [PATCH 025/105] Fix kitchen YAML. --- .kitchen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kitchen.yml b/.kitchen.yml index 488eff99..29450299 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,4 +1,4 @@ - --- +--- driver: name: vagrant From 64c0126a7d0e82c7c816138143ebc8dcb22249e4 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:37:46 +1000 Subject: [PATCH 026/105] Fix YAML lint. --- .circleci/config.yml | 1 - .github/lock.yml | 2 +- .kitchen.dokken.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6f44b4f8..aa27c2ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -41,4 +41,3 @@ workflows: name: custom-group suite: custom-group-install-centos-7 requires: [mdlint, yamllint, danger] - \ No newline at end of file diff --git a/.github/lock.yml b/.github/lock.yml index c2f55d4d..d59c23ea 100644 --- a/.github/lock.yml +++ b/.github/lock.yml @@ -4,7 +4,7 @@ # Number of days of inactivity before a closed issue or pull request is locked daysUntilLock: 365 -# Issues and pull requests with these labels will not be locked. Set to `[]` +# Issues and pull requests with these labels will not be locked. Set to `[]` # to disable exemptLabels: [] diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml index feb95a4a..6e0d5d38 100644 --- a/.kitchen.dokken.yml +++ b/.kitchen.dokken.yml @@ -1,4 +1,4 @@ - --- +--- driver: name: dokken privileged: true From ab4802eb008a82088a60c93b4fe88f76903b6dad Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:42:56 +1000 Subject: [PATCH 027/105] Fix YAML lint. --- .kitchen.dokken.yml | 123 +++++++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml index 6e0d5d38..0d55e2dc 100644 --- a/.kitchen.dokken.yml +++ b/.kitchen.dokken.yml @@ -3,74 +3,71 @@ driver: name: dokken privileged: true env: [CHEF_LICENSE=accept] - transport: name: dokken - provisioner: name: dokken deprecations_as_errors: true - verifier: name: inspec - platforms: -- name: debian-8 - driver: - image: dokken/debian-8 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - -- name: debian-9 - driver: - image: dokken/debian-9 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - -- name: centos-6 - driver: - image: dokken/centos-6 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN yum -y install sudo - -- name: centos-7 - driver: - image: dokken/centos-7 - pid_one_command: /usr/lib/systemd/systemd - intermediate_instructions: - - RUN yum -y install sudo - -- name: fedora-latest - driver: - image: dokken/fedora-latest - pid_one_command: /usr/lib/systemd/systemd - intermediate_instructions: - - RUN dnf -y install sudo - -- name: ubuntu-16.04 - driver: - image: dokken/ubuntu-16.04 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - -- name: ubuntu-18.04 - driver: - image: dokken/ubuntu-18.04 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - -- name: opensuse-leap - driver: - image: dokken/opensuse-leap - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN zypper --non-interactive install sudo + - + name: debian-8 + driver: + image: dokken/debian-8 + pid_one_command: /sbin/init + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: debian-9 + driver: + image: dokken/debian-9 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: centos-6 + driver: + image: dokken/centos-6 + pid_one_command: /sbin/init + intermediate_instructions: + - RUN yum -y install sudo + - + name: centos-7 + driver: + image: dokken/centos-7 + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN yum -y install sudo + - + name: fedora-latest + driver: + image: dokken/fedora-latest + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN dnf -y install sudo + - + name: ubuntu-16.04 + driver: + image: dokken/ubuntu-16.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: ubuntu-18.04 + driver: + image: dokken/ubuntu-18.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: opensuse-leap + driver: + image: dokken/opensuse-leap + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN zypper --non-interactive install sudo From 8ee0d99efbd4236707f4ce7a022cd0596df066c9 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:47:56 +1000 Subject: [PATCH 028/105] Fix too long YAML to multi-line commands. --- appveyor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c9f91f96..a1b227dd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,9 @@ clone_depth: 1 # Install the latest nightly of ChefDK install: - - ps: iex (irm https://omnitruck.chef.io/install.ps1); Install-Project -Project chefdk -channel stable + - ps: <- + iex (irm https://omnitruck.chef.io/install.ps1) + Install-Project -Project chefdk -channel stable - ps: 'Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version' - ps: $PSVersionTable - c:\opscode\chefdk\bin\chef.bat exec ruby --version From 84aafa65e6ddf0a4e88ba8fdf5d1ea5ddae79219 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 08:58:10 +1000 Subject: [PATCH 029/105] Fix long commands. --- appveyor.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a1b227dd..746d1f8b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,10 +17,8 @@ clone_depth: 1 # Install the latest nightly of ChefDK install: - - ps: <- - iex (irm https://omnitruck.chef.io/install.ps1) - Install-Project -Project chefdk -channel stable - - ps: 'Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version' + - ps: "iex (irm https://omnitruck.chef.io/install.ps1); Install-Project -Project chefdk -channel stable" + - ps: "Get-CimInstance win32_operatingsystem -Property Caption, OSArchitecture, Version | fl Caption, OSArchitecture, Version" - ps: $PSVersionTable - c:\opscode\chefdk\bin\chef.bat exec ruby --version - ps: secedit /export /cfg $env:temp/export.cfg From dc5bdf7512ead26f3dfe149d72ff9ec32d8e617c Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 09:10:39 +1000 Subject: [PATCH 030/105] Add YAML lint config file. --- .circleci/yamllint.cfg | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .circleci/yamllint.cfg diff --git a/.circleci/yamllint.cfg b/.circleci/yamllint.cfg new file mode 100644 index 00000000..2f6c5bfa --- /dev/null +++ b/.circleci/yamllint.cfg @@ -0,0 +1,6 @@ +extends: default +rules: + # Don't fail if > 80 characters + line-length: + max: 80 + level: warning From 143041223601646f0954822070a6ee03fbd180c6 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 09:25:06 +1000 Subject: [PATCH 031/105] Remove yaml lint config in lieu of relaxed setting in orb. --- .circleci/yamllint.cfg | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .circleci/yamllint.cfg diff --git a/.circleci/yamllint.cfg b/.circleci/yamllint.cfg deleted file mode 100644 index 2f6c5bfa..00000000 --- a/.circleci/yamllint.cfg +++ /dev/null @@ -1,6 +0,0 @@ -extends: default -rules: - # Don't fail if > 80 characters - line-length: - max: 80 - level: warning From 65d44cc3d113e5f5a84a55f207c7badecc7d328e Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 09:26:47 +1000 Subject: [PATCH 032/105] Bump kitchen orb in CircleCI. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index aa27c2ca..ef96ce60 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: taqtiqa/kitchen@1.1.0 + kitchen: taqtiqa/kitchen@1.2.0 workflows: kitchen: From 9f4062381fc5336773df8ea5cb764fdbdf3537ff Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 10:12:30 +1000 Subject: [PATCH 033/105] Fix Markdown lint errors --- .mdlrc | 1 + README.md | 58 +++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 .mdlrc diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 00000000..54bea599 --- /dev/null +++ b/.mdlrc @@ -0,0 +1 @@ +rules ~"MD033" \ No newline at end of file diff --git a/README.md b/README.md index cb85514f..edf00d5b 100755 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. ## Maintainers -This cookbook is maintained by volunteers. [All contributions and bug reports are welcome](./CONTRIBUTING). +This cookbook is maintained by volunteers. +[All contributions and bug reports are welcome](./CONTRIBUTING). ## Requirements @@ -28,18 +29,23 @@ This cookbook requires Chef 13.0+. - openSUSE and openSUSE leap - Windows (not supported) -# Usage +## Usage **Please read** Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. -A `jlenv_user_install` is required to be set so that jlenv knows which version you want to use, and is installed on the system. +A `jlenv_user_install` is required to be set so that jlenv knows which version +you want to use, and is installed on the system. -#### NOTE: -> System wide installations of jlenv are discouraged by the jlenv maintainer. +| **NOTE:** | +| System wide installations of jlenv are discouraged by the jlenv maintainer.| +|---| -However they are supported by this cookbook, see [these][https://github.com/rbenv/rbenv/issues/38] [two][https://github.com/rbenv/rbenv/issues/306] issues in the rbenv repository for the reasons why. +However they are supported by this cookbook, see +(these)[https://github.com/rbenv/rbenv/issues/38/] +(two)[https://github.com/rbenv/rbenv/issues/306/] issues in the rbenv repository +for the reasons why. ## Pkg @@ -47,13 +53,13 @@ Used to install a package into the selected jlenv environment. ```julia jlenv_package 'pkg_name' do - options # Optional: Options to pass to the packagecommand e.g. '--no-rdoc --no-ri' + options # Optional: Options for the packagecommand e.g. '--no-rdoc --no-ri' source # Optional: source URL/location for gem. timeout # Optional: Pkg install timeout version # Optional: Pkg version to install response_file # Optional: response file to reconfigure a gem jlenv_version # Required: Which jlenv version to install the packageto. - user # Which user to install packageto. REQUIRED if you're using jlenv_user_install + user # Which user to install for. REQUIRED if you're using jlenv_user_install end ``` @@ -63,11 +69,14 @@ Sets the global Julia version. The name of the resource is the version to set. ```julia jlenv_global '1.1.0' do - user # Optional: if passed sets the users global version. Leave unset, to set the system global version + user # Optional: Sets the users global version. + # Leave unset, to set the system global version. end ``` -If a user is passed in to this resource it sets the global version for the user, under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the system global version. +If a user is passed in to this resource it sets the global version for the user, +under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the +system global version. ## Plugin @@ -77,7 +86,8 @@ Installs a jlenv plugin. jlenv_plugin 'julia-build' do git_url # Git URL of the plugin git_ref # Git reference of the plugin - user # Optional: if passed installs to the users jlenv. Do not set, to set installs to the system jlenv. + user # Optional: Install to the users jlenv. + # Do not set, to set installs to the system jlenv. end ``` @@ -87,7 +97,7 @@ If user is passed in, the plugin is installed to the users install of jlenv. ```julia jlenv_rehash 'rehash' do - user 'vagrant' # Optional: if passed rehashes the user Julia otherwise rehashes the system jlenv + user 'vagrant' # Optional: Rehash the user jlenv otherwise rehash system jlenv end ``` @@ -100,7 +110,8 @@ Installs a given Julia version to the system or user location. ```julia jlenv_julia '1.1.0' do user # Optional, but recommended: If passed, the user to install jlenv to - jlenv_action # Optional: the action to perform, 'install' (default), 'uninstall' etc + jlenv_action # Optional: Action to perform: + # 'install' (default), 'uninstall' etc. end ``` @@ -113,15 +124,18 @@ Runs a jlenv aware script. ```julia jlenv_script 'foo' do jlenv_version #jlenv version to run the script against - environment # Optional: A Hash of environment variables in the form of ({"ENV_VARIABLE" => "VALUE"}). + environment # Optional: Hash of environment variables in the form of + # ({"ENV_VARIABLE" => "VALUE"}). user # Optional: User to run as group # Optional: Group to run as returns # Optional: Expected return code code # Script code to run end ``` + Note that environment overwrites the entire variable. For example. setting the `$PATH` variable can be done like this: + ```julia jlenv_script 'bundle package' do cwd node["bundle_dir"] @@ -129,8 +143,9 @@ jlenv_script 'bundle package' do code "bundle package --all" end ``` -Where `#{ENV["PATH"]}` appends the existing PATH to the end of the newly set PATH. +Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set +`PATH`. ## System_install @@ -152,22 +167,27 @@ Installs jlenv to the user path, making jlenv available to that user only. jlenv_user_install 'vagrant' do git_url # Optional: Git URL to checkout jlenv from. git_ref # Optional: Git reference to checkout e.g. 'master' - user # Which user to install jlenv to (also specified in the resources name above) + user # Which user to install jlenv to (also given in the resources name above) end ``` ## System-Wide macOS Installation Note -This cookbook takes advantage of managing profile fragments in an `/etc/profile.d` directory, common on most Unix-flavored platforms. Unfortunately, macOS does not support this idiom out of the box, so you may need to [modify][mac_profile_d] your user profile. +This cookbook takes advantage of managing profile fragments in an +`/etc/profile.d` directory, common on most Unix-flavored platforms. +Unfortunately, macOS does not support this idiom out of the box, so you may +need to [modify][mac_profile_d] your user profile. ## Development -- Source hosted at [GitHub][https://github.com/jlenv/jlenv-cookbook] -- Report issues/Questions/Feature requests on [GitHub Issues][https://github.com/jlenv/jlenv-cookbook/issues] +- Source hosted at [GitHub](https://github.com/jlenv/jlenv-cookbook/) +- Report Issues/Questions/Feature requests on + [GitHub Issues](https://github.com/jlenv/jlenv-cookbook/issues) Pull requests are very welcome! Make sure your patches are well tested. ## Contributors +
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
From fb6a61507851b3bbb16f2696dda2556c7c4d2f2a Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 10:14:26 +1000 Subject: [PATCH 034/105] Fix MD lint config file syntax. --- .mdlrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mdlrc b/.mdlrc index 54bea599..dee444ef 100644 --- a/.mdlrc +++ b/.mdlrc @@ -1 +1 @@ -rules ~"MD033" \ No newline at end of file +rules "~MD033" \ No newline at end of file From 7f4ec70875acb1087be7481e57ad81033525ab2f Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 10:18:47 +1000 Subject: [PATCH 035/105] Fix trailing spaces for MD lint. --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index edf00d5b..57201460 100755 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. ## Maintainers -This cookbook is maintained by volunteers. +This cookbook is maintained by volunteers. [All contributions and bug reports are welcome](./CONTRIBUTING). ## Requirements @@ -42,8 +42,8 @@ you want to use, and is installed on the system. | System wide installations of jlenv are discouraged by the jlenv maintainer.| |---| -However they are supported by this cookbook, see -(these)[https://github.com/rbenv/rbenv/issues/38/] +However they are supported by this cookbook, see +(these)[https://github.com/rbenv/rbenv/issues/38/] (two)[https://github.com/rbenv/rbenv/issues/306/] issues in the rbenv repository for the reasons why. @@ -69,13 +69,13 @@ Sets the global Julia version. The name of the resource is the version to set. ```julia jlenv_global '1.1.0' do - user # Optional: Sets the users global version. + user # Optional: Sets the users global version. # Leave unset, to set the system global version. end ``` If a user is passed in to this resource it sets the global version for the user, -under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the +under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the system global version. ## Plugin @@ -86,7 +86,7 @@ Installs a jlenv plugin. jlenv_plugin 'julia-build' do git_url # Git URL of the plugin git_ref # Git reference of the plugin - user # Optional: Install to the users jlenv. + user # Optional: Install to the users jlenv. # Do not set, to set installs to the system jlenv. end ``` @@ -110,7 +110,7 @@ Installs a given Julia version to the system or user location. ```julia jlenv_julia '1.1.0' do user # Optional, but recommended: If passed, the user to install jlenv to - jlenv_action # Optional: Action to perform: + jlenv_action # Optional: Action to perform: # 'install' (default), 'uninstall' etc. end ``` @@ -124,7 +124,7 @@ Runs a jlenv aware script. ```julia jlenv_script 'foo' do jlenv_version #jlenv version to run the script against - environment # Optional: Hash of environment variables in the form of + environment # Optional: Hash of environment variables in the form of # ({"ENV_VARIABLE" => "VALUE"}). user # Optional: User to run as group # Optional: Group to run as @@ -144,7 +144,7 @@ jlenv_script 'bundle package' do end ``` -Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set +Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set `PATH`. ## System_install @@ -173,15 +173,15 @@ end ## System-Wide macOS Installation Note -This cookbook takes advantage of managing profile fragments in an -`/etc/profile.d` directory, common on most Unix-flavored platforms. -Unfortunately, macOS does not support this idiom out of the box, so you may +This cookbook takes advantage of managing profile fragments in an +`/etc/profile.d` directory, common on most Unix-flavored platforms. +Unfortunately, macOS does not support this idiom out of the box, so you may need to [modify][mac_profile_d] your user profile. ## Development - Source hosted at [GitHub](https://github.com/jlenv/jlenv-cookbook/) -- Report Issues/Questions/Feature requests on +- Report Issues/Questions/Feature requests on [GitHub Issues](https://github.com/jlenv/jlenv-cookbook/issues) Pull requests are very welcome! Make sure your patches are well tested. From 0b39ab4055c30c08f7e11a06b27e2531f2db4d8a Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 10:35:04 +1000 Subject: [PATCH 036/105] Fix MD lint errors. --- CHANGELOG.md | 143 +++++++++++++++++++++++++++++++++--------------- CONTRIBUTING.md | 23 +++++--- README.md | 6 +- 3 files changed, 117 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df27c10b..4dd96915 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,23 +60,28 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 2.0.1 (2017-08-02) -- Fix user_install resource bug where the script wasn't being called with the correct environment. Fixes #175 +- Fix user_install resource bug where the script wasn't being called with the + correct environment. Fixes #175 ## 2.0.0 (2017-07-24) - Switch libraries to custom resources - Use gem install from core Chef - Add rbenv_system_install resource -- Remove system_install recipe. Please see the system_install test recipe for usage. +- Remove system_install recipe. Please see the system_install test recipe for + usage. - Remove user_install recipe. Please see the user_install test recipe for usage. - Removed all other recipes for consistent usage. - Remove FreeBSD "support" (the platform isn't currently tested) -- Remove Arch Linux support in README. We never really supported this, and it isn't tested +- Remove Arch Linux support in README. We never really supported this, and it + isn't tested - Update required chef-version to the one we test with (Chef 12.19+) ### Known Current Bugs -- Installing Ruby 2.3.1 on Fedora requires a patched version of 2.3.1\. As patching is currently unavailable please pin to a prior version if you need this installing. +- Installing Ruby 2.3.1 on Fedora requires a patched version of 2.3.1\. As + patching is currently unavailable please pin to a prior version if you need + this installing. ## 1.2.1 (2017-06-23) @@ -88,16 +93,21 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 1.2.0 (2017-04-11) - Migrated maintenance of this cookbook to Sous Chefs -- Remove the check to see if the homebrew provider exists since this always exists in Chef 12 and the code failed on Chef 13 -- Added checks to user install recipes to avoid breaking if the rbenv_home does not exist +- Remove the check to see if the homebrew provider exists since this always + exists in Chef 12 and the code failed on Chef 13 +- Added checks to user install recipes to avoid breaking if the rbenv_home does + not exist - Removed test deps from the Gemfile as we should be testing with ChefDK -- Removed the "suggests 'java'" metadata as suggests was never implemented in Chef and has been removed from Chef 13 +- Removed the "suggests 'java'" metadata as suggests was never implemented in + Chef and has been removed from Chef 13 - Bumped the required Chef release from 12.0 to 12.1 ## 1.1.0 (2016-06-17) -- Restored compatibility for platforms that don't yet support multipackage installs in Chef (BSD and OS X in particular) -- Updated to Grab rbenv from the new repo URL and use https vs. git for compatibility +- Restored compatibility for platforms that don't yet support multipackage + installs in Chef (BSD and OS X in particular) +- Updated to Grab rbenv from the new repo URL and use https vs. git for + compatibility - Added missing Chefspec matchers - Enabled use_inline_resources in all providers - Added chef_version metadata to metadata.rb @@ -115,25 +125,36 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ### WARNING: Cookbook has been renamed -- Renamed to ruby_rbenv and uploaded to Supermarket (all attributes rename in the rbenv cookbook). If you wrap this cookbook you're going to need to update the recipes you include. All providers have been updated to keep their existing rbenv_xyz names for backwards compatibility and attributes still maintain the rbenv namespace. +- Renamed to ruby_rbenv and uploaded to Supermarket (all attributes rename in + the rbenv cookbook). If you wrap this cookbook you're going to need to update + the recipes you include. All providers have been updated to keep their + existing rbenv_xyz names for backwards compatibility and attributes still + maintain the rbenv namespace. - Updated Travis config to run integration tests in Travis using kitchen-docker ## 0.9.0 (2015-10-12) -- Fixed base platform case statement in the cookbook that set install_pkgs and user_home_root attributes. This has been converted to a platform_family statement to better support derivitive operating systems and the attributes are set at default levels so they can be overwritten in wrapper cookbooks +- Fixed base platform case statement in the cookbook that set install_pkgs and + user_home_root attributes. This has been converted to a platform_family + statement to better support derivitive operating systems and the attributes + are set at default levels so they can be overwritten in wrapper cookbooks - Updated Travis to test using Chef DK vs. Gem installs - Fixed Chefspecs and Test Kitchen bats tests to all pass - Added the Apache 2.0 license file - Updated and added new development dependencies to the Gemfile -- Use Chef 12.1+ multi-package installs for the dependency packages to speed up installs +- Use Chef 12.1+ multi-package installs for the dependency packages to speed up + installs - Removed the empty Vagrant recipe -- Actually depend on ruby_version vs. suggests since suggests isn't implemented in Chef +- Actually depend on ruby_version vs. suggests since suggests isn't implemented + in Chef ## 0.8.1 (2015-08-28) -- Add rbenv_action attribute to rbenv_ruby LWRP so to allow using rvm-download rbenv plugin to download ruby vs. installing ruby +- Add rbenv_action attribute to rbenv_ruby LWRP so to allow using rvm-download + rbenv plugin to download ruby vs. installing ruby - Fix the ability to install gems to a specific version of ruby -- Remove Chef version checks around use_inline_resources since we require Chef 12 +- Remove Chef version checks around use_inline_resources since we require Chef + 12 - Use default_action method in the LWRPs - Fix various rubocop warnings @@ -145,59 +166,90 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 0.7.3 (2015-07-8) -- Issue [#91](https://github.com/fnichol/chef-rbenv/issues/91) [#79](https://github.com/fnichol/chef-rbenv/issues/79) [#92](https://github.com/fnichol/chef-rbenv/pull/92): Add matchers for rbenv_gem and rbenv_ruby. ([@tduffield](https://github.com/tduffield) and many others) -- Issue [#107](https://github.com/fnichol/chef-rbenv/issues/107): "Option name must be a kind of String!" when installing gems. -- Issue [#101](https://github.com/fnichol/chef-rbenv/issues/101): Use full class name for rbenv_rehash resource -- Fix undefined method `timeout' for LWRP resource rbenv_gem. ([@nathantsoi](https://github.com/nathantsoi) and others) -- Issue [#110](https://github.com/fnichol/chef-rbenv/issues/110): Chef 12.3.0 - undefined method `clear_sources' for Chef::Resource::RbenvGem. ([@tatat](https://github.com/tatat) and others) +- Issue [#91](https://github.com/fnichol/chef-rbenv/issues/91) + [#79](https://github.com/fnichol/chef-rbenv/issues/79) + [#92](https://github.com/fnichol/chef-rbenv/pull/92): Add matchers for + rbenv_gem and rbenv_ruby. ([@tduffield](https://github.com/tduffield) and + many others) +- Issue [#107](https://github.com/fnichol/chef-rbenv/issues/107): "Option name + must be a kind of String!" when installing gems. +- Issue [#101](https://github.com/fnichol/chef-rbenv/issues/101): Use full + class name for rbenv_rehash resource +- Fix undefined method `timeout' for LWRP resource rbenv_gem. + ([@nathantsoi](https://github.com/nathantsoi) and others) +- Issue [#110](https://github.com/fnichol/chef-rbenv/issues/110): Chef 12.3.0 - + undefined method `clear_sources' for Chef::Resource::RbenvGem. + ([@tatat](https://github.com/tatat) and others) - Fork from ## 0.7.2 (2012-12-31) -- Pull request [#26](https://github.com/fnichol/chef-rbenv/pull/26): Don't call libexec commands directly. ([@mhoran]) +- Pull request [#26](https://github.com/fnichol/chef-rbenv/pull/26): Don't call + libexec commands directly. ([@mhoran]) - Add integration tests for a system Ruby version. ([@fnichol]) ## 0.7.1 (unreleased) -- Pull request [#36](https://github.com/fnichol/chef-rbenv/pull/36): Use the ruby name as the definition to install ([@gsandie]) -- Pull request [#55](https://github.com/fnichol/chef-rbenv/pull/55): Fix some CHEF-3694 warnings when using with ruby_build ([@trinitronx]) +- Pull request [#36](https://github.com/fnichol/chef-rbenv/pull/36): Use the + ruby name as the definition to install ([@gsandie]) +- Pull request [#55](https://github.com/fnichol/chef-rbenv/pull/55): Fix some + CHEF-3694 warnings when using with ruby_build ([@trinitronx]) ### New features -- Pull request [#26](https://github.com/fnichol/chef-rbenv/pull/26): Allow setting environment vars per ruby install ([@jasherai]) -- Pull request [#37](https://github.com/fnichol/chef-rbenv/pull/37): Allows use `include_recipe("ruby_build")` instead of having to put it in the `run_list` ([@tjwallace]) -- Pull request [#42](https://github.com/fnichol/chef-rbenv/pull/42): Load rbenv environment after install ([@msaffitz]) -- Pull request [#62](https://github.com/fnichol/chef-rbenv/pull/62): Add Gentoo as supported platform ([@gentooboontoo]) -- Pull request [#46](https://github.com/fnichol/chef-rbenv/pull/46): Add a `definition_file` attribute to the `rbenv_ruby` resource to prevent continually trying to build a custom ruby when passed a build file name instead of a built-in definition ([@jf647]) -- Pull request [#60](https://github.com/fnichol/chef-rbenv/pull/60): Support `definition_file` in rubies definition ([@cyu]) -- Pull request [#75](https://github.com/fnichol/chef-rbenv/pull/75): Update testing support and add unit tests for existing resources ([@fnichol]) -- Pull request [#70](https://github.com/fnichol/chef-rbenv/pull/70): Support ruby 2.1.0 ([@WhyEee]) +- Pull request [#26](https://github.com/fnichol/chef-rbenv/pull/26): Allow + setting environment vars per ruby install ([@jasherai]) +- Pull request [#37](https://github.com/fnichol/chef-rbenv/pull/37): Allows use + `include_recipe("ruby_build")` instead of having to put it in the `run_list` + ([@tjwallace]) +- Pull request [#42](https://github.com/fnichol/chef-rbenv/pull/42): Load rbenv + environment after install ([@msaffitz]) +- Pull request [#62](https://github.com/fnichol/chef-rbenv/pull/62): Add Gentoo + as supported platform ([@gentooboontoo]) +- Pull request [#46](https://github.com/fnichol/chef-rbenv/pull/46): Add a + `definition_file` attribute to the `rbenv_ruby` resource to prevent + continually trying to build a custom ruby when passed a build file name + instead of a built-in definition ([@jf647]) +- Pull request [#60](https://github.com/fnichol/chef-rbenv/pull/60): Support + `definition_file` in rubies definition ([@cyu]) +- Pull request [#75](https://github.com/fnichol/chef-rbenv/pull/75): Update + testing support and add unit tests for existing resources ([@fnichol]) +- Pull request [#70](https://github.com/fnichol/chef-rbenv/pull/70): Support + ruby 2.1.0 ([@WhyEee]) ## 0.7.0 (2012-11-21) -- Issue [#14](https://github.com/fnichol/chef-rbenv/pull/14): Create /etc/profile.d on system-wide and add note for Mac. ([@fnichol]) -- Pull request [#20](https://github.com/fnichol/chef-rbenv/pull/20): Set an attribute to create profile.d for user install. ([@jtimberman]) -- Pull request [#12](https://github.com/fnichol/chef-rbenv/pull/12): Add name attribute to metadata. ([@jtimberman]) +- Issue [#14](https://github.com/fnichol/chef-rbenv/pull/14): Create + `/etc/profile.d` on system-wide and add note for Mac. ([@fnichol]) +- Pull request [#20](https://github.com/fnichol/chef-rbenv/pull/20): Set an + attribute to create profile.d for user install. ([@jtimberman]) +- Pull request [#12](https://github.com/fnichol/chef-rbenv/pull/12): Add name + attribute to metadata. ([@jtimberman]) - Update foodcritic configuration and update .travis.yml. ([@fnichol]) - Update Installation section of README (welcome Berkshelf). ([@fnichol]) ## 0.6.10 (2012-05-18) -- Pull request [#11](https://github.com/fnichol/chef-rbenv/pull/11): Add FreeBSD support. ([@jssjr]) +- Pull request [#11](https://github.com/fnichol/chef-rbenv/pull/11): Add FreeBSD + support. ([@jssjr]) - Add other platform supports in metadata.rb and README. ([@fnichol]) ## 0.6.8 (2012-05-06) -- Add official hook resource `log[rbenv-post-init-*]` for inter-cookbook integration. ([@fnichol]) +- Add official hook resource `log[rbenv-post-init-*]` for inter-cookbook + integration. ([@fnichol]) ## 0.6.6 (2012-05-04) -- Fix FC022: Resource condition within loop may not behave as expected. ([@fnichol]) +- Fix FC022: Resource condition within loop may not behave as expected. + ([@fnichol]) - Add plaform equivalents in default attrs (FC024). ([@fnichol]) - Ensure update-java-alternatives is called before JRuby is built. ([@fnichol]) -- Pull request [#8](https://github.com/fnichol/chef-rbenv/pull/8): Add /etc/profile.d/rbenv.sh support for user installs. ([@thoughtless]) +- Pull request [#8](https://github.com/fnichol/chef-rbenv/pull/8): Add + `/etc/profile.d/rbenv.sh` support for user installs. ([@thoughtless]) - Add TravisCI to run Foodcritic linter. ([@fnichol]) -- Pull request [#10](https://github.com/fnichol/chef-rbenv/pull/10): README proofreading. ([@jdsiegel]) +- Pull request [#10](https://github.com/fnichol/chef-rbenv/pull/10): README + proofreading. ([@jdsiegel]) - README updates. ([@fnichol]) - Confirm debian platform support. ([@fnichol]) @@ -209,11 +261,16 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 0.6.2 (2012-02-22) -- Issues [#1](https://github.com/fnichol/chef-rbenv/issues/1), [#2](https://github.com/fnichol/chef-rbenv/issues/2): Stub mixins in RbenvRubygems to avoid libraries load ordering issues. ([@fnichol]) -- Pull request [#5](https://github.com/fnichol/chef-rbenv/pull/5): Include user setting in rehash calls. ([@magnetised]) -- Issue [#4](https://github.com/fnichol/chef-rbenv/issues/4): Fix rbenv/gems hash parsing. ([@fnichol]) +- Issues [#1](https://github.com/fnichol/chef-rbenv/issues/1), + [#2](https://github.com/fnichol/chef-rbenv/issues/2): Stub mixins in + RbenvRubygems to avoid libraries load ordering issues. ([@fnichol]) +- Pull request [#5](https://github.com/fnichol/chef-rbenv/pull/5): Include user + setting in rehash calls. ([@magnetised]) +- Issue [#4](https://github.com/fnichol/chef-rbenv/issues/4): Fix rbenv/gems + hash parsing. ([@fnichol]) - Large formatting updates to README. ([@fnichol]) -- Add gh-pages branch for sectioned README at +- Add gh-pages branch for sectioned README at + ## 0.6.0 (2011-12-21) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3eb280a..df239525 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,10 +4,16 @@ We are glad you want to contribute to the sysctl cookbook! The first step is the desire to improve the project. ## Recognizing All Contributors -This project follows the [All Contributors](https://allcontributors.org/docs/en/overview) specification for recognizing contributors to an open source project in a way that recognizes different types of contributions, not just code. + +This project follows the +[All Contributors](https://allcontributors.org/docs/en/overview) specification +for recognizing contributors to an open source project in a way that recognizes +different types of contributions, not just code. ### Adding a contributor -Contributors are encouraged to add themselves to the list using the [All Contributors (Git Hub) bot](https://allcontributors.org/docs/en/bot/overview). + +Contributors are encouraged to add themselves to the list using the +[All Contributors (Git Hub) bot](https://allcontributors.org/docs/en/bot/overview). See the bot [usage instructions](https://allcontributors.org/docs/en/bot/usage)). ## Quick-contribute @@ -23,8 +29,8 @@ any suggestions or concerns. You should submit your patch as a git branch named after the change. It is a best practice to have your commit message have a _summary -line_, followed by an empty line and then a brief description of -the commit. This also helps other contributors understand the +line_, followed by an empty line and then a brief description of +the commit. This also helps other contributors understand the purpose of changes to the code. Remember that not all users use Chef in the same way or on the same @@ -42,8 +48,8 @@ downloading the branch. ## Functional and Unit Tests -This cookbook is set up to run tests under [test-kitchen](https://kitchen.ci/). It -uses serverspec to run integration tests after the node has been +This cookbook is set up to run tests under [test-kitchen](https://kitchen.ci/). +It uses serverspec to run integration tests after the node has been converged to verify that the state of the node. Test kitchen should run completely without exception using the default @@ -88,8 +94,9 @@ isn't trivial so we don't have to duplicate effort in testing. Chef 10.14+ "doc" formatted output is sufficient. Please do indicate new platform (families) or platform versions in the -commit message, and update the relevant ticket. If a contribution adds -new platforms or platform versions, indicate such in the body of the commit message(s). +commit message, and update the relevant ticket. If a contribution adds +new platforms or platform versions, indicate such in the body of the commit +message(s). Please do use [foodcritic](http://www.foodcritic.io/) to lint-check the cookbook. Except FC007, it should pass all correctness diff --git a/README.md b/README.md index 57201460..5fe922be 100755 --- a/README.md +++ b/README.md @@ -31,8 +31,6 @@ This cookbook requires Chef 13.0+. ## Usage -**Please read** - Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. A `jlenv_user_install` is required to be set so that jlenv knows which version @@ -43,8 +41,8 @@ you want to use, and is installed on the system. |---| However they are supported by this cookbook, see -(these)[https://github.com/rbenv/rbenv/issues/38/] -(two)[https://github.com/rbenv/rbenv/issues/306/] issues in the rbenv repository +[these](https://github.com/rbenv/rbenv/issues/38/) +[two](https://github.com/rbenv/rbenv/issues/306/) issues in the rbenv repository for the reasons why. ## Pkg From ecb4dc66dd51427c7f05f4a004a86c15585fada2 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 10:39:56 +1000 Subject: [PATCH 037/105] Fix MD YAML lint errors. --- CHANGELOG.md | 15 +++++++-------- CONTRIBUTING.md | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd96915..5e84ea70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,6 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo - Renamed to jlenv-cookbook and uploaded to Supermarket. - Updated Circle-CI config to run integration tests using kitchen-docker - ## 2.1.2 (2018-11-09) - Fix `TypeError: no implicit conversion of nil into String` for `mac_os_x` platforms @@ -219,7 +218,7 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 0.7.0 (2012-11-21) -- Issue [#14](https://github.com/fnichol/chef-rbenv/pull/14): Create +- Issue [#14](https://github.com/fnichol/chef-rbenv/pull/14): Create `/etc/profile.d` on system-wide and add note for Mac. ([@fnichol]) - Pull request [#20](https://github.com/fnichol/chef-rbenv/pull/20): Set an attribute to create profile.d for user install. ([@jtimberman]) @@ -236,19 +235,19 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 0.6.8 (2012-05-06) -- Add official hook resource `log[rbenv-post-init-*]` for inter-cookbook +- Add official hook resource `log[rbenv-post-init-*]` for inter-cookbook integration. ([@fnichol]) ## 0.6.6 (2012-05-04) -- Fix FC022: Resource condition within loop may not behave as expected. +- Fix FC022: Resource condition within loop may not behave as expected. ([@fnichol]) - Add plaform equivalents in default attrs (FC024). ([@fnichol]) - Ensure update-java-alternatives is called before JRuby is built. ([@fnichol]) -- Pull request [#8](https://github.com/fnichol/chef-rbenv/pull/8): Add +- Pull request [#8](https://github.com/fnichol/chef-rbenv/pull/8): Add `/etc/profile.d/rbenv.sh` support for user installs. ([@thoughtless]) - Add TravisCI to run Foodcritic linter. ([@fnichol]) -- Pull request [#10](https://github.com/fnichol/chef-rbenv/pull/10): README +- Pull request [#10](https://github.com/fnichol/chef-rbenv/pull/10): README proofreading. ([@jdsiegel]) - README updates. ([@fnichol]) - Confirm debian platform support. ([@fnichol]) @@ -261,8 +260,8 @@ This file is used to list changes made in each version of the ruby_rbenv cookboo ## 0.6.2 (2012-02-22) -- Issues [#1](https://github.com/fnichol/chef-rbenv/issues/1), - [#2](https://github.com/fnichol/chef-rbenv/issues/2): Stub mixins in +- Issues [#1](https://github.com/fnichol/chef-rbenv/issues/1), + [#2](https://github.com/fnichol/chef-rbenv/issues/2): Stub mixins in RbenvRubygems to avoid libraries load ordering issues. ([@fnichol]) - Pull request [#5](https://github.com/fnichol/chef-rbenv/pull/5): Include user setting in rehash calls. ([@magnetised]) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df239525..0e3873c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ downloading the branch. ## Functional and Unit Tests -This cookbook is set up to run tests under [test-kitchen](https://kitchen.ci/). +This cookbook is set up to run tests under [test-kitchen](https://kitchen.ci/). It uses serverspec to run integration tests after the node has been converged to verify that the state of the node. From 87c056c009652a79e94792a430a3f898c85da9a8 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 12:28:21 +1000 Subject: [PATCH 038/105] Remove MD line length lint due to all-contributors HTML length. --- .mdlrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mdlrc b/.mdlrc index dee444ef..fdf88b64 100644 --- a/.mdlrc +++ b/.mdlrc @@ -1 +1 @@ -rules "~MD033" \ No newline at end of file +rules "~MD033", "~MD013" \ No newline at end of file From b0ee4c256e2e8b11d32a19d406aaf18292e73fb5 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 13:02:23 +1000 Subject: [PATCH 039/105] Suspend Danger. Add brief pointers to Danger. --- .circleci/config.yml | 27 +++++++++++++++++---------- TESTING.md | 6 ++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ef96ce60..40ffe636 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,9 +6,9 @@ orbs: workflows: kitchen: jobs: - - kitchen/danger: - name: danger - context: Danger + # - kitchen/danger: + # name: danger + # context: Danger - kitchen/mdlint: name: mdlint - kitchen/yamllint: @@ -16,28 +16,35 @@ workflows: - kitchen/dokken: suite: global name: global - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global-opensuse-leap name: global-opensuse-leap - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: system-install-centos-7 suite: system-install-centos-7 - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: user-install-centos-7 suite: user-install-centos-7 - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: pkg-centos-7 suite: pkg-centos-7 - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: julia-uninstall-ubuntu-1804 suite: julia-uninstall-ubuntu-1804 - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: custom-group suite: custom-group-install-centos-7 - requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] diff --git a/TESTING.md b/TESTING.md index 47d11c59..b1c7f492 100644 --- a/TESTING.md +++ b/TESTING.md @@ -1,3 +1,9 @@ # Testing Please refer to the [community cookbook documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD). + +In addition, setup (Danger)[https://github.com/danger/danger] +((Ruby)[https://danger.systems/ruby/], +(JavaScript)[https://danger.systems/js/], +(Swift)[https://danger.systems/swift/]), +for (use in CI)[https://danger.systems/guides/getting_started.html]. From a81ea5b15830e6e08efe983d410d4a28aaffb6c6 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 13:11:32 +1000 Subject: [PATCH 040/105] Fix URL link syntax. --- TESTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TESTING.md b/TESTING.md index b1c7f492..04a01b29 100644 --- a/TESTING.md +++ b/TESTING.md @@ -2,8 +2,8 @@ Please refer to the [community cookbook documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD). -In addition, setup (Danger)[https://github.com/danger/danger] -((Ruby)[https://danger.systems/ruby/], -(JavaScript)[https://danger.systems/js/], -(Swift)[https://danger.systems/swift/]), +In addition, setup [Danger](https://github.com/danger/danger]) +([Ruby](https://danger.systems/ruby/]) +[JavaScript](https://danger.systems/js/), +[Swift](https://danger.systems/swift/), for (use in CI)[https://danger.systems/guides/getting_started.html]. From e3a729c7f64abc9fedc95678c272763be6dd63b0 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 13:30:32 +1000 Subject: [PATCH 041/105] Fix MD URL syntax. --- TESTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TESTING.md b/TESTING.md index 04a01b29..9d42d98c 100644 --- a/TESTING.md +++ b/TESTING.md @@ -6,4 +6,4 @@ In addition, setup [Danger](https://github.com/danger/danger]) ([Ruby](https://danger.systems/ruby/]) [JavaScript](https://danger.systems/js/), [Swift](https://danger.systems/swift/), -for (use in CI)[https://danger.systems/guides/getting_started.html]. +for [use in CI](https://danger.systems/guides/getting_started.html). From 21b4aff5c7696a58acf950e2d068e2c4b72bac4c Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 13:46:18 +1000 Subject: [PATCH 042/105] Use ORB updated for source.list fix. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 40ffe636..8169dc5e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: taqtiqa/kitchen@1.2.0 + kitchen: taqtiqa/kitchen@1.3.0 workflows: kitchen: From cd7dd27a667b11374d419ac605ed9b8fffb54003 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 14:00:47 +1000 Subject: [PATCH 043/105] Update ORB version for chef install fix. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8169dc5e..81303e9e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: taqtiqa/kitchen@1.3.0 + kitchen: taqtiqa/kitchen@1.3.1 workflows: kitchen: From 9e86f99614dc7396e0d032cab7540f10f3493517 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 14:04:29 +1000 Subject: [PATCH 044/105] Update ORB version for sudo premissions. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 81303e9e..2a5311fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: taqtiqa/kitchen@1.3.1 + kitchen: taqtiqa/kitchen@1.3.2 workflows: kitchen: From 0ba8584e1f2bb111794536d96b6ee4399601c626 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Tue, 16 Jul 2019 14:09:46 +1000 Subject: [PATCH 045/105] Bumpt Orb version for sudo use. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2a5311fa..b8ee8b95 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: taqtiqa/kitchen@1.3.2 + kitchen: taqtiqa/kitchen@1.3.3 workflows: kitchen: From e77be0ebcd15e7d633dcab2f6879087a3cc80fce Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 17 Jul 2019 11:28:17 +1000 Subject: [PATCH 046/105] Add vagrant install using commands orb. --- .circleci/config.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b8ee8b95..a729192f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,10 +2,17 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 + cmds: taqtiqa/commands@0.1.1 workflows: kitchen: jobs: + - vagrant: + steps: + - cmds/get-pkg-check-install: + url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' + checksum: '415f50b93235e761db284c761f6a8240a6ef6762ee3ec7ff869d2bccb1a1cdf7' + verify_command: 'vagrant' # - kitchen/danger: # name: danger # context: Danger From c325000945b9ec253b3758c2e43affdf4b7e92df Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 17 Jul 2019 11:37:07 +1000 Subject: [PATCH 047/105] Fix circleci indentation. Add vagrant dependency. --- .circleci/config.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a729192f..1a51bfc9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,11 +8,12 @@ workflows: kitchen: jobs: - vagrant: - steps: - - cmds/get-pkg-check-install: - url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' - checksum: '415f50b93235e761db284c761f6a8240a6ef6762ee3ec7ff869d2bccb1a1cdf7' - verify_command: 'vagrant' + name: vagrant-installation + steps: + - cmds/get-pkg-check-install: + url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' + checksum: '415f50b93235e761db284c761f6a8240a6ef6762ee3ec7ff869d2bccb1a1cdf7' + verify_command: 'vagrant' # - kitchen/danger: # name: danger # context: Danger @@ -23,7 +24,7 @@ workflows: - kitchen/dokken: suite: global name: global - requires: [mdlint, yamllint] + requires: [mdlint, yamllint, vagrant] # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global-opensuse-leap @@ -48,7 +49,7 @@ workflows: - kitchen/dokken-single: name: julia-uninstall-ubuntu-1804 suite: julia-uninstall-ubuntu-1804 - requires: [mdlint, yamllint] + requires: [mdlint, yamllint, vagrant] # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: custom-group From 46dca439014a710fb0f536969b4e0064f0cc7b1b Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 17 Jul 2019 11:41:16 +1000 Subject: [PATCH 048/105] Fix name mixup. --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1a51bfc9..356c8da7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,8 +7,8 @@ orbs: workflows: kitchen: jobs: - - vagrant: - name: vagrant-installation + - install-vagrant: + name: vagrant steps: - cmds/get-pkg-check-install: url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' From 63a666d69112f068fa8902dbbbfef5f6f37f1683 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 17 Jul 2019 14:49:34 +1000 Subject: [PATCH 049/105] Fix vgrant install job. --- .circleci/config.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 356c8da7..2e98374b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,18 +2,22 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@0.1.1 + cmds: taqtiqa/commands@0.1.2 + +jobs: + vagrant: + executor: kitchen/chef + steps: + - cmds/get-pkg-check-install: + url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' + checksum: '415f50b93235e761db284c761f6a8240a6ef6762ee3ec7ff869d2bccb1a1cdf7' + verify_command: 'vagrant' workflows: kitchen: jobs: - - install-vagrant: + - vagrant: name: vagrant - steps: - - cmds/get-pkg-check-install: - url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' - checksum: '415f50b93235e761db284c761f6a8240a6ef6762ee3ec7ff869d2bccb1a1cdf7' - verify_command: 'vagrant' # - kitchen/danger: # name: danger # context: Danger From 56e887c49e18ef41681394fc7d188a3b0c933138 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 17 Jul 2019 15:33:58 +1000 Subject: [PATCH 050/105] Update commands Orb. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e98374b..b5155ed2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@0.1.2 + cmds: taqtiqa/commands@0.1.3 jobs: vagrant: From 386fd788cca3b424de6f767892c61ce75b8c5067 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Thu, 18 Jul 2019 21:01:38 +1000 Subject: [PATCH 051/105] Add bundle config. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 00110fec..05ffd083 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,6 @@ _Store .julia-gemset .rvmrc Pkgfile.lock -.bundle *.gem # YARD artifacts From 5a5fe6c7031b1e03afa3344af2560a6ed8aa8364 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 31 Jul 2019 20:55:16 +1000 Subject: [PATCH 052/105] ignore vscode config folder --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 05ffd083..bcd0dd93 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ _Store *.bk *.bkup +# IDE +.vscode + # julia/bundler files .julia-version .julia-gemset From 18bfa683bc8fc4559d55619c79ad5d0e01e0bd4a Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 31 Jul 2019 20:56:20 +1000 Subject: [PATCH 053/105] Add chefspecs to delivery unit phase. --- .delivery/project.toml | 2 +- test/unit/default_spec.rb | 12 ------------ test/unit/recipes/default_spec.rb | 15 +++++++++++++++ test/unit/spec_helper.rb | 12 ++++++++++++ 4 files changed, 28 insertions(+), 13 deletions(-) delete mode 100644 test/unit/default_spec.rb create mode 100644 test/unit/recipes/default_spec.rb create mode 100644 test/unit/spec_helper.rb diff --git a/.delivery/project.toml b/.delivery/project.toml index 3accb43c..b57e5a37 100644 --- a/.delivery/project.toml +++ b/.delivery/project.toml @@ -1,5 +1,5 @@ [local_phases] -unit = "rspec" +unit = "chef exec rspec test/unit" lint = 'cookstyle --display-cop-names --extra-details' syntax = "foodcritic ." provision = "echo skipping" diff --git a/test/unit/default_spec.rb b/test/unit/default_spec.rb deleted file mode 100644 index 7e5ef68b..00000000 --- a/test/unit/default_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'chefspec' -require 'chefspec/berkshelf' - -describe 'jlenv-cookbook::default' do - let(:chef_run) do - ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end -end diff --git a/test/unit/recipes/default_spec.rb b/test/unit/recipes/default_spec.rb new file mode 100644 index 00000000..b6194332 --- /dev/null +++ b/test/unit/recipes/default_spec.rb @@ -0,0 +1,15 @@ +require_relative '../spec_helper' + +describe 'jlenv-cookbook::default' do + let(:chef_run) do + ChefSpec::SoloRunner.new.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end + + it 'installs a file' do + expect(chef_run).to create_file('/tmp/foobar') + end +end diff --git a/test/unit/spec_helper.rb b/test/unit/spec_helper.rb new file mode 100644 index 00000000..6e51ba3d --- /dev/null +++ b/test/unit/spec_helper.rb @@ -0,0 +1,12 @@ +require 'chefspec' +require 'chefspec/berkshelf' # TODO: Policyfiles + + +RSpec.configure do |config| + config.mock_with :rspec do |mocks| + mocks.syntax = :expect + end + + config.platform = 'ubuntu' + config.version = '18.04' +end \ No newline at end of file From 1e3e52605a8b19dcc023aae399c7a9eb11a1df0e Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 31 Jul 2019 20:57:48 +1000 Subject: [PATCH 054/105] Fix ruby code block. --- resources/system_install.rb | 4 ++-- resources/user_install.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/system_install.rb b/resources/system_install.rb index ed96b238..b33bc730 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -52,7 +52,7 @@ repository new_resource.git_url reference new_resource.git_ref action :checkout if new_resource.update_jlenv == false - notifies :run, 'julia_block[Add jlenv to PATH]', :immediately + notifies :run, 'ruby_block[Add jlenv to PATH]', :immediately notifies :run, 'bash[Initialize system jlenv]', :immediately end @@ -62,7 +62,7 @@ end # Initialize jlenv - julia_block 'Add jlenv to PATH' do + ruby_block 'Add jlenv to PATH' do block do ENV['PATH'] = "#{new_resource.global_prefix}/shims:#{new_resource.global_prefix}/bin:#{ENV['PATH']}" end diff --git a/resources/user_install.rb b/resources/user_install.rb index ce6b18af..b85450b9 100644 --- a/resources/user_install.rb +++ b/resources/user_install.rb @@ -54,7 +54,7 @@ action :checkout if new_resource.update_jlenv == false user new_resource.user group new_resource.group - notifies :run, 'julia_block[Add jlenv to PATH]', :immediately + notifies :run, 'ruby_block[Add jlenv to PATH]', :immediately end %w(plugins shims versions).each do |d| @@ -66,7 +66,7 @@ end # Initialize jlenv - julia_block 'Add jlenv to PATH' do + ruby_block 'Add jlenv to PATH' do block do ENV['PATH'] = "#{new_resource.user_prefix}/shims:#{new_resource.user_prefix}/bin:#{ENV['PATH']}" end From 7a66ec2319d43046e19ffc4cbf069446d2ed03a7 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 31 Jul 2019 20:58:04 +1000 Subject: [PATCH 055/105] Fix cookbook name in tests. --- test/fixtures/cookbooks/test/metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb index d300c691..1b8e82f9 100644 --- a/test/fixtures/cookbooks/test/metadata.rb +++ b/test/fixtures/cookbooks/test/metadata.rb @@ -1,4 +1,4 @@ name 'test' version '0.99.0' -depends 'chef-jlenv' +depends 'jlenv-cookbook' From e66b22d21a5d557316dede977bbfc54b90b98749 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 31 Jul 2019 20:58:36 +1000 Subject: [PATCH 056/105] Fix lint: space at EOL. --- test/fixtures/cookbooks/test/recipes/pkg.rb | 6 +++--- test/fixtures/cookbooks/test/recipes/script.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fixtures/cookbooks/test/recipes/pkg.rb b/test/fixtures/cookbooks/test/recipes/pkg.rb index e77c0e3f..46a36a74 100644 --- a/test/fixtures/cookbooks/test/recipes/pkg.rb +++ b/test/fixtures/cookbooks/test/recipes/pkg.rb @@ -17,7 +17,7 @@ ##################################################################### # -# JuliaRegistries/General Hosted Repository +# JuliaRegistries/General Hosted Repository # ##################################################################### @@ -76,7 +76,7 @@ ##################################################################### # -# Git Hosted Repository +# Git Hosted Repository # ##################################################################### @@ -115,7 +115,7 @@ jlenv_version '1.1.0' end -# Install latest for specific user +# Install latest for specific user jlenv_user_install 'vagrant' # Install a Julia to a user directory diff --git a/test/fixtures/cookbooks/test/recipes/script.rb b/test/fixtures/cookbooks/test/recipes/script.rb index 68ab9116..ca816fc2 100644 --- a/test/fixtures/cookbooks/test/recipes/script.rb +++ b/test/fixtures/cookbooks/test/recipes/script.rb @@ -1,4 +1,4 @@ -# Make is Julia's build orchestration +# Make is Julia's build orchestration jlenv_script 'not-much' do code 'make nadda' end From 7e6ba8f4be965983959630a173834e10924da397 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 31 Jul 2019 22:45:46 +1000 Subject: [PATCH 057/105] Add Chefspec using Policyfiles. One spec passing. --- .delivery/project.toml | 2 +- .kitchen.yml | 2 + Policyfile.rb | 7 + README.1.md | 194 ++++++++++++++++++++ libraries/helpers.rb | 2 +- metadata.rb | 2 +- policyfiles/base.rb | 1 + policyfiles/jlenv.rb | 0 recipes/default.rb | 0 resources/global.rb | 2 +- resources/julia.rb | 2 +- resources/pkg.rb | 2 +- resources/plugin.rb | 2 +- resources/rehash.rb | 2 +- resources/script.rb | 2 +- resources/system_install.rb | 4 +- resources/user_install.rb | 4 +- test/fixtures/cookbooks/test/Policyfile.rb | 4 + test/fixtures/cookbooks/test/metadata.rb | 2 +- test/{unit => spec}/recipes/default_spec.rb | 8 +- test/{unit => spec}/spec_helper.rb | 3 +- test/{unit => spec}/system_install_spec.rb | 2 +- test/{unit => spec}/system_spec.rb | 2 +- test/{unit => spec}/user_install_spec.rb | 2 +- test/{unit => spec}/user_spec.rb | 2 +- 25 files changed, 232 insertions(+), 23 deletions(-) create mode 100644 Policyfile.rb create mode 100755 README.1.md create mode 100644 policyfiles/base.rb create mode 100644 policyfiles/jlenv.rb create mode 100644 recipes/default.rb create mode 100644 test/fixtures/cookbooks/test/Policyfile.rb rename test/{unit => spec}/recipes/default_spec.rb (62%) rename test/{unit => spec}/spec_helper.rb (77%) rename test/{unit => spec}/system_install_spec.rb (85%) rename test/{unit => spec}/system_spec.rb (87%) rename test/{unit => spec}/user_install_spec.rb (85%) rename test/{unit => spec}/user_spec.rb (87%) diff --git a/.delivery/project.toml b/.delivery/project.toml index b57e5a37..376a950c 100644 --- a/.delivery/project.toml +++ b/.delivery/project.toml @@ -1,5 +1,5 @@ [local_phases] -unit = "chef exec rspec test/unit" +unit = "chef exec rspec test/spec" lint = 'cookstyle --display-cop-names --extra-details' syntax = "foodcritic ." provision = "echo skipping" diff --git a/.kitchen.yml b/.kitchen.yml index 29450299..b9fcafbb 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -3,10 +3,12 @@ driver: name: vagrant provisioner: + name: chef_zero product_name: chef product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> install_strategy: once deprecations_as_errors: true + policyfile: Policyfile.rb verifier: name: inspec diff --git a/Policyfile.rb b/Policyfile.rb new file mode 100644 index 00000000..6b5e0538 --- /dev/null +++ b/Policyfile.rb @@ -0,0 +1,7 @@ +name "jlenv" + +path = File.expand_path("../policyfiles/base.rb",__FILE__) +instance_eval(IO.read(path)) + +run_list 'jlenv::default' +cookbook 'jlenv', path: '.' diff --git a/README.1.md b/README.1.md new file mode 100755 index 00000000..5fe922be --- /dev/null +++ b/README.1.md @@ -0,0 +1,194 @@ +# Chef Jlenv Cookbook + +[![Cookbook Version](https://img.shields.io/cookbook/v/jlenv-cookbook.svg)](https://supermarket.chef.io/cookbooks/jlenv-cookbook) +[![Build Status](https://img.shields.io/circleci/project/github/jlenv/jlenv-cookbook/master.svg)](https://circleci.com/gh/jlenv/jlenv-cookbook) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) +[![CircleCI](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook.svg?style=svg)](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook) + +## Description + +Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. + +## Maintainers + +This cookbook is maintained by volunteers. +[All contributions and bug reports are welcome](./CONTRIBUTING). + +## Requirements + +### Chef + +This cookbook requires Chef 13.0+. + +### Platform + +- Debian derivatives +- Fedora +- macOS (not currently tested) +- RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux) +- openSUSE and openSUSE leap +- Windows (not supported) + +## Usage + +Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. + +A `jlenv_user_install` is required to be set so that jlenv knows which version +you want to use, and is installed on the system. + +| **NOTE:** | +| System wide installations of jlenv are discouraged by the jlenv maintainer.| +|---| + +However they are supported by this cookbook, see +[these](https://github.com/rbenv/rbenv/issues/38/) +[two](https://github.com/rbenv/rbenv/issues/306/) issues in the rbenv repository +for the reasons why. + +## Pkg + +Used to install a package into the selected jlenv environment. + +```julia +jlenv_package 'pkg_name' do + options # Optional: Options for the packagecommand e.g. '--no-rdoc --no-ri' + source # Optional: source URL/location for gem. + timeout # Optional: Pkg install timeout + version # Optional: Pkg version to install + response_file # Optional: response file to reconfigure a gem + jlenv_version # Required: Which jlenv version to install the packageto. + user # Which user to install for. REQUIRED if you're using jlenv_user_install +end +``` + +## Global + +Sets the global Julia version. The name of the resource is the version to set. + +```julia +jlenv_global '1.1.0' do + user # Optional: Sets the users global version. + # Leave unset, to set the system global version. +end +``` + +If a user is passed in to this resource it sets the global version for the user, +under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the +system global version. + +## Plugin + +Installs a jlenv plugin. + +```julia +jlenv_plugin 'julia-build' do + git_url # Git URL of the plugin + git_ref # Git reference of the plugin + user # Optional: Install to the users jlenv. + # Do not set, to set installs to the system jlenv. +end +``` + +If user is passed in, the plugin is installed to the users install of jlenv. + +## Rehash + +```julia +jlenv_rehash 'rehash' do + user 'vagrant' # Optional: Rehash the user jlenv otherwise rehash system jlenv +end +``` + +If user is passed in, the user Julia is rehashed rather than the system Julia. + +## Julia + +Installs a given Julia version to the system or user location. + +```julia +jlenv_julia '1.1.0' do + user # Optional, but recommended: If passed, the user to install jlenv to + jlenv_action # Optional: Action to perform: + # 'install' (default), 'uninstall' etc. +end +``` + +Shorter example `jlenv_julia '1.1.0'` + +## Script + +Runs a jlenv aware script. + +```julia +jlenv_script 'foo' do + jlenv_version #jlenv version to run the script against + environment # Optional: Hash of environment variables in the form of + # ({"ENV_VARIABLE" => "VALUE"}). + user # Optional: User to run as + group # Optional: Group to run as + returns # Optional: Expected return code + code # Script code to run +end +``` + +Note that environment overwrites the entire variable. +For example. setting the `$PATH` variable can be done like this: + +```julia +jlenv_script 'bundle package' do + cwd node["bundle_dir"] + environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"}) + code "bundle package --all" +end +``` + +Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set +`PATH`. + +## System_install + +Installs jlenv to the system location, by default `/usr/local/jlenv` + +```julia +jlenv_system_install 'foo' do + git_url # URL of the plugin repo you want to checkout + git_ref # Optional: Git reference to checkout + update_jlenv # Optional: Keeps the git repo up to date +end +``` + +## User_install + +Installs jlenv to the user path, making jlenv available to that user only. + +```julia +jlenv_user_install 'vagrant' do + git_url # Optional: Git URL to checkout jlenv from. + git_ref # Optional: Git reference to checkout e.g. 'master' + user # Which user to install jlenv to (also given in the resources name above) +end +``` + +## System-Wide macOS Installation Note + +This cookbook takes advantage of managing profile fragments in an +`/etc/profile.d` directory, common on most Unix-flavored platforms. +Unfortunately, macOS does not support this idiom out of the box, so you may +need to [modify][mac_profile_d] your user profile. + +## Development + +- Source hosted at [GitHub](https://github.com/jlenv/jlenv-cookbook/) +- Report Issues/Questions/Feature requests on + [GitHub Issues](https://github.com/jlenv/jlenv-cookbook/issues) + +Pull requests are very welcome! Make sure your patches are well tested. + +## Contributors + + + +
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
+ + +This project exists thanks to all the people who contribute. diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 5e485819..56f3eb4d 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Library:: Chef::Jlenv::ShellHelpers # # Author:: Fletcher Nichol diff --git a/metadata.rb b/metadata.rb index eb020a94..a107a0e8 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,4 +1,4 @@ -name 'jlenv-cookbook' +name 'jlenv' maintainer 'Mark Van de Vyver' maintainer_email 'mark@taqtiqa.com' issues_url 'https://github.com/jlenv/jlenv-cookbook/issues' diff --git a/policyfiles/base.rb b/policyfiles/base.rb new file mode 100644 index 00000000..d3439731 --- /dev/null +++ b/policyfiles/base.rb @@ -0,0 +1 @@ +default_source :supermarket diff --git a/policyfiles/jlenv.rb b/policyfiles/jlenv.rb new file mode 100644 index 00000000..e69de29b diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 00000000..e69de29b diff --git a/resources/global.rb b/resources/global.rb index 7232df17..4599b6c8 100644 --- a/resources/global.rb +++ b/resources/global.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: global # # Author:: Fletcher Nichol diff --git a/resources/julia.rb b/resources/julia.rb index 6a461908..97a89429 100644 --- a/resources/julia.rb +++ b/resources/julia.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: julia # # Author:: Fletcher Nichol diff --git a/resources/pkg.rb b/resources/pkg.rb index db43f0f7..7ff6c54d 100644 --- a/resources/pkg.rb +++ b/resources/pkg.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: pkg # # Author:: Fletcher Nichol diff --git a/resources/plugin.rb b/resources/plugin.rb index 3d7a376a..c36aedf8 100644 --- a/resources/plugin.rb +++ b/resources/plugin.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: plugin # # Author:: Dan Webb diff --git a/resources/rehash.rb b/resources/rehash.rb index 8a94c44b..7ba4dcdb 100644 --- a/resources/rehash.rb +++ b/resources/rehash.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: rehash # # Author:: Fletcher Nichol diff --git a/resources/script.rb b/resources/script.rb index 4e45e1bf..aab37167 100644 --- a/resources/script.rb +++ b/resources/script.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: script # # Author:: Fletcher Nichol diff --git a/resources/system_install.rb b/resources/system_install.rb index b33bc730..fe85705e 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: system_install # # Author:: Dan Webb @@ -41,7 +41,7 @@ end template '/etc/profile.d/jlenv.sh' do - cookbook 'jlenv-cookbook' + cookbook 'jlenv' source 'jlenv.sh.erb' owner 'root' mode '0755' diff --git a/resources/user_install.rb b/resources/user_install.rb index b85450b9..5b37dd78 100644 --- a/resources/user_install.rb +++ b/resources/user_install.rb @@ -1,5 +1,5 @@ # -# Cookbook:: jlenv-cookbook +# Cookbook:: jlenv # Resource:: user_install # # Author:: Dan Webb @@ -41,7 +41,7 @@ system_prefix = node.run_state['root_path']['system'] template '/etc/profile.d/jlenv.sh' do - cookbook 'jlenv-cookbook' + cookbook 'jlenv' source 'jlenv.sh.erb' variables(global_prefix: system_prefix) if system_prefix owner 'root' diff --git a/test/fixtures/cookbooks/test/Policyfile.rb b/test/fixtures/cookbooks/test/Policyfile.rb new file mode 100644 index 00000000..b3dc3180 --- /dev/null +++ b/test/fixtures/cookbooks/test/Policyfile.rb @@ -0,0 +1,4 @@ +name "test" +run_list "test:::pkg" +default_source :supermarket +cookbook 'jlenv', path: '../../../../' \ No newline at end of file diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb index 1b8e82f9..01136ae7 100644 --- a/test/fixtures/cookbooks/test/metadata.rb +++ b/test/fixtures/cookbooks/test/metadata.rb @@ -1,4 +1,4 @@ name 'test' version '0.99.0' -depends 'jlenv-cookbook' +depends 'jlenv' diff --git a/test/unit/recipes/default_spec.rb b/test/spec/recipes/default_spec.rb similarity index 62% rename from test/unit/recipes/default_spec.rb rename to test/spec/recipes/default_spec.rb index b6194332..e9d74b23 100644 --- a/test/unit/recipes/default_spec.rb +++ b/test/spec/recipes/default_spec.rb @@ -1,6 +1,6 @@ require_relative '../spec_helper' -describe 'jlenv-cookbook::default' do +describe 'jlenv::default' do let(:chef_run) do ChefSpec::SoloRunner.new.converge(described_recipe) end @@ -9,7 +9,7 @@ expect { chef_run }.to_not raise_error end - it 'installs a file' do - expect(chef_run).to create_file('/tmp/foobar') - end + # it 'installs a file' do + # expect(chef_run).to create_file('/tmp/foobar') + # end end diff --git a/test/unit/spec_helper.rb b/test/spec/spec_helper.rb similarity index 77% rename from test/unit/spec_helper.rb rename to test/spec/spec_helper.rb index 6e51ba3d..fa87ced7 100644 --- a/test/unit/spec_helper.rb +++ b/test/spec/spec_helper.rb @@ -1,5 +1,5 @@ require 'chefspec' -require 'chefspec/berkshelf' # TODO: Policyfiles +require 'chefspec/policyfile' # TODO: Policyfiles RSpec.configure do |config| @@ -9,4 +9,5 @@ config.platform = 'ubuntu' config.version = '18.04' + end \ No newline at end of file diff --git a/test/unit/system_install_spec.rb b/test/spec/system_install_spec.rb similarity index 85% rename from test/unit/system_install_spec.rb rename to test/spec/system_install_spec.rb index a1515d55..ea56465b 100644 --- a/test/unit/system_install_spec.rb +++ b/test/spec/system_install_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'jlenv-cookbook::system_install' do +describe 'jlenv::system_install' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/system_spec.rb b/test/spec/system_spec.rb similarity index 87% rename from test/unit/system_spec.rb rename to test/spec/system_spec.rb index 3e0653f3..8c95f3f6 100644 --- a/test/unit/system_spec.rb +++ b/test/spec/system_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'jlenv-cookbook::system' do +describe 'jlenv::system' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/user_install_spec.rb b/test/spec/user_install_spec.rb similarity index 85% rename from test/unit/user_install_spec.rb rename to test/spec/user_install_spec.rb index 3ac33e89..fed66c50 100644 --- a/test/unit/user_install_spec.rb +++ b/test/spec/user_install_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'jlenv-cookbook::user_install' do +describe 'jlenv::user_install' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/unit/user_spec.rb b/test/spec/user_spec.rb similarity index 87% rename from test/unit/user_spec.rb rename to test/spec/user_spec.rb index f17a5996..a6fdc473 100644 --- a/test/unit/user_spec.rb +++ b/test/spec/user_spec.rb @@ -1,7 +1,7 @@ require 'chefspec' require 'chefspec/berkshelf' -describe 'jlenv-cookbook::user' do +describe 'jlenv::user' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end From 4068d4adbdfbc9ab80cd215835afdccd3f1663fb Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 7 Aug 2019 19:52:10 +1000 Subject: [PATCH 058/105] Fixed delivery local lint --- Policyfile.rb | 4 ++-- libraries/package_deps.rb | 2 +- test/fixtures/cookbooks/test/Policyfile.rb | 6 +++--- test/spec/spec_helper.rb | 4 +--- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Policyfile.rb b/Policyfile.rb index 6b5e0538..36603c9e 100644 --- a/Policyfile.rb +++ b/Policyfile.rb @@ -1,6 +1,6 @@ -name "jlenv" +name 'jlenv' -path = File.expand_path("../policyfiles/base.rb",__FILE__) +path = File.expand_path('../policyfiles/base.rb', __FILE__) instance_eval(IO.read(path)) run_list 'jlenv::default' diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index ebddfe1e..ef53a79a 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -4,7 +4,7 @@ module PackageDeps def install_julia_dependencies case ::File.basename(new_resource.version) when /^special-julia-/ - # call another package install method + puts 'call another package install method' else package_deps.each do |deps| package deps diff --git a/test/fixtures/cookbooks/test/Policyfile.rb b/test/fixtures/cookbooks/test/Policyfile.rb index b3dc3180..2b019dd7 100644 --- a/test/fixtures/cookbooks/test/Policyfile.rb +++ b/test/fixtures/cookbooks/test/Policyfile.rb @@ -1,4 +1,4 @@ -name "test" -run_list "test:::pkg" +name 'test' +run_list 'test:::pkg' default_source :supermarket -cookbook 'jlenv', path: '../../../../' \ No newline at end of file +cookbook 'jlenv', path: '../../../../' diff --git a/test/spec/spec_helper.rb b/test/spec/spec_helper.rb index fa87ced7..c228e527 100644 --- a/test/spec/spec_helper.rb +++ b/test/spec/spec_helper.rb @@ -1,7 +1,6 @@ require 'chefspec' require 'chefspec/policyfile' # TODO: Policyfiles - RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.syntax = :expect @@ -9,5 +8,4 @@ config.platform = 'ubuntu' config.version = '18.04' - -end \ No newline at end of file +end From 1ff6aa56de775227bede89f0dccb8523b10bceee Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 7 Aug 2019 19:53:35 +1000 Subject: [PATCH 059/105] Add dokken as kitchen default. Vagrant optional. --- .kitchen.dokken.yml | 73 ------------------------------ .kitchen.vagrant.yml | 43 ++++++++++++++++++ .kitchen.yml | 103 ++++++++++++++++++++++++++++++------------- CONTRIBUTING.md | 31 +++++++++++-- README.1.md | 28 ++++++------ 5 files changed, 158 insertions(+), 120 deletions(-) delete mode 100644 .kitchen.dokken.yml create mode 100644 .kitchen.vagrant.yml diff --git a/.kitchen.dokken.yml b/.kitchen.dokken.yml deleted file mode 100644 index 0d55e2dc..00000000 --- a/.kitchen.dokken.yml +++ /dev/null @@ -1,73 +0,0 @@ ---- -driver: - name: dokken - privileged: true - env: [CHEF_LICENSE=accept] -transport: - name: dokken -provisioner: - name: dokken - deprecations_as_errors: true -verifier: - name: inspec -platforms: - - - name: debian-8 - driver: - image: dokken/debian-8 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - - - name: debian-9 - driver: - image: dokken/debian-9 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - - - name: centos-6 - driver: - image: dokken/centos-6 - pid_one_command: /sbin/init - intermediate_instructions: - - RUN yum -y install sudo - - - name: centos-7 - driver: - image: dokken/centos-7 - pid_one_command: /usr/lib/systemd/systemd - intermediate_instructions: - - RUN yum -y install sudo - - - name: fedora-latest - driver: - image: dokken/fedora-latest - pid_one_command: /usr/lib/systemd/systemd - intermediate_instructions: - - RUN dnf -y install sudo - - - name: ubuntu-16.04 - driver: - image: dokken/ubuntu-16.04 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - - - name: ubuntu-18.04 - driver: - image: dokken/ubuntu-18.04 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y - - - name: opensuse-leap - driver: - image: dokken/opensuse-leap - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN zypper --non-interactive install sudo diff --git a/.kitchen.vagrant.yml b/.kitchen.vagrant.yml new file mode 100644 index 00000000..b9fcafbb --- /dev/null +++ b/.kitchen.vagrant.yml @@ -0,0 +1,43 @@ +--- +driver: + name: vagrant + +provisioner: + name: chef_zero + product_name: chef + product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> + install_strategy: once + deprecations_as_errors: true + policyfile: Policyfile.rb + +verifier: + name: inspec + +platforms: + - name: centos-6 + - name: centos-7 + - name: fedora-latest + - name: debian-8 + - name: debian-9 + - name: ubuntu-16.04 + - name: ubuntu-18.04 + - name: opensuse-leap + +suites: + - name: pkg + run_list: recipe[test::pkg] + includes: [centos-7] + - name: global + run_list: recipe[test::global] + - name: julia_uninstall + run_list: recipe[test::julia_uninstall] + includes: [ubuntu-18.04] + - name: system_install + run_list: recipe[test::system_install] + includes: [centos-7] + - name: user_install + run_list: recipe[test::user_install] + includes: [centos-7] + - name: custom_group_install + run_list: recipe[test::custom_group_install] + includes: [centos-7] diff --git a/.kitchen.yml b/.kitchen.yml index b9fcafbb..1bfc811e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -1,43 +1,86 @@ --- driver: - name: vagrant + name: dokken + privileged: true + env: [CHEF_LICENSE=accept] + +transport: + name: dokken provisioner: - name: chef_zero - product_name: chef - product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> - install_strategy: once + name: dokken deprecations_as_errors: true - policyfile: Policyfile.rb verifier: name: inspec platforms: - - name: centos-6 - - name: centos-7 - - name: fedora-latest - - name: debian-8 - - name: debian-9 - - name: ubuntu-16.04 - - name: ubuntu-18.04 - - name: opensuse-leap + - + name: debian-8 + driver: + image: dokken/debian-8 + pid_one_command: /sbin/init + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: debian-9 + driver: + image: dokken/debian-9 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: centos-6 + driver: + image: dokken/centos-6 + pid_one_command: /sbin/init + intermediate_instructions: + - RUN yum -y install sudo + - + name: centos-7 + driver: + image: dokken/centos-7 + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN yum -y install sudo + - + name: fedora-latest + driver: + image: dokken/fedora-latest + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN dnf -y install sudo + - + name: ubuntu-16.04 + driver: + image: dokken/ubuntu-16.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: ubuntu-18.04 + driver: + image: dokken/ubuntu-18.04 + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN /usr/bin/apt-get update + - RUN /usr/bin/apt-get install sudo -y + - + name: opensuse-leap + driver: + image: dokken/opensuse-leap + pid_one_command: /bin/systemd + intermediate_instructions: + - RUN zypper --non-interactive install sudo suites: - - name: pkg - run_list: recipe[test::pkg] - includes: [centos-7] - name: global - run_list: recipe[test::global] - - name: julia_uninstall - run_list: recipe[test::julia_uninstall] - includes: [ubuntu-18.04] - - name: system_install - run_list: recipe[test::system_install] - includes: [centos-7] - - name: user_install - run_list: recipe[test::user_install] - includes: [centos-7] - - name: custom_group_install - run_list: recipe[test::custom_group_install] - includes: [centos-7] + provisioner: + policyfile: test/fixtures/cookbooks/test/Policyfile.rb + verifier: + inspec_tests: + - test/spec/integration/global + attributes: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e3873c2..eb228a76 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,12 +48,23 @@ downloading the branch. ## Functional and Unit Tests -This cookbook is set up to run tests under [test-kitchen](https://kitchen.ci/). -It uses serverspec to run integration tests after the node has been -converged to verify that the state of the node. +This cookbook is set up to: + +1. Run lint and unit test with [delivery](https://github.com/chef/delivery-cli). + Uses `delivery local ` to tun lint and unit tests locally. +1. Run integration tests with [test-kitchen](https://kitchen.ci/). + It uses serverspec to run integration tests after the node has been + converged to verify that the state of the node. + +For faster testing, we use [Dokken](https://github.com/someara/kitchen-dokken) kitchen file, invoked by: + +``` +KITECHEN_YAML=.kitchen.dokken.yml kitchen test +``` +https://hub.docker.com/u/dokken/ Test kitchen should run completely without exception using the default -[baseboxes provided by Chef](http://opscode.github.io/bento/). +[containers provided by Dokken](https://hub.docker.com/u/dokken/). Because Test Kitchen creates VirtualBox machines and runs through every configuration in the .kitchen.yml file, it may take some time for these tests to complete. @@ -81,6 +92,18 @@ for it. If you need help writing tests, please ask on the Chef Developer's mailing list, or the #chef-hacking IRC channel. +Test kitchen can be run using the default +[baseboxes provided by Chef](http://opscode.github.io/bento/): + +``` +KITECHEN_YAML=.kitchen.vagrant.yml kitchen test +``` + +Because Test Kitchen creates VirtualBox machines and runs through +every configuration in the .kitchen.yml file, it may take some time for +these tests to complete. + + ## Cookbook Contribution Do's and Don't's Please do include tests for your contribution. If you need help, ask diff --git a/README.1.md b/README.1.md index 5fe922be..8fd92653 100755 --- a/README.1.md +++ b/README.1.md @@ -12,7 +12,7 @@ Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. ## Maintainers This cookbook is maintained by volunteers. -[All contributions and bug reports are welcome](./CONTRIBUTING). +[All contributions and bug reports are welcome.](./CONTRIBUTING). ## Requirements @@ -37,19 +37,19 @@ A `jlenv_user_install` is required to be set so that jlenv knows which version you want to use, and is installed on the system. | **NOTE:** | -| System wide installations of jlenv are discouraged by the jlenv maintainer.| +| System wide installations of jlenv are discouraged.| |---| -However they are supported by this cookbook, see +However thsystem wide installs are supported by this cookbook, see [these](https://github.com/rbenv/rbenv/issues/38/) [two](https://github.com/rbenv/rbenv/issues/306/) issues in the rbenv repository -for the reasons why. +for the reasons why system wide installs can be problematic. ## Pkg Used to install a package into the selected jlenv environment. -```julia +```ruby jlenv_package 'pkg_name' do options # Optional: Options for the packagecommand e.g. '--no-rdoc --no-ri' source # Optional: source URL/location for gem. @@ -65,7 +65,7 @@ end Sets the global Julia version. The name of the resource is the version to set. -```julia +```ruby jlenv_global '1.1.0' do user # Optional: Sets the users global version. # Leave unset, to set the system global version. @@ -80,7 +80,7 @@ system global version. Installs a jlenv plugin. -```julia +```ruby jlenv_plugin 'julia-build' do git_url # Git URL of the plugin git_ref # Git reference of the plugin @@ -93,7 +93,7 @@ If user is passed in, the plugin is installed to the users install of jlenv. ## Rehash -```julia +```ruby jlenv_rehash 'rehash' do user 'vagrant' # Optional: Rehash the user jlenv otherwise rehash system jlenv end @@ -105,7 +105,7 @@ If user is passed in, the user Julia is rehashed rather than the system Julia. Installs a given Julia version to the system or user location. -```julia +```ruby jlenv_julia '1.1.0' do user # Optional, but recommended: If passed, the user to install jlenv to jlenv_action # Optional: Action to perform: @@ -119,7 +119,7 @@ Shorter example `jlenv_julia '1.1.0'` Runs a jlenv aware script. -```julia +```ruby jlenv_script 'foo' do jlenv_version #jlenv version to run the script against environment # Optional: Hash of environment variables in the form of @@ -134,7 +134,7 @@ end Note that environment overwrites the entire variable. For example. setting the `$PATH` variable can be done like this: -```julia +```ruby jlenv_script 'bundle package' do cwd node["bundle_dir"] environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"}) @@ -149,7 +149,7 @@ Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set Installs jlenv to the system location, by default `/usr/local/jlenv` -```julia +```ruby jlenv_system_install 'foo' do git_url # URL of the plugin repo you want to checkout git_ref # Optional: Git reference to checkout @@ -161,7 +161,7 @@ end Installs jlenv to the user path, making jlenv available to that user only. -```julia +```ruby jlenv_user_install 'vagrant' do git_url # Optional: Git URL to checkout jlenv from. git_ref # Optional: Git reference to checkout e.g. 'master' @@ -186,6 +186,8 @@ Pull requests are very welcome! Make sure your patches are well tested. ## Contributors +[All contributions and bug reports are welcome.](./CONTRIBUTING) +
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
From fd76c57fcceda1db127be88ab5e543432a69c2b4 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 7 Aug 2019 21:40:33 +1000 Subject: [PATCH 060/105] All specs green: delivery local unit. --- Berksfile | 7 ------- Policyfile.rb | 2 +- policyfiles/base.rb | 2 ++ test/fixtures/cookbooks/test/Policyfile.rb | 6 +++++- test/fixtures/cookbooks/test/metadata.rb | 2 ++ .../system_install_spec.rb} | 5 ++--- test/spec/{ => recipes}/system_spec.rb | 5 ++--- test/spec/recipes/user_install_spec.rb | 13 +++++++++++++ test/spec/spec_helper.rb | 3 +-- test/spec/system_install_spec.rb | 12 ------------ test/spec/user_install_spec.rb | 12 ------------ 11 files changed, 28 insertions(+), 41 deletions(-) delete mode 100644 Berksfile rename test/spec/{user_spec.rb => recipes/system_install_spec.rb} (73%) rename test/spec/{ => recipes}/system_spec.rb (73%) create mode 100644 test/spec/recipes/user_install_spec.rb delete mode 100644 test/spec/system_install_spec.rb delete mode 100644 test/spec/user_install_spec.rb diff --git a/Berksfile b/Berksfile deleted file mode 100644 index e09849c7..00000000 --- a/Berksfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://supermarket.chef.io' - -metadata - -group :integration do - cookbook 'test', path: 'test/fixtures/cookbooks/test' -end diff --git a/Policyfile.rb b/Policyfile.rb index 36603c9e..98eae4fb 100644 --- a/Policyfile.rb +++ b/Policyfile.rb @@ -1,6 +1,6 @@ name 'jlenv' -path = File.expand_path('../policyfiles/base.rb', __FILE__) +path = File.expand_path('policyfiles/base.rb', __dir__) instance_eval(IO.read(path)) run_list 'jlenv::default' diff --git a/policyfiles/base.rb b/policyfiles/base.rb index d3439731..fc052a02 100644 --- a/policyfiles/base.rb +++ b/policyfiles/base.rb @@ -1 +1,3 @@ default_source :supermarket + +cookbook 'test', path: './test/fixtures/cookbooks/test' diff --git a/test/fixtures/cookbooks/test/Policyfile.rb b/test/fixtures/cookbooks/test/Policyfile.rb index 2b019dd7..fa0a47e5 100644 --- a/test/fixtures/cookbooks/test/Policyfile.rb +++ b/test/fixtures/cookbooks/test/Policyfile.rb @@ -1,4 +1,8 @@ name 'test' +# The run list is also ignored by ChefSpec but you need to specify one. run_list 'test:::pkg' + default_source :supermarket -cookbook 'jlenv', path: '../../../../' + +cookbook 'test', path: '.' +# cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb index 01136ae7..811eb774 100644 --- a/test/fixtures/cookbooks/test/metadata.rb +++ b/test/fixtures/cookbooks/test/metadata.rb @@ -2,3 +2,5 @@ version '0.99.0' depends 'jlenv' + +recipe 'test::user_install', 'Provides an example for documentation purposes.' diff --git a/test/spec/user_spec.rb b/test/spec/recipes/system_install_spec.rb similarity index 73% rename from test/spec/user_spec.rb rename to test/spec/recipes/system_install_spec.rb index a6fdc473..93a3d6d2 100644 --- a/test/spec/user_spec.rb +++ b/test/spec/recipes/system_install_spec.rb @@ -1,7 +1,6 @@ -require 'chefspec' -require 'chefspec/berkshelf' +require_relative '../spec_helper' -describe 'jlenv::user' do +describe 'test::system_install' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/spec/system_spec.rb b/test/spec/recipes/system_spec.rb similarity index 73% rename from test/spec/system_spec.rb rename to test/spec/recipes/system_spec.rb index 8c95f3f6..93a3d6d2 100644 --- a/test/spec/system_spec.rb +++ b/test/spec/recipes/system_spec.rb @@ -1,7 +1,6 @@ -require 'chefspec' -require 'chefspec/berkshelf' +require_relative '../spec_helper' -describe 'jlenv::system' do +describe 'test::system_install' do let(:chef_run) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) end diff --git a/test/spec/recipes/user_install_spec.rb b/test/spec/recipes/user_install_spec.rb new file mode 100644 index 00000000..9b4b8d1b --- /dev/null +++ b/test/spec/recipes/user_install_spec.rb @@ -0,0 +1,13 @@ +require_relative '../spec_helper' + +describe 'test::user_install' do + let(:chef_run) do + #ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) + # USe platform and version set in spec_helper.rb + ChefSpec::SoloRunner.new.converge(described_recipe) + end + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end +end diff --git a/test/spec/spec_helper.rb b/test/spec/spec_helper.rb index c228e527..55e12ddc 100644 --- a/test/spec/spec_helper.rb +++ b/test/spec/spec_helper.rb @@ -1,11 +1,10 @@ require 'chefspec' -require 'chefspec/policyfile' # TODO: Policyfiles +require 'chefspec/policyfile' RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.syntax = :expect end - config.platform = 'ubuntu' config.version = '18.04' end diff --git a/test/spec/system_install_spec.rb b/test/spec/system_install_spec.rb deleted file mode 100644 index ea56465b..00000000 --- a/test/spec/system_install_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'chefspec' -require 'chefspec/berkshelf' - -describe 'jlenv::system_install' do - let(:chef_run) do - ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end -end diff --git a/test/spec/user_install_spec.rb b/test/spec/user_install_spec.rb deleted file mode 100644 index fed66c50..00000000 --- a/test/spec/user_install_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'chefspec' -require 'chefspec/berkshelf' - -describe 'jlenv::user_install' do - let(:chef_run) do - ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end -end From 888d09ec77a101023e6a6c588f4f15b4bb5ddc42 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 9 Aug 2019 10:50:07 +1000 Subject: [PATCH 061/105] Add policyfile to dokken kitchen test. Global use case recipe is broken, but it looks like the jlenv_system_install recipe may have an issue. --- .kitchen.yml | 4 +- metadata.rb | 4 +- resources/user_install.rb | 1 + test/fixtures/cookbooks/test/Policyfile.rb | 4 +- .../test/Policyfile_global.lock.json | 81 +++++++++++++++++++ .../cookbooks/test/Policyfile_global.rb | 8 ++ test/fixtures/cookbooks/test/metadata.rb | 2 +- .../cookbooks/test/policyfiles/base.rb | 2 + .../cookbooks/test/policyfiles/global.rb | 8 ++ .../cookbooks/test/recipes/default.rb | 4 + .../fixtures/cookbooks/test/recipes/global.rb | 17 ++-- .../cookbooks/test/recipes/system_install.rb | 4 + .../cookbooks/test/recipes/user_install.rb | 7 +- .../test/recipes/{dokken.rb => vagrant.rb} | 3 +- test/integration/julia_uninstall/inspec.yml | 2 +- .../user_install/controls/user_install.rb | 43 ++++++++-- test/spec/recipes/system_spec.rb | 11 --- test/spec/recipes/user_install_spec.rb | 7 +- 18 files changed, 171 insertions(+), 41 deletions(-) create mode 100644 test/fixtures/cookbooks/test/Policyfile_global.lock.json create mode 100644 test/fixtures/cookbooks/test/Policyfile_global.rb create mode 100644 test/fixtures/cookbooks/test/policyfiles/base.rb create mode 100644 test/fixtures/cookbooks/test/policyfiles/global.rb create mode 100644 test/fixtures/cookbooks/test/recipes/default.rb rename test/fixtures/cookbooks/test/recipes/{dokken.rb => vagrant.rb} (66%) delete mode 100644 test/spec/recipes/system_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 1bfc811e..bd04ff9e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -79,8 +79,8 @@ platforms: suites: - name: global provisioner: - policyfile: test/fixtures/cookbooks/test/Policyfile.rb + policyfile: test/fixtures/cookbooks/test/Policyfile_global.rb verifier: inspec_tests: - - test/spec/integration/global + - test/integration/global attributes: diff --git a/metadata.rb b/metadata.rb index a107a0e8..e2a4da9d 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,8 +6,8 @@ license 'Apache-2.0' description 'Manages jlenv and plugins for Julia installations.' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.0' -chef_version '>= 13.0' +version '0.3.0' +chef_version '>= 14.0' supports 'ubuntu' supports 'linuxmint' diff --git a/resources/user_install.rb b/resources/user_install.rb index 5b37dd78..9eb99249 100644 --- a/resources/user_install.rb +++ b/resources/user_install.rb @@ -62,6 +62,7 @@ owner new_resource.user group new_resource.group mode '0755' + recursive false end end diff --git a/test/fixtures/cookbooks/test/Policyfile.rb b/test/fixtures/cookbooks/test/Policyfile.rb index fa0a47e5..88fbef21 100644 --- a/test/fixtures/cookbooks/test/Policyfile.rb +++ b/test/fixtures/cookbooks/test/Policyfile.rb @@ -1,8 +1,8 @@ name 'test' # The run list is also ignored by ChefSpec but you need to specify one. -run_list 'test:::pkg' +run_list 'test::default' default_source :supermarket cookbook 'test', path: '.' -# cookbook 'jlenv', path: '../../../../' +cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/Policyfile_global.lock.json b/test/fixtures/cookbooks/test/Policyfile_global.lock.json new file mode 100644 index 00000000..df6fb1cf --- /dev/null +++ b/test/fixtures/cookbooks/test/Policyfile_global.lock.json @@ -0,0 +1,81 @@ +{ + "revision_id": "85779d6bdf5d0083f1b427cf042b2189dabb51bccace41437f90b66e7e92c538", + "name": "test", + "run_list": [ + "recipe[test::global]" + ], + "included_policy_locks": [ + + ], + "cookbook_locks": { + "jlenv": { + "version": "0.3.0", + "identifier": "28fe8c10add7484f99c9e1d1940185cfb04ba1bb", + "dotted_decimal_identifier": "11538876597131080.22405615516226561.147127062471099", + "source": "../../../..", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "fd76c57fcceda1db127be88ab5e543432a69c2b4", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "../../../.." + } + }, + "test": { + "version": "0.99.1", + "identifier": "f9aab80cae4f1394001625e1c066357d669d136a", + "dotted_decimal_identifier": "70274976664407827.41658391678009446.58812708754282", + "source": ".", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "fd76c57fcceda1db127be88ab5e543432a69c2b4", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "." + } + } + }, + "default_attributes": { + + }, + "override_attributes": { + + }, + "solution_dependencies": { + "Policyfile": [ + [ + "jlenv", + ">= 0.0.0" + ], + [ + "test", + ">= 0.0.0" + ] + ], + "dependencies": { + "jlenv (0.3.0)": [ + + ], + "test (0.99.1)": [ + [ + "jlenv", + ">= 0.0.0" + ] + ] + } + } +} diff --git a/test/fixtures/cookbooks/test/Policyfile_global.rb b/test/fixtures/cookbooks/test/Policyfile_global.rb new file mode 100644 index 00000000..049175e0 --- /dev/null +++ b/test/fixtures/cookbooks/test/Policyfile_global.rb @@ -0,0 +1,8 @@ +name 'test' +# The run list is also ignored by ChefSpec but you need to specify one. +run_list 'test::global' + +#default_source :supermarket + +cookbook 'test', path: '.' +cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb index 811eb774..48347929 100644 --- a/test/fixtures/cookbooks/test/metadata.rb +++ b/test/fixtures/cookbooks/test/metadata.rb @@ -1,5 +1,5 @@ name 'test' -version '0.99.0' +version '0.99.1' depends 'jlenv' diff --git a/test/fixtures/cookbooks/test/policyfiles/base.rb b/test/fixtures/cookbooks/test/policyfiles/base.rb new file mode 100644 index 00000000..e386b22a --- /dev/null +++ b/test/fixtures/cookbooks/test/policyfiles/base.rb @@ -0,0 +1,2 @@ +cookbook 'test', path: '.' +cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/policyfiles/global.rb b/test/fixtures/cookbooks/test/policyfiles/global.rb new file mode 100644 index 00000000..07b78c39 --- /dev/null +++ b/test/fixtures/cookbooks/test/policyfiles/global.rb @@ -0,0 +1,8 @@ +name 'Test Global Recipe' + +path = File.expand_path('base.rb', __dir__) +instance_eval(IO.read(path)) + +#include_policy 'base', path: '.' +# The run list is also ignored by ChefSpec but you need to specify one. +run_list 'test::global' diff --git a/test/fixtures/cookbooks/test/recipes/default.rb b/test/fixtures/cookbooks/test/recipes/default.rb new file mode 100644 index 00000000..bd0c8de1 --- /dev/null +++ b/test/fixtures/cookbooks/test/recipes/default.rb @@ -0,0 +1,4 @@ +# recipe file to satisfy Policyfile build. + +# Make sure that Vagrant user is on the box for dokken +include_recipe 'test::vagrant' diff --git a/test/fixtures/cookbooks/test/recipes/global.rb b/test/fixtures/cookbooks/test/recipes/global.rb index 40f030b3..500dab7c 100644 --- a/test/fixtures/cookbooks/test/recipes/global.rb +++ b/test/fixtures/cookbooks/test/recipes/global.rb @@ -1,14 +1,17 @@ + +# Use case + +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + global_version = '1.0.3' # Install Jlenv Globally jlenv_system_install 'system' -jlenv_julia global_version do - verbose true -end - -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' +# jlenv_julia global_version do +# verbose true +# end -# Set that Julia as the global Julia +# Set that Julia version as the global Julia jlenv_global global_version diff --git a/test/fixtures/cookbooks/test/recipes/system_install.rb b/test/fixtures/cookbooks/test/recipes/system_install.rb index 870e46f9..46a6a37c 100644 --- a/test/fixtures/cookbooks/test/recipes/system_install.rb +++ b/test/fixtures/cookbooks/test/recipes/system_install.rb @@ -1,4 +1,8 @@ # Install Jlenv to the system path e.g. /usr/local/jlenv + +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + jlenv_system_install 'system' do update_jlenv false end diff --git a/test/fixtures/cookbooks/test/recipes/user_install.rb b/test/fixtures/cookbooks/test/recipes/user_install.rb index ae2117a2..91fd0a15 100644 --- a/test/fixtures/cookbooks/test/recipes/user_install.rb +++ b/test/fixtures/cookbooks/test/recipes/user_install.rb @@ -1,8 +1,9 @@ # Install jlenv and makes it avilable to the selected user -version = '1.0.1' -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + +version = '1.0.1' # Keeps the jlenv install upto date jlenv_user_install 'vagrant' diff --git a/test/fixtures/cookbooks/test/recipes/dokken.rb b/test/fixtures/cookbooks/test/recipes/vagrant.rb similarity index 66% rename from test/fixtures/cookbooks/test/recipes/dokken.rb rename to test/fixtures/cookbooks/test/recipes/vagrant.rb index 4c225ee4..3860f53a 100644 --- a/test/fixtures/cookbooks/test/recipes/dokken.rb +++ b/test/fixtures/cookbooks/test/recipes/vagrant.rb @@ -1,4 +1,5 @@ -# Make sure Vagrant user is on the box. This should fix the dokken user install +# Make sure Vagrant user is on the box. +# This should fix the dokken user install. user 'vagrant' group 'vagrant' do diff --git a/test/integration/julia_uninstall/inspec.yml b/test/integration/julia_uninstall/inspec.yml index 9baf31c5..1cd2f1a7 100644 --- a/test/integration/julia_uninstall/inspec.yml +++ b/test/integration/julia_uninstall/inspec.yml @@ -3,7 +3,7 @@ name: jlenv title: jlenv profile maintainer: Taqtiqa LLC license: Apache-2.0 -summary: Verifies that Julias can be uninstalled +summary: Verify that Julias can be uninstalled version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/user_install/controls/user_install.rb b/test/integration/user_install/controls/user_install.rb index 5b711c28..c34cf158 100644 --- a/test/integration/user_install/controls/user_install.rb +++ b/test/integration/user_install/controls/user_install.rb @@ -1,19 +1,50 @@ # frozen_string_literal: true -global_julia = '1.0.1' +title 'Jlenv User Install Example Recipe' control 'Jlenv should be installed' do - title 'Jlenv should be installed to the users home directory' + impact 0.6 + title 'Jlenv should be installed uner the users home directory.' + desc 'Always specify environment variables, folders and permissions.' + desc 'rationale', 'This ensures that there are no unexpected scripts run.' # Requires InSpec >=2.3.4 + tag 'julia','jlenv' + #ref 'NSA-RH6-STIG - Section 3.5.2.1', url: 'https://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf' + + global_julia = '1.0.1' - desc 'Jlenv should be installed' describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv global"') do its('exit_status') { should eq 0 } its('stdout') { should include(global_julia) } end - describe file('/home/vagrant/.jlenv/versions') do - it { should exist } - it { should be_writable.by_user('vagrant') } + %w(plugins shims versions).each do |d| + describe directory("/home/vagrant/.jlenv/#{d}") do + it { should exist } + it { should be_writable.by_user('vagrant') } + its('mode') { should cmp '0755' } + end + end + + describe file('/etc/profile.d/jlenv.sh') do + its('group') { should eq 'admins' } + its('user') { should eq 'root' } + its('mode') { should cmp '0755' } + it { should_not be_writable.by_user('vagrant') } + it { should be_executable.by('others') } + it { should be_executable.by_user('vagrant') } + end + + it 'checkouts from git with attributes' do + is_expected.to checkout_git('/home/vagrant/.jlenv').with( + repository: 'https://github.com/jlenv/jlenv.git', + reference: 'master' + ) + end + + describe os_env('PATH', 'target') do + its('split') { should_not include('') } + its('split') { should_not include('.') } + its('split') { should include ('/home/vagrant/.jlenv/shims') } end end diff --git a/test/spec/recipes/system_spec.rb b/test/spec/recipes/system_spec.rb deleted file mode 100644 index 93a3d6d2..00000000 --- a/test/spec/recipes/system_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -require_relative '../spec_helper' - -describe 'test::system_install' do - let(:chef_run) do - ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) - end - - it 'converges successfully' do - expect { chef_run }.to_not raise_error - end -end diff --git a/test/spec/recipes/user_install_spec.rb b/test/spec/recipes/user_install_spec.rb index 9b4b8d1b..3cc46265 100644 --- a/test/spec/recipes/user_install_spec.rb +++ b/test/spec/recipes/user_install_spec.rb @@ -1,11 +1,8 @@ require_relative '../spec_helper' describe 'test::user_install' do - let(:chef_run) do - #ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) - # USe platform and version set in spec_helper.rb - ChefSpec::SoloRunner.new.converge(described_recipe) - end + let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } + let(:git) { chef_run.git('/home/vagrant/.jlenv') } it 'converges successfully' do expect { chef_run }.to_not raise_error From 2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 16 Aug 2019 11:06:54 +1000 Subject: [PATCH 062/105] Refactor policyfiles. --- .kitchen.yml | 2 +- CHANGELOG.md | 4 +- .../test/Policyfile_global.lock.json | 81 ------------------- .../test/{Policyfile_global.rb => global.pf} | 4 +- .../fixtures/cookbooks/test/recipes/global.rb | 9 +-- test/spec/recipes/default_spec.rb | 4 +- 6 files changed, 8 insertions(+), 96 deletions(-) delete mode 100644 test/fixtures/cookbooks/test/Policyfile_global.lock.json rename test/fixtures/cookbooks/test/{Policyfile_global.rb => global.pf} (50%) diff --git a/.kitchen.yml b/.kitchen.yml index bd04ff9e..1a6b24e7 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -79,7 +79,7 @@ platforms: suites: - name: global provisioner: - policyfile: test/fixtures/cookbooks/test/Policyfile_global.rb + policyfile: test/fixtures/cookbooks/test/global.pf verifier: inspec_tests: - test/integration/global diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e84ea70..e294ad87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ -# ruby_rbenv Cookbook Changelog +# jlenv Cookbook Changelog -This file is used to list changes made in each version of the ruby_rbenv cookbook. +This file is used to list changes made in each version of the jlenv cookbook. ## 0.1.0 (2019-07-03) diff --git a/test/fixtures/cookbooks/test/Policyfile_global.lock.json b/test/fixtures/cookbooks/test/Policyfile_global.lock.json deleted file mode 100644 index df6fb1cf..00000000 --- a/test/fixtures/cookbooks/test/Policyfile_global.lock.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "revision_id": "85779d6bdf5d0083f1b427cf042b2189dabb51bccace41437f90b66e7e92c538", - "name": "test", - "run_list": [ - "recipe[test::global]" - ], - "included_policy_locks": [ - - ], - "cookbook_locks": { - "jlenv": { - "version": "0.3.0", - "identifier": "28fe8c10add7484f99c9e1d1940185cfb04ba1bb", - "dotted_decimal_identifier": "11538876597131080.22405615516226561.147127062471099", - "source": "../../../..", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "fd76c57fcceda1db127be88ab5e543432a69c2b4", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "../../../.." - } - }, - "test": { - "version": "0.99.1", - "identifier": "f9aab80cae4f1394001625e1c066357d669d136a", - "dotted_decimal_identifier": "70274976664407827.41658391678009446.58812708754282", - "source": ".", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "fd76c57fcceda1db127be88ab5e543432a69c2b4", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "." - } - } - }, - "default_attributes": { - - }, - "override_attributes": { - - }, - "solution_dependencies": { - "Policyfile": [ - [ - "jlenv", - ">= 0.0.0" - ], - [ - "test", - ">= 0.0.0" - ] - ], - "dependencies": { - "jlenv (0.3.0)": [ - - ], - "test (0.99.1)": [ - [ - "jlenv", - ">= 0.0.0" - ] - ] - } - } -} diff --git a/test/fixtures/cookbooks/test/Policyfile_global.rb b/test/fixtures/cookbooks/test/global.pf similarity index 50% rename from test/fixtures/cookbooks/test/Policyfile_global.rb rename to test/fixtures/cookbooks/test/global.pf index 049175e0..dc9ebf08 100644 --- a/test/fixtures/cookbooks/test/Policyfile_global.rb +++ b/test/fixtures/cookbooks/test/global.pf @@ -1,8 +1,6 @@ name 'test' -# The run list is also ignored by ChefSpec but you need to specify one. -run_list 'test::global' -#default_source :supermarket +run_list 'test::global' cookbook 'test', path: '.' cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/recipes/global.rb b/test/fixtures/cookbooks/test/recipes/global.rb index 500dab7c..39b40f17 100644 --- a/test/fixtures/cookbooks/test/recipes/global.rb +++ b/test/fixtures/cookbooks/test/recipes/global.rb @@ -1,17 +1,14 @@ -# Use case +# Spec resource usage with defaults. # Ensure Vagrant user exists on test environment include_recipe 'test::default' global_version = '1.0.3' -# Install Jlenv Globally +# Install Jlenv Globally. +# TODO: Remove this step by installing the given version if not installed. jlenv_system_install 'system' -# jlenv_julia global_version do -# verbose true -# end - # Set that Julia version as the global Julia jlenv_global global_version diff --git a/test/spec/recipes/default_spec.rb b/test/spec/recipes/default_spec.rb index e9d74b23..323bc742 100644 --- a/test/spec/recipes/default_spec.rb +++ b/test/spec/recipes/default_spec.rb @@ -1,6 +1,7 @@ require_relative '../spec_helper' describe 'jlenv::default' do + let(:chef_run) do ChefSpec::SoloRunner.new.converge(described_recipe) end @@ -9,7 +10,4 @@ expect { chef_run }.to_not raise_error end - # it 'installs a file' do - # expect(chef_run).to create_file('/tmp/foobar') - # end end From fb08ec447b611d9365d8b696f0cbbec8b83b18e5 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 16 Aug 2019 11:46:04 +1000 Subject: [PATCH 063/105] Add system install policyfile integration spec. 3 controls passing. --- .kitchen.yml | 8 +- README.1.md | 196 ------------------ README.md | 2 +- resources/system_install.rb | 2 +- test/fixtures/cookbooks/test/Policyfile.rb | 8 - .../cookbooks/test/global.pf.lock.json | 81 ++++++++ .../test/{global.pf => global.pf.rb} | 0 test/fixtures/cookbooks/test/metadata.rb | 4 +- .../cookbooks/test/policyfiles/global.rb | 8 - .../test/system_install.pf.lock.json | 81 ++++++++ .../base.rb => system_install.pf.rb} | 4 + 11 files changed, 177 insertions(+), 217 deletions(-) delete mode 100755 README.1.md delete mode 100644 test/fixtures/cookbooks/test/Policyfile.rb create mode 100644 test/fixtures/cookbooks/test/global.pf.lock.json rename test/fixtures/cookbooks/test/{global.pf => global.pf.rb} (100%) delete mode 100644 test/fixtures/cookbooks/test/policyfiles/global.rb create mode 100644 test/fixtures/cookbooks/test/system_install.pf.lock.json rename test/fixtures/cookbooks/test/{policyfiles/base.rb => system_install.pf.rb} (58%) diff --git a/.kitchen.yml b/.kitchen.yml index 1a6b24e7..b5c7852b 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -77,9 +77,15 @@ platforms: - RUN zypper --non-interactive install sudo suites: + - name: system_install + provisioner: + policyfile: test/fixtures/cookbooks/test/system_install.pf.rb + verifier: + inspec_tests: + - test/integration/system_install - name: global provisioner: - policyfile: test/fixtures/cookbooks/test/global.pf + policyfile: test/fixtures/cookbooks/test/global.pf.rb verifier: inspec_tests: - test/integration/global diff --git a/README.1.md b/README.1.md deleted file mode 100755 index 8fd92653..00000000 --- a/README.1.md +++ /dev/null @@ -1,196 +0,0 @@ -# Chef Jlenv Cookbook - -[![Cookbook Version](https://img.shields.io/cookbook/v/jlenv-cookbook.svg)](https://supermarket.chef.io/cookbooks/jlenv-cookbook) -[![Build Status](https://img.shields.io/circleci/project/github/jlenv/jlenv-cookbook/master.svg)](https://circleci.com/gh/jlenv/jlenv-cookbook) -[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) -[![CircleCI](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook.svg?style=svg)](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook) - -## Description - -Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. - -## Maintainers - -This cookbook is maintained by volunteers. -[All contributions and bug reports are welcome.](./CONTRIBUTING). - -## Requirements - -### Chef - -This cookbook requires Chef 13.0+. - -### Platform - -- Debian derivatives -- Fedora -- macOS (not currently tested) -- RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux) -- openSUSE and openSUSE leap -- Windows (not supported) - -## Usage - -Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. - -A `jlenv_user_install` is required to be set so that jlenv knows which version -you want to use, and is installed on the system. - -| **NOTE:** | -| System wide installations of jlenv are discouraged.| -|---| - -However thsystem wide installs are supported by this cookbook, see -[these](https://github.com/rbenv/rbenv/issues/38/) -[two](https://github.com/rbenv/rbenv/issues/306/) issues in the rbenv repository -for the reasons why system wide installs can be problematic. - -## Pkg - -Used to install a package into the selected jlenv environment. - -```ruby -jlenv_package 'pkg_name' do - options # Optional: Options for the packagecommand e.g. '--no-rdoc --no-ri' - source # Optional: source URL/location for gem. - timeout # Optional: Pkg install timeout - version # Optional: Pkg version to install - response_file # Optional: response file to reconfigure a gem - jlenv_version # Required: Which jlenv version to install the packageto. - user # Which user to install for. REQUIRED if you're using jlenv_user_install -end -``` - -## Global - -Sets the global Julia version. The name of the resource is the version to set. - -```ruby -jlenv_global '1.1.0' do - user # Optional: Sets the users global version. - # Leave unset, to set the system global version. -end -``` - -If a user is passed in to this resource it sets the global version for the user, -under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the -system global version. - -## Plugin - -Installs a jlenv plugin. - -```ruby -jlenv_plugin 'julia-build' do - git_url # Git URL of the plugin - git_ref # Git reference of the plugin - user # Optional: Install to the users jlenv. - # Do not set, to set installs to the system jlenv. -end -``` - -If user is passed in, the plugin is installed to the users install of jlenv. - -## Rehash - -```ruby -jlenv_rehash 'rehash' do - user 'vagrant' # Optional: Rehash the user jlenv otherwise rehash system jlenv -end -``` - -If user is passed in, the user Julia is rehashed rather than the system Julia. - -## Julia - -Installs a given Julia version to the system or user location. - -```ruby -jlenv_julia '1.1.0' do - user # Optional, but recommended: If passed, the user to install jlenv to - jlenv_action # Optional: Action to perform: - # 'install' (default), 'uninstall' etc. -end -``` - -Shorter example `jlenv_julia '1.1.0'` - -## Script - -Runs a jlenv aware script. - -```ruby -jlenv_script 'foo' do - jlenv_version #jlenv version to run the script against - environment # Optional: Hash of environment variables in the form of - # ({"ENV_VARIABLE" => "VALUE"}). - user # Optional: User to run as - group # Optional: Group to run as - returns # Optional: Expected return code - code # Script code to run -end -``` - -Note that environment overwrites the entire variable. -For example. setting the `$PATH` variable can be done like this: - -```ruby -jlenv_script 'bundle package' do - cwd node["bundle_dir"] - environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"}) - code "bundle package --all" -end -``` - -Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set -`PATH`. - -## System_install - -Installs jlenv to the system location, by default `/usr/local/jlenv` - -```ruby -jlenv_system_install 'foo' do - git_url # URL of the plugin repo you want to checkout - git_ref # Optional: Git reference to checkout - update_jlenv # Optional: Keeps the git repo up to date -end -``` - -## User_install - -Installs jlenv to the user path, making jlenv available to that user only. - -```ruby -jlenv_user_install 'vagrant' do - git_url # Optional: Git URL to checkout jlenv from. - git_ref # Optional: Git reference to checkout e.g. 'master' - user # Which user to install jlenv to (also given in the resources name above) -end -``` - -## System-Wide macOS Installation Note - -This cookbook takes advantage of managing profile fragments in an -`/etc/profile.d` directory, common on most Unix-flavored platforms. -Unfortunately, macOS does not support this idiom out of the box, so you may -need to [modify][mac_profile_d] your user profile. - -## Development - -- Source hosted at [GitHub](https://github.com/jlenv/jlenv-cookbook/) -- Report Issues/Questions/Feature requests on - [GitHub Issues](https://github.com/jlenv/jlenv-cookbook/issues) - -Pull requests are very welcome! Make sure your patches are well tested. - -## Contributors - -[All contributions and bug reports are welcome.](./CONTRIBUTING) - - - -
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
- - -This project exists thanks to all the people who contribute. diff --git a/README.md b/README.md index 5fe922be..ae3d7910 100755 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This cookbook requires Chef 13.0+. ### Platform -- Debian derivatives +- Debian derivatives (Ubuntu etc.) - Fedora - macOS (not currently tested) - RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux) diff --git a/resources/system_install.rb b/resources/system_install.rb index fe85705e..56276000 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -24,7 +24,7 @@ # Install jlenv to a system wide location provides :jlenv_system_install -property :git_url, String, default: 'https://github.com/rbenv/rbenv.git' +property :git_url, String, default: 'https://github.com/jlenv/jlenv.git' property :git_ref, String, default: 'master' property :global_prefix, String, default: '/usr/local/jlenv' property :update_jlenv, [true, false], default: true diff --git a/test/fixtures/cookbooks/test/Policyfile.rb b/test/fixtures/cookbooks/test/Policyfile.rb deleted file mode 100644 index 88fbef21..00000000 --- a/test/fixtures/cookbooks/test/Policyfile.rb +++ /dev/null @@ -1,8 +0,0 @@ -name 'test' -# The run list is also ignored by ChefSpec but you need to specify one. -run_list 'test::default' - -default_source :supermarket - -cookbook 'test', path: '.' -cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/global.pf.lock.json b/test/fixtures/cookbooks/test/global.pf.lock.json new file mode 100644 index 00000000..e09d63de --- /dev/null +++ b/test/fixtures/cookbooks/test/global.pf.lock.json @@ -0,0 +1,81 @@ +{ + "revision_id": "dbde1355a3c3231e94164732e13c15c4dcff4864d6da77356d8b7e16504ebf3b", + "name": "test", + "run_list": [ + "recipe[test::global]" + ], + "included_policy_locks": [ + + ], + "cookbook_locks": { + "jlenv": { + "version": "0.3.0", + "identifier": "3eb9daf4e541b89187cdc1a2d4f25af148a7e9b6", + "dotted_decimal_identifier": "17655798618735032.40963189409764594.99992352582070", + "source": "../../../..", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", + "working_tree_clean": false, + "published": false, + "synchronized_remote_branches": [ + + ] + }, + "source_options": { + "path": "../../../.." + } + }, + "test": { + "version": "0.99.1", + "identifier": "15a298986ff1ca3135bace847ba369eed9309261", + "dotted_decimal_identifier": "6089750787125706.13851350303800227.116474566972001", + "source": ".", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", + "working_tree_clean": false, + "published": false, + "synchronized_remote_branches": [ + + ] + }, + "source_options": { + "path": "." + } + } + }, + "default_attributes": { + + }, + "override_attributes": { + + }, + "solution_dependencies": { + "Policyfile": [ + [ + "jlenv", + ">= 0.0.0" + ], + [ + "test", + ">= 0.0.0" + ] + ], + "dependencies": { + "jlenv (0.3.0)": [ + + ], + "test (0.99.1)": [ + [ + "jlenv", + ">= 0.0.0" + ] + ] + } + } +} diff --git a/test/fixtures/cookbooks/test/global.pf b/test/fixtures/cookbooks/test/global.pf.rb similarity index 100% rename from test/fixtures/cookbooks/test/global.pf rename to test/fixtures/cookbooks/test/global.pf.rb diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb index 48347929..93f7954c 100644 --- a/test/fixtures/cookbooks/test/metadata.rb +++ b/test/fixtures/cookbooks/test/metadata.rb @@ -1,6 +1,6 @@ name 'test' -version '0.99.1' +version '0.99.2' depends 'jlenv' -recipe 'test::user_install', 'Provides an example for documentation purposes.' +recipe 'test::default', 'Provides an example for documentation purposes.' diff --git a/test/fixtures/cookbooks/test/policyfiles/global.rb b/test/fixtures/cookbooks/test/policyfiles/global.rb deleted file mode 100644 index 07b78c39..00000000 --- a/test/fixtures/cookbooks/test/policyfiles/global.rb +++ /dev/null @@ -1,8 +0,0 @@ -name 'Test Global Recipe' - -path = File.expand_path('base.rb', __dir__) -instance_eval(IO.read(path)) - -#include_policy 'base', path: '.' -# The run list is also ignored by ChefSpec but you need to specify one. -run_list 'test::global' diff --git a/test/fixtures/cookbooks/test/system_install.pf.lock.json b/test/fixtures/cookbooks/test/system_install.pf.lock.json new file mode 100644 index 00000000..26f40fd4 --- /dev/null +++ b/test/fixtures/cookbooks/test/system_install.pf.lock.json @@ -0,0 +1,81 @@ +{ + "revision_id": "0143d6b077174ba584e301055c74ff5db469a51ae28216103d5c5d5c1cba0a5b", + "name": "test", + "run_list": [ + "recipe[test::system_install]" + ], + "included_policy_locks": [ + + ], + "cookbook_locks": { + "jlenv": { + "version": "0.3.0", + "identifier": "3eb9daf4e541b89187cdc1a2d4f25af148a7e9b6", + "dotted_decimal_identifier": "17655798618735032.40963189409764594.99992352582070", + "source": "../../../..", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", + "working_tree_clean": false, + "published": false, + "synchronized_remote_branches": [ + + ] + }, + "source_options": { + "path": "../../../.." + } + }, + "test": { + "version": "0.99.2", + "identifier": "699fc7356f5dcd42a16aec3b8936fbe8e89cf302", + "dotted_decimal_identifier": "29730550498418125.18754829064833334.276977753584386", + "source": ".", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", + "working_tree_clean": false, + "published": false, + "synchronized_remote_branches": [ + + ] + }, + "source_options": { + "path": "." + } + } + }, + "default_attributes": { + + }, + "override_attributes": { + + }, + "solution_dependencies": { + "Policyfile": [ + [ + "jlenv", + ">= 0.0.0" + ], + [ + "test", + ">= 0.0.0" + ] + ], + "dependencies": { + "jlenv (0.3.0)": [ + + ], + "test (0.99.2)": [ + [ + "jlenv", + ">= 0.0.0" + ] + ] + } + } +} diff --git a/test/fixtures/cookbooks/test/policyfiles/base.rb b/test/fixtures/cookbooks/test/system_install.pf.rb similarity index 58% rename from test/fixtures/cookbooks/test/policyfiles/base.rb rename to test/fixtures/cookbooks/test/system_install.pf.rb index e386b22a..f11eed25 100644 --- a/test/fixtures/cookbooks/test/policyfiles/base.rb +++ b/test/fixtures/cookbooks/test/system_install.pf.rb @@ -1,2 +1,6 @@ +name 'test' + +run_list 'test::system_install' + cookbook 'test', path: '.' cookbook 'jlenv', path: '../../../../' From c7a46c25ea59d92e870063bdbf5e0688c362e528 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 19 Aug 2019 17:51:23 +1000 Subject: [PATCH 064/105] Add Rubocop todo --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index d88ffa9f..b42d3014 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,5 @@ +inherit_from: .rubocop_todo.yml + --- AllCops: Exclude: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..5a34606f --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,71 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2019-08-01 09:44:31 +1000 using RuboCop version 0.55.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLines: + Exclude: + - 'test/spec/spec_helper.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/SpaceAfterComma: + Exclude: + - 'Policyfile.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingBlankLines: + Exclude: + - 'test/fixtures/cookbooks/test/Policyfile.rb' + - 'test/spec/spec_helper.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'Policyfile.rb' + - 'test/spec/spec_helper.rb' + +# Offense count: 1 +Lint/EmptyWhen: + Exclude: + - 'libraries/package_deps.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'Dangerfile' + - 'libraries/helpers.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: only_raise, only_fail, semantic +Style/SignalException: + Exclude: + - 'Dangerfile' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'Policyfile.rb' + - 'test/fixtures/cookbooks/test/Policyfile.rb' + +# Offense count: 25 +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 157 From eec428a4adbb3c58f4afeda8a41410048143043b Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 19 Aug 2019 19:55:59 +1000 Subject: [PATCH 065/105] Refactor integration tests. --- .kitchen.yml | 20 ++- test/fixtures/cookbooks/issues/Policyfile.rb | 9 ++ test/fixtures/cookbooks/issues/metadata.rb | 6 + .../recipes/custom_group_install.rb | 0 .../{test => issues}/recipes/default.rb | 0 .../{test => issues}/recipes/global.rb | 0 .../recipes/julia_uninstall.rb | 0 .../cookbooks/{test => issues}/recipes/pkg.rb | 0 .../{test => issues}/recipes/plugin.rb | 0 .../{test => issues}/recipes/rehash.rb | 0 .../{test => issues}/recipes/script.rb | 0 .../recipes/system_install.rb | 0 .../{test => issues}/recipes/user_install.rb | 0 .../{test => issues}/recipes/vagrant.rb | 0 test/fixtures/cookbooks/recipes/Policyfile.rb | 10 ++ test/fixtures/cookbooks/recipes/metadata.rb | 6 + .../recipes/recipes/custom_group_install.rb | 29 ++++ .../cookbooks/recipes/recipes/default.rb | 4 + .../cookbooks/recipes/recipes/global.rb | 14 ++ .../recipes/recipes/julia_uninstall.rb | 20 +++ .../fixtures/cookbooks/recipes/recipes/pkg.rb | 129 ++++++++++++++++++ .../cookbooks/recipes/recipes/plugin.rb | 28 ++++ .../cookbooks/recipes/recipes/rehash.rb | 1 + .../cookbooks/recipes/recipes/script.rb | 4 + .../recipes/recipes/system_install.rb | 8 ++ .../cookbooks/recipes/recipes/user_install.rb | 22 +++ .../cookbooks/recipes/recipes/vagrant.rb | 13 ++ .../fixtures/cookbooks/resources/global.pf.rb | 9 ++ test/fixtures/cookbooks/resources/metadata.rb | 6 + .../resources/recipes/custom_group_install.rb | 29 ++++ .../cookbooks/resources/recipes/default.rb | 4 + .../cookbooks/resources/recipes/global.rb | 13 ++ .../resources/recipes/julia_uninstall.rb | 20 +++ .../cookbooks/resources/recipes/pkg.rb | 129 ++++++++++++++++++ .../cookbooks/resources/recipes/plugin.rb | 28 ++++ .../cookbooks/resources/recipes/rehash.rb | 1 + .../cookbooks/resources/recipes/script.rb | 4 + .../resources/recipes/system_install.rb | 8 ++ .../resources/recipes/user_install.rb | 22 +++ .../resources/system_install.pf.lock.json | 111 +++++++++++++++ .../cookbooks/resources/system_install.pf.rb | 9 ++ test/fixtures/cookbooks/shared/Policyfile.rb | 9 ++ test/fixtures/cookbooks/shared/metadata.rb | 6 + .../cookbooks/shared/recipes/default.rb | 2 + .../cookbooks/shared/recipes/vagrant.rb | 13 ++ .../cookbooks/test/global.pf.lock.json | 81 ----------- test/fixtures/cookbooks/test/global.pf.rb | 6 - test/fixtures/cookbooks/test/metadata.rb | 6 - .../test/system_install.pf.lock.json | 81 ----------- .../cookbooks/test/system_install.pf.rb | 6 - test/integration/issues/.gitkeep | 0 .../custom_group_install/controls/default.rb | 0 .../custom_group_install/inspec.yml | 0 .../global/controls/global_install.rb | 0 .../{ => resources}/global/inspec.yml | 0 .../controls/julia_uninstall.rb | 0 .../julia_uninstall/inspec.yml | 0 .../system_install/controls/system_install.rb | 0 .../{ => resources}/system_install/inspec.yml | 0 .../user_install/controls/user_install.rb | 0 .../{ => resources}/user_install/inspec.yml | 0 61 files changed, 742 insertions(+), 184 deletions(-) create mode 100644 test/fixtures/cookbooks/issues/Policyfile.rb create mode 100644 test/fixtures/cookbooks/issues/metadata.rb rename test/fixtures/cookbooks/{test => issues}/recipes/custom_group_install.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/default.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/global.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/julia_uninstall.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/pkg.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/plugin.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/rehash.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/script.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/system_install.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/user_install.rb (100%) rename test/fixtures/cookbooks/{test => issues}/recipes/vagrant.rb (100%) create mode 100644 test/fixtures/cookbooks/recipes/Policyfile.rb create mode 100644 test/fixtures/cookbooks/recipes/metadata.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/default.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/global.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/julia_uninstall.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/pkg.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/plugin.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/rehash.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/script.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/system_install.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/user_install.rb create mode 100644 test/fixtures/cookbooks/recipes/recipes/vagrant.rb create mode 100644 test/fixtures/cookbooks/resources/global.pf.rb create mode 100644 test/fixtures/cookbooks/resources/metadata.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/custom_group_install.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/default.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/global.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/pkg.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/plugin.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/rehash.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/script.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/system_install.rb create mode 100644 test/fixtures/cookbooks/resources/recipes/user_install.rb create mode 100644 test/fixtures/cookbooks/resources/system_install.pf.lock.json create mode 100644 test/fixtures/cookbooks/resources/system_install.pf.rb create mode 100644 test/fixtures/cookbooks/shared/Policyfile.rb create mode 100644 test/fixtures/cookbooks/shared/metadata.rb create mode 100644 test/fixtures/cookbooks/shared/recipes/default.rb create mode 100644 test/fixtures/cookbooks/shared/recipes/vagrant.rb delete mode 100644 test/fixtures/cookbooks/test/global.pf.lock.json delete mode 100644 test/fixtures/cookbooks/test/global.pf.rb delete mode 100644 test/fixtures/cookbooks/test/metadata.rb delete mode 100644 test/fixtures/cookbooks/test/system_install.pf.lock.json delete mode 100644 test/fixtures/cookbooks/test/system_install.pf.rb create mode 100644 test/integration/issues/.gitkeep rename test/integration/{ => recipes}/custom_group_install/controls/default.rb (100%) rename test/integration/{ => recipes}/custom_group_install/inspec.yml (100%) rename test/integration/{ => resources}/global/controls/global_install.rb (100%) rename test/integration/{ => resources}/global/inspec.yml (100%) rename test/integration/{ => resources}/julia_uninstall/controls/julia_uninstall.rb (100%) rename test/integration/{ => resources}/julia_uninstall/inspec.yml (100%) rename test/integration/{ => resources}/system_install/controls/system_install.rb (100%) rename test/integration/{ => resources}/system_install/inspec.yml (100%) rename test/integration/{ => resources}/user_install/controls/user_install.rb (100%) rename test/integration/{ => resources}/user_install/inspec.yml (100%) diff --git a/.kitchen.yml b/.kitchen.yml index b5c7852b..197b9ef0 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -77,16 +77,28 @@ platforms: - RUN zypper --non-interactive install sudo suites: + - name: recipes + provisioner: + policyfile: test/fixtures/cookbooks/recipes/system_install.pf.rb + verifier: + inspec_tests: + - test/integration/recipes + - name: issues + provisioner: + policyfile: test/fixtures/cookbooks/issues/system_install.pf.rb + verifier: + inspec_tests: + - test/integration/issues - name: system_install provisioner: - policyfile: test/fixtures/cookbooks/test/system_install.pf.rb + policyfile: test/fixtures/cookbooks/resources/system_install.pf.rb verifier: inspec_tests: - - test/integration/system_install + - test/integration/resources/system_install - name: global provisioner: - policyfile: test/fixtures/cookbooks/test/global.pf.rb + policyfile: test/fixtures/cookbooks/resources/global.pf.rb verifier: inspec_tests: - - test/integration/global + - test/integration/resources/global attributes: diff --git a/test/fixtures/cookbooks/issues/Policyfile.rb b/test/fixtures/cookbooks/issues/Policyfile.rb new file mode 100644 index 00000000..e49d6890 --- /dev/null +++ b/test/fixtures/cookbooks/issues/Policyfile.rb @@ -0,0 +1,9 @@ +name 'issues' + +run_list 'issues::global' + +default_source :chef_repo, "../../../../../" +default_source :chef_repo, "../" + +cookbook 'issues' +cookbook 'shared' diff --git a/test/fixtures/cookbooks/issues/metadata.rb b/test/fixtures/cookbooks/issues/metadata.rb new file mode 100644 index 00000000..a5f4fb69 --- /dev/null +++ b/test/fixtures/cookbooks/issues/metadata.rb @@ -0,0 +1,6 @@ +name 'issues' +version '0.99.2' + +depends 'shared' + +recipe 'issues::default', 'Provides an example for documentation purposes.' diff --git a/test/fixtures/cookbooks/test/recipes/custom_group_install.rb b/test/fixtures/cookbooks/issues/recipes/custom_group_install.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/custom_group_install.rb rename to test/fixtures/cookbooks/issues/recipes/custom_group_install.rb diff --git a/test/fixtures/cookbooks/test/recipes/default.rb b/test/fixtures/cookbooks/issues/recipes/default.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/default.rb rename to test/fixtures/cookbooks/issues/recipes/default.rb diff --git a/test/fixtures/cookbooks/test/recipes/global.rb b/test/fixtures/cookbooks/issues/recipes/global.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/global.rb rename to test/fixtures/cookbooks/issues/recipes/global.rb diff --git a/test/fixtures/cookbooks/test/recipes/julia_uninstall.rb b/test/fixtures/cookbooks/issues/recipes/julia_uninstall.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/julia_uninstall.rb rename to test/fixtures/cookbooks/issues/recipes/julia_uninstall.rb diff --git a/test/fixtures/cookbooks/test/recipes/pkg.rb b/test/fixtures/cookbooks/issues/recipes/pkg.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/pkg.rb rename to test/fixtures/cookbooks/issues/recipes/pkg.rb diff --git a/test/fixtures/cookbooks/test/recipes/plugin.rb b/test/fixtures/cookbooks/issues/recipes/plugin.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/plugin.rb rename to test/fixtures/cookbooks/issues/recipes/plugin.rb diff --git a/test/fixtures/cookbooks/test/recipes/rehash.rb b/test/fixtures/cookbooks/issues/recipes/rehash.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/rehash.rb rename to test/fixtures/cookbooks/issues/recipes/rehash.rb diff --git a/test/fixtures/cookbooks/test/recipes/script.rb b/test/fixtures/cookbooks/issues/recipes/script.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/script.rb rename to test/fixtures/cookbooks/issues/recipes/script.rb diff --git a/test/fixtures/cookbooks/test/recipes/system_install.rb b/test/fixtures/cookbooks/issues/recipes/system_install.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/system_install.rb rename to test/fixtures/cookbooks/issues/recipes/system_install.rb diff --git a/test/fixtures/cookbooks/test/recipes/user_install.rb b/test/fixtures/cookbooks/issues/recipes/user_install.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/user_install.rb rename to test/fixtures/cookbooks/issues/recipes/user_install.rb diff --git a/test/fixtures/cookbooks/test/recipes/vagrant.rb b/test/fixtures/cookbooks/issues/recipes/vagrant.rb similarity index 100% rename from test/fixtures/cookbooks/test/recipes/vagrant.rb rename to test/fixtures/cookbooks/issues/recipes/vagrant.rb diff --git a/test/fixtures/cookbooks/recipes/Policyfile.rb b/test/fixtures/cookbooks/recipes/Policyfile.rb new file mode 100644 index 00000000..13113bf3 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/Policyfile.rb @@ -0,0 +1,10 @@ +name 'recipes' + +run_list 'recipes::system_install', + 'recipes::global' + +default_source :chef_repo, "../../../../../" +default_source :chef_repo, "../" + +cookbook 'recipes' +cookbook 'shared' diff --git a/test/fixtures/cookbooks/recipes/metadata.rb b/test/fixtures/cookbooks/recipes/metadata.rb new file mode 100644 index 00000000..48e81f58 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/metadata.rb @@ -0,0 +1,6 @@ +name 'recipes' +version '0.9.2' + +depends 'shared' + +recipe 'recipes::default', 'Provides an example for documentation purposes.' diff --git a/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb b/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb new file mode 100644 index 00000000..15db2dac --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb @@ -0,0 +1,29 @@ +# Install jlenv and makes it avilable to the selected user +version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +group 'new-group' do + members 'vagrant' +end + +# Keeps the jlenv install upto date +jlenv_user_install 'vagrant' do + user 'vagrant' + group 'new-group' +end + +# Install plugin to build Julia +jlenv_plugin 'julia-build' do + git_url 'https://github.com/HiroakiMikami/julia-build.git' + user 'vagrant' +end + +jlenv_julia '1.0.1' do + user 'vagrant' +end + +jlenv_global version do + user 'vagrant' +end diff --git a/test/fixtures/cookbooks/recipes/recipes/default.rb b/test/fixtures/cookbooks/recipes/recipes/default.rb new file mode 100644 index 00000000..bd0c8de1 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/default.rb @@ -0,0 +1,4 @@ +# recipe file to satisfy Policyfile build. + +# Make sure that Vagrant user is on the box for dokken +include_recipe 'test::vagrant' diff --git a/test/fixtures/cookbooks/recipes/recipes/global.rb b/test/fixtures/cookbooks/recipes/recipes/global.rb new file mode 100644 index 00000000..39b40f17 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/global.rb @@ -0,0 +1,14 @@ + +# Spec resource usage with defaults. + +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + +global_version = '1.0.3' + +# Install Jlenv Globally. +# TODO: Remove this step by installing the given version if not installed. +jlenv_system_install 'system' + +# Set that Julia version as the global Julia +jlenv_global global_version diff --git a/test/fixtures/cookbooks/recipes/recipes/julia_uninstall.rb b/test/fixtures/cookbooks/recipes/recipes/julia_uninstall.rb new file mode 100644 index 00000000..7c709ea8 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/julia_uninstall.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +system_version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +# System Install +jlenv_system_install 'system' + +# Install system wide Julia +jlenv_julia system_version + +# Set System global version +jlenv_global system_version + +# Uninstall Julia +jlenv_julia system_version do + jlenv_action 'uninstall' +end diff --git a/test/fixtures/cookbooks/recipes/recipes/pkg.rb b/test/fixtures/cookbooks/recipes/recipes/pkg.rb new file mode 100644 index 00000000..46a36a74 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/pkg.rb @@ -0,0 +1,129 @@ +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +# System Install +jlenv_system_install 'system' +# Install several Julias to a system wide location +jlenv_julia '1.0.4' do + verbose true +end + +jlenv_julia '1.1.0' do + verbose true +end + +# Set System global version +jlenv_global '1.0.4' + +##################################################################### +# +# JuliaRegistries/General Hosted Repository +# +##################################################################### + +# Default is latest from default registry to global Julia +jlenv_pkg 'DataFrames' + +jlenv_pkg 'DataFrames' do + action :remove +end + +# Registry add by version numbers +jlenv_pkg 'DataFrames' do + version '0.15.2' + jlenv_version '1.1.0' + action :add +end + +# Registry remove action +jlenv_pkg 'DataFrames' do + version '0.15.2' + jlenv_version '1.0.4' + action :remove +end + +# Registry by UUID numbers +jlenv_pkg 'DataFrames' do + uuid 'a93c6f00-e57d-5684-b7b6-d8193f3e46c0' + jlenv_version '1.0.4' +end + +# Registry by branch name +jlenv_pkg 'DataFrames' do + branch 'master' + jlenv_version '1.1.0' +end + +# Registry hash +jlenv_pkg 'DataFrames' do + hash '279baa63' + jlenv_version '1.1.0' +end + +# Registry version +jlenv_pkg 'General Registry Data Frames' do + name 'DataFrames' + version '0.15.1' + jlenv_version '1.1.0' +end + +# Registry nomination +jlenv_pkg 'DataFrames' do + registry 'https://github.com/JuliaRegistries/General' + version '0.15.2' + jlenv_version '1.1.0' +end + +##################################################################### +# +# Git Hosted Repository +# +##################################################################### + +# Remote git branch. +jlenv_pkg 'Free Text' do + repo 'https://github.com/JuliaData/DataFrames.jl' + branch 'master' + jlenv_version '1.1.0' +end + +# Remote git version. +jlenv_pkg 'Free Text' do + url 'https://github.com/JuliaData/DataFrames.jl' + version '0.18.2' + jlenv_version '1.1.0' +end + +# Remote git version. +jlenv_pkg 'Free Text' do + url 'https://github.com/JuliaData/DataFrames.jl' + hash '279baa6358fd5e944deccab88434f69c74cfc722' + jlenv_version '1.1.0' +end + +# Local (bare) git branch +jlenv_pkg 'Free Text' do + repo 'file:///src/DataFrames.jl.git' + branch 'master' + jlenv_version '1.1.0' +end + +# Local (bare) git hash +jlenv_pkg 'Bare repository' do + repo 'file:///src/DataFrames.jl.git' + hash '3891a62fd843662af9f78f25bdd415530b9b9c1e' + jlenv_version '1.1.0' +end + +# Install latest for specific user +jlenv_user_install 'vagrant' + +# Install a Julia to a user directory +jlenv_julia '1.1.0' do + user 'vagrant' +end + +# Set the vagrant global version +jlenv_global '1.1.0' do + user 'vagrant' +end diff --git a/test/fixtures/cookbooks/recipes/recipes/plugin.rb b/test/fixtures/cookbooks/recipes/recipes/plugin.rb new file mode 100644 index 00000000..6b0b6f7e --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/plugin.rb @@ -0,0 +1,28 @@ +version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +jlenv_user_install 'vagrant' + +jlenv_system_install 'system' + +jlenv_julia version do + install_julia_build false + user 'vagrant' +end + +jlenv_global version do + user 'vagrant' +end + +jlenv_plugin 'julia-build' do + git_url 'https://github.com/HiroakiMikami/julia-build.git' + user 'vagrant' +end + +# This should get installed to the system_install +jlenv_plugin 'julia-build' do + git_url 'git@github.com:HiroakiMikami/julia-build.git' + git_ref 'bb86c68' +end diff --git a/test/fixtures/cookbooks/recipes/recipes/rehash.rb b/test/fixtures/cookbooks/recipes/recipes/rehash.rb new file mode 100644 index 00000000..31560f04 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/rehash.rb @@ -0,0 +1 @@ +jlenv_rehash 'defaultness' diff --git a/test/fixtures/cookbooks/recipes/recipes/script.rb b/test/fixtures/cookbooks/recipes/recipes/script.rb new file mode 100644 index 00000000..ca816fc2 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/script.rb @@ -0,0 +1,4 @@ +# Make is Julia's build orchestration +jlenv_script 'not-much' do + code 'make nadda' +end diff --git a/test/fixtures/cookbooks/recipes/recipes/system_install.rb b/test/fixtures/cookbooks/recipes/recipes/system_install.rb new file mode 100644 index 00000000..46a6a37c --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/system_install.rb @@ -0,0 +1,8 @@ +# Install Jlenv to the system path e.g. /usr/local/jlenv + +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + +jlenv_system_install 'system' do + update_jlenv false +end diff --git a/test/fixtures/cookbooks/recipes/recipes/user_install.rb b/test/fixtures/cookbooks/recipes/recipes/user_install.rb new file mode 100644 index 00000000..91fd0a15 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/user_install.rb @@ -0,0 +1,22 @@ +# Install jlenv and makes it avilable to the selected user + +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + +version = '1.0.1' + +# Keeps the jlenv install upto date +jlenv_user_install 'vagrant' + +jlenv_plugin 'julia-build' do + git_url 'https://github.com/jlenv/julia-build.git' + user 'vagrant' +end + +jlenv_julia '1.0.4' do + user 'vagrant' +end + +jlenv_global version do + user 'vagrant' +end diff --git a/test/fixtures/cookbooks/recipes/recipes/vagrant.rb b/test/fixtures/cookbooks/recipes/recipes/vagrant.rb new file mode 100644 index 00000000..3860f53a --- /dev/null +++ b/test/fixtures/cookbooks/recipes/recipes/vagrant.rb @@ -0,0 +1,13 @@ +# Make sure Vagrant user is on the box. +# This should fix the dokken user install. +user 'vagrant' + +group 'vagrant' do + members 'vagrant' +end + +directory '/home/vagrant' do + owner 'vagrant' + group 'vagrant' + not_if { platform?('windows') } +end diff --git a/test/fixtures/cookbooks/resources/global.pf.rb b/test/fixtures/cookbooks/resources/global.pf.rb new file mode 100644 index 00000000..15be74d5 --- /dev/null +++ b/test/fixtures/cookbooks/resources/global.pf.rb @@ -0,0 +1,9 @@ +name 'resources' + +run_list 'resources::global' + +default_source :chef_repo, "../../../../../" +default_source :chef_repo, "../" + +cookbook 'resources' +cookbook 'shared' diff --git a/test/fixtures/cookbooks/resources/metadata.rb b/test/fixtures/cookbooks/resources/metadata.rb new file mode 100644 index 00000000..4ac2a229 --- /dev/null +++ b/test/fixtures/cookbooks/resources/metadata.rb @@ -0,0 +1,6 @@ +name 'resources' +version '0.9.2' + +depends 'shared' + +recipe 'resources::default', 'Provides an example for documentation purposes.' diff --git a/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb b/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb new file mode 100644 index 00000000..15db2dac --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb @@ -0,0 +1,29 @@ +# Install jlenv and makes it avilable to the selected user +version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +group 'new-group' do + members 'vagrant' +end + +# Keeps the jlenv install upto date +jlenv_user_install 'vagrant' do + user 'vagrant' + group 'new-group' +end + +# Install plugin to build Julia +jlenv_plugin 'julia-build' do + git_url 'https://github.com/HiroakiMikami/julia-build.git' + user 'vagrant' +end + +jlenv_julia '1.0.1' do + user 'vagrant' +end + +jlenv_global version do + user 'vagrant' +end diff --git a/test/fixtures/cookbooks/resources/recipes/default.rb b/test/fixtures/cookbooks/resources/recipes/default.rb new file mode 100644 index 00000000..bd0c8de1 --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/default.rb @@ -0,0 +1,4 @@ +# recipe file to satisfy Policyfile build. + +# Make sure that Vagrant user is on the box for dokken +include_recipe 'test::vagrant' diff --git a/test/fixtures/cookbooks/resources/recipes/global.rb b/test/fixtures/cookbooks/resources/recipes/global.rb new file mode 100644 index 00000000..9029bb7a --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/global.rb @@ -0,0 +1,13 @@ +# Spec resource usage with defaults. + +# Ensure test setup +include_recipe 'shared::default' + +global_version = '1.0.3' + +# Install Jlenv Globally. +# TODO: Remove this step by installing the given version if not installed. +jlenv_system_install 'system' + +# Set that Julia version as the global Julia +jlenv_global global_version diff --git a/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb b/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb new file mode 100644 index 00000000..7c709ea8 --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +system_version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +# System Install +jlenv_system_install 'system' + +# Install system wide Julia +jlenv_julia system_version + +# Set System global version +jlenv_global system_version + +# Uninstall Julia +jlenv_julia system_version do + jlenv_action 'uninstall' +end diff --git a/test/fixtures/cookbooks/resources/recipes/pkg.rb b/test/fixtures/cookbooks/resources/recipes/pkg.rb new file mode 100644 index 00000000..f9a75a2b --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/pkg.rb @@ -0,0 +1,129 @@ +# Ensure test setup +include_recipe 'shared::default' + +# System Install +jlenv_system_install 'system' +# Install several Julias to a system wide location +jlenv_julia '1.0.4' do + verbose true +end + +jlenv_julia '1.1.0' do + verbose true +end + +# Set System global version +jlenv_global '1.0.4' + +##################################################################### +# +# JuliaRegistries/General Hosted Repository +# +##################################################################### + +# Default is latest from default registry to global Julia +jlenv_pkg 'DataFrames' + +jlenv_pkg 'DataFrames' do + action :remove +end + +# Registry add by version numbers +jlenv_pkg 'DataFrames' do + version '0.15.2' + jlenv_version '1.1.0' + action :add +end + +# Registry remove action +jlenv_pkg 'DataFrames' do + version '0.15.2' + jlenv_version '1.0.4' + action :remove +end + +# Registry by UUID numbers +jlenv_pkg 'DataFrames' do + uuid 'a93c6f00-e57d-5684-b7b6-d8193f3e46c0' + jlenv_version '1.0.4' +end + +# Registry by branch name +jlenv_pkg 'DataFrames' do + branch 'master' + jlenv_version '1.1.0' +end + +# Registry hash +jlenv_pkg 'DataFrames' do + hash '279baa63' + jlenv_version '1.1.0' +end + +# Registry version +jlenv_pkg 'General Registry Data Frames' do + name 'DataFrames' + version '0.15.1' + jlenv_version '1.1.0' +end + +# Registry nomination +jlenv_pkg 'DataFrames' do + registry 'https://github.com/JuliaRegistries/General' + version '0.15.2' + jlenv_version '1.1.0' +end + +##################################################################### +# +# Git Hosted Repository +# +##################################################################### + +# Remote git branch. +jlenv_pkg 'Free Text' do + repo 'https://github.com/JuliaData/DataFrames.jl' + branch 'master' + jlenv_version '1.1.0' +end + +# Remote git version. +jlenv_pkg 'Free Text' do + url 'https://github.com/JuliaData/DataFrames.jl' + version '0.18.2' + jlenv_version '1.1.0' +end + +# Remote git version. +jlenv_pkg 'Free Text' do + url 'https://github.com/JuliaData/DataFrames.jl' + hash '279baa6358fd5e944deccab88434f69c74cfc722' + jlenv_version '1.1.0' +end + +# Local (bare) git branch +jlenv_pkg 'Free Text' do + repo 'file:///src/DataFrames.jl.git' + branch 'master' + jlenv_version '1.1.0' +end + +# Local (bare) git hash +jlenv_pkg 'Bare repository' do + repo 'file:///src/DataFrames.jl.git' + hash '3891a62fd843662af9f78f25bdd415530b9b9c1e' + jlenv_version '1.1.0' +end + +# Install latest for specific user +jlenv_user_install 'vagrant' + +# Install a Julia to a user directory +jlenv_julia '1.1.0' do + user 'vagrant' +end + +# Set the vagrant global version +jlenv_global '1.1.0' do + user 'vagrant' +end diff --git a/test/fixtures/cookbooks/resources/recipes/plugin.rb b/test/fixtures/cookbooks/resources/recipes/plugin.rb new file mode 100644 index 00000000..6b0b6f7e --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/plugin.rb @@ -0,0 +1,28 @@ +version = '1.0.1' + +# Make sure that Vagarant user is on the box for dokken +include_recipe 'test::dokken' + +jlenv_user_install 'vagrant' + +jlenv_system_install 'system' + +jlenv_julia version do + install_julia_build false + user 'vagrant' +end + +jlenv_global version do + user 'vagrant' +end + +jlenv_plugin 'julia-build' do + git_url 'https://github.com/HiroakiMikami/julia-build.git' + user 'vagrant' +end + +# This should get installed to the system_install +jlenv_plugin 'julia-build' do + git_url 'git@github.com:HiroakiMikami/julia-build.git' + git_ref 'bb86c68' +end diff --git a/test/fixtures/cookbooks/resources/recipes/rehash.rb b/test/fixtures/cookbooks/resources/recipes/rehash.rb new file mode 100644 index 00000000..31560f04 --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/rehash.rb @@ -0,0 +1 @@ +jlenv_rehash 'defaultness' diff --git a/test/fixtures/cookbooks/resources/recipes/script.rb b/test/fixtures/cookbooks/resources/recipes/script.rb new file mode 100644 index 00000000..ca816fc2 --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/script.rb @@ -0,0 +1,4 @@ +# Make is Julia's build orchestration +jlenv_script 'not-much' do + code 'make nadda' +end diff --git a/test/fixtures/cookbooks/resources/recipes/system_install.rb b/test/fixtures/cookbooks/resources/recipes/system_install.rb new file mode 100644 index 00000000..91505ff1 --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/system_install.rb @@ -0,0 +1,8 @@ +# Install Jlenv to the system path e.g. /usr/local/jlenv + +# Ensure test setup +include_recipe 'shared::default' + +jlenv_system_install 'system' do + update_jlenv false +end diff --git a/test/fixtures/cookbooks/resources/recipes/user_install.rb b/test/fixtures/cookbooks/resources/recipes/user_install.rb new file mode 100644 index 00000000..91fd0a15 --- /dev/null +++ b/test/fixtures/cookbooks/resources/recipes/user_install.rb @@ -0,0 +1,22 @@ +# Install jlenv and makes it avilable to the selected user + +# Ensure Vagrant user exists on test environment +include_recipe 'test::default' + +version = '1.0.1' + +# Keeps the jlenv install upto date +jlenv_user_install 'vagrant' + +jlenv_plugin 'julia-build' do + git_url 'https://github.com/jlenv/julia-build.git' + user 'vagrant' +end + +jlenv_julia '1.0.4' do + user 'vagrant' +end + +jlenv_global version do + user 'vagrant' +end diff --git a/test/fixtures/cookbooks/resources/system_install.pf.lock.json b/test/fixtures/cookbooks/resources/system_install.pf.lock.json new file mode 100644 index 00000000..db2572af --- /dev/null +++ b/test/fixtures/cookbooks/resources/system_install.pf.lock.json @@ -0,0 +1,111 @@ +{ + "revision_id": "c071004d2481a244e5f4ea03708571411ecbad852fe382f78c3aacb2d5cf132f", + "name": "resources", + "run_list": [ + "recipe[resources::system_install]" + ], + "included_policy_locks": [ + + ], + "cookbook_locks": { + "jlenv": { + "version": "0.3.0", + "identifier": "183b955641fea20e105da45e1fe2e4059a1998bd", + "dotted_decimal_identifier": "6820912024387234.3958644049584098.250712711338173", + "source": "../../../..", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "96ca33093960f1fe1fe346812efc9a8ce83906c3", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "../../../.." + } + }, + "resources": { + "version": "0.9.2", + "identifier": "202d11914cbefed1a0dc60b9d657bf447ef65912", + "dotted_decimal_identifier": "9056752730160894.59005138508568151.210300908755218", + "source": ".", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "96ca33093960f1fe1fe346812efc9a8ce83906c3", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "." + } + }, + "shared": { + "version": "0.9.2", + "identifier": "3ae1173b397d76ac609342fa7ee4b441f0bb62cd", + "dotted_decimal_identifier": "16573038543338870.48519881594404580.198195304686285", + "source": "../shared", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "96ca33093960f1fe1fe346812efc9a8ce83906c3", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "../shared" + } + } + }, + "default_attributes": { + + }, + "override_attributes": { + + }, + "solution_dependencies": { + "Policyfile": [ + [ + "jlenv", + "= 0.3.0" + ], + [ + "resources", + "= 0.9.2" + ], + [ + "shared", + "= 0.9.2" + ] + ], + "dependencies": { + "jlenv (0.3.0)": [ + + ], + "resources (0.9.2)": [ + [ + "shared", + ">= 0.0.0" + ] + ], + "shared (0.9.2)": [ + [ + "jlenv", + ">= 0.0.0" + ] + ] + } + } +} diff --git a/test/fixtures/cookbooks/resources/system_install.pf.rb b/test/fixtures/cookbooks/resources/system_install.pf.rb new file mode 100644 index 00000000..640d9993 --- /dev/null +++ b/test/fixtures/cookbooks/resources/system_install.pf.rb @@ -0,0 +1,9 @@ +name 'resources' + +run_list 'resources::system_install' + +default_source :chef_repo, "../../../../../" +default_source :chef_repo, "../" + +cookbook 'resources' +cookbook 'shared' diff --git a/test/fixtures/cookbooks/shared/Policyfile.rb b/test/fixtures/cookbooks/shared/Policyfile.rb new file mode 100644 index 00000000..f30c0b3c --- /dev/null +++ b/test/fixtures/cookbooks/shared/Policyfile.rb @@ -0,0 +1,9 @@ +name 'shared' + +run_list 'shared::default' + +default_source :chef_repo, "../../../../" +default_source :chef_repo, "../" + +cookbook 'shared' +cookbook 'jlenv' diff --git a/test/fixtures/cookbooks/shared/metadata.rb b/test/fixtures/cookbooks/shared/metadata.rb new file mode 100644 index 00000000..981052b6 --- /dev/null +++ b/test/fixtures/cookbooks/shared/metadata.rb @@ -0,0 +1,6 @@ +name 'shared' +version '0.9.2' + +depends 'jlenv' + +recipe 'shared::default', 'Provides an example for documentation purposes.' diff --git a/test/fixtures/cookbooks/shared/recipes/default.rb b/test/fixtures/cookbooks/shared/recipes/default.rb new file mode 100644 index 00000000..3a39925c --- /dev/null +++ b/test/fixtures/cookbooks/shared/recipes/default.rb @@ -0,0 +1,2 @@ +# Ensure test setup +include_recipe 'shared::vagrant' diff --git a/test/fixtures/cookbooks/shared/recipes/vagrant.rb b/test/fixtures/cookbooks/shared/recipes/vagrant.rb new file mode 100644 index 00000000..3860f53a --- /dev/null +++ b/test/fixtures/cookbooks/shared/recipes/vagrant.rb @@ -0,0 +1,13 @@ +# Make sure Vagrant user is on the box. +# This should fix the dokken user install. +user 'vagrant' + +group 'vagrant' do + members 'vagrant' +end + +directory '/home/vagrant' do + owner 'vagrant' + group 'vagrant' + not_if { platform?('windows') } +end diff --git a/test/fixtures/cookbooks/test/global.pf.lock.json b/test/fixtures/cookbooks/test/global.pf.lock.json deleted file mode 100644 index e09d63de..00000000 --- a/test/fixtures/cookbooks/test/global.pf.lock.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "revision_id": "dbde1355a3c3231e94164732e13c15c4dcff4864d6da77356d8b7e16504ebf3b", - "name": "test", - "run_list": [ - "recipe[test::global]" - ], - "included_policy_locks": [ - - ], - "cookbook_locks": { - "jlenv": { - "version": "0.3.0", - "identifier": "3eb9daf4e541b89187cdc1a2d4f25af148a7e9b6", - "dotted_decimal_identifier": "17655798618735032.40963189409764594.99992352582070", - "source": "../../../..", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", - "working_tree_clean": false, - "published": false, - "synchronized_remote_branches": [ - - ] - }, - "source_options": { - "path": "../../../.." - } - }, - "test": { - "version": "0.99.1", - "identifier": "15a298986ff1ca3135bace847ba369eed9309261", - "dotted_decimal_identifier": "6089750787125706.13851350303800227.116474566972001", - "source": ".", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", - "working_tree_clean": false, - "published": false, - "synchronized_remote_branches": [ - - ] - }, - "source_options": { - "path": "." - } - } - }, - "default_attributes": { - - }, - "override_attributes": { - - }, - "solution_dependencies": { - "Policyfile": [ - [ - "jlenv", - ">= 0.0.0" - ], - [ - "test", - ">= 0.0.0" - ] - ], - "dependencies": { - "jlenv (0.3.0)": [ - - ], - "test (0.99.1)": [ - [ - "jlenv", - ">= 0.0.0" - ] - ] - } - } -} diff --git a/test/fixtures/cookbooks/test/global.pf.rb b/test/fixtures/cookbooks/test/global.pf.rb deleted file mode 100644 index dc9ebf08..00000000 --- a/test/fixtures/cookbooks/test/global.pf.rb +++ /dev/null @@ -1,6 +0,0 @@ -name 'test' - -run_list 'test::global' - -cookbook 'test', path: '.' -cookbook 'jlenv', path: '../../../../' diff --git a/test/fixtures/cookbooks/test/metadata.rb b/test/fixtures/cookbooks/test/metadata.rb deleted file mode 100644 index 93f7954c..00000000 --- a/test/fixtures/cookbooks/test/metadata.rb +++ /dev/null @@ -1,6 +0,0 @@ -name 'test' -version '0.99.2' - -depends 'jlenv' - -recipe 'test::default', 'Provides an example for documentation purposes.' diff --git a/test/fixtures/cookbooks/test/system_install.pf.lock.json b/test/fixtures/cookbooks/test/system_install.pf.lock.json deleted file mode 100644 index 26f40fd4..00000000 --- a/test/fixtures/cookbooks/test/system_install.pf.lock.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "revision_id": "0143d6b077174ba584e301055c74ff5db469a51ae28216103d5c5d5c1cba0a5b", - "name": "test", - "run_list": [ - "recipe[test::system_install]" - ], - "included_policy_locks": [ - - ], - "cookbook_locks": { - "jlenv": { - "version": "0.3.0", - "identifier": "3eb9daf4e541b89187cdc1a2d4f25af148a7e9b6", - "dotted_decimal_identifier": "17655798618735032.40963189409764594.99992352582070", - "source": "../../../..", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", - "working_tree_clean": false, - "published": false, - "synchronized_remote_branches": [ - - ] - }, - "source_options": { - "path": "../../../.." - } - }, - "test": { - "version": "0.99.2", - "identifier": "699fc7356f5dcd42a16aec3b8936fbe8e89cf302", - "dotted_decimal_identifier": "29730550498418125.18754829064833334.276977753584386", - "source": ".", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "2213e6a79375a8f7dbfc7c84b1d1f3a9aa12488a", - "working_tree_clean": false, - "published": false, - "synchronized_remote_branches": [ - - ] - }, - "source_options": { - "path": "." - } - } - }, - "default_attributes": { - - }, - "override_attributes": { - - }, - "solution_dependencies": { - "Policyfile": [ - [ - "jlenv", - ">= 0.0.0" - ], - [ - "test", - ">= 0.0.0" - ] - ], - "dependencies": { - "jlenv (0.3.0)": [ - - ], - "test (0.99.2)": [ - [ - "jlenv", - ">= 0.0.0" - ] - ] - } - } -} diff --git a/test/fixtures/cookbooks/test/system_install.pf.rb b/test/fixtures/cookbooks/test/system_install.pf.rb deleted file mode 100644 index f11eed25..00000000 --- a/test/fixtures/cookbooks/test/system_install.pf.rb +++ /dev/null @@ -1,6 +0,0 @@ -name 'test' - -run_list 'test::system_install' - -cookbook 'test', path: '.' -cookbook 'jlenv', path: '../../../../' diff --git a/test/integration/issues/.gitkeep b/test/integration/issues/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/test/integration/custom_group_install/controls/default.rb b/test/integration/recipes/custom_group_install/controls/default.rb similarity index 100% rename from test/integration/custom_group_install/controls/default.rb rename to test/integration/recipes/custom_group_install/controls/default.rb diff --git a/test/integration/custom_group_install/inspec.yml b/test/integration/recipes/custom_group_install/inspec.yml similarity index 100% rename from test/integration/custom_group_install/inspec.yml rename to test/integration/recipes/custom_group_install/inspec.yml diff --git a/test/integration/global/controls/global_install.rb b/test/integration/resources/global/controls/global_install.rb similarity index 100% rename from test/integration/global/controls/global_install.rb rename to test/integration/resources/global/controls/global_install.rb diff --git a/test/integration/global/inspec.yml b/test/integration/resources/global/inspec.yml similarity index 100% rename from test/integration/global/inspec.yml rename to test/integration/resources/global/inspec.yml diff --git a/test/integration/julia_uninstall/controls/julia_uninstall.rb b/test/integration/resources/julia_uninstall/controls/julia_uninstall.rb similarity index 100% rename from test/integration/julia_uninstall/controls/julia_uninstall.rb rename to test/integration/resources/julia_uninstall/controls/julia_uninstall.rb diff --git a/test/integration/julia_uninstall/inspec.yml b/test/integration/resources/julia_uninstall/inspec.yml similarity index 100% rename from test/integration/julia_uninstall/inspec.yml rename to test/integration/resources/julia_uninstall/inspec.yml diff --git a/test/integration/system_install/controls/system_install.rb b/test/integration/resources/system_install/controls/system_install.rb similarity index 100% rename from test/integration/system_install/controls/system_install.rb rename to test/integration/resources/system_install/controls/system_install.rb diff --git a/test/integration/system_install/inspec.yml b/test/integration/resources/system_install/inspec.yml similarity index 100% rename from test/integration/system_install/inspec.yml rename to test/integration/resources/system_install/inspec.yml diff --git a/test/integration/user_install/controls/user_install.rb b/test/integration/resources/user_install/controls/user_install.rb similarity index 100% rename from test/integration/user_install/controls/user_install.rb rename to test/integration/resources/user_install/controls/user_install.rb diff --git a/test/integration/user_install/inspec.yml b/test/integration/resources/user_install/inspec.yml similarity index 100% rename from test/integration/user_install/inspec.yml rename to test/integration/resources/user_install/inspec.yml From 6f9a57c7816005f3acecb1f5f0d862b0ef5b2181 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 19 Aug 2019 20:09:30 +1000 Subject: [PATCH 066/105] Add ignore test lock files. --- .gitignore | 2 ++ .../resources/recipes/custom_group_install.rb | 4 ++-- test/fixtures/cookbooks/resources/recipes/default.rb | 4 ++-- .../cookbooks/resources/recipes/julia_uninstall.rb | 4 ++-- test/fixtures/cookbooks/resources/recipes/plugin.rb | 4 ++-- .../cookbooks/resources/recipes/user_install.rb | 4 ++-- .../cookbooks/resources/system_install.pf.lock.json | 12 ++++++------ 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index bcd0dd93..3b9e896e 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,5 @@ Cheffile.lock .vagrant/ .vagrant.d/ .kitchen/ + +test/*.lock.json diff --git a/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb b/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb index 15db2dac..d004b215 100644 --- a/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb @@ -1,8 +1,8 @@ # Install jlenv and makes it avilable to the selected user version = '1.0.1' -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' +# Ensure test setup +include_recipe 'shared::default' group 'new-group' do members 'vagrant' diff --git a/test/fixtures/cookbooks/resources/recipes/default.rb b/test/fixtures/cookbooks/resources/recipes/default.rb index bd0c8de1..63d452c3 100644 --- a/test/fixtures/cookbooks/resources/recipes/default.rb +++ b/test/fixtures/cookbooks/resources/recipes/default.rb @@ -1,4 +1,4 @@ # recipe file to satisfy Policyfile build. -# Make sure that Vagrant user is on the box for dokken -include_recipe 'test::vagrant' +# Ensure test setup +include_recipe 'shared::default' diff --git a/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb b/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb index 7c709ea8..827c0cc3 100644 --- a/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb +++ b/test/fixtures/cookbooks/resources/recipes/julia_uninstall.rb @@ -2,8 +2,8 @@ system_version = '1.0.1' -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' +# Ensure test setup +include_recipe 'shared::default' # System Install jlenv_system_install 'system' diff --git a/test/fixtures/cookbooks/resources/recipes/plugin.rb b/test/fixtures/cookbooks/resources/recipes/plugin.rb index 6b0b6f7e..b99a38ab 100644 --- a/test/fixtures/cookbooks/resources/recipes/plugin.rb +++ b/test/fixtures/cookbooks/resources/recipes/plugin.rb @@ -1,7 +1,7 @@ version = '1.0.1' -# Make sure that Vagarant user is on the box for dokken -include_recipe 'test::dokken' +# Ensure test setup +include_recipe 'shared::default' jlenv_user_install 'vagrant' diff --git a/test/fixtures/cookbooks/resources/recipes/user_install.rb b/test/fixtures/cookbooks/resources/recipes/user_install.rb index 91fd0a15..1a4048f8 100644 --- a/test/fixtures/cookbooks/resources/recipes/user_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/user_install.rb @@ -1,7 +1,7 @@ # Install jlenv and makes it avilable to the selected user -# Ensure Vagrant user exists on test environment -include_recipe 'test::default' +# Ensure test setup +include_recipe 'shared::default' version = '1.0.1' diff --git a/test/fixtures/cookbooks/resources/system_install.pf.lock.json b/test/fixtures/cookbooks/resources/system_install.pf.lock.json index db2572af..d1833fa8 100644 --- a/test/fixtures/cookbooks/resources/system_install.pf.lock.json +++ b/test/fixtures/cookbooks/resources/system_install.pf.lock.json @@ -1,5 +1,5 @@ { - "revision_id": "c071004d2481a244e5f4ea03708571411ecbad852fe382f78c3aacb2d5cf132f", + "revision_id": "0dbf3d1156e29a935f4414811a977861704fa84a85bb327ac8d22bdb9358411b", "name": "resources", "run_list": [ "recipe[resources::system_install]" @@ -17,7 +17,7 @@ "scm_info": { "scm": "git", "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "96ca33093960f1fe1fe346812efc9a8ce83906c3", + "revision": "eec428a4adbb3c58f4afeda8a41410048143043b", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ @@ -30,14 +30,14 @@ }, "resources": { "version": "0.9.2", - "identifier": "202d11914cbefed1a0dc60b9d657bf447ef65912", - "dotted_decimal_identifier": "9056752730160894.59005138508568151.210300908755218", + "identifier": "509631788074b98fdc4df95e6ee361dfd20d6b30", + "dotted_decimal_identifier": "22683137356100793.40493149123931875.107613929696048", "source": ".", "cache_key": null, "scm_info": { "scm": "git", "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "96ca33093960f1fe1fe346812efc9a8ce83906c3", + "revision": "eec428a4adbb3c58f4afeda8a41410048143043b", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ @@ -57,7 +57,7 @@ "scm_info": { "scm": "git", "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "96ca33093960f1fe1fe346812efc9a8ce83906c3", + "revision": "eec428a4adbb3c58f4afeda8a41410048143043b", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ From 3661196638bb5fbadfa5257d8af0f2f211a8e514 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 21 Aug 2019 05:55:42 +1000 Subject: [PATCH 067/105] System install of jlenv and Julia. --- resources/julia.rb | 2 +- resources/pkg.rb | 2 +- test/fixtures/cookbooks/resources/recipes/global.rb | 6 +++++- test/fixtures/cookbooks/resources/recipes/system_install.rb | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/resources/julia.rb b/resources/julia.rb index 97a89429..17ff8e61 100644 --- a/resources/julia.rb +++ b/resources/julia.rb @@ -30,7 +30,7 @@ property :environment, Hash property :jlenv_action, String, default: 'install' property :verbose, [true, false], default: false -property :julia_build_git_url, String, default: 'https://github.com/rbenv/julia-build.git' +property :julia_build_git_url, String, default: 'https://github.com/jlenv/julia-build.git' action :install do Chef::Log.fatal('Rubinius not supported by this cookbook') if new_resource.version =~ /rbx/ diff --git a/resources/pkg.rb b/resources/pkg.rb index 7ff6c54d..5a7969bf 100644 --- a/resources/pkg.rb +++ b/resources/pkg.rb @@ -36,7 +36,7 @@ property :version, String property :response_file, String # Only used to reconfigure property :user, String -property :rbenv_version, String, required: true +property :jlenv_version, String, required: true default_action :install diff --git a/test/fixtures/cookbooks/resources/recipes/global.rb b/test/fixtures/cookbooks/resources/recipes/global.rb index 9029bb7a..fa44460f 100644 --- a/test/fixtures/cookbooks/resources/recipes/global.rb +++ b/test/fixtures/cookbooks/resources/recipes/global.rb @@ -3,11 +3,15 @@ # Ensure test setup include_recipe 'shared::default' -global_version = '1.0.3' +global_version = 'v1.0.3' # Install Jlenv Globally. # TODO: Remove this step by installing the given version if not installed. jlenv_system_install 'system' +jlenv_julia global_version do + verbose true +end + # Set that Julia version as the global Julia jlenv_global global_version diff --git a/test/fixtures/cookbooks/resources/recipes/system_install.rb b/test/fixtures/cookbooks/resources/recipes/system_install.rb index 91505ff1..b94a02ed 100644 --- a/test/fixtures/cookbooks/resources/recipes/system_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/system_install.rb @@ -6,3 +6,6 @@ jlenv_system_install 'system' do update_jlenv false end + +# Resources should be idempotent +jlenv_system_install 'system' From 7051c7baf60ebeb94f78cbbe2b7e27d86df71361 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 21 Aug 2019 05:57:57 +1000 Subject: [PATCH 068/105] Update apt before installing Builds in dokken fail without this, under Ubuntu 18.04. --- libraries/package_deps.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index ef53a79a..f5e1296d 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -6,6 +6,7 @@ def install_julia_dependencies when /^special-julia-/ puts 'call another package install method' else + apt_update if node['platform_family'] == 'debian' package_deps.each do |deps| package deps end From 95a61c7bd85bb5055109f9769fc4955f325caf30 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 21 Aug 2019 05:59:47 +1000 Subject: [PATCH 069/105] Add arch and platform specific packaging. --- libraries/package_deps.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index f5e1296d..d518d6d0 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -15,7 +15,7 @@ def install_julia_dependencies end def package_deps - case node['platform_family'] + case node['platform'] when 'mac_os_x' %w(openssl makedepend pkg-config libyaml libffi) when 'rhel', 'fedora', 'amazon' @@ -26,6 +26,30 @@ def package_deps else %w(gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev make) end + when 'ubuntu' + case node['platform_version'] + when '18.04' + case node['hostnamectl']['architecture'] + when 'x86-64' + %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time g++-5 gfortran-5) + else + %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time binutils gcc-5 g++-5 gcc-5-multilib g++-5-multilib make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + end + when '16.04' + case node['hostnamectl']['architecture'] + when 'x86-64' + %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time g++-5 gfortran-5) + else + %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time binutils gcc-5 g++-5 gcc-5-multilib g++-5-multilib make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + end + when '14.04' + case node['hostnamectl']['architecture'] + when 'x86-64' + %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time g++-5 gfortran-5) + else + %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time binutils gcc-5 g++-5 gcc-5-multilib g++-5-multilib make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + end + end when 'suse' %w(gcc make automake gdbm-devel libyaml-devel ncurses-devel readline-devel zlib-devel libopenssl-devel ) end From f61377c7b5609694a82d9dcb2af06170f31ecb7d Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Wed, 21 Aug 2019 06:00:18 +1000 Subject: [PATCH 070/105] Remove rbx check. --- resources/julia.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/julia.rb b/resources/julia.rb index 17ff8e61..01b80d3c 100644 --- a/resources/julia.rb +++ b/resources/julia.rb @@ -33,8 +33,7 @@ property :julia_build_git_url, String, default: 'https://github.com/jlenv/julia-build.git' action :install do - Chef::Log.fatal('Rubinius not supported by this cookbook') if new_resource.version =~ /rbx/ - + install_start = Time.now Chef::Log.info("Building Julia #{new_resource.version}, this could take a while...") From 1b81c1439c6204dbe0dd2071f2c5530c00c90cab Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 21 Aug 2019 15:02:27 +1000 Subject: [PATCH 071/105] Update global version. --- .kitchen.yml | 4 ++-- test/integration/resources/global/controls/global_install.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 197b9ef0..350e501c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -79,13 +79,13 @@ platforms: suites: - name: recipes provisioner: - policyfile: test/fixtures/cookbooks/recipes/system_install.pf.rb + policyfile: test/fixtures/cookbooks/recipes/Policyfile.rb verifier: inspec_tests: - test/integration/recipes - name: issues provisioner: - policyfile: test/fixtures/cookbooks/issues/system_install.pf.rb + policyfile: test/fixtures/cookbooks/issues/Policyfile.rb verifier: inspec_tests: - test/integration/issues diff --git a/test/integration/resources/global/controls/global_install.rb b/test/integration/resources/global/controls/global_install.rb index 129f3ee2..e30eab8b 100644 --- a/test/integration/resources/global/controls/global_install.rb +++ b/test/integration/resources/global/controls/global_install.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -global_julia = '1.0.1' +global_julia = 'v1.0.3' control 'Jlenv should be installed' do title 'Jlenv should be installed globally' From 120f89d4be7277a63b5e375a7c1e034ae7698077 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 21 Aug 2019 18:19:35 +1000 Subject: [PATCH 072/105] Refine Package deps. We now link gcc to gcc-5 so don't require these packages. Linking is done via alternatives/update-alternatives, so we install packages for thos commands. --- libraries/package_deps.rb | 22 +++++++++---------- .../system_install/controls/system_install.rb | 1 + .../user_install/controls/user_install.rb | 3 +-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index d518d6d0..ebce68ab 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -19,39 +19,39 @@ def package_deps when 'mac_os_x' %w(openssl makedepend pkg-config libyaml libffi) when 'rhel', 'fedora', 'amazon' - %w(gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel make) + %w(bzip2 gcc-5 g++-5 chkconfig openssl-devel readline-devel zlib-devel ncurses-devel make) when 'debian' if node['platform_version'].to_i >= 18 - %w(gcc autoconf bison build-essential libssl1.0-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev make) + %w(autoconf bison gcc-5 g++-5 libssl1.0-dev libreadline6-dev zlib1g-dev libncurses5-dev make) else - %w(gcc autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev make) + %w(autoconf bison gcc-5 g++-5 libssl-dev libreadline6-dev zlib1g-dev libncurses5-dev make) end when 'ubuntu' case node['platform_version'] when '18.04' case node['hostnamectl']['architecture'] when 'x86-64' - %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time g++-5 gfortran-5) + %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time) else - %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time binutils gcc-5 g++-5 gcc-5-multilib g++-5-multilib make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time binutils make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) end when '16.04' - case node['hostnamectl']['architecture'] + case node['hostnamectl']['architecture'] when 'x86-64' - %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time g++-5 gfortran-5) + %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time ) else - %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time binutils gcc-5 g++-5 gcc-5-multilib g++-5-multilib make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time binutils make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) end when '14.04' case node['hostnamectl']['architecture'] when 'x86-64' - %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time g++-5 gfortran-5) + %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time) else - %w(bar cmake ccache gawk gcc gfortran libatomic1 libqd-dev libssl1.0.0 make m4 patch pkg-config python-minimal time binutils gcc-5 g++-5 gcc-5-multilib g++-5-multilib make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time binutils make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) end end when 'suse' - %w(gcc make automake gdbm-devel libyaml-devel ncurses-devel readline-devel zlib-devel libopenssl-devel ) + %w(gcc-5 g++-5 gfortran-5 make automake ncurses-devel readline-devel zlib-devel libopenssl-devel update-alternatives) end end end diff --git a/test/integration/resources/system_install/controls/system_install.rb b/test/integration/resources/system_install/controls/system_install.rb index d0896665..eb070b06 100644 --- a/test/integration/resources/system_install/controls/system_install.rb +++ b/test/integration/resources/system_install/controls/system_install.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true +title 'Jlenv User Install Resource' control 'Jlenv system install' do title 'Jlenv should be installed system wide' diff --git a/test/integration/resources/user_install/controls/user_install.rb b/test/integration/resources/user_install/controls/user_install.rb index c34cf158..290c49db 100644 --- a/test/integration/resources/user_install/controls/user_install.rb +++ b/test/integration/resources/user_install/controls/user_install.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true - -title 'Jlenv User Install Example Recipe' +title 'Jlenv User Install Resource' control 'Jlenv should be installed' do impact 0.6 From 0d687979aea581b1268cf0799a8bcfffd6c3c5c9 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 23 Aug 2019 10:56:53 +1000 Subject: [PATCH 073/105] Lint changes. --- libraries/package_deps.rb | 49 +++++++++++++------ resources/julia.rb | 4 +- .../system_install/controls/system_install.rb | 1 + .../user_install/controls/user_install.rb | 3 +- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/libraries/package_deps.rb b/libraries/package_deps.rb index ebce68ab..6a03f782 100644 --- a/libraries/package_deps.rb +++ b/libraries/package_deps.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Chef module Jlenv module PackageDeps @@ -17,41 +19,60 @@ def install_julia_dependencies def package_deps case node['platform'] when 'mac_os_x' - %w(openssl makedepend pkg-config libyaml libffi) + %w[openssl makedepend pkg-config libyaml libffi] when 'rhel', 'fedora', 'amazon' - %w(bzip2 gcc-5 g++-5 chkconfig openssl-devel readline-devel zlib-devel ncurses-devel make) + %w[bzip2 gcc-5 g++-5 chkconfig openssl-devel readline-devel zlib-devel + ncurses-devel make] when 'debian' if node['platform_version'].to_i >= 18 - %w(autoconf bison gcc-5 g++-5 libssl1.0-dev libreadline6-dev zlib1g-dev libncurses5-dev make) + %w[autoconf bison gcc-5 g++-5 libssl1.0-dev libreadline6-dev zlib1g-dev + libncurses5-dev make] else - %w(autoconf bison gcc-5 g++-5 libssl-dev libreadline6-dev zlib1g-dev libncurses5-dev make) + %w[autoconf bison gcc-5 g++-5 libssl-dev libreadline6-dev zlib1g-dev + libncurses5-dev make] end when 'ubuntu' case node['platform_version'] when '18.04' - case node['hostnamectl']['architecture'] + case node['hostnamectl']['architecture'] when 'x86-64' - %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time) + %w[bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 + libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config + python-minimal time] else - %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time binutils make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + %w[bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 + gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 + make m4 patch perl pkg-config python-minimal time binutils + make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib] end when '16.04' case node['hostnamectl']['architecture'] when 'x86-64' - %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time ) + %w[bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 + libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config + python-minimal time] else - %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time binutils make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + %w[bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 + gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 + make m4 patch perl pkg-config python-minimal time binutils + make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib] end when '14.04' - case node['hostnamectl']['architecture'] + case node['hostnamectl']['architecture'] when 'x86-64' - %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time) - else - %w(bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config python-minimal time binutils make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib) + %w[bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 + libatomic1 libqd-dev libssl1.0.0 make m4 patch perl pkg-config + python-minimal time] + else + %w[bar bzip2 cmake ccache curl dpkg gawk gcc-5 g++-5 gfortran-5 + gcc-5-multilib g++-5-multilib libatomic1 libqd-dev libssl1.0.0 + make m4 patch perl pkg-config python-minimal time binutils + make:i386 libssl-dev:i386 gfortran-5 gfortran-5-multilib] end end when 'suse' - %w(gcc-5 g++-5 gfortran-5 make automake ncurses-devel readline-devel zlib-devel libopenssl-devel update-alternatives) + %w[gcc-5 g++-5 gfortran-5 make automake ncurses-devel readline-devel + zlib-devel libopenssl-devel update-alternatives] end end end diff --git a/resources/julia.rb b/resources/julia.rb index 01b80d3c..64616b86 100644 --- a/resources/julia.rb +++ b/resources/julia.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # # Cookbook:: jlenv # Resource:: julia @@ -33,7 +35,7 @@ property :julia_build_git_url, String, default: 'https://github.com/jlenv/julia-build.git' action :install do - + install_start = Time.now Chef::Log.info("Building Julia #{new_resource.version}, this could take a while...") diff --git a/test/integration/resources/system_install/controls/system_install.rb b/test/integration/resources/system_install/controls/system_install.rb index eb070b06..7ef0fc93 100644 --- a/test/integration/resources/system_install/controls/system_install.rb +++ b/test/integration/resources/system_install/controls/system_install.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + title 'Jlenv User Install Resource' control 'Jlenv system install' do diff --git a/test/integration/resources/user_install/controls/user_install.rb b/test/integration/resources/user_install/controls/user_install.rb index 290c49db..3527c4ac 100644 --- a/test/integration/resources/user_install/controls/user_install.rb +++ b/test/integration/resources/user_install/controls/user_install.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + title 'Jlenv User Install Resource' control 'Jlenv should be installed' do @@ -43,7 +44,7 @@ describe os_env('PATH', 'target') do its('split') { should_not include('') } its('split') { should_not include('.') } - its('split') { should include ('/home/vagrant/.jlenv/shims') } + its('split') { should include('/home/vagrant/.jlenv/shims') } end end From 62aa4637cde92556da692a63a5101afb74e104bf Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sat, 24 Aug 2019 20:12:57 +1000 Subject: [PATCH 074/105] Add commands orb dev version. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5155ed2..9eea3733 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@0.1.3 + cmds: taqtiqa/commands@dev:0.1.4 jobs: vagrant: From 03d0ba641ef0aa0f6f3b71bc2a77022e1ff49333 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sat, 24 Aug 2019 20:28:14 +1000 Subject: [PATCH 075/105] mdlint fixes. --- CONTRIBUTING.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb228a76..d739dbcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,7 +61,6 @@ For faster testing, we use [Dokken](https://github.com/someara/kitchen-dokken) k ``` KITECHEN_YAML=.kitchen.dokken.yml kitchen test ``` -https://hub.docker.com/u/dokken/ Test kitchen should run completely without exception using the default [containers provided by Dokken](https://hub.docker.com/u/dokken/). @@ -103,7 +102,6 @@ Because Test Kitchen creates VirtualBox machines and runs through every configuration in the .kitchen.yml file, it may take some time for these tests to complete. - ## Cookbook Contribution Do's and Don't's Please do include tests for your contribution. If you need help, ask From 123846b717b5f048b2198c384c14ce84bd85c475 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sat, 24 Aug 2019 21:08:52 +1000 Subject: [PATCH 076/105] Fix checksum --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9eea3733..9923bff5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ jobs: steps: - cmds/get-pkg-check-install: url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' - checksum: '415f50b93235e761db284c761f6a8240a6ef6762ee3ec7ff869d2bccb1a1cdf7' + checksum: '2bfbecb6cd75f1b97fa9c10264d2e2fb6c428313' verify_command: 'vagrant' workflows: From 3ea9d55a446e8ea4e250261a7b5fa3c4b20459db Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 08:12:22 +1000 Subject: [PATCH 077/105] Update commands orb. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9923bff5..ab3662fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.4 + cmds: taqtiqa/commands@dev:0.1.5 jobs: vagrant: From 53438c6b277ce01bdf5a263f9f8e60f0594c9d55 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 08:41:16 +1000 Subject: [PATCH 078/105] Update orb that kills apt daily service. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ab3662fa..52c357a5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.5 + cmds: taqtiqa/commands@dev:0.1.6 jobs: vagrant: From c6924ac32a5a75d2356ec02274a2e096702d78cc Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 08:55:10 +1000 Subject: [PATCH 079/105] Update commands orb build. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 52c357a5..f5de242b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.6 + cmds: taqtiqa/commands@dev:0.1.7 jobs: vagrant: From 43a572dbc468c06bfc6b848bf9e84a10bc0affc3 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 09:00:10 +1000 Subject: [PATCH 080/105] Aupdate commands orb killall apt. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f5de242b..e1159977 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.7 + cmds: taqtiqa/commands@dev:0.1.8 jobs: vagrant: From 5963d4a47caf1e1ca33b00832718468a9acb3c84 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 09:12:07 +1000 Subject: [PATCH 081/105] Update commands orb dev 0.1.9. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1159977..0d6318dd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.8 + cmds: taqtiqa/commands@dev:0.1.9 jobs: vagrant: From e490b839fc99d8242a3c78cf96d5c71c18653fce Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 10:24:07 +1000 Subject: [PATCH 082/105] Update commands orb v0.1.10 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d6318dd..51edeb97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.9 + cmds: taqtiqa/commands@dev:0.1.10 jobs: vagrant: From 1394e538b4cf8ebf5bf2f13b7d5fab04efaa4786 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 10:38:14 +1000 Subject: [PATCH 083/105] Update commands orb v0.1.11 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 51edeb97..ee007285 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.10 + cmds: taqtiqa/commands@dev:0.1.1 jobs: vagrant: From 17d9fe38269e2b65bd65ca6aad478785d6ab2c82 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 10:39:09 +1000 Subject: [PATCH 084/105] Update commands orb v0.1.11 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ee007285..8f759361 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.1 + cmds: taqtiqa/commands@dev:0.1.11 jobs: vagrant: From 0d864e3908b3636d23aff8fc902b54aafe6ceaf3 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 10:54:21 +1000 Subject: [PATCH 085/105] Update commands orb v.0.1.12 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f759361..e11a7ce4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.11 + cmds: taqtiqa/commands@dev:0.1.12 jobs: vagrant: From b141885b13ce9147a1deee7213db24138dddd622 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 11:10:26 +1000 Subject: [PATCH 086/105] Update commands orb v0.1.13 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e11a7ce4..7a3a3171 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.12 + cmds: taqtiqa/commands@dev:0.1.13 jobs: vagrant: From e3b0ef6cd3d0e8945346113742ed4c755ad91024 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 11:20:00 +1000 Subject: [PATCH 087/105] Fix verify command --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7a3a3171..13fcf1bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ jobs: - cmds/get-pkg-check-install: url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' checksum: '2bfbecb6cd75f1b97fa9c10264d2e2fb6c428313' - verify_command: 'vagrant' + verify_command: '/usr/bin/vagrant' workflows: kitchen: From 0e40e58f9102f6783fb688539f857d620f741262 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 11:31:01 +1000 Subject: [PATCH 088/105] Update verify command to e --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 13fcf1bd..d0c1ea7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ jobs: - cmds/get-pkg-check-install: url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' checksum: '2bfbecb6cd75f1b97fa9c10264d2e2fb6c428313' - verify_command: '/usr/bin/vagrant' + verify_command: 'which vagrant' workflows: kitchen: From 6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Sun, 25 Aug 2019 11:39:56 +1000 Subject: [PATCH 089/105] Update opt localtion for vagrant --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d0c1ea7b..0d09af7b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ jobs: - cmds/get-pkg-check-install: url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' checksum: '2bfbecb6cd75f1b97fa9c10264d2e2fb6c428313' - verify_command: 'which vagrant' + verify_command: '/opt/vagrant/bin/vagrant' workflows: kitchen: From f2105969ef39e923499580cc05261560d8effb0a Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver Date: Mon, 26 Aug 2019 15:57:14 +1000 Subject: [PATCH 090/105] Add laptop run. --- .../cookbooks/resources/global.pf.lock.json | 111 ++++++++++++++++++ .../resources/system_install.pf.lock.json | 16 +-- 2 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 test/fixtures/cookbooks/resources/global.pf.lock.json diff --git a/test/fixtures/cookbooks/resources/global.pf.lock.json b/test/fixtures/cookbooks/resources/global.pf.lock.json new file mode 100644 index 00000000..e38862e6 --- /dev/null +++ b/test/fixtures/cookbooks/resources/global.pf.lock.json @@ -0,0 +1,111 @@ +{ + "revision_id": "6fcd5754ddb3d49df52646deccdffc66f68897c98e8549811712f33ab611dbda", + "name": "resources", + "run_list": [ + "recipe[resources::global]" + ], + "included_policy_locks": [ + + ], + "cookbook_locks": { + "jlenv": { + "version": "0.3.0", + "identifier": "bc297a6531117367f8be90e91ce5cc699004cfd6", + "dotted_decimal_identifier": "52962901282066803.29265419959868645.224753759866838", + "source": "../../../..", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "../../../.." + } + }, + "resources": { + "version": "0.9.2", + "identifier": "678475979e87d9197ccfa775b70293a9b10f0626", + "dotted_decimal_identifier": "29137563190986713.7174105727350530.162357029307942", + "source": ".", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "." + } + }, + "shared": { + "version": "0.9.2", + "identifier": "3ae1173b397d76ac609342fa7ee4b441f0bb62cd", + "dotted_decimal_identifier": "16573038543338870.48519881594404580.198195304686285", + "source": "../shared", + "cache_key": null, + "scm_info": { + "scm": "git", + "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", + "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", + "working_tree_clean": false, + "published": true, + "synchronized_remote_branches": [ + "origin/julia" + ] + }, + "source_options": { + "path": "../shared" + } + } + }, + "default_attributes": { + + }, + "override_attributes": { + + }, + "solution_dependencies": { + "Policyfile": [ + [ + "jlenv", + "= 0.3.0" + ], + [ + "resources", + "= 0.9.2" + ], + [ + "shared", + "= 0.9.2" + ] + ], + "dependencies": { + "jlenv (0.3.0)": [ + + ], + "resources (0.9.2)": [ + [ + "shared", + ">= 0.0.0" + ] + ], + "shared (0.9.2)": [ + [ + "jlenv", + ">= 0.0.0" + ] + ] + } + } +} diff --git a/test/fixtures/cookbooks/resources/system_install.pf.lock.json b/test/fixtures/cookbooks/resources/system_install.pf.lock.json index d1833fa8..bb214667 100644 --- a/test/fixtures/cookbooks/resources/system_install.pf.lock.json +++ b/test/fixtures/cookbooks/resources/system_install.pf.lock.json @@ -1,5 +1,5 @@ { - "revision_id": "0dbf3d1156e29a935f4414811a977861704fa84a85bb327ac8d22bdb9358411b", + "revision_id": "c88f218b95b64bbd2f514457eceb53b32221ed9de73626962beba8ece191123e", "name": "resources", "run_list": [ "recipe[resources::system_install]" @@ -10,14 +10,14 @@ "cookbook_locks": { "jlenv": { "version": "0.3.0", - "identifier": "183b955641fea20e105da45e1fe2e4059a1998bd", - "dotted_decimal_identifier": "6820912024387234.3958644049584098.250712711338173", + "identifier": "bc297a6531117367f8be90e91ce5cc699004cfd6", + "dotted_decimal_identifier": "52962901282066803.29265419959868645.224753759866838", "source": "../../../..", "cache_key": null, "scm_info": { "scm": "git", "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "eec428a4adbb3c58f4afeda8a41410048143043b", + "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ @@ -30,14 +30,14 @@ }, "resources": { "version": "0.9.2", - "identifier": "509631788074b98fdc4df95e6ee361dfd20d6b30", - "dotted_decimal_identifier": "22683137356100793.40493149123931875.107613929696048", + "identifier": "4cbc67a04862beecd2a8f6eb724f4659a0b761e8", + "dotted_decimal_identifier": "21599251486761662.66659717642678863.77350762406376", "source": ".", "cache_key": null, "scm_info": { "scm": "git", "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "eec428a4adbb3c58f4afeda8a41410048143043b", + "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ @@ -57,7 +57,7 @@ "scm_info": { "scm": "git", "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "eec428a4adbb3c58f4afeda8a41410048143043b", + "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ From aec2b2ac8835ca9ffbbdd82153e2491a170d2cd2 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Mon, 26 Aug 2019 17:27:44 +1000 Subject: [PATCH 091/105] Remove vagrant script and add ignite requirements check. --- .circleci/config.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d09af7b..157621fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,16 +2,10 @@ version: 2.1 orbs: kitchen: taqtiqa/kitchen@1.3.3 - cmds: taqtiqa/commands@dev:0.1.13 + cmds: taqtiqa/commands@dev:0.1.14 jobs: - vagrant: - executor: kitchen/chef - steps: - - cmds/get-pkg-check-install: - url: 'https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb' - checksum: '2bfbecb6cd75f1b97fa9c10264d2e2fb6c428313' - verify_command: '/opt/vagrant/bin/vagrant' + ignite-install: workflows: kitchen: From 7777c98462179b3e0cc7434087ab3f18773473d5 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Mon, 26 Aug 2019 17:32:53 +1000 Subject: [PATCH 092/105] Add Ignite requirements check. --- .circleci/config.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 157621fd..749af070 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,13 +5,16 @@ orbs: cmds: taqtiqa/commands@dev:0.1.14 jobs: - ignite-install: + ignite: + executor: kitchen/chef + steps: + - cmds/ignite-install: workflows: kitchen: jobs: - - vagrant: - name: vagrant + - ignite: + name: ignite # - kitchen/danger: # name: danger # context: Danger @@ -22,7 +25,7 @@ workflows: - kitchen/dokken: suite: global name: global - requires: [mdlint, yamllint, vagrant] + requires: [mdlint, yamllint, ignite] # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: suite: global-opensuse-leap @@ -47,7 +50,7 @@ workflows: - kitchen/dokken-single: name: julia-uninstall-ubuntu-1804 suite: julia-uninstall-ubuntu-1804 - requires: [mdlint, yamllint, vagrant] + requires: [mdlint, yamllint] # requires: [mdlint, yamllint, danger] - kitchen/dokken-single: name: custom-group From a18d642b78bb9dd720fd66d8caeb2a14711b4973 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Mon, 26 Aug 2019 17:38:13 +1000 Subject: [PATCH 093/105] Fix ignite job parameter --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 749af070..282633cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,7 @@ jobs: executor: kitchen/chef steps: - cmds/ignite-install: + version: workflows: kitchen: From bbf5b00e2f9f6ad382b8f794bfc0f5a9ec256348 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Mon, 26 Aug 2019 17:43:16 +1000 Subject: [PATCH 094/105] Revert to using dokken only. --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 282633cf..e626f4b2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,8 +14,8 @@ jobs: workflows: kitchen: jobs: - - ignite: - name: ignite + # - ignite: + # name: ignite # - kitchen/danger: # name: danger # context: Danger @@ -26,8 +26,8 @@ workflows: - kitchen/dokken: suite: global name: global - requires: [mdlint, yamllint, ignite] - # requires: [mdlint, yamllint, danger] + requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, ignite] - kitchen/dokken-single: suite: global-opensuse-leap name: global-opensuse-leap From 9a0ac6c4140944f5b3da4144319cf093e2ccdecb Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Mon, 26 Aug 2019 17:58:48 +1000 Subject: [PATCH 095/105] Revised kitchen orb dev:1.3.5 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e626f4b2..eeb662b5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ --- version: 2.1 orbs: - kitchen: taqtiqa/kitchen@1.3.3 + kitchen: taqtiqa/kitchen@dev:1.3.5 cmds: taqtiqa/commands@dev:0.1.14 jobs: From 8d673b6f9df6164e6fec2de70323796c0cb2c9cf Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Mon, 26 Aug 2019 23:03:05 +1000 Subject: [PATCH 096/105] Refactor integration tests. --- .kitchen.yml | 6 + Policyfile.rb | 5 +- test/fixtures/cookbooks/issues/Policyfile.rb | 6 +- test/fixtures/cookbooks/issues/README.md | 6 + test/fixtures/cookbooks/issues/metadata.rb | 1 + .../issues/recipes/custom_group_install.rb | 2 +- .../cookbooks/issues/recipes/default.rb | 4 +- .../cookbooks/issues/recipes/plugin.rb | 4 +- test/fixtures/cookbooks/recipes/Policyfile.rb | 1 + test/fixtures/cookbooks/recipes/README.md | 6 + test/fixtures/cookbooks/recipes/metadata.rb | 1 + .../recipes/recipes/custom_group_install.rb | 2 +- .../cookbooks/recipes/recipes/default.rb | 4 +- .../cookbooks/recipes/recipes/plugin.rb | 4 +- .../cookbooks/resources/Policyfile.rb | 10 ++ test/fixtures/cookbooks/resources/README.md | 6 + .../cookbooks/resources/global.pf.lock.json | 111 ------------------ test/fixtures/cookbooks/resources/metadata.rb | 3 +- .../resources/recipes/custom_group_install.rb | 2 +- .../cookbooks/resources/recipes/plugin.rb | 23 +--- .../resources/recipes/system_install.rb | 6 +- .../resources/recipes/user_install.rb | 17 +-- .../resources/system_install.pf.lock.json | 111 ------------------ .../cookbooks/resources/system_install.pf.rb | 5 +- test/fixtures/cookbooks/shared/Policyfile.rb | 6 +- test/fixtures/cookbooks/shared/metadata.rb | 2 +- test/integration/resources/global/inspec.yml | 2 +- .../system_install/controls/system_install.rb | 2 +- .../resources/system_install/inspec.yml | 2 +- .../resources/user_install/inspec.yml | 2 +- 30 files changed, 73 insertions(+), 289 deletions(-) create mode 100644 test/fixtures/cookbooks/issues/README.md create mode 100644 test/fixtures/cookbooks/recipes/README.md create mode 100644 test/fixtures/cookbooks/resources/Policyfile.rb create mode 100644 test/fixtures/cookbooks/resources/README.md delete mode 100644 test/fixtures/cookbooks/resources/global.pf.lock.json delete mode 100644 test/fixtures/cookbooks/resources/system_install.pf.lock.json diff --git a/.kitchen.yml b/.kitchen.yml index 350e501c..db40d684 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -77,6 +77,12 @@ platforms: - RUN zypper --non-interactive install sudo suites: + - name: resources + provisioner: + policyfile: test/fixtures/cookbooks/resources/Policyfile.rb + verifier: + inspec_tests: + - test/integration/resources - name: recipes provisioner: policyfile: test/fixtures/cookbooks/recipes/Policyfile.rb diff --git a/Policyfile.rb b/Policyfile.rb index 98eae4fb..d6a989f6 100644 --- a/Policyfile.rb +++ b/Policyfile.rb @@ -1,7 +1,6 @@ name 'jlenv' -path = File.expand_path('policyfiles/base.rb', __dir__) -instance_eval(IO.read(path)) +# path = File.expand_path('policyfiles/base.rb', __dir__) +# instance_eval(IO.read(path)) run_list 'jlenv::default' -cookbook 'jlenv', path: '.' diff --git a/test/fixtures/cookbooks/issues/Policyfile.rb b/test/fixtures/cookbooks/issues/Policyfile.rb index e49d6890..87f797e9 100644 --- a/test/fixtures/cookbooks/issues/Policyfile.rb +++ b/test/fixtures/cookbooks/issues/Policyfile.rb @@ -1,9 +1,9 @@ name 'issues' -run_list 'issues::global' +run_list 'issues::default' -default_source :chef_repo, "../../../../../" -default_source :chef_repo, "../" +default_source :chef_repo, '../../../../../' +default_source :chef_repo, '../' cookbook 'issues' cookbook 'shared' diff --git a/test/fixtures/cookbooks/issues/README.md b/test/fixtures/cookbooks/issues/README.md new file mode 100644 index 00000000..d83f1c81 --- /dev/null +++ b/test/fixtures/cookbooks/issues/README.md @@ -0,0 +1,6 @@ +# Issues Integration Cookbook + +The Resources cookbook exercise resource default behaviour. +The Recipes cookbook exercise resource non-default behaviour. +The Issues cookbook exercise past broken or incorrect behaviour +- regression tests. diff --git a/test/fixtures/cookbooks/issues/metadata.rb b/test/fixtures/cookbooks/issues/metadata.rb index a5f4fb69..9149b321 100644 --- a/test/fixtures/cookbooks/issues/metadata.rb +++ b/test/fixtures/cookbooks/issues/metadata.rb @@ -1,4 +1,5 @@ name 'issues' +description 'A cookbook that exercises past broken or incorrect behaviour - regression tests.' version '0.99.2' depends 'shared' diff --git a/test/fixtures/cookbooks/issues/recipes/custom_group_install.rb b/test/fixtures/cookbooks/issues/recipes/custom_group_install.rb index 15db2dac..07855920 100644 --- a/test/fixtures/cookbooks/issues/recipes/custom_group_install.rb +++ b/test/fixtures/cookbooks/issues/recipes/custom_group_install.rb @@ -16,7 +16,7 @@ # Install plugin to build Julia jlenv_plugin 'julia-build' do - git_url 'https://github.com/HiroakiMikami/julia-build.git' + git_url 'https://github.com/jlenv/julia-build.git' user 'vagrant' end diff --git a/test/fixtures/cookbooks/issues/recipes/default.rb b/test/fixtures/cookbooks/issues/recipes/default.rb index bd0c8de1..63d452c3 100644 --- a/test/fixtures/cookbooks/issues/recipes/default.rb +++ b/test/fixtures/cookbooks/issues/recipes/default.rb @@ -1,4 +1,4 @@ # recipe file to satisfy Policyfile build. -# Make sure that Vagrant user is on the box for dokken -include_recipe 'test::vagrant' +# Ensure test setup +include_recipe 'shared::default' diff --git a/test/fixtures/cookbooks/issues/recipes/plugin.rb b/test/fixtures/cookbooks/issues/recipes/plugin.rb index 6b0b6f7e..0476dab6 100644 --- a/test/fixtures/cookbooks/issues/recipes/plugin.rb +++ b/test/fixtures/cookbooks/issues/recipes/plugin.rb @@ -17,12 +17,12 @@ end jlenv_plugin 'julia-build' do - git_url 'https://github.com/HiroakiMikami/julia-build.git' + git_url 'https://github.com/jlenv/julia-build.git' user 'vagrant' end # This should get installed to the system_install jlenv_plugin 'julia-build' do - git_url 'git@github.com:HiroakiMikami/julia-build.git' + git_url 'git@github.com:jlenv/julia-build.git' git_ref 'bb86c68' end diff --git a/test/fixtures/cookbooks/recipes/Policyfile.rb b/test/fixtures/cookbooks/recipes/Policyfile.rb index 13113bf3..3b3edcea 100644 --- a/test/fixtures/cookbooks/recipes/Policyfile.rb +++ b/test/fixtures/cookbooks/recipes/Policyfile.rb @@ -1,6 +1,7 @@ name 'recipes' run_list 'recipes::system_install', + 'recipes::user_install', 'recipes::global' default_source :chef_repo, "../../../../../" diff --git a/test/fixtures/cookbooks/recipes/README.md b/test/fixtures/cookbooks/recipes/README.md new file mode 100644 index 00000000..32638842 --- /dev/null +++ b/test/fixtures/cookbooks/recipes/README.md @@ -0,0 +1,6 @@ +# Recipes Integration Cookbook + +The Resources cookbook exercise resource default behaviour. +The Recipes cookbook exercise resource non-default behaviour. +The Issues cookbook exercise past broken or incorrect behaviour +- regression tests. diff --git a/test/fixtures/cookbooks/recipes/metadata.rb b/test/fixtures/cookbooks/recipes/metadata.rb index 48e81f58..64eff822 100644 --- a/test/fixtures/cookbooks/recipes/metadata.rb +++ b/test/fixtures/cookbooks/recipes/metadata.rb @@ -1,4 +1,5 @@ name 'recipes' +description 'A cookbook that exercises non-default behaviour.' version '0.9.2' depends 'shared' diff --git a/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb b/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb index 15db2dac..07855920 100644 --- a/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb +++ b/test/fixtures/cookbooks/recipes/recipes/custom_group_install.rb @@ -16,7 +16,7 @@ # Install plugin to build Julia jlenv_plugin 'julia-build' do - git_url 'https://github.com/HiroakiMikami/julia-build.git' + git_url 'https://github.com/jlenv/julia-build.git' user 'vagrant' end diff --git a/test/fixtures/cookbooks/recipes/recipes/default.rb b/test/fixtures/cookbooks/recipes/recipes/default.rb index bd0c8de1..63d452c3 100644 --- a/test/fixtures/cookbooks/recipes/recipes/default.rb +++ b/test/fixtures/cookbooks/recipes/recipes/default.rb @@ -1,4 +1,4 @@ # recipe file to satisfy Policyfile build. -# Make sure that Vagrant user is on the box for dokken -include_recipe 'test::vagrant' +# Ensure test setup +include_recipe 'shared::default' diff --git a/test/fixtures/cookbooks/recipes/recipes/plugin.rb b/test/fixtures/cookbooks/recipes/recipes/plugin.rb index 6b0b6f7e..0476dab6 100644 --- a/test/fixtures/cookbooks/recipes/recipes/plugin.rb +++ b/test/fixtures/cookbooks/recipes/recipes/plugin.rb @@ -17,12 +17,12 @@ end jlenv_plugin 'julia-build' do - git_url 'https://github.com/HiroakiMikami/julia-build.git' + git_url 'https://github.com/jlenv/julia-build.git' user 'vagrant' end # This should get installed to the system_install jlenv_plugin 'julia-build' do - git_url 'git@github.com:HiroakiMikami/julia-build.git' + git_url 'git@github.com:jlenv/julia-build.git' git_ref 'bb86c68' end diff --git a/test/fixtures/cookbooks/resources/Policyfile.rb b/test/fixtures/cookbooks/resources/Policyfile.rb new file mode 100644 index 00000000..57f4dcac --- /dev/null +++ b/test/fixtures/cookbooks/resources/Policyfile.rb @@ -0,0 +1,10 @@ +name 'resources' + +run_list 'resources::system_install', + 'resources::user_install', + 'resources::plugin' + +default_source :chef_repo, './../' + +cookbook 'resources' +cookbook 'jlenv', path: './../../../../' \ No newline at end of file diff --git a/test/fixtures/cookbooks/resources/README.md b/test/fixtures/cookbooks/resources/README.md new file mode 100644 index 00000000..6811e4e5 --- /dev/null +++ b/test/fixtures/cookbooks/resources/README.md @@ -0,0 +1,6 @@ +# Resources Integration Cookbook + +The Resources cookbook exercise resource default behaviour. +The Recipes cookbook exercise resource non-default behaviour. +The Issues cookbook exercise past broken or incorrect behaviour +- regression tests. diff --git a/test/fixtures/cookbooks/resources/global.pf.lock.json b/test/fixtures/cookbooks/resources/global.pf.lock.json deleted file mode 100644 index e38862e6..00000000 --- a/test/fixtures/cookbooks/resources/global.pf.lock.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "revision_id": "6fcd5754ddb3d49df52646deccdffc66f68897c98e8549811712f33ab611dbda", - "name": "resources", - "run_list": [ - "recipe[resources::global]" - ], - "included_policy_locks": [ - - ], - "cookbook_locks": { - "jlenv": { - "version": "0.3.0", - "identifier": "bc297a6531117367f8be90e91ce5cc699004cfd6", - "dotted_decimal_identifier": "52962901282066803.29265419959868645.224753759866838", - "source": "../../../..", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "../../../.." - } - }, - "resources": { - "version": "0.9.2", - "identifier": "678475979e87d9197ccfa775b70293a9b10f0626", - "dotted_decimal_identifier": "29137563190986713.7174105727350530.162357029307942", - "source": ".", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "." - } - }, - "shared": { - "version": "0.9.2", - "identifier": "3ae1173b397d76ac609342fa7ee4b441f0bb62cd", - "dotted_decimal_identifier": "16573038543338870.48519881594404580.198195304686285", - "source": "../shared", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "../shared" - } - } - }, - "default_attributes": { - - }, - "override_attributes": { - - }, - "solution_dependencies": { - "Policyfile": [ - [ - "jlenv", - "= 0.3.0" - ], - [ - "resources", - "= 0.9.2" - ], - [ - "shared", - "= 0.9.2" - ] - ], - "dependencies": { - "jlenv (0.3.0)": [ - - ], - "resources (0.9.2)": [ - [ - "shared", - ">= 0.0.0" - ] - ], - "shared (0.9.2)": [ - [ - "jlenv", - ">= 0.0.0" - ] - ] - } - } -} diff --git a/test/fixtures/cookbooks/resources/metadata.rb b/test/fixtures/cookbooks/resources/metadata.rb index 4ac2a229..d7deb875 100644 --- a/test/fixtures/cookbooks/resources/metadata.rb +++ b/test/fixtures/cookbooks/resources/metadata.rb @@ -1,5 +1,6 @@ name 'resources' -version '0.9.2' +description 'A cookbook that exercises default behaviour.' +version '0.9.3' depends 'shared' diff --git a/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb b/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb index d004b215..f0bf2664 100644 --- a/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/custom_group_install.rb @@ -16,7 +16,7 @@ # Install plugin to build Julia jlenv_plugin 'julia-build' do - git_url 'https://github.com/HiroakiMikami/julia-build.git' + git_url 'https://github.com/jlenv/julia-build.git' user 'vagrant' end diff --git a/test/fixtures/cookbooks/resources/recipes/plugin.rb b/test/fixtures/cookbooks/resources/recipes/plugin.rb index b99a38ab..8fd03002 100644 --- a/test/fixtures/cookbooks/resources/recipes/plugin.rb +++ b/test/fixtures/cookbooks/resources/recipes/plugin.rb @@ -1,28 +1,11 @@ -version = '1.0.1' # Ensure test setup include_recipe 'shared::default' -jlenv_user_install 'vagrant' - -jlenv_system_install 'system' - -jlenv_julia version do - install_julia_build false - user 'vagrant' -end - -jlenv_global version do - user 'vagrant' -end - +# Julia build plugin should get installed to the user's jlenv. jlenv_plugin 'julia-build' do - git_url 'https://github.com/HiroakiMikami/julia-build.git' user 'vagrant' end -# This should get installed to the system_install -jlenv_plugin 'julia-build' do - git_url 'git@github.com:HiroakiMikami/julia-build.git' - git_ref 'bb86c68' -end +# Julia build plugin should get installed to the system_install. +jlenv_plugin 'julia-build' diff --git a/test/fixtures/cookbooks/resources/recipes/system_install.rb b/test/fixtures/cookbooks/resources/recipes/system_install.rb index b94a02ed..75e637af 100644 --- a/test/fixtures/cookbooks/resources/recipes/system_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/system_install.rb @@ -1,11 +1,11 @@ + + # Install Jlenv to the system path e.g. /usr/local/jlenv # Ensure test setup include_recipe 'shared::default' -jlenv_system_install 'system' do - update_jlenv false -end +jlenv_system_install 'system' # Resources should be idempotent jlenv_system_install 'system' diff --git a/test/fixtures/cookbooks/resources/recipes/user_install.rb b/test/fixtures/cookbooks/resources/recipes/user_install.rb index 1a4048f8..1f9e194e 100644 --- a/test/fixtures/cookbooks/resources/recipes/user_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/user_install.rb @@ -1,22 +1,11 @@ + # Install jlenv and makes it avilable to the selected user # Ensure test setup include_recipe 'shared::default' -version = '1.0.1' - # Keeps the jlenv install upto date jlenv_user_install 'vagrant' -jlenv_plugin 'julia-build' do - git_url 'https://github.com/jlenv/julia-build.git' - user 'vagrant' -end - -jlenv_julia '1.0.4' do - user 'vagrant' -end - -jlenv_global version do - user 'vagrant' -end +# User installs are idempotent. +jlenv_user_install 'vagrant' diff --git a/test/fixtures/cookbooks/resources/system_install.pf.lock.json b/test/fixtures/cookbooks/resources/system_install.pf.lock.json deleted file mode 100644 index bb214667..00000000 --- a/test/fixtures/cookbooks/resources/system_install.pf.lock.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "revision_id": "c88f218b95b64bbd2f514457eceb53b32221ed9de73626962beba8ece191123e", - "name": "resources", - "run_list": [ - "recipe[resources::system_install]" - ], - "included_policy_locks": [ - - ], - "cookbook_locks": { - "jlenv": { - "version": "0.3.0", - "identifier": "bc297a6531117367f8be90e91ce5cc699004cfd6", - "dotted_decimal_identifier": "52962901282066803.29265419959868645.224753759866838", - "source": "../../../..", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "../../../.." - } - }, - "resources": { - "version": "0.9.2", - "identifier": "4cbc67a04862beecd2a8f6eb724f4659a0b761e8", - "dotted_decimal_identifier": "21599251486761662.66659717642678863.77350762406376", - "source": ".", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "." - } - }, - "shared": { - "version": "0.9.2", - "identifier": "3ae1173b397d76ac609342fa7ee4b441f0bb62cd", - "dotted_decimal_identifier": "16573038543338870.48519881594404580.198195304686285", - "source": "../shared", - "cache_key": null, - "scm_info": { - "scm": "git", - "remote": "https://github.com/taqtiqa-mark/jlenv-cookbook.git", - "revision": "6bc3a8161a6d3c33def9c7f1df73c6de1ddbab10", - "working_tree_clean": false, - "published": true, - "synchronized_remote_branches": [ - "origin/julia" - ] - }, - "source_options": { - "path": "../shared" - } - } - }, - "default_attributes": { - - }, - "override_attributes": { - - }, - "solution_dependencies": { - "Policyfile": [ - [ - "jlenv", - "= 0.3.0" - ], - [ - "resources", - "= 0.9.2" - ], - [ - "shared", - "= 0.9.2" - ] - ], - "dependencies": { - "jlenv (0.3.0)": [ - - ], - "resources (0.9.2)": [ - [ - "shared", - ">= 0.0.0" - ] - ], - "shared (0.9.2)": [ - [ - "jlenv", - ">= 0.0.0" - ] - ] - } - } -} diff --git a/test/fixtures/cookbooks/resources/system_install.pf.rb b/test/fixtures/cookbooks/resources/system_install.pf.rb index 640d9993..cd408b61 100644 --- a/test/fixtures/cookbooks/resources/system_install.pf.rb +++ b/test/fixtures/cookbooks/resources/system_install.pf.rb @@ -2,8 +2,7 @@ run_list 'resources::system_install' -default_source :chef_repo, "../../../../../" -default_source :chef_repo, "../" +default_source :chef_repo, './../' cookbook 'resources' -cookbook 'shared' +cookbook 'jlenv', path: './../../../../' \ No newline at end of file diff --git a/test/fixtures/cookbooks/shared/Policyfile.rb b/test/fixtures/cookbooks/shared/Policyfile.rb index f30c0b3c..456ad07b 100644 --- a/test/fixtures/cookbooks/shared/Policyfile.rb +++ b/test/fixtures/cookbooks/shared/Policyfile.rb @@ -2,8 +2,6 @@ run_list 'shared::default' -default_source :chef_repo, "../../../../" -default_source :chef_repo, "../" +# default_source :chef_repo, './../../../../' -cookbook 'shared' -cookbook 'jlenv' +cookbook 'jlenv', path: './../../../../' \ No newline at end of file diff --git a/test/fixtures/cookbooks/shared/metadata.rb b/test/fixtures/cookbooks/shared/metadata.rb index 981052b6..fde835ac 100644 --- a/test/fixtures/cookbooks/shared/metadata.rb +++ b/test/fixtures/cookbooks/shared/metadata.rb @@ -1,5 +1,5 @@ name 'shared' -version '0.9.2' +version '0.9.4' depends 'jlenv' diff --git a/test/integration/resources/global/inspec.yml b/test/integration/resources/global/inspec.yml index 1a025b8e..f8534154 100644 --- a/test/integration/resources/global/inspec.yml +++ b/test/integration/resources/global/inspec.yml @@ -4,7 +4,7 @@ title: jlenv profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv correctly sets the global Julia version +summary: Verifies jlenv correctly sets the global Julia version. version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/resources/system_install/controls/system_install.rb b/test/integration/resources/system_install/controls/system_install.rb index 7ef0fc93..0bd0f9d5 100644 --- a/test/integration/resources/system_install/controls/system_install.rb +++ b/test/integration/resources/system_install/controls/system_install.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -title 'Jlenv User Install Resource' +title 'Jlenv System Install Resource' control 'Jlenv system install' do title 'Jlenv should be installed system wide' diff --git a/test/integration/resources/system_install/inspec.yml b/test/integration/resources/system_install/inspec.yml index 8c646fbf..f0eda0d6 100644 --- a/test/integration/resources/system_install/inspec.yml +++ b/test/integration/resources/system_install/inspec.yml @@ -4,7 +4,7 @@ title: jlenv profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly system wide +summary: Verifies jlenv is installed correctly system wide. version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/resources/user_install/inspec.yml b/test/integration/resources/user_install/inspec.yml index a131fa3e..e2d520af 100644 --- a/test/integration/resources/user_install/inspec.yml +++ b/test/integration/resources/user_install/inspec.yml @@ -4,7 +4,7 @@ title: jlenv profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly for a user +summary: Verifies jlenv is installed correctly for a user. version: 1.0.0 supports: - os-family: linux From 083830f8e4b5372c459547906b98a9aa6ff354ae Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 30 Aug 2019 17:04:21 +1000 Subject: [PATCH 097/105] Refactor unit & interation tests Commitng these changes in order to move to monkey patching the git resource revision logic to over come chef/chef/issues/8855 Policyfile referencing was difficult to get stabilised for both unit and integration tests. --- Policyfile.rb | 4 +-- README.md | 28 ++++++++++++------- policyfiles/base.rb | 2 +- resources/plugin.rb | 4 +-- resources/system_install.rb | 12 ++++++++ test/fixtures/cookbooks/recipes/Policyfile.rb | 9 ++++-- test/fixtures/cookbooks/recipes/README.md | 6 ++-- .../cookbooks/resources/Policyfile.rb | 7 +++-- test/fixtures/cookbooks/shared/Policyfile.rb | 4 ++- test/spec/recipes/default_spec.rb | 2 +- test/spec/recipes/system_install_spec.rb | 8 +++--- ...{spec_helper.rb => recipes_spec_helper.rb} | 1 + test/spec/resources/plugin_spec.rb | 9 ++++++ .../user_install_spec.rb | 5 ++-- test/spec/resources_spec_helper.rb | 11 ++++++++ 15 files changed, 80 insertions(+), 32 deletions(-) rename test/spec/{spec_helper.rb => recipes_spec_helper.rb} (66%) create mode 100644 test/spec/resources/plugin_spec.rb rename test/spec/{recipes => resources}/user_install_spec.rb (57%) create mode 100644 test/spec/resources_spec_helper.rb diff --git a/Policyfile.rb b/Policyfile.rb index d6a989f6..aa59b599 100644 --- a/Policyfile.rb +++ b/Policyfile.rb @@ -1,6 +1,6 @@ name 'jlenv' -# path = File.expand_path('policyfiles/base.rb', __dir__) -# instance_eval(IO.read(path)) +path = File.expand_path('policyfiles/base.rb', __dir__) +instance_eval(IO.read(path)) run_list 'jlenv::default' diff --git a/README.md b/README.md index ae3d7910..04e1b07a 100755 --- a/README.md +++ b/README.md @@ -45,11 +45,11 @@ However they are supported by this cookbook, see [two](https://github.com/rbenv/rbenv/issues/306/) issues in the rbenv repository for the reasons why. -## Pkg +## Package Used to install a package into the selected jlenv environment. -```julia +```ruby jlenv_package 'pkg_name' do options # Optional: Options for the packagecommand e.g. '--no-rdoc --no-ri' source # Optional: source URL/location for gem. @@ -65,7 +65,7 @@ end Sets the global Julia version. The name of the resource is the version to set. -```julia +```ruby jlenv_global '1.1.0' do user # Optional: Sets the users global version. # Leave unset, to set the system global version. @@ -80,7 +80,7 @@ system global version. Installs a jlenv plugin. -```julia +```ruby jlenv_plugin 'julia-build' do git_url # Git URL of the plugin git_ref # Git reference of the plugin @@ -93,7 +93,7 @@ If user is passed in, the plugin is installed to the users install of jlenv. ## Rehash -```julia +```ruby jlenv_rehash 'rehash' do user 'vagrant' # Optional: Rehash the user jlenv otherwise rehash system jlenv end @@ -105,7 +105,7 @@ If user is passed in, the user Julia is rehashed rather than the system Julia. Installs a given Julia version to the system or user location. -```julia +```ruby jlenv_julia '1.1.0' do user # Optional, but recommended: If passed, the user to install jlenv to jlenv_action # Optional: Action to perform: @@ -119,7 +119,7 @@ Shorter example `jlenv_julia '1.1.0'` Runs a jlenv aware script. -```julia +```ruby jlenv_script 'foo' do jlenv_version #jlenv version to run the script against environment # Optional: Hash of environment variables in the form of @@ -134,7 +134,7 @@ end Note that environment overwrites the entire variable. For example. setting the `$PATH` variable can be done like this: -```julia +```ruby jlenv_script 'bundle package' do cwd node["bundle_dir"] environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"}) @@ -149,7 +149,7 @@ Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set Installs jlenv to the system location, by default `/usr/local/jlenv` -```julia +```ruby jlenv_system_install 'foo' do git_url # URL of the plugin repo you want to checkout git_ref # Optional: Git reference to checkout @@ -161,7 +161,7 @@ end Installs jlenv to the user path, making jlenv available to that user only. -```julia +```ruby jlenv_user_install 'vagrant' do git_url # Optional: Git URL to checkout jlenv from. git_ref # Optional: Git reference to checkout e.g. 'master' @@ -184,6 +184,14 @@ need to [modify][mac_profile_d] your user profile. Pull requests are very welcome! Make sure your patches are well tested. +## Testing + +For local unit tests: + +```bash +delivery local +``` + ## Contributors diff --git a/policyfiles/base.rb b/policyfiles/base.rb index fc052a02..b548c30d 100644 --- a/policyfiles/base.rb +++ b/policyfiles/base.rb @@ -1,3 +1,3 @@ default_source :supermarket -cookbook 'test', path: './test/fixtures/cookbooks/test' +cookbook 'resources', path: './test/fixtures/cookbooks/resources' diff --git a/resources/plugin.rb b/resources/plugin.rb index c36aedf8..0e135133 100644 --- a/resources/plugin.rb +++ b/resources/plugin.rb @@ -22,7 +22,7 @@ # provides :jlenv_plugin -property :git_url, String, required: true +property :git_url, String, default: 'https://github.com/jlenv/jlenv-build.git' property :git_ref, String, default: 'master' property :user, String @@ -35,7 +35,7 @@ repository new_resource.git_url reference new_resource.git_ref user new_resource.user if new_resource.user - action :sync + action :checkout end end diff --git a/resources/system_install.rb b/resources/system_install.rb index 56276000..3a34edf0 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -26,6 +26,7 @@ property :git_url, String, default: 'https://github.com/jlenv/jlenv.git' property :git_ref, String, default: 'master' +property :git_username, String, default: 'root' property :global_prefix, String, default: '/usr/local/jlenv' property :update_jlenv, [true, false], default: true @@ -52,6 +53,7 @@ repository new_resource.git_url reference new_resource.git_ref action :checkout if new_resource.update_jlenv == false + notifies :run, 'bash[Initialize global git username]', :immediately notifies :run, 'ruby_block[Add jlenv to PATH]', :immediately notifies :run, 'bash[Initialize system jlenv]', :immediately end @@ -69,6 +71,16 @@ action :nothing end + # Git within dokken encounters the problem that /dev/tty is not available. + # See also: https://stackoverflow.com/a/57458443/152860 + bash 'Initialize global git username' do + code <<-EOH + su -l #{node['current_user']} -c 'git config --global user.name #{new_resource.git_username||node['current_user']}' + EOH + flags "-x" + action :nothing + end + bash 'Initialize system jlenv' do code %(PATH="#{new_resource.global_prefix}/bin:$PATH" jlenv init -) environment('JLENV_ROOT' => new_resource.global_prefix) diff --git a/test/fixtures/cookbooks/recipes/Policyfile.rb b/test/fixtures/cookbooks/recipes/Policyfile.rb index 3b3edcea..fa19ddb5 100644 --- a/test/fixtures/cookbooks/recipes/Policyfile.rb +++ b/test/fixtures/cookbooks/recipes/Policyfile.rb @@ -4,8 +4,13 @@ 'recipes::user_install', 'recipes::global' -default_source :chef_repo, "../../../../../" -default_source :chef_repo, "../" +# default_source :chef_repo, "../../../../../" +# default_source :chef_repo, "../" + +# cookbook 'recipes' +# cookbook 'shared' +default_source :chef_repo, './../' cookbook 'recipes' cookbook 'shared' +cookbook 'jlenv', path: './../../../../' diff --git a/test/fixtures/cookbooks/recipes/README.md b/test/fixtures/cookbooks/recipes/README.md index 32638842..363905c9 100644 --- a/test/fixtures/cookbooks/recipes/README.md +++ b/test/fixtures/cookbooks/recipes/README.md @@ -1,6 +1,6 @@ # Recipes Integration Cookbook -The Resources cookbook exercise resource default behaviour. -The Recipes cookbook exercise resource non-default behaviour. -The Issues cookbook exercise past broken or incorrect behaviour +The **Resources cookbook** exercise resource default behaviour. +The **Recipes cookbook** exercise resource non-default behaviour. +The **Issues cookbook** exercise past broken or incorrect behaviour - regression tests. diff --git a/test/fixtures/cookbooks/resources/Policyfile.rb b/test/fixtures/cookbooks/resources/Policyfile.rb index 57f4dcac..e3d8eb45 100644 --- a/test/fixtures/cookbooks/resources/Policyfile.rb +++ b/test/fixtures/cookbooks/resources/Policyfile.rb @@ -1,10 +1,11 @@ name 'resources' run_list 'resources::system_install', - 'resources::user_install', - 'resources::plugin' + 'resources::user_install', + 'resources::plugin' default_source :chef_repo, './../' cookbook 'resources' -cookbook 'jlenv', path: './../../../../' \ No newline at end of file +cookbook 'shared' +cookbook 'jlenv', path: './../../../../' diff --git a/test/fixtures/cookbooks/shared/Policyfile.rb b/test/fixtures/cookbooks/shared/Policyfile.rb index 456ad07b..f4c6bca3 100644 --- a/test/fixtures/cookbooks/shared/Policyfile.rb +++ b/test/fixtures/cookbooks/shared/Policyfile.rb @@ -3,5 +3,7 @@ run_list 'shared::default' # default_source :chef_repo, './../../../../' +default_source :chef_repo, './../' -cookbook 'jlenv', path: './../../../../' \ No newline at end of file +cookbook 'shared' +cookbook 'jlenv', path: './../../../../' diff --git a/test/spec/recipes/default_spec.rb b/test/spec/recipes/default_spec.rb index 323bc742..2aa77593 100644 --- a/test/spec/recipes/default_spec.rb +++ b/test/spec/recipes/default_spec.rb @@ -1,4 +1,4 @@ -require_relative '../spec_helper' +require_relative '../recipes_spec_helper' describe 'jlenv::default' do diff --git a/test/spec/recipes/system_install_spec.rb b/test/spec/recipes/system_install_spec.rb index 93a3d6d2..ebba144d 100644 --- a/test/spec/recipes/system_install_spec.rb +++ b/test/spec/recipes/system_install_spec.rb @@ -1,8 +1,8 @@ -require_relative '../spec_helper' +require_relative '../recipes_spec_helper' -describe 'test::system_install' do - let(:chef_run) do - ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe) +describe 'recipes::system_install' do + let(:chef_run) do + ChefSpec::SoloRunner.new.converge(described_recipe) end it 'converges successfully' do diff --git a/test/spec/spec_helper.rb b/test/spec/recipes_spec_helper.rb similarity index 66% rename from test/spec/spec_helper.rb rename to test/spec/recipes_spec_helper.rb index 55e12ddc..68b16ec8 100644 --- a/test/spec/spec_helper.rb +++ b/test/spec/recipes_spec_helper.rb @@ -7,4 +7,5 @@ end config.platform = 'ubuntu' config.version = '18.04' + config.policyfile_path = File.join(Dir.pwd, 'test', 'fixtures', 'cookbooks', 'recipes', 'Policyfile.rb') end diff --git a/test/spec/resources/plugin_spec.rb b/test/spec/resources/plugin_spec.rb new file mode 100644 index 00000000..3de69ba3 --- /dev/null +++ b/test/spec/resources/plugin_spec.rb @@ -0,0 +1,9 @@ +require_relative '../resources_spec_helper' + +describe 'resources::plugin' do + let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } + + it 'converges successfully' do + expect { chef_run }.to_not raise_error + end +end diff --git a/test/spec/recipes/user_install_spec.rb b/test/spec/resources/user_install_spec.rb similarity index 57% rename from test/spec/recipes/user_install_spec.rb rename to test/spec/resources/user_install_spec.rb index 3cc46265..9356b64f 100644 --- a/test/spec/recipes/user_install_spec.rb +++ b/test/spec/resources/user_install_spec.rb @@ -1,8 +1,7 @@ -require_relative '../spec_helper' +require_relative '../resources_spec_helper' -describe 'test::user_install' do +describe 'resources::user_install' do let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) } - let(:git) { chef_run.git('/home/vagrant/.jlenv') } it 'converges successfully' do expect { chef_run }.to_not raise_error diff --git a/test/spec/resources_spec_helper.rb b/test/spec/resources_spec_helper.rb new file mode 100644 index 00000000..6225e04b --- /dev/null +++ b/test/spec/resources_spec_helper.rb @@ -0,0 +1,11 @@ +require 'chefspec' +require 'chefspec/policyfile' + +RSpec.configure do |config| + config.mock_with :rspec do |mocks| + mocks.syntax = :expect + end + config.platform = 'ubuntu' + config.version = '18.04' + config.policyfile_path = File.join(Dir.pwd, 'test', 'fixtures', 'cookbooks', 'resources', 'Policyfile.rb') +end From 26928f6ad22b7e1a1b91e75b7f3a2027b3dbd5b5 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 13 Sep 2019 17:03:44 +1000 Subject: [PATCH 098/105] Fix mdlint errors. --- libraries/lib/chef/provider/git_ext.rb | 59 +++++++++++++++++++++ test/fixtures/cookbooks/issues/README.md | 8 +-- test/fixtures/cookbooks/recipes/README.md | 4 +- test/fixtures/cookbooks/resources/README.md | 8 +-- 4 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 libraries/lib/chef/provider/git_ext.rb diff --git a/libraries/lib/chef/provider/git_ext.rb b/libraries/lib/chef/provider/git_ext.rb new file mode 100644 index 00000000..7a59fa8b --- /dev/null +++ b/libraries/lib/chef/provider/git_ext.rb @@ -0,0 +1,59 @@ +# git_ext.rb + +module GitExt + def self.prepended(base) + base.singleton_class.prepend(ClassMethods) + end + + # module ClassMethods + # def remote_resolve_reference(ref) + # super || JSON.parse(obj_or_json_string) rescue nil + # end + # end + + # Resolve SHA values given references such as, (ordered): + # 1. tags first: "refs/tags/" + # 2. then heads: "refs/heads/" + # 3. then revisions: "refs/pulls/v1.0" + # spec tests: + # 1. v1.0^{} i.e. converts from an annotated tag to the tagged SHA (not SHA of tag) + # 2. v1.0 + # 3. v1.0 returns refs/tags/v1.0 before refs/tags/releases/v1.0 + # 4. refs/heads/v1.0 is accepted, etc + # 5. "origin/" raises Chef::Exceptions::InvalidRemoteGitReference + # 6. "junk" raises Chef::Exceptions::UnresolvableGitReference + # 7. "" Returns HEAD SHA + # + # bash implmentation logic: + # git_ref_type() { + # [ -n "$1" ] || die "Missing ref name" + # if git show-ref -q --verify "refs/tags/$1" 2>/dev/null; then + # echo "tag" + # elif git show-ref -q --verify "refs/heads/$1" 2>/dev/null; then + # echo "branch" + # elif git show-ref -q --verify "refs/pulls/$1" 2>/dev/null; then + # echo "revision" + # elif git show-ref -q --verify "refs/remote/$1" 2>/dev/null; then + # echo "remote" + # elif git rev-parse --verify "$1^{commit}" >/dev/null 2>&1; then + # echo "hash" + # else + # echo "unknown" + # fi + # return 0 + # } + + def remote_resolve_reference(reference) + case strip(reference) + when '' + git_head_ref + when /^a/ + else + end + end + def git_ls_remote(rev_pattern) + git("ls-remote", "\"#{new_resource.repository}\"", "\"#{rev_pattern}\"").stdout + end +end + +Chef::Provider::Git.prepend(GitExt) diff --git a/test/fixtures/cookbooks/issues/README.md b/test/fixtures/cookbooks/issues/README.md index d83f1c81..cc01991f 100644 --- a/test/fixtures/cookbooks/issues/README.md +++ b/test/fixtures/cookbooks/issues/README.md @@ -1,6 +1,6 @@ # Issues Integration Cookbook -The Resources cookbook exercise resource default behaviour. -The Recipes cookbook exercise resource non-default behaviour. -The Issues cookbook exercise past broken or incorrect behaviour -- regression tests. +The **Resources cookbook** exercise resource default behaviour. +The **Recipes cookbook** exercise resource non-default behaviour. +The **Issues cookbook** exercise past broken or incorrect behaviour i.e. +regression tests. diff --git a/test/fixtures/cookbooks/recipes/README.md b/test/fixtures/cookbooks/recipes/README.md index 363905c9..f8124679 100644 --- a/test/fixtures/cookbooks/recipes/README.md +++ b/test/fixtures/cookbooks/recipes/README.md @@ -2,5 +2,5 @@ The **Resources cookbook** exercise resource default behaviour. The **Recipes cookbook** exercise resource non-default behaviour. -The **Issues cookbook** exercise past broken or incorrect behaviour -- regression tests. +The **Issues cookbook** exercise past broken or incorrect behaviour i.e. +regression tests. diff --git a/test/fixtures/cookbooks/resources/README.md b/test/fixtures/cookbooks/resources/README.md index 6811e4e5..ecb0979e 100644 --- a/test/fixtures/cookbooks/resources/README.md +++ b/test/fixtures/cookbooks/resources/README.md @@ -1,6 +1,6 @@ # Resources Integration Cookbook -The Resources cookbook exercise resource default behaviour. -The Recipes cookbook exercise resource non-default behaviour. -The Issues cookbook exercise past broken or incorrect behaviour -- regression tests. +The **Resources cookbook** exercise resource default behaviour. +The **Recipes cookbook** exercise resource non-default behaviour. +The **Issues cookbook** exercise past broken or incorrect behaviour i.e. +regression tests. From b8a840bbecaad0b8fa95d39cea37914f2750c5af Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 13 Sep 2019 17:21:42 +1000 Subject: [PATCH 099/105] Refine kitchen test instances --- .circleci/config.yml | 51 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index eeb662b5..dd81046e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,33 +28,34 @@ workflows: name: global requires: [mdlint, yamllint] # requires: [mdlint, yamllint, ignite] - - kitchen/dokken-single: - suite: global-opensuse-leap - name: global-opensuse-leap - requires: [mdlint, yamllint] + # Kitchen/dokken-single runs a single Instance + # - kitchen/dokken-single: + # suite: global-opensuse-leap + # name: global-opensuse-leap + # requires: [mdlint, yamllint] + # requires: [mdlint, yamllint, danger] + # - kitchen/dokken-single: + # name: system-install-centos-7 + # suite: system-install-centos-7 + # requires: [mdlint, yamllint] # requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - name: system-install-centos-7 - suite: system-install-centos-7 - requires: [mdlint, yamllint] + # - kitchen/dokken-single: + # name: user-install-centos-7 + # suite: user-install-centos-7 + # requires: [mdlint, yamllint] # requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - name: user-install-centos-7 - suite: user-install-centos-7 - requires: [mdlint, yamllint] + # - kitchen/dokken-single: + # name: pkg-centos-7 + # suite: pkg-centos-7 + # requires: [mdlint, yamllint] # requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - name: pkg-centos-7 - suite: pkg-centos-7 - requires: [mdlint, yamllint] + # - kitchen/dokken-single: + # name: julia-uninstall-ubuntu-1804 + # suite: julia-uninstall-ubuntu-1804 + # requires: [mdlint, yamllint] # requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - name: julia-uninstall-ubuntu-1804 - suite: julia-uninstall-ubuntu-1804 - requires: [mdlint, yamllint] - # requires: [mdlint, yamllint, danger] - - kitchen/dokken-single: - name: custom-group - suite: custom-group-install-centos-7 - requires: [mdlint, yamllint] + # - kitchen/dokken-single: + # name: custom-group + # suite: custom-group-install-centos-7 + # requires: [mdlint, yamllint] # requires: [mdlint, yamllint, danger] From 2fb6470e3dbae83862677992ba5eddcd7d722fad Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 18 Sep 2019 20:49:11 +1000 Subject: [PATCH 100/105] Monkey-patch Chef Git Resource - Run in no-tty environments. - Validate reference formats - Validate reference hash value - Clone then validate reference --- libraries/helpers.rb | 13 ++- libraries/lib/chef/provider/git_ext.rb | 129 ++++++++++++++++++++++--- recipes/default.rb | 1 + resources/plugin.rb | 11 ++- resources/system_install.rb | 4 +- resources/user_install.rb | 1 + 6 files changed, 138 insertions(+), 21 deletions(-) diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 56f3eb4d..0cdc272a 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -20,6 +20,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +require_relative 'lib/chef/provider/git_ext' class Chef module Jlenv @@ -85,7 +86,17 @@ def package_prerequisites when 'rhel', 'fedora', 'amazon' %w(git grep tar) when 'debian', 'suse' - %w(git grep) + case node['platform'] + when 'ubuntu' + case node['platform_version'] + when '18.04' + %w(git grep) + else + %w(git grep) + end + else + %w(git grep) + end when 'mac_os_x', 'gentoo' %w(git) when 'freebsd' diff --git a/libraries/lib/chef/provider/git_ext.rb b/libraries/lib/chef/provider/git_ext.rb index 7a59fa8b..f902a060 100644 --- a/libraries/lib/chef/provider/git_ext.rb +++ b/libraries/lib/chef/provider/git_ext.rb @@ -1,15 +1,15 @@ -# git_ext.rb +# +# https://blog.daveallie.com/clean-monkey-patching/ module GitExt + def self.prepended(base) base.singleton_class.prepend(ClassMethods) end - # module ClassMethods - # def remote_resolve_reference(ref) - # super || JSON.parse(obj_or_json_string) rescue nil - # end - # end + module ClassMethods + # Placeholder + end # Resolve SHA values given references such as, (ordered): # 1. tags first: "refs/tags/" @@ -33,7 +33,7 @@ def self.prepended(base) # echo "branch" # elif git show-ref -q --verify "refs/pulls/$1" 2>/dev/null; then # echo "revision" - # elif git show-ref -q --verify "refs/remote/$1" 2>/dev/null; then + # elif git show-ref -q --verify "refs/remote/$1" 2>/dev/null; then # echo "remote" # elif git rev-parse --verify "$1^{commit}" >/dev/null 2>&1; then # echo "hash" @@ -43,17 +43,116 @@ def self.prepended(base) # return 0 # } - def remote_resolve_reference(reference) - case strip(reference) - when '' - git_head_ref - when /^a/ - else + def find_current_revision + logger.trace("#{new_resource} finding current git revision") + if ::File.exist?(::File.join(cwd, ".git")) + # 128 is returned when not in a git repo - no problem. + result = git("rev-parse", "HEAD", + cwd: cwd, + returns: [0, 128], + live_stdout: StringIO.new, + live_stderr: StringIO.new, + live_stream: StringIO.new + ).live_stdout.string.strip end + sha_hash?(result) ? result : nil end - def git_ls_remote(rev_pattern) - git("ls-remote", "\"#{new_resource.repository}\"", "\"#{rev_pattern}\"").stdout + + def clone + Chef::Log.warn "#{new_resource} before super existing_git_clone? is '#{existing_git_clone?}'" + Chef::Log.warn "#{new_resource} before super cwd is '#{cwd}'" + converge_by("clone from #{repo_url} into #{cwd}") do + remote = new_resource.remote + + clone_cmd = ["clone"] + clone_cmd << "-o #{remote}" unless remote == "origin" + clone_cmd << "--depth #{new_resource.depth}" if new_resource.depth + clone_cmd << "--no-single-branch" if new_resource.depth && git_has_single_branch_option? + clone_cmd << "\"#{new_resource.repository}\"" + clone_cmd << "\"#{cwd}\"" + + logger.info "#{new_resource} cloning repo #{repo_url} to #{cwd}" + git(clone_cmd, returns: [0, 128]) + end + Chef::Log.warn "#{new_resource} after clone existing_git_clone? is '#{existing_git_clone?}'" + Chef::Log.warn "#{new_resource} after clone cwd is '#{cwd}'" + target_revision + Chef::Log.warn "#{new_resource.revision} after clone is '#{@target_revision}'" + @target_revision end + + def target_revision + return '' unless existing_git_clone? + @target_revision ||= + begin + if sha_hash?(new_resource.revision) + @target_revision = new_resource.revision + else + Chef::Log.warn "#{new_resource} resolving reference" + Chef::Log.warn "#{new_resource} cwd is '#{cwd}'" + Chef::Log.warn "#{new_resource} existing_git_clone? is '#{existing_git_clone?}'" + @target_revision = local_resolve_reference + end + end + end + + def local_resolve_reference + Chef::Log.warn "#{new_resource} resolving remote reference" + @resolved_reference = git_ref(rev_search_pattern) + @resolved_reference + end + + def rev_search_pattern + if ["", "HEAD"].include? new_resource.revision + "HEAD" + else + new_resource.revision + end + end + + def git_ref(reference) + # Raise an error if not valid reference format.... + valid = git_ref_format_valid?(reference) + hash = '' + %w[refs/heads refs/tags packed-refs].each do |prefix| + # 128 is returned when not in a git repo - no problem. + hash = git('show-ref', '--verify', "\"#{prefix}/#{reference}\"", + cwd: cwd, + returns: [0, 128], + live_stdout: StringIO.new, + live_stderr: StringIO.new, + live_stream: StringIO.new + ) + puts hash.inspect + puts "="*80 + puts hash.live_stdout.string + break if hash.exitstatus == 0 + puts hash.exitstatus.inspect + end + # This avoids stdout which is not available where no /dev/tty + ref = hash.exitstatus == 0 ? hash.live_stdout.string : '' + puts "+"*80 + puts ref.inspect + puts "~"*80 + puts hash.live_stderr.string + ref.chomp.split(' ').first + end + + def git_ref_format_valid?(reference) + valid = false + result = git('check-ref-format', '--allow-onelevel', reference, returns: [0, 1]) + if result.exitstatus + valid = true + else + git('check-ref-format', reference).exit_status ? valid = true : valid = false + end + unless valid + # For invalid reference formats git cannot return a revision + raise Chef::Exceptions::User, "The given reference '#{reference}' is not a valid Git reference format." + end + valid + end + end Chef::Provider::Git.prepend(GitExt) diff --git a/recipes/default.rb b/recipes/default.rb index e69de29b..5e75480f 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -0,0 +1 @@ +require_relative './../libraries/lib/chef/provider/git_ext' \ No newline at end of file diff --git a/resources/plugin.rb b/resources/plugin.rb index 0e135133..be42c234 100644 --- a/resources/plugin.rb +++ b/resources/plugin.rb @@ -20,13 +20,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # + +# Install a plugin to either user or system jlenv. provides :jlenv_plugin -property :git_url, String, default: 'https://github.com/jlenv/jlenv-build.git' +property :git_url, String, default: 'https://github.com/jlenv/julia-build.git' property :git_ref, String, default: 'master' +property :plugin, String, name_property: true property :user, String +property :update_jlenv, [true, false], default: true -# https://github.com/jlenv/jlenv/wiki/Plugins +# TODO: +# redirect https://github.com/jlenv/jlenv/wiki/Plugins to github pages action :install do # If we pass in a username, we then to a plugin install to the users home_dir # See chef_jlenv_script_helpers.rb for root_path @@ -35,7 +40,7 @@ repository new_resource.git_url reference new_resource.git_ref user new_resource.user if new_resource.user - action :checkout + action :checkout if new_resource.update_jlenv == false end end diff --git a/resources/system_install.rb b/resources/system_install.rb index 3a34edf0..6546712d 100644 --- a/resources/system_install.rb +++ b/resources/system_install.rb @@ -28,7 +28,7 @@ property :git_ref, String, default: 'master' property :git_username, String, default: 'root' property :global_prefix, String, default: '/usr/local/jlenv' -property :update_jlenv, [true, false], default: true +property :update_jlenv, [true, false], default: true action :install do node.run_state['root_path'] ||= {} @@ -53,7 +53,7 @@ repository new_resource.git_url reference new_resource.git_ref action :checkout if new_resource.update_jlenv == false - notifies :run, 'bash[Initialize global git username]', :immediately + #notifies :run, 'bash[Initialize global git username]', :immediately notifies :run, 'ruby_block[Add jlenv to PATH]', :immediately notifies :run, 'bash[Initialize system jlenv]', :immediately end diff --git a/resources/user_install.rb b/resources/user_install.rb index 9eb99249..9e58c109 100644 --- a/resources/user_install.rb +++ b/resources/user_install.rb @@ -33,6 +33,7 @@ property :update_jlenv, [true, false], default: true action :install do + package package_prerequisites node.run_state['root_path'] ||= {} From d87c7fb12733e4eebc773c3b23a33b6dbb37d372 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 18 Sep 2019 20:49:51 +1000 Subject: [PATCH 101/105] Add Amazonlinux --- .kitchen.yml | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index db40d684..4a217c4d 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -22,7 +22,7 @@ platforms: pid_one_command: /sbin/init intermediate_instructions: - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + # - RUN /usr/bin/apt-get upgrade -y - name: debian-9 driver: @@ -30,7 +30,7 @@ platforms: pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + # - RUN /usr/bin/apt-get upgrade -y - name: centos-6 driver: @@ -45,6 +45,20 @@ platforms: pid_one_command: /usr/lib/systemd/systemd intermediate_instructions: - RUN yum -y install sudo + - + name: amazonlinux + driver: + image: dokken/amazonlinux + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN yum -y install sudo + - + name: amazonlinux-2 + driver: + image: dokken/amazonlinux-2 + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + - RUN yum -y install sudo - name: fedora-latest driver: @@ -59,15 +73,15 @@ platforms: pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + # - RUN /usr/bin/apt-get upgrade -y - name: ubuntu-18.04 driver: - image: dokken/ubuntu-18.04 + image: taqtiqa/dokken-images:ubuntu-18.04-latest pid_one_command: /bin/systemd intermediate_instructions: - RUN /usr/bin/apt-get update - - RUN /usr/bin/apt-get install sudo -y + # - RUN /usr/bin/apt-get upgrade -y - name: opensuse-leap driver: @@ -95,16 +109,16 @@ suites: verifier: inspec_tests: - test/integration/issues - - name: system_install - provisioner: - policyfile: test/fixtures/cookbooks/resources/system_install.pf.rb - verifier: - inspec_tests: - - test/integration/resources/system_install - - name: global - provisioner: - policyfile: test/fixtures/cookbooks/resources/global.pf.rb - verifier: - inspec_tests: - - test/integration/resources/global - attributes: + # - name: system_install + # provisioner: + # policyfile: test/fixtures/cookbooks/resources/system_install.pf.rb + # verifier: + # inspec_tests: + # - test/integration/resources/system_install + # - name: global + # provisioner: + # policyfile: test/fixtures/cookbooks/resources/global.pf.rb + # verifier: + # inspec_tests: + # - test/integration/resources/global + # attributes: From 71d8272f8369d95deaf58a6436f982158ce86d8d Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Wed, 18 Sep 2019 21:00:20 +1000 Subject: [PATCH 102/105] Inspec control skeleton for resources recipes. --- test/integration/resources/global/inspec.yml | 4 +++- test/integration/resources/inspec.yml | 15 +++++++++++++++ .../integration/resources/julia/controls/julia.rb | 12 ++++++++++++ test/integration/resources/julia/inspec.yml | 10 ++++++++++ .../resources/plugin/controls/plugin.rb | 12 ++++++++++++ test/integration/resources/plugin/inspec.yml | 10 ++++++++++ .../resources/rehash/controls/rehash.rb | 12 ++++++++++++ test/integration/resources/rehash/inspec.yml | 10 ++++++++++ .../resources/script/controls/script.rb | 12 ++++++++++++ test/integration/resources/script/inspec.yml | 10 ++++++++++ 10 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 test/integration/resources/inspec.yml create mode 100644 test/integration/resources/julia/controls/julia.rb create mode 100644 test/integration/resources/julia/inspec.yml create mode 100644 test/integration/resources/plugin/controls/plugin.rb create mode 100644 test/integration/resources/plugin/inspec.yml create mode 100644 test/integration/resources/rehash/controls/rehash.rb create mode 100644 test/integration/resources/rehash/inspec.yml create mode 100644 test/integration/resources/script/controls/script.rb create mode 100644 test/integration/resources/script/inspec.yml diff --git a/test/integration/resources/global/inspec.yml b/test/integration/resources/global/inspec.yml index f8534154..eedad067 100644 --- a/test/integration/resources/global/inspec.yml +++ b/test/integration/resources/global/inspec.yml @@ -3,8 +3,10 @@ name: jlenv title: jlenv profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC +copyright_email: admin@taqtiqa.com license: Apache-2.0 summary: Verifies jlenv correctly sets the global Julia version. -version: 1.0.0 +version: 0.1.0 +inspec_version: "~> 2.1" supports: - os-family: linux diff --git a/test/integration/resources/inspec.yml b/test/integration/resources/inspec.yml new file mode 100644 index 00000000..172d5b19 --- /dev/null +++ b/test/integration/resources/inspec.yml @@ -0,0 +1,15 @@ +--- +name: jlenv +title: jlenv profile +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC +copyright_email: admin@taqtiqa.com +license: Apache-2.0 +summary: Verifies jlenv correctly sets the global Julia version. +version: 0.1.0 +inspec_version: "~> 2.1" +supports: + - os-family: linux +depends: + - name: global + path: ../global diff --git a/test/integration/resources/julia/controls/julia.rb b/test/integration/resources/julia/controls/julia.rb new file mode 100644 index 00000000..493c8516 --- /dev/null +++ b/test/integration/resources/julia/controls/julia.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +title 'Jlenv System Install Resource' + +control 'Jlenv system install' do + title 'Jlenv should be installed system wide' + + desc 'Jlenv should be installed and run successfully' + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do + its('exit_status') { should eq 0 } + end +end diff --git a/test/integration/resources/julia/inspec.yml b/test/integration/resources/julia/inspec.yml new file mode 100644 index 00000000..79dcff31 --- /dev/null +++ b/test/integration/resources/julia/inspec.yml @@ -0,0 +1,10 @@ +--- +name: jlenv +title: jlenv profile +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC +license: Apache-2.0 +summary: Verifies jlenv is installed correctly system wide. +version: 0.1.0 +supports: + - os-family: linux diff --git a/test/integration/resources/plugin/controls/plugin.rb b/test/integration/resources/plugin/controls/plugin.rb new file mode 100644 index 00000000..493c8516 --- /dev/null +++ b/test/integration/resources/plugin/controls/plugin.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +title 'Jlenv System Install Resource' + +control 'Jlenv system install' do + title 'Jlenv should be installed system wide' + + desc 'Jlenv should be installed and run successfully' + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do + its('exit_status') { should eq 0 } + end +end diff --git a/test/integration/resources/plugin/inspec.yml b/test/integration/resources/plugin/inspec.yml new file mode 100644 index 00000000..79dcff31 --- /dev/null +++ b/test/integration/resources/plugin/inspec.yml @@ -0,0 +1,10 @@ +--- +name: jlenv +title: jlenv profile +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC +license: Apache-2.0 +summary: Verifies jlenv is installed correctly system wide. +version: 0.1.0 +supports: + - os-family: linux diff --git a/test/integration/resources/rehash/controls/rehash.rb b/test/integration/resources/rehash/controls/rehash.rb new file mode 100644 index 00000000..493c8516 --- /dev/null +++ b/test/integration/resources/rehash/controls/rehash.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +title 'Jlenv System Install Resource' + +control 'Jlenv system install' do + title 'Jlenv should be installed system wide' + + desc 'Jlenv should be installed and run successfully' + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do + its('exit_status') { should eq 0 } + end +end diff --git a/test/integration/resources/rehash/inspec.yml b/test/integration/resources/rehash/inspec.yml new file mode 100644 index 00000000..79dcff31 --- /dev/null +++ b/test/integration/resources/rehash/inspec.yml @@ -0,0 +1,10 @@ +--- +name: jlenv +title: jlenv profile +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC +license: Apache-2.0 +summary: Verifies jlenv is installed correctly system wide. +version: 0.1.0 +supports: + - os-family: linux diff --git a/test/integration/resources/script/controls/script.rb b/test/integration/resources/script/controls/script.rb new file mode 100644 index 00000000..493c8516 --- /dev/null +++ b/test/integration/resources/script/controls/script.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +title 'Jlenv System Install Resource' + +control 'Jlenv system install' do + title 'Jlenv should be installed system wide' + + desc 'Jlenv should be installed and run successfully' + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do + its('exit_status') { should eq 0 } + end +end diff --git a/test/integration/resources/script/inspec.yml b/test/integration/resources/script/inspec.yml new file mode 100644 index 00000000..79dcff31 --- /dev/null +++ b/test/integration/resources/script/inspec.yml @@ -0,0 +1,10 @@ +--- +name: jlenv +title: jlenv profile +maintainer: Taqtiqa LLC +copyright: Taqtiqa LLC +license: Apache-2.0 +summary: Verifies jlenv is installed correctly system wide. +version: 0.1.0 +supports: + - os-family: linux From b9e820921fd846c964a5793b20fd64d53ce24f54 Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Thu, 19 Sep 2019 07:39:11 +1000 Subject: [PATCH 103/105] Add InSpec control references --- test/integration/resources/inspec.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/integration/resources/inspec.yml b/test/integration/resources/inspec.yml index 172d5b19..0f3b4247 100644 --- a/test/integration/resources/inspec.yml +++ b/test/integration/resources/inspec.yml @@ -7,9 +7,13 @@ copyright_email: admin@taqtiqa.com license: Apache-2.0 summary: Verifies jlenv correctly sets the global Julia version. version: 0.1.0 -inspec_version: "~> 2.1" +inspec_version: "~> 3.0" supports: - os-family: linux depends: - name: global - path: ../global + path: ./test/integration/resources/global + - name: system_install + path: ./test/integration/resources/system_install + - name: user_install + path: ./test/integration/resources/user_install From a5d6651e46614134db6aeb00fc062acfe5247c8b Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Fri, 20 Sep 2019 11:11:05 +1000 Subject: [PATCH 104/105] InSpec controls around system_install user_install and plugin default behavior. --- .../resources/recipes/user_install.rb | 8 ++- .../resources/controls/cookbook.rb | 6 ++ test/integration/resources/global/inspec.yml | 4 +- test/integration/resources/inspec.yml | 10 ++- test/integration/resources/julia/inspec.yml | 4 +- .../resources/julia_uninstall/inspec.yml | 4 +- .../resources/plugin/controls/plugin.rb | 15 +++-- test/integration/resources/plugin/inspec.yml | 4 +- test/integration/resources/rehash/inspec.yml | 4 +- test/integration/resources/script/inspec.yml | 4 +- .../system_install/controls/system_install.rb | 13 ++++ .../resources/system_install/inspec.yml | 4 +- .../user_install/controls/user_install.rb | 67 +++++++++++-------- .../resources/user_install/files/users.yml | 13 ++++ .../resources/user_install/inspec.yml | 4 +- 15 files changed, 108 insertions(+), 56 deletions(-) create mode 100644 test/integration/resources/controls/cookbook.rb create mode 100644 test/integration/resources/user_install/files/users.yml diff --git a/test/fixtures/cookbooks/resources/recipes/user_install.rb b/test/fixtures/cookbooks/resources/recipes/user_install.rb index 1f9e194e..7debf8a9 100644 --- a/test/fixtures/cookbooks/resources/recipes/user_install.rb +++ b/test/fixtures/cookbooks/resources/recipes/user_install.rb @@ -1,5 +1,4 @@ - -# Install jlenv and makes it avilable to the selected user +# Install jlenv and make it avilable to the selected user # Ensure test setup include_recipe 'shared::default' @@ -7,5 +6,10 @@ # Keeps the jlenv install upto date jlenv_user_install 'vagrant' +# Issue: https://github.com/jlenv/jlenv-cookbook/issues/2 +# +# User installs are independent. +#jlenv_user_install 'jovyan' + # User installs are idempotent. jlenv_user_install 'vagrant' diff --git a/test/integration/resources/controls/cookbook.rb b/test/integration/resources/controls/cookbook.rb new file mode 100644 index 00000000..cdec502b --- /dev/null +++ b/test/integration/resources/controls/cookbook.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +title 'Jlenv Resource Cookbook' + +include_controls 'system_install' +include_controls 'user_install' diff --git a/test/integration/resources/global/inspec.yml b/test/integration/resources/global/inspec.yml index eedad067..83edebb3 100644 --- a/test/integration/resources/global/inspec.yml +++ b/test/integration/resources/global/inspec.yml @@ -1,11 +1,11 @@ --- name: jlenv -title: jlenv profile +title: jlenv global resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC copyright_email: admin@taqtiqa.com license: Apache-2.0 -summary: Verifies jlenv correctly sets the global Julia version. +summary: Verifies jlenv global resource correctly functions with defaults. version: 0.1.0 inspec_version: "~> 2.1" supports: diff --git a/test/integration/resources/inspec.yml b/test/integration/resources/inspec.yml index 0f3b4247..de1a2e0a 100644 --- a/test/integration/resources/inspec.yml +++ b/test/integration/resources/inspec.yml @@ -1,19 +1,17 @@ --- name: jlenv -title: jlenv profile +title: jlenv resource defaults wrapper profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC copyright_email: admin@taqtiqa.com license: Apache-2.0 -summary: Verifies jlenv correctly sets the global Julia version. +summary: Verifies jlenv resources correctly functions with defaults. version: 0.1.0 inspec_version: "~> 3.0" supports: - os-family: linux depends: - - name: global - path: ./test/integration/resources/global - name: system_install - path: ./test/integration/resources/system_install + path: test/integration/resources/system_install - name: user_install - path: ./test/integration/resources/user_install + path: test/integration/resources/user_install diff --git a/test/integration/resources/julia/inspec.yml b/test/integration/resources/julia/inspec.yml index 79dcff31..7115a526 100644 --- a/test/integration/resources/julia/inspec.yml +++ b/test/integration/resources/julia/inspec.yml @@ -1,10 +1,10 @@ --- name: jlenv -title: jlenv profile +title: jlenv julia resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly system wide. +summary: Verifies jlenv julia resource correctly functions with defaults. version: 0.1.0 supports: - os-family: linux diff --git a/test/integration/resources/julia_uninstall/inspec.yml b/test/integration/resources/julia_uninstall/inspec.yml index 1cd2f1a7..d50bd803 100644 --- a/test/integration/resources/julia_uninstall/inspec.yml +++ b/test/integration/resources/julia_uninstall/inspec.yml @@ -1,9 +1,9 @@ --- name: jlenv -title: jlenv profile +title: jlenv julia_uninstall resourse profile maintainer: Taqtiqa LLC license: Apache-2.0 -summary: Verify that Julias can be uninstalled +summary: Verifies jlenv julia_uninstall resource correctly functions with defaults. version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/resources/plugin/controls/plugin.rb b/test/integration/resources/plugin/controls/plugin.rb index 493c8516..b81b4a19 100644 --- a/test/integration/resources/plugin/controls/plugin.rb +++ b/test/integration/resources/plugin/controls/plugin.rb @@ -1,12 +1,19 @@ # frozen_string_literal: true -title 'Jlenv System Install Resource' - -control 'Jlenv system install' do - title 'Jlenv should be installed system wide' +title 'Jlenv Plugin Resource Defaults' +control 'julia-build plugin should be installed' do + title 'julia-build should be installed to the users home directory' + desc 'Jlenv should be installed and run successfully' describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do its('exit_status') { should eq 0 } end + + desc 'Julia build versions available can now be listed.' + describe bash("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv install -l'") do + its('exit_status') { should eq 0 } + its('stdout') { should include(user_julia_version) } + its('stderr') { should eq '' } + end end diff --git a/test/integration/resources/plugin/inspec.yml b/test/integration/resources/plugin/inspec.yml index 79dcff31..e0646d36 100644 --- a/test/integration/resources/plugin/inspec.yml +++ b/test/integration/resources/plugin/inspec.yml @@ -1,10 +1,10 @@ --- name: jlenv -title: jlenv profile +title: jlenv plugin resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly system wide. +summary: Verifies jlenv plugin resource correctly functions with defaults. version: 0.1.0 supports: - os-family: linux diff --git a/test/integration/resources/rehash/inspec.yml b/test/integration/resources/rehash/inspec.yml index 79dcff31..cb329b04 100644 --- a/test/integration/resources/rehash/inspec.yml +++ b/test/integration/resources/rehash/inspec.yml @@ -1,10 +1,10 @@ --- name: jlenv -title: jlenv profile +title: jlenv rehash resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly system wide. +summary: Verifies jlenv rehash resource is installed correctly system wide. version: 0.1.0 supports: - os-family: linux diff --git a/test/integration/resources/script/inspec.yml b/test/integration/resources/script/inspec.yml index 79dcff31..38c60a5e 100644 --- a/test/integration/resources/script/inspec.yml +++ b/test/integration/resources/script/inspec.yml @@ -1,10 +1,10 @@ --- name: jlenv -title: jlenv profile +title: jlenv script resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly system wide. +summary: Verifies jlenv script resource correctly functions with defaults. version: 0.1.0 supports: - os-family: linux diff --git a/test/integration/resources/system_install/controls/system_install.rb b/test/integration/resources/system_install/controls/system_install.rb index 0bd0f9d5..e9911616 100644 --- a/test/integration/resources/system_install/controls/system_install.rb +++ b/test/integration/resources/system_install/controls/system_install.rb @@ -18,4 +18,17 @@ it { should exist } it { should be_directory } end + + # Issue: https://github.com/jlenv/jlenv-cookbook/issues/3 + # Issue: https://github.com/jlenv/jlenv-cookbook/issues/4 + # + describe file('/etc/profile.d/jlenv.sh') do + its('type') { should be_file } + its('group') { should eq 'root' } + its('owner') { should eq 'root' } + its('mode') { should cmp '0755' } + it { should be_executable.by('others') } + it { should_not be_writable.by('others') } + end + end diff --git a/test/integration/resources/system_install/inspec.yml b/test/integration/resources/system_install/inspec.yml index f0eda0d6..5af94de4 100644 --- a/test/integration/resources/system_install/inspec.yml +++ b/test/integration/resources/system_install/inspec.yml @@ -1,10 +1,10 @@ --- name: jlenv -title: jlenv profile +title: jlenv system resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly system wide. +summary: Verifies jlenv system_install resource correctly functions with defaults. version: 1.0.0 supports: - os-family: linux diff --git a/test/integration/resources/user_install/controls/user_install.rb b/test/integration/resources/user_install/controls/user_install.rb index 3527c4ac..af6e743f 100644 --- a/test/integration/resources/user_install/controls/user_install.rb +++ b/test/integration/resources/user_install/controls/user_install.rb @@ -2,40 +2,46 @@ title 'Jlenv User Install Resource' +# Default user in resources is jovyan i.e. Jupyter assumption +julia_users ||= yaml(content: inspec.profile.file('users.yml'))['users'] +julia_user ||= 'vagrant' +user_julia_version ||= julia_users[julia_user]['version'] + control 'Jlenv should be installed' do impact 0.6 - title 'Jlenv should be installed uner the users home directory.' + title 'Jlenv should be installed under the users home directory.' desc 'Always specify environment variables, folders and permissions.' - desc 'rationale', 'This ensures that there are no unexpected scripts run.' # Requires InSpec >=2.3.4 - tag 'julia','jlenv' + desc 'Rationale:', 'This ensures that there are no unexpected scripts run.' # Requires InSpec >=2.3.4 + tag 'julia', 'jlenv' #ref 'NSA-RH6-STIG - Section 3.5.2.1', url: 'https://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf' - global_julia = '1.0.1' - - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv global"') do + describe bash("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv global'") do its('exit_status') { should eq 0 } - its('stdout') { should include(global_julia) } + its('stdout') { should include('system') } + its('stdout') { should not_include(user_julia_version) } + its('stderr') { should eq '' } end %w(plugins shims versions).each do |d| - describe directory("/home/vagrant/.jlenv/#{d}") do - it { should exist } - it { should be_writable.by_user('vagrant') } + describe directory("/home/#{julia_user}/.jlenv/#{d}") do + its('type') { should be_file } its('mode') { should cmp '0755' } + it { should exist } + it { should be_writable.by_user(julia_user) } end end + # Issue: https://github.com/jlenv/jlenv-cookbook/issues/3 + # Refactor this control to verify the user install script has had no + # (unintended/specified) side effect on the system install (and vice versa). describe file('/etc/profile.d/jlenv.sh') do - its('group') { should eq 'admins' } - its('user') { should eq 'root' } - its('mode') { should cmp '0755' } - it { should_not be_writable.by_user('vagrant') } + it { should_not be_writable.by_user(julia_user) } it { should be_executable.by('others') } - it { should be_executable.by_user('vagrant') } + it { should be_executable.by_user(julia_user) } end it 'checkouts from git with attributes' do - is_expected.to checkout_git('/home/vagrant/.jlenv').with( + is_expected.to checkout_git("/home/#{julia_user}/.jlenv").with( repository: 'https://github.com/jlenv/jlenv.git', reference: 'master' ) @@ -44,25 +50,30 @@ describe os_env('PATH', 'target') do its('split') { should_not include('') } its('split') { should_not include('.') } - its('split') { should include('/home/vagrant/.jlenv/shims') } + its('split') { should include("/home/#{julia_user}/.jlenv/shims") } end end -control 'julia-build plugin should be installed' do - title 'julia-build should be installed to the users home directory' - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv install -l"') do +control 'Global Jlenv' do + title 'Jlenv should be installed globally' + + desc "Can set global Julia version to #{user_julia_version}" + describe bash("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv versions --bare'") do its('exit_status') { should eq 0 } - its('stdout') { should include('2.3.4') } - its('stdout') { should include(global_julia) } + its('stdout') { should include(user_julia_version) } + its('stderr') { should eq '' } end end -control 'Global Julia' do - title 'Jlenv should be installed globally' +jlenv_env_vars = %w( + HOME + JLENV_ROOT + PATH +) - desc "Can set global Julia version to #{global_julia}" - describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/jlenv.sh && jlenv versions --bare"') do - its('exit_status') { should eq 0 } - its('stdout') { should include(global_julia) } +jlenv_env_vars.each do |e| + describe os_env(e) do + its('content') { should_not eq nil } + its('content') { should_not eq '' } end end diff --git a/test/integration/resources/user_install/files/users.yml b/test/integration/resources/user_install/files/users.yml new file mode 100644 index 00000000..f4546a57 --- /dev/null +++ b/test/integration/resources/user_install/files/users.yml @@ -0,0 +1,13 @@ +users: + jovyan: + group: jovyan + version: '1.0.5' + ubuntu: + group: ubuntu + version: '1.2.0' + vagrant: + group: vagrant + version: '1.0.2' + root: + group: root + version: '1.0.0' diff --git a/test/integration/resources/user_install/inspec.yml b/test/integration/resources/user_install/inspec.yml index e2d520af..9dd9ed6f 100644 --- a/test/integration/resources/user_install/inspec.yml +++ b/test/integration/resources/user_install/inspec.yml @@ -1,10 +1,10 @@ --- name: jlenv -title: jlenv profile +title: jlenv julia resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC license: Apache-2.0 -summary: Verifies jlenv is installed correctly for a user. +summary: Verifies jlenv user_install resource correctly functions with defaults. version: 1.0.0 supports: - os-family: linux From 1f3d57f7074f0042cf2f869ccd712b28c7dbfb6d Mon Sep 17 00:00:00 2001 From: Mark Van de Vyver <1335713+taqtiqa-admin@users.noreply.github.com> Date: Thu, 31 Oct 2019 20:02:22 +1100 Subject: [PATCH 105/105] Add intergration specs/tests. --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .markdownlint.yml | 4 + LICENSE.md | 14 + docs/CONDUCT.md | 4 + docs/LICENSE.md | 14 + docs/README.md | 204 +++++++++++++ docs/_config.yml | 19 ++ gh-md-toc | 281 ++++++++++++++++++ libraries/lib/chef/provider/git_ext.rb | 19 -- resources/global.rb | 2 +- templates/jlenv.sh.erb | 6 +- .../resources/controls/cookbook.rb | 2 +- .../global/controls/global_install.rb | 12 - test/integration/resources/global/inspec.yml | 12 - .../system_install/controls/global_install.rb | 148 +++++++++ .../system_install/controls/system_install.rb | 34 --- .../resources/system_install/files/users.yml | 13 + .../resources/system_install/inspec.yml | 8 +- .../user_install/controls/user_install.rb | 81 +++-- 19 files changed, 768 insertions(+), 111 deletions(-) create mode 100644 .markdownlint.yml create mode 100644 LICENSE.md create mode 100644 docs/CONDUCT.md create mode 100644 docs/LICENSE.md create mode 100755 docs/README.md create mode 100644 docs/_config.yml create mode 100755 gh-md-toc delete mode 100644 test/integration/resources/global/controls/global_install.rb delete mode 100644 test/integration/resources/global/inspec.yml create mode 100644 test/integration/resources/system_install/controls/global_install.rb delete mode 100644 test/integration/resources/system_install/controls/system_install.rb create mode 100644 test/integration/resources/system_install/files/users.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index bce1ae57..e3b01f77 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -10,4 +10,4 @@ - [ ] All tests pass. - [ ] New functionality includes testing. -- [ ] New functionality has been documented in the README if applicable \ No newline at end of file +- [ ] New functionality has been documented in the `docs/` folder (if applicable). \ No newline at end of file diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 00000000..f9a89e17 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,4 @@ +{ + "default": true, + "MD003": { "style": "atx" } +} \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..c4673760 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,14 @@ +Copyright 2019 Mark Van de Vyver +Copyright 2019 TAQTIQA LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/docs/CONDUCT.md b/docs/CONDUCT.md new file mode 100644 index 00000000..7cca28f8 --- /dev/null +++ b/docs/CONDUCT.md @@ -0,0 +1,4 @@ +# Requested Contributor Conduct + +In the interest of fostering an excellent code base, we try to encourage anyone +to participate in our project. Please do likewise. diff --git a/docs/LICENSE.md b/docs/LICENSE.md new file mode 100644 index 00000000..c4673760 --- /dev/null +++ b/docs/LICENSE.md @@ -0,0 +1,14 @@ +Copyright 2019 Mark Van de Vyver +Copyright 2019 TAQTIQA LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/docs/README.md b/docs/README.md new file mode 100755 index 00000000..569f3336 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,204 @@ +# Chef Jlenv Cookbook + +[![Cookbook Version](https://img.shields.io/cookbook/v/jlenv-cookbook.svg)](https://supermarket.chef.io/cookbooks/jlenv-cookbook) +[![Build Status](https://img.shields.io/circleci/project/github/jlenv/jlenv-cookbook/master.svg)](https://circleci.com/gh/jlenv/jlenv-cookbook) +[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) +[![CircleCI](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook.svg?style=svg)](https://circleci.com/gh/taqtiqa-mark/jlenv-cookbook) +[![CodeFactor](https://www.codefactor.io/repository/github/jlenv/jlenv-cookbook/badge)](https://www.codefactor.io/repository/github/jlenv/jlenv-cookbook) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/59d2b1d6ca64492cba22fd99517beaec)](https://www.codacy.com/manual/taqtiqa-mark/jlenv-jlenv-cookbook?utm_source=github.com&utm_medium=referral&utm_content=jlenv/jlenv-cookbook&utm_campaign=Badge_Grade) + +## Description + +Manages [jlenv](https://github.com/jlenv/jlenv) installed Julias. + +## Maintainers + +This cookbook is maintained by volunteers. +[All contributions and bug reports are welcome](./CONTRIBUTING). + +## Requirements + +### Chef + +This cookbook requires Chef 13.0+. + +### Platform + +- Debian derivatives (Ubuntu etc.) +- Fedora +- macOS (not currently tested) +- RHEL derivatives (RHEL, CentOS, Amazon Linux, Oracle, Scientific Linux) +- openSUSE and openSUSE leap +- Windows (not supported) + +## Usage + +Example installations are provided in `test/fixtures/cookbooks/test/recipes/`. + +A `jlenv_user_install` is required to be set so that jlenv knows which version +you want to use, and is installed on the system. + +| **NOTE:** | +| System wide installations of jlenv are discouraged by the jlenv maintainer.| +|---| + +However they are supported by this cookbook, see +[these](https://github.com/rbenv/rbenv/issues/38/) +[two](https://github.com/rbenv/rbenv/issues/306/) issues in the rbenv repository +for the reasons why. + +## Package + +Used to install a package into the selected jlenv environment. + +```ruby +jlenv_package 'pkg_name' do + options # Optional: Options for the packagecommand e.g. '--no-rdoc --no-ri' + source # Optional: source URL/location for gem. + timeout # Optional: Pkg install timeout + version # Optional: Pkg version to install + response_file # Optional: response file to reconfigure a gem + jlenv_version # Required: Which jlenv version to install the packageto. + user # Which user to install for. REQUIRED if you're using jlenv_user_install +end +``` + +## Global + +Sets the global Julia version. The name of the resource is the version to set. + +```ruby +jlenv_global '1.1.0' do + user # Optional: Sets the users global version. + # Leave unset, to set the system global version. +end +``` + +If a user is passed in to this resource it sets the global version for the user, +under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the +system global version. + +## Plugin + +Installs a jlenv plugin. + +```ruby +jlenv_plugin 'julia-build' do + git_url # Git URL of the plugin + git_ref # Git reference of the plugin + user # Optional: Install to the users jlenv. + # Do not set, to set installs to the system jlenv. +end +``` + +If user is passed in, the plugin is installed to the users install of jlenv. + +## Rehash + +```ruby +jlenv_rehash 'rehash' do + user 'vagrant' # Optional: Rehash the user jlenv otherwise rehash system jlenv +end +``` + +If user is passed in, the user Julia is rehashed rather than the system Julia. + +## Julia + +Installs a given Julia version to the system or user location. + +```ruby +jlenv_julia '1.1.0' do + user # Optional, but recommended: If passed, the user to install jlenv to + jlenv_action # Optional: Action to perform: + # 'install' (default), 'uninstall' etc. +end +``` + +Shorter example `jlenv_julia '1.1.0'` + +## Script + +Runs a jlenv aware script. + +```ruby +jlenv_script 'foo' do + jlenv_version #jlenv version to run the script against + environment # Optional: Hash of environment variables in the form of + # ({"ENV_VARIABLE" => "VALUE"}). + user # Optional: User to run as + group # Optional: Group to run as + returns # Optional: Expected return code + code # Script code to run +end +``` + +Note that environment overwrites the entire variable. +For example. setting the `$PATH` variable can be done like this: + +```ruby +jlenv_script 'bundle package' do + cwd node["bundle_dir"] + environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"}) + code "bundle package --all" +end +``` + +Where `#{ENV["PATH"]}` appends the existing `PATH` to the end of the newly set +`PATH`. + +## System_install + +Installs jlenv to the system location, by default `/usr/local/jlenv` + +```ruby +jlenv_system_install 'foo' do + git_url # URL of the plugin repo you want to checkout + git_ref # Optional: Git reference to checkout + update_jlenv # Optional: Keeps the git repo up to date +end +``` + +## User_install + +Installs jlenv to the user path, making jlenv available to that user only. + +```ruby +jlenv_user_install 'vagrant' do + git_url # Optional: Git URL to checkout jlenv from. + git_ref # Optional: Git reference to checkout e.g. 'master' + user # Which user to install jlenv to (also given in the resources name above) +end +``` + +## System-Wide macOS Installation Note + +This cookbook takes advantage of managing profile fragments in an +`/etc/profile.d` directory, common on most Unix-flavored platforms. +Unfortunately, macOS does not support this idiom out of the box, so you may +need to [modify][mac_profile_d] your user profile. + +## Development + +- Source hosted at [GitHub](https://github.com/jlenv/jlenv-cookbook/) +- Report Issues/Questions/Feature requests on + [GitHub Issues](https://github.com/jlenv/jlenv-cookbook/issues) + +Pull requests are very welcome! Make sure your patches are well tested. + +## Testing + +For local unit tests: + +```bash +delivery local +``` + +## Contributors + + + +
Mark Van de Vyver
Mark Van de Vyver

🚇 ⚠️ 💻
+ + +This project exists thanks to all the people who contribute. diff --git a/docs/_config.yml b/docs/_config.yml new file mode 100644 index 00000000..db103554 --- /dev/null +++ b/docs/_config.yml @@ -0,0 +1,19 @@ +--- +title: `jlenv` Chef Cookbook +email: mark@taqtiqa.com +description: > # this means to ignore newlines until "baseurl:" + Build, install and manage multiple versions of [Julia].(https://www.julialang.org/). +github_username: jlenv +include_related_posts: true +plugins: + - jekyll-relative-links +relative_links: + enabled: true + collections: true +include: + - README.md + - LICENSE.md + - ISSUE_TEMPLATE.md + - PULL_REQUEST_TEMPLATE.md + - CONTRIBUTING.md + - CONDUCT.md diff --git a/gh-md-toc b/gh-md-toc new file mode 100755 index 00000000..792d6ff5 --- /dev/null +++ b/gh-md-toc @@ -0,0 +1,281 @@ +#!/usr/bin/env bash + +# +# Steps: +# +# 1. Download corresponding html file for some README.md: +# curl -s $1 +# +# 2. Discard rows where no substring 'user-content-' (github's markup): +# awk '/user-content-/ { ... +# +# 3.1 Get last number in each row like ' ... sitemap.js.*<\/h/)+2, RLENGTH-5) +# +# 5. Find anchor and insert it inside "(...)": +# substr($0, match($0, "href=\"[^\"]+?\" ")+6, RLENGTH-8) +# + +gh_toc_version="0.6.1" + +gh_user_agent="gh-md-toc v$gh_toc_version" + +# +# Download rendered into html README.md by its url. +# +# +gh_toc_load() { + local gh_url=$1 + + if type curl &>/dev/null; then + curl --user-agent "$gh_user_agent" -s "$gh_url" + elif type wget &>/dev/null; then + wget --user-agent="$gh_user_agent" -qO- "$gh_url" + else + echo "Please, install 'curl' or 'wget' and try again." + exit 1 + fi +} + +# +# Converts local md file into html by GitHub +# +# ➥ curl -X POST --data '{"text": "Hello world github/linguist#1 **cool**, and #1!"}' https://api.github.com/markdown +#

Hello world github/linguist#1 cool, and #1!

'" +gh_toc_md2html() { + local gh_file_md=$1 + URL=https://api.github.com/markdown/raw + if [ ! -z "$GH_TOC_TOKEN" ]; then + TOKEN=$GH_TOC_TOKEN + else + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + fi + if [ -f "$TOKEN" ]; then + URL="$URL?access_token=$(cat $TOKEN)" + fi + # echo $URL 1>&2 + OUTPUT="$(curl -s --user-agent "$gh_user_agent" \ + --data-binary @"$gh_file_md" -H "Content-Type:text/plain" \ + $URL)" + + if [ "$?" != "0" ]; then + echo "XXNetworkErrorXX" + fi + if [ "$(echo "${OUTPUT}" | awk '/API rate limit exceeded/')" != "" ]; then + echo "XXRateLimitXX" + else + echo "${OUTPUT}" + fi +} + + +# +# Is passed string url +# +gh_is_url() { + case $1 in + https* | http*) + echo "yes";; + *) + echo "no";; + esac +} + +# +# TOC generator +# +gh_toc(){ + local gh_src=$1 + local gh_src_copy=$1 + local gh_ttl_docs=$2 + local need_replace=$3 + + if [ "$gh_src" = "" ]; then + echo "Please, enter URL or local path for a README.md" + exit 1 + fi + + + # Show "TOC" string only if working with one document + if [ "$gh_ttl_docs" = "1" ]; then + + echo "Table of Contents" + echo "=================" + echo "" + gh_src_copy="" + + fi + + if [ "$(gh_is_url "$gh_src")" == "yes" ]; then + gh_toc_load "$gh_src" | gh_toc_grab "$gh_src_copy" + if [ "${PIPESTATUS[0]}" != "0" ]; then + echo "Could not load remote document." + echo "Please check your url or network connectivity" + exit 1 + fi + if [ "$need_replace" = "yes" ]; then + echo + echo "!! '$gh_src' is not a local file" + echo "!! Can't insert the TOC into it." + echo + fi + else + local rawhtml=$(gh_toc_md2html "$gh_src") + if [ "$rawhtml" == "XXNetworkErrorXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Please make sure curl is installed and check your network connectivity" + exit 1 + fi + if [ "$rawhtml" == "XXRateLimitXX" ]; then + echo "Parsing local markdown file requires access to github API" + echo "Error: You exceeded the hourly limit. See: https://developer.github.com/v3/#rate-limiting" + TOKEN="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/token.txt" + echo "or place github auth token here: $TOKEN" + exit 1 + fi + local toc=`echo "$rawhtml" | gh_toc_grab "$gh_src_copy"` + echo "$toc" + if [ "$need_replace" = "yes" ]; then + if grep -Fxq "" $gh_src && grep -Fxq "" $gh_src; then + echo "Found markers" + else + echo "You don't have or in your file...exiting" + exit 1 + fi + local ts="<\!--ts-->" + local te="<\!--te-->" + local dt=`date +'%F_%H%M%S'` + local ext=".orig.${dt}" + local toc_path="${gh_src}.toc.${dt}" + local toc_footer="" + # http://fahdshariff.blogspot.ru/2012/12/sed-mutli-line-replacement-between-two.html + # clear old TOC + sed -i${ext} "/${ts}/,/${te}/{//!d;}" "$gh_src" + # create toc file + echo "${toc}" > "${toc_path}" + echo -e "\n${toc_footer}\n" >> "$toc_path" + # insert toc file + if [[ "`uname`" == "Darwin" ]]; then + sed -i "" "/${ts}/r ${toc_path}" "$gh_src" + else + sed -i "/${ts}/r ${toc_path}" "$gh_src" + fi + echo + echo "!! TOC was added into: '$gh_src'" + echo "!! Origin version of the file: '${gh_src}${ext}'" + echo "!! TOC added into a separate file: '${toc_path}'" + echo + fi + fi +} + +# +# Grabber of the TOC from rendered html +# +# $1 — a source url of document. +# It's need if TOC is generated for multiple documents. +# +gh_toc_grab() { + # if closed is on the new line, then move it on the prev line + # for example: + # was: The command foo1 + # + # became: The command foo1 + sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | + # find strings that corresponds to template + grep -E -o '//g' | sed 's/<\/code>//g' | + # now all rows are like: + # ... .*<\/h/)+2, RLENGTH-5) + href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) + print sprintf("%*s", level*3, " ") "* [" text "](" gh_url href ")" }' | + sed 'y/+/ /; s/%/\\x/g')" +} + +# +# Returns filename only from full path or url +# +gh_toc_get_filename() { + echo "${1##*/}" +} + +# +# Options hendlers +# +gh_toc_app() { + local need_replace="no" + + if [ "$1" = '--help' ] || [ $# -eq 0 ] ; then + local app_name=$(basename "$0") + echo "GitHub TOC generator ($app_name): $gh_toc_version" + echo "" + echo "Usage:" + echo " $app_name [--insert] src [src] Create TOC for a README file (url or local path)" + echo " $app_name - Create TOC for markdown from STDIN" + echo " $app_name --help Show help" + echo " $app_name --version Show version" + return + fi + + if [ "$1" = '--version' ]; then + echo "$gh_toc_version" + echo + echo "os: `lsb_release -d | cut -f 2`" + echo "kernel: `cat /proc/version`" + echo "shell: `$SHELL --version`" + echo + for tool in curl wget grep awk sed; do + printf "%-5s: " $tool + echo `$tool --version | head -n 1` + done + return + fi + + if [ "$1" = "-" ]; then + if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" + elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then + mkdir -p "$TMPDIR" + fi + local gh_tmp_md + gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) + while read input; do + echo "$input" >> "$gh_tmp_md" + done + gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" + return + fi + + if [ "$1" = '--insert' ]; then + need_replace="yes" + shift + fi + + for md in "$@" + do + echo "" + gh_toc "$md" "$#" "$need_replace" + done + + echo "" + echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" +} + +# +# Entry point +# +gh_toc_app "$@" diff --git a/libraries/lib/chef/provider/git_ext.rb b/libraries/lib/chef/provider/git_ext.rb index f902a060..a6b85295 100644 --- a/libraries/lib/chef/provider/git_ext.rb +++ b/libraries/lib/chef/provider/git_ext.rb @@ -59,11 +59,8 @@ def find_current_revision end def clone - Chef::Log.warn "#{new_resource} before super existing_git_clone? is '#{existing_git_clone?}'" - Chef::Log.warn "#{new_resource} before super cwd is '#{cwd}'" converge_by("clone from #{repo_url} into #{cwd}") do remote = new_resource.remote - clone_cmd = ["clone"] clone_cmd << "-o #{remote}" unless remote == "origin" clone_cmd << "--depth #{new_resource.depth}" if new_resource.depth @@ -74,11 +71,7 @@ def clone logger.info "#{new_resource} cloning repo #{repo_url} to #{cwd}" git(clone_cmd, returns: [0, 128]) end - Chef::Log.warn "#{new_resource} after clone existing_git_clone? is '#{existing_git_clone?}'" - Chef::Log.warn "#{new_resource} after clone cwd is '#{cwd}'" target_revision - Chef::Log.warn "#{new_resource.revision} after clone is '#{@target_revision}'" - @target_revision end def target_revision @@ -88,16 +81,12 @@ def target_revision if sha_hash?(new_resource.revision) @target_revision = new_resource.revision else - Chef::Log.warn "#{new_resource} resolving reference" - Chef::Log.warn "#{new_resource} cwd is '#{cwd}'" - Chef::Log.warn "#{new_resource} existing_git_clone? is '#{existing_git_clone?}'" @target_revision = local_resolve_reference end end end def local_resolve_reference - Chef::Log.warn "#{new_resource} resolving remote reference" @resolved_reference = git_ref(rev_search_pattern) @resolved_reference end @@ -123,18 +112,10 @@ def git_ref(reference) live_stderr: StringIO.new, live_stream: StringIO.new ) - puts hash.inspect - puts "="*80 - puts hash.live_stdout.string break if hash.exitstatus == 0 - puts hash.exitstatus.inspect end # This avoids stdout which is not available where no /dev/tty ref = hash.exitstatus == 0 ? hash.live_stdout.string : '' - puts "+"*80 - puts ref.inspect - puts "~"*80 - puts hash.live_stderr.string ref.chomp.split(' ').first end diff --git a/resources/global.rb b/resources/global.rb index 4599b6c8..1ae9a5a9 100644 --- a/resources/global.rb +++ b/resources/global.rb @@ -23,7 +23,7 @@ # limitations under the License. # -# Check for the user or system global verison +# Check for the user or system global version # If we pass in a user check that users global provides :jlenv_global diff --git a/templates/jlenv.sh.erb b/templates/jlenv.sh.erb index 7ec6704e..6ee29e65 100644 --- a/templates/jlenv.sh.erb +++ b/templates/jlenv.sh.erb @@ -6,10 +6,10 @@ if [ -s "${HOME}/.jlenv/bin" ]; then jlenv_root="${HOME}/.jlenv" elif [ -s "<%= @global_prefix %>" ]; then jlenv_root="<%= @global_prefix %>" - export JLENV_ROOT="$jlenv_root" fi +export JLENV_ROOT="$jlenv_root" -if [ -n "$jlenv_root" ]; then - export PATH="${jlenv_root}/bin:$PATH" +if [ -n "$JLENV_ROOT" ]; then + export PATH="${JLENV_ROOT}/bin:$PATH" eval "$(jlenv init -)" fi diff --git a/test/integration/resources/controls/cookbook.rb b/test/integration/resources/controls/cookbook.rb index cdec502b..9c3e7f96 100644 --- a/test/integration/resources/controls/cookbook.rb +++ b/test/integration/resources/controls/cookbook.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -title 'Jlenv Resource Cookbook' +title 'Jlenv Resource Cookbook Audit Controls' include_controls 'system_install' include_controls 'user_install' diff --git a/test/integration/resources/global/controls/global_install.rb b/test/integration/resources/global/controls/global_install.rb deleted file mode 100644 index e30eab8b..00000000 --- a/test/integration/resources/global/controls/global_install.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true -global_julia = 'v1.0.3' - -control 'Jlenv should be installed' do - title 'Jlenv should be installed globally' - - desc "Can set global Julia version to #{global_julia}" - describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do - its('exit_status') { should eq 0 } - its('stdout') { should include(global_julia) } - end -end diff --git a/test/integration/resources/global/inspec.yml b/test/integration/resources/global/inspec.yml deleted file mode 100644 index 83edebb3..00000000 --- a/test/integration/resources/global/inspec.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -name: jlenv -title: jlenv global resource profile -maintainer: Taqtiqa LLC -copyright: Taqtiqa LLC -copyright_email: admin@taqtiqa.com -license: Apache-2.0 -summary: Verifies jlenv global resource correctly functions with defaults. -version: 0.1.0 -inspec_version: "~> 2.1" -supports: - - os-family: linux diff --git a/test/integration/resources/system_install/controls/global_install.rb b/test/integration/resources/system_install/controls/global_install.rb new file mode 100644 index 00000000..3e0e0fe7 --- /dev/null +++ b/test/integration/resources/system_install/controls/global_install.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +title 'Jlenv System Install Resource' + +# Default user in resources is jovyan i.e. Jupyter assumption +julia_users ||= yaml(content: inspec.profile.file('users.yml'))['users'] +julia_user ||= 'vagrant' +global_julia_version ||= julia_users[julia_user]['version'] + +jlenv_global = command("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv global'") + +# frozen_string_literal: true + +control 'Jlenv system install' do + title 'Jlenv should be installed system wide' + + desc 'Jlenv should be installed and run successfully' + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do + its('exit_status') { should eq 0 } + end +end + +control 'Jlenv system path' do + title 'Jlenv should be installed in the system wide location' + + describe file('/usr/local/jlenv') do + it { should exist } + it { should be_directory } + end + + # Issue: https://github.com/jlenv/jlenv-cookbook/issues/3 + # Issue: https://github.com/jlenv/jlenv-cookbook/issues/4 + # + describe file('/etc/profile.d/jlenv.sh') do + its('type') { should eq :file } + its('group') { should eq 'root' } + its('owner') { should eq 'root' } + its('mode') { should cmp '0755' } + it { should be_executable.by('others') } + it { should_not be_writable.by('others') } + end + +end + +control 'Global Installations' do + impact 0.6 + title 'Jlenv should be installed under the .... directory.' + desc 'Always specify environment variables, folders and permissions.' + desc 'Rationale:', 'This ensures that there are no unexpected scripts run.' # Requires InSpec >=2.3.4 + tag 'julia', 'jlenv' + #ref 'NSA-RH6-STIG - Section 3.5.2.1', url: 'https://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf' + + # before :all do + # command("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv global'") + # end + + # The following nested describe is blocked by inspec issue #630: + # + # + # Workarounds not yet known. + # Best practice to audit os_env(...) generated by user scripts not known. + # + # describe jlenv_global do + # env_vars = %w( + # HOME + # PATH + # ) + # + # env_vars.each do |e| + # describe os_env(e) do + # its('content') { should_not eq nil } + # its('content') { should_not eq '' } + # its('split'){ should_not eq '' } + # its('split'){ should_not eq '.' } + # end + # end + # end + + describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do + its('exit_status') { should eq 0 } + its('stdout') { should include(global_julia_version ) } + end + + describe jlenv_global do + its('exit_status') { should eq 0 } + its('stdout') { should include('system') } + its('stdout') { should_not include(global_julia_version ) } + its('stderr') { should eq '' } + end + + %w(plugins shims versions).each do |d| + describe directory("/home/#{julia_user}/.jlenv/#{d}") do + its('type') { should eq :directory } + its('mode') { should cmp '0755' } + it { should be_writable.by_user(julia_user) } + end + end + + # Issue: https://github.com/jlenv/jlenv-cookbook/issues/3 + # Refactor this control to verify the user install script has had no + # (unintended/specified) side effect on the system install (and vice versa). + describe file('/etc/profile.d/jlenv.sh') do + it { should_not be_writable.by_user(julia_user) } + it { should be_executable.by('others') } + it { should be_executable.by_user(julia_user) } + end + + describe directory("/home/#{julia_user}/.jlenv/.git") do + its('type') { should eq :directory } + its('mode') { should cmp '0755' } + it { should be_writable.by_user(julia_user) } + end + + describe os_env('PATH', 'target') do + its('split') { should_not include('') } + its('split') { should_not include('.') } + its('split') { should include("/home/#{julia_user}/.jlenv/shims") } + end +end + +control 'Global Installations' do + title 'Jlenv should be installed globally' + + desc "Can set global Julia version toglobal}" + jlenv_versions = command("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv versions --bare'") + describe jlenv_versions do + its('exit_status') { should eq 0 } + its('stdout') { should_not include(global_julia_version) } + its('stderr') { should eq '' } + end + + jlenv_env_vars = %w( + JLENV_DEBUG + JLENV_DIR + JLENV_HOOK_PATH + JLENV_ROOT + JLENV_VERSION + ) + + jlenv_env_vars.each do |e| + describe os_env(e) do + its('content') { should eq nil } + its('content') { should_not eq '' } + its('split'){ should_not eq '' } + its('split'){ should_not eq '.' } + end + end +end diff --git a/test/integration/resources/system_install/controls/system_install.rb b/test/integration/resources/system_install/controls/system_install.rb deleted file mode 100644 index e9911616..00000000 --- a/test/integration/resources/system_install/controls/system_install.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -title 'Jlenv System Install Resource' - -control 'Jlenv system install' do - title 'Jlenv should be installed system wide' - - desc 'Jlenv should be installed and run successfully' - describe bash('source /etc/profile.d/jlenv.sh && jlenv versions --bare') do - its('exit_status') { should eq 0 } - end -end - -control 'Jlenv system path' do - title 'Jlenv should be installed in the system wide location' - - describe file('/usr/local/jlenv') do - it { should exist } - it { should be_directory } - end - - # Issue: https://github.com/jlenv/jlenv-cookbook/issues/3 - # Issue: https://github.com/jlenv/jlenv-cookbook/issues/4 - # - describe file('/etc/profile.d/jlenv.sh') do - its('type') { should be_file } - its('group') { should eq 'root' } - its('owner') { should eq 'root' } - its('mode') { should cmp '0755' } - it { should be_executable.by('others') } - it { should_not be_writable.by('others') } - end - -end diff --git a/test/integration/resources/system_install/files/users.yml b/test/integration/resources/system_install/files/users.yml new file mode 100644 index 00000000..f4546a57 --- /dev/null +++ b/test/integration/resources/system_install/files/users.yml @@ -0,0 +1,13 @@ +users: + jovyan: + group: jovyan + version: '1.0.5' + ubuntu: + group: ubuntu + version: '1.2.0' + vagrant: + group: vagrant + version: '1.0.2' + root: + group: root + version: '1.0.0' diff --git a/test/integration/resources/system_install/inspec.yml b/test/integration/resources/system_install/inspec.yml index 5af94de4..83edebb3 100644 --- a/test/integration/resources/system_install/inspec.yml +++ b/test/integration/resources/system_install/inspec.yml @@ -1,10 +1,12 @@ --- name: jlenv -title: jlenv system resource profile +title: jlenv global resource profile maintainer: Taqtiqa LLC copyright: Taqtiqa LLC +copyright_email: admin@taqtiqa.com license: Apache-2.0 -summary: Verifies jlenv system_install resource correctly functions with defaults. -version: 1.0.0 +summary: Verifies jlenv global resource correctly functions with defaults. +version: 0.1.0 +inspec_version: "~> 2.1" supports: - os-family: linux diff --git a/test/integration/resources/user_install/controls/user_install.rb b/test/integration/resources/user_install/controls/user_install.rb index af6e743f..9b66fbfd 100644 --- a/test/integration/resources/user_install/controls/user_install.rb +++ b/test/integration/resources/user_install/controls/user_install.rb @@ -7,7 +7,9 @@ julia_user ||= 'vagrant' user_julia_version ||= julia_users[julia_user]['version'] -control 'Jlenv should be installed' do +jlenv_global = command("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv global'") + +control 'User Installations' do impact 0.6 title 'Jlenv should be installed under the users home directory.' desc 'Always specify environment variables, folders and permissions.' @@ -15,18 +17,43 @@ tag 'julia', 'jlenv' #ref 'NSA-RH6-STIG - Section 3.5.2.1', url: 'https://www.nsa.gov/ia/_files/os/redhat/rhel5-guide-i731.pdf' - describe bash("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv global'") do + # before :all do + # command("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv global'") + # end + + # The following nested describe is blocked by inspec issue #630: + # + # + # Workarounds not yet known. + # Best practice to audit os_env(...) generated by user scripts not known. + # + # describe jlenv_global do + # env_vars = %w( + # HOME + # PATH + # ) + # + # env_vars.each do |e| + # describe os_env(e) do + # its('content') { should_not eq nil } + # its('content') { should_not eq '' } + # its('split'){ should_not eq '' } + # its('split'){ should_not eq '.' } + # end + # end + # end + + describe jlenv_global do its('exit_status') { should eq 0 } its('stdout') { should include('system') } - its('stdout') { should not_include(user_julia_version) } + its('stdout') { should_not include(user_julia_version) } its('stderr') { should eq '' } end %w(plugins shims versions).each do |d| describe directory("/home/#{julia_user}/.jlenv/#{d}") do - its('type') { should be_file } + its('type') { should eq :directory } its('mode') { should cmp '0755' } - it { should exist } it { should be_writable.by_user(julia_user) } end end @@ -40,11 +67,10 @@ it { should be_executable.by_user(julia_user) } end - it 'checkouts from git with attributes' do - is_expected.to checkout_git("/home/#{julia_user}/.jlenv").with( - repository: 'https://github.com/jlenv/jlenv.git', - reference: 'master' - ) + describe directory("/home/#{julia_user}/.jlenv/.git") do + its('type') { should eq :directory } + its('mode') { should cmp '0755' } + it { should be_writable.by_user(julia_user) } end describe os_env('PATH', 'target') do @@ -54,26 +80,31 @@ end end -control 'Global Jlenv' do - title 'Jlenv should be installed globally' +control 'User Installations' do + title 'Jlenv should be installed locally' - desc "Can set global Julia version to #{user_julia_version}" - describe bash("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv versions --bare'") do + desc "Can set user-space Julia version to #{user_julia_version}" + jlenv_versions = command("sudo -H -u #{julia_user} bash -c 'source /etc/profile.d/jlenv.sh && jlenv versions --bare'") + describe jlenv_versions do its('exit_status') { should eq 0 } - its('stdout') { should include(user_julia_version) } + its('stdout') { should_not include(user_julia_version) } its('stderr') { should eq '' } end -end -jlenv_env_vars = %w( - HOME - JLENV_ROOT - PATH -) + jlenv_env_vars = %w( + JLENV_DEBUG + JLENV_DIR + JLENV_HOOK_PATH + JLENV_ROOT + JLENV_VERSION + ) -jlenv_env_vars.each do |e| - describe os_env(e) do - its('content') { should_not eq nil } - its('content') { should_not eq '' } + jlenv_env_vars.each do |e| + describe os_env(e) do + its('content') { should eq nil } + its('content') { should_not eq '' } + its('split'){ should_not eq '' } + its('split'){ should_not eq '.' } + end end end