Prechádzať zdrojové kódy

feat(packages): Add basic packages

Signed-off-by: Jeremy MAURO <jeremy.mauro@gmail.com>
Jeremy MAURO 2 rokov pred
rodič
commit
f0ccae70e0

+ 39 - 0
cookbooks/workstation/recipes/_packages.rb

@@ -0,0 +1,39 @@
+#
+# Cookbook:: workstation
+# Recipe:: _packages
+#
+# Copyright:: 2022, The Authors, All Rights Reserved.
+#
+
+package %w{
+  moreutils
+  debian-goodies
+  bash-completion
+  vim
+  dnsutils
+  whois
+  iproute2
+  apt-file
+  mc
+  curl
+  wget
+  grc
+  jq
+  lftp
+  lsof
+  openssh-client
+  plocate
+  smem
+  sudo
+} do
+  notifies :run, 'execute[/usr/bin/apt-file update]', :immediately
+  notifies :run, 'execute[/usr/bin/updatedb]', :immediately
+end
+
+execute '/usr/bin/apt-file update' do
+  action :nothing
+end
+
+execute '/usr/bin/updatedb' do
+  action :nothing
+end

+ 29 - 0
cookbooks/workstation/spec/unit/recipes/_packages_spec.rb

@@ -0,0 +1,29 @@
+#
+# Cookbook:: workstation
+# Spec:: _packages
+#
+# Copyright:: 2022, The Authors, All Rights Reserved.
+
+require 'spec_helper'
+
+describe 'workstation::_packages' do
+  context 'When all attributes are default, on Ubuntu 20.04' do
+    # for a complete list of available platforms and versions see:
+    # https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md
+    platform 'ubuntu', '20.04'
+
+    it 'converges successfully' do
+      expect { chef_run }.to_not raise_error
+    end
+  end
+
+  context 'When all attributes are default, on CentOS 8' do
+    # for a complete list of available platforms and versions see:
+    # https://github.com/chefspec/fauxhai/blob/main/PLATFORMS.md
+    platform 'centos', '8'
+
+    it 'converges successfully' do
+      expect { chef_run }.to_not raise_error
+    end
+  end
+end

+ 16 - 0
cookbooks/workstation/test/integration/default/_packages_test.rb

@@ -0,0 +1,16 @@
+# Chef InSpec test for recipe workstation::_packages
+
+# The Chef InSpec reference, with examples and extensive documentation, can be
+# found at https://docs.chef.io/inspec/resources/
+
+unless os.windows?
+  # This is an example test, replace with your own test.
+  describe user('root'), :skip do
+    it { should exist }
+  end
+end
+
+# This is an example test, replace it with your own test.
+describe port(80), :skip do
+  it { should_not be_listening }
+end