commit 617f7959abda045326c8f06f1c1bcedbaa7c7285 Author: Râu Cao Date: Sat Jun 8 17:01:45 2024 +0200 Initial release diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f1e57b8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +.vagrant +*~ +*# +.#* +\#*# +.*.sw[a-z] +*.un~ + +# Bundler +Gemfile.lock +gems.locked +bin/* +.bundle/* + +# test kitchen +.kitchen/ +kitchen.local.yml + +# Chef Infra +Berksfile.lock +.zero-knife.rb +Policyfile.lock.json + +.idea/ + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..23e912d --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2024 Kosmos Developers + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Policyfile.rb b/Policyfile.rb new file mode 100644 index 0000000..6f3555a --- /dev/null +++ b/Policyfile.rb @@ -0,0 +1,16 @@ +# Policyfile.rb - Describe how you want Chef Infra Client to build your system. +# +# For more information on the Policyfile feature, visit +# https://docs.chef.io/policyfile/ + +# A name that describes what the system you're building with Chef does. +name 'deno' + +# Where to find external cookbooks: +default_source :supermarket + +# run_list: chef-client will run these recipes in the order specified. +run_list 'deno::default' + +# Specify a custom source for a single cookbook: +cookbook 'deno', path: '.' diff --git a/README.md b/README.md new file mode 100644 index 0000000..7fdb87e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# deno cookbook + +A Chef cookbook for installing/configuring Deno diff --git a/attributes/default.rb b/attributes/default.rb new file mode 100644 index 0000000..12e6c87 --- /dev/null +++ b/attributes/default.rb @@ -0,0 +1,3 @@ +node.default["deno"]["version"] = "1.44.1" +node.default["deno"]["download_url"] = "https://github.com/denoland/deno/releases/download/v#{node['deno']['version']}/deno-x86_64-unknown-linux-gnu.zip" +node.default["deno"]["checksum"] = "b9ed6c90f12dd7751ad5f39e07f580f71a73e9947d2be703ea54086f8b9becfb" diff --git a/chefignore b/chefignore new file mode 100644 index 0000000..cc170ea --- /dev/null +++ b/chefignore @@ -0,0 +1,115 @@ +# Put files/directories that should be ignored in this file when uploading +# to a Chef Infra Server or Supermarket. +# Lines that start with '# ' are comments. + +# OS generated files # +###################### +.DS_Store +ehthumbs.db +Icon? +nohup.out +Thumbs.db +.envrc + +# EDITORS # +########### +.#* +.project +.settings +*_flymake +*_flymake.* +*.bak +*.sw[a-z] +*.tmproj +*~ +\#* +REVISION +TAGS* +tmtags +.vscode +.editorconfig + +## COMPILED ## +############## +*.class +*.com +*.dll +*.exe +*.o +*.pyc +*.so +*/rdoc/ +a.out +mkmf.log + +# Testing # +########### +.circleci/* +.codeclimate.yml +.delivery/* +.foodcritic +.kitchen* +.mdlrc +.overcommit.yml +.rspec +.rubocop.yml +.travis.yml +.watchr +.yamllint +azure-pipelines.yml +Dangerfile +examples/* +features/* +Guardfile +kitchen.yml* +mlc_config.json +Procfile +Rakefile +spec/* +test/* + +# SCM # +####### +.git +.gitattributes +.gitconfig +.github/* +.gitignore +.gitkeep +.gitmodules +.svn +*/.bzr/* +*/.git +*/.hg/* +*/.svn/* + +# Berkshelf # +############# +Berksfile +Berksfile.lock +cookbooks/* +tmp + +# Bundler # +########### +vendor/* +Gemfile +Gemfile.lock + +# Policyfile # +############## +Policyfile.rb +Policyfile.lock.json + +# Documentation # +############# +CODE_OF_CONDUCT* +CONTRIBUTING* +documentation/* +TESTING* +UPGRADING* + +# Vagrant # +########### +.vagrant +Vagrantfile diff --git a/kitchen.yml b/kitchen.yml new file mode 100644 index 0000000..bd80b17 --- /dev/null +++ b/kitchen.yml @@ -0,0 +1,35 @@ +--- +driver: + name: dokken + chef_version: 18.2.7 + pull_platform_image: false + pull_chef_image: false + volumes: + # saves the apt archieves outside of the container + - /var/cache/apt/archives/:/var/cache/apt/archives/ + +transport: + name: dokken + +provisioner: + name: dokken + +verifier: + name: inspec + +platforms: + - name: ubuntu-22.04 + driver: + image: dokken/ubuntu-22.04 + privileged: true + pid_one_command: /usr/lib/systemd/systemd + intermediate_instructions: + # prevent APT from deleting the APT folder + - RUN rm /etc/apt/apt.conf.d/docker-clean + - RUN /usr/bin/apt-get update + +suites: + - name: deno + verifier: + inspec_tests: + - test/integration/default diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..e27ca75 --- /dev/null +++ b/metadata.rb @@ -0,0 +1,11 @@ +name 'deno' +maintainer 'Kosmos' +maintainer_email 'ops@kosmos.org' +license 'MIT' +description 'Installs/configures strfry' +version '0.1.0' +chef_version '>= 18.0' +issues_url 'https://gitea.kosmos.org/kosmos/deno-cookbook/issues' +source_url 'https://gitea.kosmos.org/kosmos/deno-cookbook' + +depends "ark" diff --git a/recipes/default.rb b/recipes/default.rb new file mode 100644 index 0000000..5261dfd --- /dev/null +++ b/recipes/default.rb @@ -0,0 +1,14 @@ +# +# Cookbook:: deno +# Recipe:: default +# + +package 'unzip' + +ark 'deno' do + url node['deno']['download_url'] + checksum node['deno']['checksum'] + creates 'deno' + path '/usr/local/bin' + action :cherry_pick +end diff --git a/test/integration/default/default_test.rb b/test/integration/default/default_test.rb new file mode 100644 index 0000000..fa06b6d --- /dev/null +++ b/test/integration/default/default_test.rb @@ -0,0 +1,15 @@ +# Chef InSpec test for recipe deno::default + +# The Chef InSpec reference, with examples and extensive documentation, can be +# found at https://docs.chef.io/inspec/resources/ + +describe file('/usr/local/bin/deno') do + it { should exist } + its('mode') { should cmp '00755' } +end + +describe bash('deno -v') do + its('stdout') { should match /deno 1\.44\.1/ } + its('stderr') { should eq '' } + its('exit_status') { should eq 0 } +end