Update golang cookbook
This commit is contained in:
104
cookbooks/seven_zip/CHANGELOG.md
Normal file
104
cookbooks/seven_zip/CHANGELOG.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# CHANGELOG for seven_zip
|
||||
|
||||
This file is used to list changes made in each version of seven_zip.
|
||||
|
||||
## 4.2.2 - *2021-08-31*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 4.2.1 - *2021-06-07*
|
||||
|
||||
- [CI] Change ActionsHub actions to main
|
||||
- [CI] Change checkout action to v2
|
||||
- [CI] Change final step to an echo for faster final step
|
||||
|
||||
## 4.2.0 - *2021-06-07*
|
||||
|
||||
- Add remove action to seven_zip_tool
|
||||
|
||||
## 4.1.1 - *2021-06-01*
|
||||
|
||||
- Update delivery configuration
|
||||
|
||||
## 4.1.0 - *2021-05-20*
|
||||
|
||||
- Reduce Chef requirement to >= 15.3
|
||||
|
||||
## 4.0.0 - *2021-04-29*
|
||||
|
||||
- Increase the supported version of Chef to Chef 16
|
||||
|
||||
This is inline with our support policies, allowing us to use the newest Chef features
|
||||
|
||||
- Remove dependency on the deprecated Windows cookbook
|
||||
- Convert to modern custom resources
|
||||
- Remove the default recipe
|
||||
- Remove default_spec as we no longer have a default recipe
|
||||
- Use the Chef `execute` and `directory` resources rather than Ruby methods
|
||||
- Pull Windows helpers from the Windows cookbook and fix them to work in this cookbook
|
||||
|
||||
As the Windows cookbook is no longer maintained many of the methods we used were deprecated
|
||||
in Ruby 2.7 but were never fixed. These methods have now been removed in Ruby 3.0
|
||||
|
||||
- Move resource documentation to the documentation/resource directory.
|
||||
- Update README to reflect new usage
|
||||
|
||||
## 3.2.0 - *2021-01-24*
|
||||
|
||||
- Sous Chefs Adoption
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
- Various Cookstyle fixes
|
||||
- Migrate from ServerSpec to InSpec for integration testing
|
||||
- Update to 7-Zip 19.00
|
||||
|
||||
## 3.1.2
|
||||
|
||||
- Update nokogiri from [1.8.2 to 1.8.5](https://snyk.io/vuln/SNYK-RUBY-NOKOGIRI-72433)
|
||||
|
||||
## 3.1.1
|
||||
|
||||
- Fix deprecation warning regarding the use of `win_friendly_path` helper.
|
||||
|
||||
## 3.1.0
|
||||
|
||||
- Having a simple resource to setup 7-zip allows other resources (since including a recipe inside a resource is not a good pattern) to use it to ensure that their prerequisites are installed before-hand.
|
||||
- This resource leverage existing attributes as default values to keep backward compatibility.
|
||||
- The `seven_zip::default` recipe's code has been refactored to just use this resource.
|
||||
|
||||
## 3.0.0
|
||||
|
||||
- Support Chef 13, drop support for Chef 12.
|
||||
- Upgrade to 7-Zip 18.05.
|
||||
- Standardize testing environment across repos. (AppVeyor, Kitchen, Rake, etc.)
|
||||
- Upgrade development dependencies.
|
||||
|
||||
## 2.0.2
|
||||
|
||||
- Add timeout to extract action on `seven_zip` resource and configurable `default_extract_timeout` attribute.
|
||||
|
||||
## 2.0.1
|
||||
|
||||
- [GH Issue 21 - NoMethodError: Undefined method or attribute kernel on node](https://github.com/daptiv/seven_zip/issues/21).
|
||||
|
||||
## 2.0.0
|
||||
|
||||
- [Upgrade to 7-Zip 15.14](https://github.com/daptiv/seven_zip/pull/9).
|
||||
- [7-Zip now installed to the default MSI location by default](https://github.com/daptiv/seven_zip/pull/11).
|
||||
- [7z.exe is located using the Windows registry unless the home attribute is explicitly set](https://github.com/daptiv/seven_zip/pull/10).
|
||||
- [7-Zip is only added to the Windows PATH if the syspath attribute is set](https://github.com/daptiv/seven_zip/pull/11).
|
||||
- [Installation idempotence check was fixed](https://github.com/daptiv/seven_zip/pull/14), package name was corrected.
|
||||
- [TravisCI build added](https://github.com/daptiv/seven_zip/pull/12).
|
||||
- [ServerSpec tests added](https://github.com/daptiv/seven_zip/pull/9)
|
||||
- [Document Archive LRWP](https://github.com/daptiv/seven_zip/pull/6)
|
||||
|
||||
## 1.0.2
|
||||
|
||||
- [COOK-3476 - Upgrade to 7-zip 9.22](https://tickets.opscode.com/browse/COOK-3476)
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- initial release
|
||||
|
||||
---
|
||||
|
||||
Refer to the [Markdown Syntax Guide](https://daringfireball.net/projects/markdown/syntax) for help with standard Markdown, and [Writing on GitHub](https://help.github.com/categories/writing-on-github/) for help with the GitHub dialect of Markdown.
|
||||
@@ -1,8 +0,0 @@
|
||||
source 'http://rubygems.org'
|
||||
|
||||
gem 'cookstyle'
|
||||
gem 'foodcritic'
|
||||
gem 'rspec-expectations'
|
||||
gem 'rspec-mocks'
|
||||
gem 'rubocop'
|
||||
gem 'stove'
|
||||
@@ -1,79 +0,0 @@
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
ast (2.4.0)
|
||||
backports (3.11.3)
|
||||
chef-api (0.8.0)
|
||||
logify (~> 0.1)
|
||||
mime-types
|
||||
cookstyle (3.0.0)
|
||||
rubocop (= 0.55.0)
|
||||
cucumber-core (3.1.0)
|
||||
backports (>= 3.8.0)
|
||||
cucumber-tag_expressions (~> 1.1.0)
|
||||
gherkin (>= 5.0.0)
|
||||
cucumber-tag_expressions (1.1.1)
|
||||
diff-lcs (1.3)
|
||||
erubis (2.7.0)
|
||||
ffi-yajl (2.3.1)
|
||||
libyajl2 (~> 1.2)
|
||||
foodcritic (13.1.1)
|
||||
cucumber-core (>= 1.3)
|
||||
erubis
|
||||
ffi-yajl (~> 2.0)
|
||||
nokogiri (>= 1.5, < 2.0)
|
||||
rake
|
||||
rufus-lru (~> 1.0)
|
||||
treetop (~> 1.4)
|
||||
gherkin (5.0.0)
|
||||
libyajl2 (1.2.0)
|
||||
logify (0.2.0)
|
||||
mime-types (3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2016.0521)
|
||||
mini_portile2 (2.3.0)
|
||||
nokogiri (1.8.2)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
parallel (1.12.1)
|
||||
parser (2.5.1.0)
|
||||
ast (~> 2.4.0)
|
||||
polyglot (0.3.5)
|
||||
powerpack (0.1.1)
|
||||
rainbow (3.0.0)
|
||||
rake (12.3.1)
|
||||
rspec-expectations (3.7.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-mocks (3.7.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-support (3.7.1)
|
||||
rubocop (0.55.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.5)
|
||||
powerpack (~> 0.1)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||
ruby-progressbar (1.9.0)
|
||||
rufus-lru (1.1.0)
|
||||
stove (6.0.0)
|
||||
chef-api (~> 0.5)
|
||||
logify (~> 0.2)
|
||||
treetop (1.6.10)
|
||||
polyglot (~> 0.3)
|
||||
unicode-display_width (1.3.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
cookstyle
|
||||
foodcritic
|
||||
rspec-expectations
|
||||
rspec-mocks
|
||||
rubocop
|
||||
stove
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.1
|
||||
@@ -1,11 +1,21 @@
|
||||
[](https://supermarket.chef.io/cookbooks/seven_zip)
|
||||
[](https://ci.appveyor.com/project/ChefWindowsCookbooks65871/seven-zip/branch/master)
|
||||
|
||||
# seven_zip Cookbook
|
||||
|
||||
[](https://supermarket.chef.io/cookbooks/seven_zip)
|
||||
[](https://github.com/sous-chefs/seven_zip/actions?query=workflow%3Aci)
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
[7-Zip](http://www.7-zip.org/) is a file archiver with a high compression ratio. This cookbook installs the full 7-Zip suite of tools (GUI and CLI). This cookbook replaces the older [7-Zip cookbook](https://github.com/sneal/7-zip).
|
||||
|
||||
# Requirements
|
||||
## 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).
|
||||
|
||||
## Requirements
|
||||
|
||||
## Platforms
|
||||
|
||||
- Windows XP
|
||||
- Windows Vista
|
||||
- Windows 7
|
||||
@@ -16,99 +26,37 @@
|
||||
- Windows Server 2012 (R1, R2)
|
||||
|
||||
## Chef
|
||||
- Chef >= 13.0
|
||||
|
||||
## Cookbooks
|
||||
- windows
|
||||
- Chef >= 16.0
|
||||
|
||||
# Attributes
|
||||
## Optional
|
||||
## Usage
|
||||
|
||||
| Key | Type | Description | Default |
|
||||
|-----|------|-------------|---------|
|
||||
| `['seven_zip']['home']` | String | 7-Zip installation directory. | |
|
||||
| `['seven_zip']['syspath']` | Boolean | If true, adds 7-Zip directory to system PATH environment variable. | |
|
||||
| `['seven_zip']['default_extract_timeout']` | Integer | The default timeout for an extract operation in seconds. This can be overridden by a resource attribute. | `600` |
|
||||
## Resources
|
||||
|
||||
# Usage
|
||||
## default
|
||||
- [seven_zip_tool](https://github.com/sous-chefs/seven_zip/blob/master/documentation/resources/seven_zip_tool.md)
|
||||
- [seven_zip_archive](https://github.com/sous-chefs/seven_zip/blob/master/documentation/resources/seven_zip_archive.md)
|
||||
|
||||
Add `seven_zip::default` to your run\_list which will download and install 7-Zip for the current Windows platform.
|
||||
## Contributors
|
||||
|
||||
# Resource/Provider
|
||||
## seven_zip_archive
|
||||
Extracts a 7-Zip compatible archive (iso, zip, 7z, etc.) to the specified destination directory.
|
||||
This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false)
|
||||
|
||||
#### Actions
|
||||
- `:extract` - Extract a 7-Zip compatible archive.
|
||||
### Backers
|
||||
|
||||
#### Attribute Parameters
|
||||
- `path` - Name attribute. The destination to extract to.
|
||||
- `source` - The file path to the archive to extract.
|
||||
- `overwrite` - Defaults to false. If true, the destination files will be overwritten.
|
||||
- `checksum` - The archive file checksum.
|
||||
- `timeout` - The extract action timeout in seconds, defaults to `node['seven_zip']['default_extract_timeout']`.
|
||||
Thank you to all our backers!
|
||||
|
||||
#### Examples
|
||||
Extract 7-Zip source files to `C:\seven_zip_source`.
|
||||

|
||||
|
||||
```ruby
|
||||
seven_zip_archive 'seven_zip_source' do
|
||||
path 'C:\seven_zip_source'
|
||||
source 'https://www.7-zip.org/a/7z1805-src.7z'
|
||||
overwrite true
|
||||
checksum 'd9acfcbbdcad078435586e00f73909358ed8d714d106e064dcba52fa73e75d83'
|
||||
timeout 30
|
||||
end
|
||||
```
|
||||
### Sponsors
|
||||
|
||||
## seven_zip_tool
|
||||
Download and install 7-zip for the current Windows platform.
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
|
||||
|
||||
#### Actions
|
||||
- `:install` - Installs 7-zip
|
||||
- `:add_to_path` - Add 7-zip to the PATH
|
||||
|
||||
#### Attribute Parameters
|
||||
- `package` - The name of the package.
|
||||
- `path` - The install directory of 7-zip.
|
||||
- `source` - The source URL of the 7-zip package.
|
||||
- `checksum` - The 7-zip package checksum.
|
||||
|
||||
#### Examples
|
||||
Install 7-zip in `C:\7z` and add it to the path.
|
||||
|
||||
```ruby
|
||||
seven_zip_tool '7z 15.14 install' do
|
||||
action [:install, :add_to_path]
|
||||
package '7-Zip 15.14'
|
||||
path 'C:\7z'
|
||||
source 'http://www.7-zip.org/a/7z1514.msi'
|
||||
checksum 'eaf58e29941d8ca95045946949d75d9b5455fac167df979a7f8e4a6bf2d39680'
|
||||
end
|
||||
```
|
||||
|
||||
# Recipes
|
||||
## default
|
||||
|
||||
Installs 7-Zip and adds it to your system PATH.
|
||||
|
||||
# License & Authors
|
||||
- Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
- Author:: Shawn Neal (<sneal@sneal.net>)
|
||||
|
||||
```text
|
||||
Copyright:: 2011-2016, Chef Software, Inc.
|
||||
|
||||
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.
|
||||
```
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
version: "3.1.1.{build}-{branch}"
|
||||
|
||||
image: Visual Studio 2013
|
||||
platform: x64
|
||||
|
||||
environment:
|
||||
machine_user: vagrant
|
||||
machine_pass: vagrant
|
||||
KITCHEN_YAML: .kitchen.appveyor.yml
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
# Do not build on tags (GitHub only)
|
||||
skip_tags: true
|
||||
|
||||
#faster cloning
|
||||
clone_depth: 1
|
||||
|
||||
install:
|
||||
- ps: (& cmd /c); iex (irm https://omnitruck.chef.io/install.ps1); Install-Project -Project chefdk -channel stable -version 3.10.1
|
||||
- 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
|
||||
- ps: ((get-content $env:temp/export.cfg) -replace ('PasswordComplexity = 1', 'PasswordComplexity = 0')) | Out-File $env:temp/export.cfg
|
||||
- ps: ((get-content $env:temp/export.cfg) -replace ('MinimumPasswordLength = 8', 'MinimumPasswordLength = 0')) | Out-File $env:temp/export.cfg
|
||||
- ps: secedit /configure /db $env:windir/security/new.sdb /cfg $env:temp/export.cfg /areas SECURITYPOLICY
|
||||
- ps: net user /add $env:machine_user $env:machine_pass
|
||||
- ps: net localgroup administrators $env:machine_user /add
|
||||
|
||||
build_script:
|
||||
- ps: c:\opscode\chefdk\bin\chef.bat shell-init powershell | iex; cmd /c c:\opscode\chefdk\bin\chef.bat --version
|
||||
|
||||
test_script:
|
||||
- c:\opscode\chefdk\bin\cookstyle --version
|
||||
- c:\opscode\chefdk\bin\chef.bat exec foodcritic --version
|
||||
- c:\opscode\chefdk\bin\chef.bat exec rake
|
||||
- c:\opscode\chefdk\bin\chef.bat exec kitchen verify
|
||||
|
||||
deploy: off
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: seven_zip
|
||||
# Attribute:: default
|
||||
#
|
||||
# Copyright:: 2011-2017, Chef Software, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
if node['kernel']['machine'] == 'x86_64'
|
||||
default['seven_zip']['url'] = 'https://www.7-zip.org/a/7z1805-x64.msi'
|
||||
default['seven_zip']['checksum'] = '898c1ca0015183fe2ba7d55cacf0a1dea35e873bf3f8090f362a6288c6ef08d7'
|
||||
default['seven_zip']['package_name'] = '7-Zip 18.05 (x64 edition)'
|
||||
else
|
||||
default['seven_zip']['url'] = 'https://www.7-zip.org/a/7z1805.msi'
|
||||
default['seven_zip']['checksum'] = 'c554238bee18a03d736525e06d9258c9ecf7f64ead7c6b0d1eb04db2c0de30d0'
|
||||
default['seven_zip']['package_name'] = '7-Zip 18.05'
|
||||
end
|
||||
|
||||
default['seven_zip']['default_extract_timeout'] = 600
|
||||
@@ -1,73 +1,85 @@
|
||||
# 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
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# SASS #
|
||||
########
|
||||
.sass-cache
|
||||
.envrc
|
||||
|
||||
# EDITORS #
|
||||
###########
|
||||
\#*
|
||||
.#*
|
||||
*~
|
||||
*.sw[a-z]
|
||||
.project
|
||||
.settings
|
||||
*_flymake
|
||||
*_flymake.*
|
||||
*.bak
|
||||
*.sw[a-z]
|
||||
*.tmproj
|
||||
*~
|
||||
\#*
|
||||
REVISION
|
||||
TAGS*
|
||||
tmtags
|
||||
*_flymake.*
|
||||
*_flymake
|
||||
*.tmproj
|
||||
.project
|
||||
.settings
|
||||
mkmf.log
|
||||
.vscode
|
||||
.editorconfig
|
||||
|
||||
## COMPILED ##
|
||||
##############
|
||||
a.out
|
||||
*.class
|
||||
*.com
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.pyc
|
||||
*.so
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*/rdoc/
|
||||
a.out
|
||||
mkmf.log
|
||||
|
||||
# Testing #
|
||||
###########
|
||||
.watchr
|
||||
.rspec
|
||||
spec/*
|
||||
spec/fixtures/*
|
||||
test/*
|
||||
features/*
|
||||
examples/*
|
||||
Guardfile
|
||||
Procfile
|
||||
.kitchen*
|
||||
.rubocop.yml
|
||||
spec/*
|
||||
Rakefile
|
||||
.travis.yml
|
||||
.foodcritic
|
||||
.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
|
||||
*/.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.gitconfig
|
||||
.gitattributes
|
||||
.gitconfig
|
||||
.github/*
|
||||
.gitignore
|
||||
.gitkeep
|
||||
.gitmodules
|
||||
.svn
|
||||
*/.bzr/*
|
||||
*/.git
|
||||
*/.hg/*
|
||||
*/.svn/*
|
||||
|
||||
@@ -78,19 +90,24 @@ Berksfile.lock
|
||||
cookbooks/*
|
||||
tmp
|
||||
|
||||
# Cookbooks #
|
||||
#############
|
||||
CONTRIBUTING*
|
||||
CHANGELOG*
|
||||
TESTING*
|
||||
MAINTAINERS.toml
|
||||
# Bundler #
|
||||
###########
|
||||
vendor/*
|
||||
Gemfile
|
||||
Gemfile.lock
|
||||
|
||||
# Strainer #
|
||||
############
|
||||
Colanderfile
|
||||
Strainerfile
|
||||
.colander
|
||||
.strainer
|
||||
# Policyfile #
|
||||
##############
|
||||
Policyfile.rb
|
||||
Policyfile.lock.json
|
||||
|
||||
# Documentation #
|
||||
#############
|
||||
CODE_OF_CONDUCT*
|
||||
CONTRIBUTING*
|
||||
documentation/*
|
||||
TESTING*
|
||||
UPGRADING*
|
||||
|
||||
# Vagrant #
|
||||
###########
|
||||
|
||||
15
cookbooks/seven_zip/kitchen.exec.yml
Normal file
15
cookbooks/seven_zip/kitchen.exec.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
driver:
|
||||
name: exec
|
||||
|
||||
transport:
|
||||
name: exec
|
||||
|
||||
provisioner:
|
||||
name: chef_zero
|
||||
enforce_idempotency: true
|
||||
multiple_converge: 2
|
||||
deprecations_as_errors: true
|
||||
|
||||
platforms:
|
||||
- name: windows-latest
|
||||
@@ -1,33 +0,0 @@
|
||||
#
|
||||
# Author:: Shawn Neal (<sneal@sneal.net>)
|
||||
# Cookbook:: visualstudio
|
||||
#
|
||||
# Copyright:: 2015-2017, Shawn Neal
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
if defined?(ChefSpec)
|
||||
chefspec_version = Gem.loaded_specs['chefspec'].version
|
||||
define_method = if chefspec_version < Gem::Version.new('4.1.0')
|
||||
ChefSpec::Runner.method(:define_runner_method)
|
||||
else
|
||||
ChefSpec.method(:define_matcher)
|
||||
end
|
||||
|
||||
define_method.call :seven_zip_archive
|
||||
|
||||
def extract_seven_zip_archive(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:seven_zip_archive, :extract, resource_name)
|
||||
end
|
||||
end
|
||||
@@ -1,32 +1,29 @@
|
||||
{
|
||||
"name": "seven_zip",
|
||||
"description": "Installs/Configures 7-Zip",
|
||||
"long_description": "[](https://supermarket.chef.io/cookbooks/seven_zip)\n[](https://ci.appveyor.com/project/ChefWindowsCookbooks65871/seven-zip/branch/master)\n\n# seven_zip Cookbook\n[7-Zip](http://www.7-zip.org/) is a file archiver with a high compression ratio. This cookbook installs the full 7-Zip suite of tools (GUI and CLI). This cookbook replaces the older [7-Zip cookbook](https://github.com/sneal/7-zip).\n\n# Requirements\n## Platforms\n- Windows XP\n- Windows Vista\n- Windows 7\n- Windows 8, 8.1\n- Windows 10\n- Windows Server 2003 R2\n- Windows Server 2008 (R1, R2)\n- Windows Server 2012 (R1, R2)\n\n## Chef\n- Chef >= 13.0\n\n## Cookbooks\n- windows\n\n# Attributes\n## Optional\n\n| Key | Type | Description | Default |\n|-----|------|-------------|---------|\n| `['seven_zip']['home']` | String | 7-Zip installation directory. | |\n| `['seven_zip']['syspath']` | Boolean | If true, adds 7-Zip directory to system PATH environment variable. | |\n| `['seven_zip']['default_extract_timeout']` | Integer | The default timeout for an extract operation in seconds. This can be overridden by a resource attribute. | `600` |\n\n# Usage\n## default\n\nAdd `seven_zip::default` to your run\\_list which will download and install 7-Zip for the current Windows platform.\n\n# Resource/Provider\n## seven_zip_archive\nExtracts a 7-Zip compatible archive (iso, zip, 7z, etc.) to the specified destination directory.\n\n#### Actions\n- `:extract` - Extract a 7-Zip compatible archive.\n\n#### Attribute Parameters\n- `path` - Name attribute. The destination to extract to.\n- `source` - The file path to the archive to extract.\n- `overwrite` - Defaults to false. If true, the destination files will be overwritten.\n- `checksum` - The archive file checksum.\n- `timeout` - The extract action timeout in seconds, defaults to `node['seven_zip']['default_extract_timeout']`.\n\n#### Examples\nExtract 7-Zip source files to `C:\\seven_zip_source`.\n\n```ruby\nseven_zip_archive 'seven_zip_source' do\n path 'C:\\seven_zip_source'\n source 'https://www.7-zip.org/a/7z1805-src.7z'\n overwrite true\n checksum 'd9acfcbbdcad078435586e00f73909358ed8d714d106e064dcba52fa73e75d83'\n timeout 30\nend\n```\n\n## seven_zip_tool\nDownload and install 7-zip for the current Windows platform.\n\n#### Actions\n- `:install` - Installs 7-zip\n- `:add_to_path` - Add 7-zip to the PATH\n\n#### Attribute Parameters\n- `package` - The name of the package.\n- `path` - The install directory of 7-zip.\n- `source` - The source URL of the 7-zip package.\n- `checksum` - The 7-zip package checksum.\n\n#### Examples\nInstall 7-zip in `C:\\7z` and add it to the path.\n\n```ruby\nseven_zip_tool '7z 15.14 install' do\n action [:install, :add_to_path]\n package '7-Zip 15.14'\n path 'C:\\7z'\n source 'http://www.7-zip.org/a/7z1514.msi'\n checksum 'eaf58e29941d8ca95045946949d75d9b5455fac167df979a7f8e4a6bf2d39680'\nend\n```\n\n# Recipes\n## default\n\nInstalls 7-Zip and adds it to your system PATH.\n\n# License & Authors\n- Author:: Seth Chisamore (<schisamo@chef.io>)\n- Author:: Shawn Neal (<sneal@sneal.net>)\n\n```text\nCopyright:: 2011-2016, Chef Software, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"maintainer": "Shawn Neal",
|
||||
"maintainer_email": "sneal@sneal.net",
|
||||
"long_description": "",
|
||||
"maintainer": "Sous Chefs",
|
||||
"maintainer_email": "help@sous-chefs.org",
|
||||
"license": "Apache-2.0",
|
||||
"platforms": {
|
||||
"windows": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"windows": ">= 0.0.0"
|
||||
},
|
||||
"providing": {
|
||||
|
||||
},
|
||||
"attributes": {
|
||||
"providing": {
|
||||
|
||||
},
|
||||
"recipes": {
|
||||
|
||||
},
|
||||
"version": "3.1.1",
|
||||
"source_url": "https://github.com/windowschefcookbooks/seven_zip",
|
||||
"issues_url": "https://github.com/windowschefcookbooks/seven_zip/issues",
|
||||
"version": "4.2.2",
|
||||
"source_url": "https://github.com/sous-chefs/seven_zip",
|
||||
"issues_url": "https://github.com/sous-chefs/seven_zip/issues",
|
||||
"privacy": false,
|
||||
"chef_versions": [
|
||||
[
|
||||
">= 13.0"
|
||||
">= 15.3"
|
||||
]
|
||||
],
|
||||
"ohai_versions": [
|
||||
@@ -34,5 +31,6 @@
|
||||
],
|
||||
"gems": [
|
||||
|
||||
]
|
||||
],
|
||||
"eager_load_libraries": true
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
name 'seven_zip'
|
||||
maintainer 'Shawn Neal'
|
||||
maintainer_email 'sneal@sneal.net'
|
||||
source_url 'https://github.com/windowschefcookbooks/seven_zip'
|
||||
issues_url 'https://github.com/windowschefcookbooks/seven_zip/issues'
|
||||
chef_version '>= 13.0' if respond_to?(:chef_version)
|
||||
maintainer 'Sous Chefs'
|
||||
maintainer_email 'help@sous-chefs.org'
|
||||
license 'Apache-2.0'
|
||||
description 'Installs/Configures 7-Zip'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '3.1.1'
|
||||
version '4.2.2'
|
||||
source_url 'https://github.com/sous-chefs/seven_zip'
|
||||
issues_url 'https://github.com/sous-chefs/seven_zip/issues'
|
||||
chef_version '>= 15.3'
|
||||
|
||||
supports 'windows'
|
||||
depends 'windows'
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#
|
||||
# Author:: Shawn Neal (<sneal@sneal.net>)
|
||||
# Cookbook:: seven_zip
|
||||
# Provider:: archive
|
||||
#
|
||||
# Copyright:: 2013-2017, Daptiv Solutions 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.
|
||||
#
|
||||
|
||||
require 'fileutils'
|
||||
require 'chef/mixin/shell_out'
|
||||
require 'chef/util/path_helper'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include Windows::Helper
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :extract do
|
||||
converge_by("Extract #{@new_resource.source} => #{@new_resource.path} (overwrite=#{@new_resource.overwrite})") do
|
||||
FileUtils.mkdir_p(@new_resource.path) unless Dir.exist?(@new_resource.path)
|
||||
local_source = cached_file(@new_resource.source, @new_resource.checksum)
|
||||
overwrite_file = @new_resource.overwrite ? ' -y' : ' -aos'
|
||||
cmd = "\"#{seven_zip_exe}\" x"
|
||||
cmd << overwrite_file
|
||||
cmd << " -o\"#{Chef::Util::PathHelper.cleanpath(@new_resource.path)}\""
|
||||
cmd << " \"#{local_source}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, timeout: extract_timeout)
|
||||
end
|
||||
end
|
||||
|
||||
def seven_zip_exe
|
||||
path = node['seven_zip']['home'] || seven_zip_exe_from_registry
|
||||
Chef::Log.debug("Using 7-zip home: #{path}")
|
||||
Chef::Util::PathHelper.cleanpath(::File.join(path, '7z.exe'))
|
||||
end
|
||||
|
||||
def seven_zip_exe_from_registry
|
||||
require 'win32/registry'
|
||||
# Read path from recommended Windows App Paths registry location
|
||||
# docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121
|
||||
::Win32::Registry::HKEY_LOCAL_MACHINE.open(
|
||||
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe',
|
||||
::Win32::Registry::KEY_READ
|
||||
).read_s('Path')
|
||||
end
|
||||
|
||||
def extract_timeout
|
||||
@new_resource.timeout || node['seven_zip']['default_extract_timeout']
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook:: seven_zip
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright:: 2011-2017, Chef Software, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Install 7z and optionally add it to path
|
||||
seven_zip_tool 'install seven_zip' do
|
||||
action [:install, :add_to_path] if node['seven_zip']['syspath']
|
||||
end
|
||||
@@ -1,29 +1,92 @@
|
||||
#
|
||||
# Author:: Shawn Neal (<sneal@sneal.net>)
|
||||
# Cookbook:: seven_zip
|
||||
# Resource:: archive
|
||||
#
|
||||
# Copyright:: 2013-2017, Daptiv Solutions 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.
|
||||
#
|
||||
unified_mode true
|
||||
|
||||
default_action :extract
|
||||
property :path,
|
||||
String,
|
||||
name_property: true,
|
||||
description: 'Path to extract the archive.'
|
||||
|
||||
actions :extract
|
||||
property :source,
|
||||
String,
|
||||
description: 'Source archive location.'
|
||||
|
||||
attribute :path, kind_of: String, name_attribute: true
|
||||
attribute :source, kind_of: String
|
||||
attribute :overwrite, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :checksum, kind_of: String
|
||||
attribute :timeout, kind_of: Integer
|
||||
property :overwrite,
|
||||
[true, false],
|
||||
default: false,
|
||||
description: 'Whether to overwrite the destination files.'
|
||||
|
||||
property :checksum,
|
||||
String,
|
||||
description: 'The checksum for the downloaded file.'
|
||||
|
||||
property :timeout,
|
||||
Integer,
|
||||
default: 600,
|
||||
description: 'Extract timeout in seconds.'
|
||||
|
||||
action :extract do
|
||||
directory new_resource.path
|
||||
|
||||
local_source = cached_file(new_resource.source, new_resource.checksum)
|
||||
|
||||
overwrite_file = new_resource.overwrite ? ' -y' : ' -aos'
|
||||
|
||||
cmd = "\"#{seven_zip_exe}\" x"
|
||||
cmd << overwrite_file
|
||||
cmd << " -o\"#{Chef::Util::PathHelper.cleanpath(new_resource.path)}\""
|
||||
cmd << " \"#{local_source}\""
|
||||
|
||||
Chef::Log.debug(cmd)
|
||||
|
||||
execute "extracting #{new_resource.source}" do
|
||||
command cmd
|
||||
timeout new_resource.timeout
|
||||
end
|
||||
end
|
||||
|
||||
action_class do
|
||||
# require 'chef/mixin/shell_out'
|
||||
# include Chef::Mixin::ShellOut
|
||||
|
||||
def seven_zip_exe
|
||||
path = seven_zip_exe_from_registry
|
||||
Chef::Log.debug("Using 7-zip home: #{path}")
|
||||
Chef::Util::PathHelper.cleanpath(::File.join(path, '7z.exe'))
|
||||
end
|
||||
|
||||
def seven_zip_exe_from_registry
|
||||
require 'win32/registry'
|
||||
# Read path from recommended Windows App Paths registry location
|
||||
# docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121
|
||||
::Win32::Registry::HKEY_LOCAL_MACHINE.open(
|
||||
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe',
|
||||
::Win32::Registry::KEY_READ
|
||||
).read_s('Path')
|
||||
end
|
||||
|
||||
# if a file is local it returns a windows friendly path version
|
||||
# if a file is remote it caches it locally
|
||||
def cached_file(source, checksum = nil)
|
||||
if source =~ %r{^(file|ftp|http|https):\/\/}
|
||||
uri = as_uri(source)
|
||||
cache_file_path = "#{Chef::Config[:file_cache_path]}/#{::File.basename(::CGI.unescape(uri.path))}"
|
||||
Chef::Log.debug("Caching a copy of file #{source} at #{cache_file_path}")
|
||||
|
||||
remote_file cache_file_path do
|
||||
source source
|
||||
backup false
|
||||
checksum checksum unless checksum.nil?
|
||||
end
|
||||
else
|
||||
cache_file_path = source
|
||||
end
|
||||
|
||||
Chef::Util::PathHelper.cleanpath(cache_file_path)
|
||||
end
|
||||
|
||||
def as_uri(source)
|
||||
URI.parse(source)
|
||||
rescue URI::InvalidURIError
|
||||
Chef::Log.warn("#{source} was an invalid URI. Trying to escape invalid characters")
|
||||
URI.parse(URI.escape(source))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
#
|
||||
# Author:: Annih (<b.courtois@criteo.com>)
|
||||
# Cookbook:: seven_zip
|
||||
# Resource:: tool
|
||||
#
|
||||
# Copyright:: 2018, Baptiste Courtois
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
property :package, ::String, default: lazy { node['seven_zip']['package_name'] }
|
||||
property :source, ::String, default: lazy { node['seven_zip']['url'] }
|
||||
property :checksum, [::NilClass, ::String], default: lazy { node['seven_zip']['checksum'] }
|
||||
property :path, [::NilClass, ::String], default: lazy { node['seven_zip']['home'] }
|
||||
unified_mode true
|
||||
|
||||
property :package,
|
||||
String,
|
||||
description: 'Name of the package to install.',
|
||||
default: node['kernel']['machine'] == 'x86_64' ? '7-Zip 19.00 (x64 edition)' : '7-Zip 19.00'
|
||||
|
||||
property :source,
|
||||
String,
|
||||
description: 'Source URL of the package to install.',
|
||||
default: node['kernel']['machine'] == 'x86_64' ? 'https://www.7-zip.org/a/7z1900-x64.msi' : 'https://www.7-zip.org/a/7z1900.msi'
|
||||
|
||||
property :checksum,
|
||||
String,
|
||||
description: 'Checksum for the downloaded pacakge.',
|
||||
default: node['kernel']['machine'] == 'x86_64' ? 'a7803233eedb6a4b59b3024ccf9292a6fffb94507dc998aa67c5b745d197a5dc' : 'b49d55a52bc0eab14947c8982c413d9be141c337da1368a24aa0484cbb5e89cd'
|
||||
|
||||
property :path,
|
||||
String,
|
||||
description: 'Optional: path to install 7zip to.'
|
||||
|
||||
action :install do
|
||||
windows_package new_resource.package do
|
||||
@@ -38,6 +35,12 @@ action :add_to_path do
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
windows_package new_resource.package do
|
||||
action :remove
|
||||
end
|
||||
end
|
||||
|
||||
action_class do
|
||||
REG_PATH = 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe'.freeze
|
||||
|
||||
|
||||
Reference in New Issue
Block a user