Get rid of compat_resource and mariadb
This commit is contained in:
5
cookbooks/homebrew/.markdownlint-cli2.yaml
Normal file
5
cookbooks/homebrew/.markdownlint-cli2.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
config:
|
||||
ul-indent: false # MD007
|
||||
line-length: false # MD013
|
||||
no-duplicate-heading: false # MD024
|
||||
reference-links-images: false # MD052
|
||||
@@ -2,6 +2,177 @@
|
||||
|
||||
This file is used to list changes made in each version of the homebrew cookbook.
|
||||
|
||||
## 5.4.1 - *2023-06-01*
|
||||
|
||||
## 5.4.0 - *2023-04-24*
|
||||
|
||||
- Add temporary sudoers entry to fix homebrew installation
|
||||
|
||||
## 5.3.8 - *2023-04-16*
|
||||
|
||||
Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.7 - *2023-04-04*
|
||||
|
||||
- Sous Chefs adoption
|
||||
- Update lint-unit workflow to 2.0.2
|
||||
- Set unified_mode for all resources
|
||||
- Require Chef 15.3+ for unified_mode
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.6 - *2023-04-01*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.5 - *2023-03-02*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.4 - *2023-02-20*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.4 - *2023-02-20*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.3 - *2023-02-14*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.3.2 - *2022-12-15*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
- Fix workflow CI
|
||||
|
||||
## 5.3.1 - *2022-02-10*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
- Remove delivery folder
|
||||
|
||||
## 5.3.0 - *2021-12-21*
|
||||
|
||||
- Update to support Apple M1 silicon (arm64) Homebrew install location (`/opt/homebrew`)
|
||||
- Add HomebrewWrapper.repository_path() for homebrew_tap resource idempotency
|
||||
- Add HomebrewWrapper.repository_path() helper for Apple M1 silicon (arm64)
|
||||
- Remove deprecated `--full` option for Homebrew (Breaking upstream CLI change!)
|
||||
- Add chefspec tests for Apple M1 silicon Homebrew path helper
|
||||
- Add InSpec tests for macOS M1 / arm64 and x86_64
|
||||
- Set `use_sudo: false` for InSpec tests to work properly
|
||||
- Convert hardcoded /usr/local to use install_path() for M1 /opt/homebrew support
|
||||
- Add Homebrew.install_path() helper for Apple M1 silicon (arm64)
|
||||
|
||||
## 5.2.2 - *2021-08-30*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.2.1 - *2021-06-01*
|
||||
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.2.0 - *2021-01-24*
|
||||
|
||||
- Sous Chefs Adoption
|
||||
- Standardise files with files in sous-chefs/repo-management
|
||||
|
||||
## 5.1.1 (2021-01-04)
|
||||
|
||||
- Update to use --cask instead of cask command for compatibility with newer homebrew releases- [@tas50](https://github.com/tas50)
|
||||
- resolved cookstyle error: resources/cask.rb:23:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName`
|
||||
- resolved cookstyle error: resources/tap.rb:23:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName`
|
||||
|
||||
## 5.1.0 (2020-05-15)
|
||||
|
||||
- Rename the kitchen config - [@tas50](https://github.com/tas50)
|
||||
- Cookstyle fixes - [@tas50](https://github.com/tas50)
|
||||
- OS X -> macOS in the readme - [@tas50](https://github.com/tas50)
|
||||
- Require Chef 12.15+ - [@tas50](https://github.com/tas50)
|
||||
- Update default install script from ruby to bash - [@bbros-dev](https://github.com/bbros-dev)
|
||||
- Resole chefspec failures - [@tas50](https://github.com/tas50)
|
||||
|
||||
## 5.0.8 (2018-10-04)
|
||||
|
||||
- Updates homebrew cask tap to homebrew/cask
|
||||
- Updates URLs to the homebrew cask repository
|
||||
|
||||
## 5.0.7 (2018-09-26)
|
||||
|
||||
- Fix cask resource running each chef-client run
|
||||
|
||||
## 5.0.6 (2018-09-26)
|
||||
|
||||
- Avoid CHEF-25 Deprecation warnings by making the tap/cask resources no-ops on modern chef-client releases
|
||||
|
||||
## 5.0.5 (2018-09-04)
|
||||
|
||||
- Update name of macos in kitchen config
|
||||
- Add deprecation notice for the homebrew_tap and homebrew_cask resources. These resources are now built into Chef 14 and they will be removed from this cookbook when Chef 13 goes EOL, April 2019.
|
||||
|
||||
## 5.0.4 (2018-03-16)
|
||||
|
||||
- Fix backwards logic in the cask install action
|
||||
|
||||
## 5.0.3 (2018-03-09)
|
||||
|
||||
- Resolve method missing errors in the library
|
||||
|
||||
## 5.0.2 (2018-03-09)
|
||||
|
||||
- Remove some legacy logic around the Chef Homebrew user module
|
||||
- Use lazy to prevent compilation failures on non-macOS platforms
|
||||
|
||||
## 5.0.1 (2018-03-08)
|
||||
|
||||
- Added a cask_name and tap_name property to the cask/tap resources. These are name_properties which allow you to set the tap/cask name to something other than the resources name. Handy for avoiding resource cloning.
|
||||
|
||||
## 5.0.0 (2018-03-08)
|
||||
|
||||
- Added a new homebrew_path property to cask/tap for the homebrew binary
|
||||
- Added a new owner property to cash/tap for setting the homebrew owner
|
||||
- Converted execute resources in the resources to converge_by and shellout to provide better converge messaging in line with other core Chef resources=
|
||||
- Renamed the :uninstall action in the cask resource to :remove. This aligns with other chef package resources. The previous action will continue to function.
|
||||
- Fully documented the resource actions and properties in the readme
|
||||
- Removed deprecated taps out of the test recipe
|
||||
- Removed the ChefSpec matchers that are now autogenerated by ChefSpec in modern releases of ChefDK. If this causes failures you need to upgrade ChefDK
|
||||
|
||||
## 4.3.0 (2018-01-13)
|
||||
|
||||
- Allow Cask name to be scoped to tap
|
||||
- Disable Foodcrtiic's FC108 since it doesn't apply here
|
||||
- Automatically install caskroom/cask in the cask resource. This eliminates the need for the cask recipe.
|
||||
- Resolve Chef 14 deprecation warnings
|
||||
|
||||
## 4.2.2 (2018-01-13)
|
||||
|
||||
- Fix failures in the cask resource
|
||||
- Improve inspec output for file mode test
|
||||
|
||||
## 4.2.1 (2018-01-13)
|
||||
|
||||
- Remove double shellout from a bad merge
|
||||
- Test on modern macOS releases
|
||||
- Use full file modes throughout the recipes
|
||||
- Add 2 retries for downloading the homebrew script in case it fails
|
||||
|
||||
## 4.2.0 (2017-05-30)
|
||||
|
||||
- Remove class_eval and require Chef 12.7+
|
||||
|
||||
## 4.1.0 (2017-04-25)
|
||||
|
||||
- Extend the tap resource to use the --full option. See the readme for details and examples
|
||||
|
||||
## 4.0.0 (2017-04-19)
|
||||
|
||||
- Convert the tap and cask resources from LWRPs to custom resources which simplifies the code and fixes an incompatibility with Chef 13
|
||||
- Uses the homebrew_owner as the user to check if a cask has been casked
|
||||
- Fixed the location of the tap dir to properly prevent trying to install a tap twice
|
||||
- Refactor the mixin to be a simpler helper that is easier to test
|
||||
- Resolved failures in the Chefspecs on Travis
|
||||
- Test with Local Delivery and not Rake
|
||||
- Use standardize Apache 2 license string
|
||||
- Only check if homebrew exists once in the default recipe
|
||||
|
||||
## 3.0.0 (2016-12-19)
|
||||
|
||||
- The homebrew package provider has been removed from this cookbook. It ships with Chef 12.0+. This cookbook now requires a minimum of Chef 12.1 or later.
|
||||
@@ -134,7 +305,7 @@ Bug Fixes:
|
||||
|
||||
## v1.7.0 (2014-06-26)
|
||||
|
||||
# 38 - Add homebrew::cask recipe
|
||||
- Add homebrew::cask recipe (#38)
|
||||
|
||||
## v1.6.6 (2014-05-29)
|
||||
|
||||
@@ -169,13 +340,13 @@ Bug Fixes:
|
||||
|
||||
### Bug
|
||||
|
||||
- **[COOK-3589](https://tickets.chef.io/browse/COOK-3589)** - Add homebrew as the default package manager on OS X Server
|
||||
- [COOK-3589] - Add homebrew as the default package manager on OS X Server
|
||||
|
||||
## v1.4.0
|
||||
|
||||
### Bug
|
||||
|
||||
- **[COOK-3283](https://tickets.chef.io/browse/COOK-3283)** - Support running homebrew cookbook as root user, with sudo, or a non-privileged user
|
||||
- [COOK-3283] - Support running homebrew cookbook as root user, with sudo, or a non-privileged user
|
||||
|
||||
## v1.3.2
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
||||
202
cookbooks/homebrew/LICENSE
Normal file
202
cookbooks/homebrew/LICENSE
Normal file
@@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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,15 +0,0 @@
|
||||
<!-- This is a generated file. Please do not edit directly -->
|
||||
|
||||
# Maintainers
|
||||
|
||||
This file lists how this cookbook project is maintained. When making changes to the system, this file tells you who needs to review your patch - you need a review from an existing maintainer for the cookbook to provide a :+1: on your pull request. Additionally, you need to not receive a veto from a Lieutenant or the Project Lead.
|
||||
|
||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) for details on the process and how to become a maintainer or the project lead.
|
||||
|
||||
# Project Maintainer
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
|
||||
# Maintainers
|
||||
* [Jennifer Davis](https://github.com/sigje)
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
* [Thom May](https://github.com/thommay)
|
||||
@@ -1,9 +1,19 @@
|
||||
# Homebrew Cookbook
|
||||
|
||||
[](http://travis-ci.org/chef-cookbooks/homebrew) [](https://supermarket.chef.io/cookbooks/homebrew)
|
||||
[](https://supermarket.chef.io/cookbooks/homebrew)
|
||||
[](https://github.com/sous-chefs/homebrew/actions?query=workflow%3Aci)
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
This cookbook installs [Homebrew](http://brew.sh/) and provides resources for working with taps and casks
|
||||
|
||||
Note: The `homebrew_tap` and `homebrew_cask` resources shipped in Chef 14.0. When Chef 15.0 is released in April 2019 these resources will be removed from this cookbook as all users should be on 14.0 or later.
|
||||
|
||||
## 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
|
||||
@@ -12,59 +22,52 @@ This cookbook installs [Homebrew](http://brew.sh/) and provides resources for wo
|
||||
|
||||
### Chef
|
||||
|
||||
- Chef 12.1+
|
||||
- Chef 12.7+
|
||||
|
||||
### Cookbooks
|
||||
|
||||
- none
|
||||
|
||||
## Attributes
|
||||
|
||||
- `node['homebrew']['owner']` - The user that will own the Homebrew installation and packages. Setting this will override the default behavior which is to use the non-privileged user that has invoked the Chef run (or the `SUDO_USER` if invoked with sudo). The default is `nil`.
|
||||
- `node['homebrew']['auto-update']` - Whether the default recipe should automatically update Homebrew each run or not. The default is `true` to maintain compatibility. Set to false or nil to disable. Note that disabling this feature may cause formula to not work.
|
||||
- `node['homebrew']['formulas']` - An Array of formula that should be installed using Homebrew by default, used only in the `homebrew::install_formulas` recipe.
|
||||
|
||||
- To install the most recent version, include just the recipe name: `- simple_formula`
|
||||
- To install a specific version, specify both its name and version:
|
||||
|
||||
```
|
||||
- name: special-version-formula
|
||||
version: 1.2.3
|
||||
```
|
||||
|
||||
- To install the HEAD of a formula, specify both its name and `head: true`:
|
||||
|
||||
```
|
||||
- name: head-tracking-formula
|
||||
head: true
|
||||
```
|
||||
|
||||
- To provide other options, specify both its name and options
|
||||
|
||||
```
|
||||
- name: formula-with-options
|
||||
options: --with-option-1 --with-other-option
|
||||
```
|
||||
|
||||
- `node['homebrew']['casks']` - An Array of casks that should be installed using brew cask by default, used only in the `homebrew::install_casks` recipe.
|
||||
|
||||
- `node['homebrew']['taps']` - An Array of taps that should be installed using brew tap by default, used only in the `homebrew::install_taps` recipe.
|
||||
|
||||
## Resources (provider)
|
||||
## Resources
|
||||
|
||||
### homebrew_tap
|
||||
|
||||
LWRP for `brew tap`, a Homebrew command used to add additional formula repositories. From the `brew` man page:
|
||||
Resource for `brew tap`, a Homebrew command used to add additional formula repositories. From the `brew` man page:
|
||||
|
||||
```text
|
||||
tap [tap]
|
||||
Tap a new formula repository from GitHub, or list existing taps.
|
||||
brew tap [--full] user/repo [URL]
|
||||
Tap a formula repository.
|
||||
|
||||
tap is of the form user/repo, e.g. brew tap homebrew/dupes.
|
||||
With URL unspecified, taps a formula repository from GitHub using HTTPS.
|
||||
Since so many taps are hosted on GitHub, this command is a shortcut for
|
||||
tap user/repo https://github.com/user/homebrew-repo.
|
||||
|
||||
With URL specified, taps a formula repository from anywhere, using
|
||||
any transport protocol that git handles. The one-argument form of tap
|
||||
simplifies but also limits. This two-argument command makes no
|
||||
assumptions, so taps can be cloned from places other than GitHub and
|
||||
using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC.
|
||||
|
||||
By default, the repository is cloned as a shallow copy (--depth=1), but
|
||||
if --full is passed, a full clone will be used. To convert a shallow copy
|
||||
to a full copy, you can retap passing --full without first untapping.
|
||||
```
|
||||
|
||||
Default action is `:tap` which enables the repository. Use `:untap` to disable a tapped repository.
|
||||
|
||||
#### Actions
|
||||
|
||||
- `:tap` (default) - Add a tap
|
||||
- `:untap` - Remove a tap
|
||||
|
||||
#### Properties
|
||||
|
||||
- `:tap_name` - Optional name property to override the resource name value
|
||||
- `:url` - Optional URL to the tap
|
||||
- `:full` - Perform a full clone rather than a shallow clone on the tap (default: false)
|
||||
- `:homebrew_path` - the path to the homebrew binary (default: '/opt/homebrew/bin/brew')
|
||||
- `:owner` - the owner of the homebrew installation (default: calculated based on existing files)
|
||||
|
||||
#### Examples
|
||||
|
||||
```ruby
|
||||
@@ -73,75 +76,114 @@ homebrew_tap 'homebrew/dupes'
|
||||
homebrew_tap 'homebrew/dupes' do
|
||||
action :untap
|
||||
end
|
||||
|
||||
homebrew_tap "Let's install homebrew/dupes" do
|
||||
tap_name 'homebrew/dupes'
|
||||
url 'https://github.com/homebrew/homebrew-dupes.git'
|
||||
full true
|
||||
end
|
||||
```
|
||||
|
||||
### homebrew_cask
|
||||
|
||||
LWRP for `brew cask`, a Homebrew-style CLI workflow for the administration of Mac applications distributed as binaries. It's implemented as a homebrew "external command" called cask.
|
||||
Resource for `brew cask`, a Homebrew-style CLI workflow for the administration of Mac applications distributed as binaries. It's implemented as a homebrew "external command" called cask.
|
||||
|
||||
[homebrew-cask on GitHub](https://github.com/caskroom/homebrew-cask)
|
||||
[homebrew-cask on GitHub](https://github.com/Homebrew/homebrew-cask)
|
||||
|
||||
#### Prerequisites
|
||||
#### Actions
|
||||
|
||||
You must have the homebrew-cask repository tapped.
|
||||
- `:install` (default) - install an Application
|
||||
- `:remove` - remove an Application.
|
||||
|
||||
#### Properties
|
||||
|
||||
- `:cask_name` - Optional name property to override the resource name value
|
||||
- `:options` - options to pass to the brew CLI during installation
|
||||
- `:install_cask` - auto install cask tap if necessary (default: true)
|
||||
- `:homebrew_path` - the path to the homebrew binary (default: '/opt/homebrew/bin/brew')
|
||||
- `:owner` - the owner of the homebrew installation (default: calculated based on existing files)
|
||||
|
||||
#### Examples
|
||||
|
||||
```ruby
|
||||
homebrew_tap 'caskroom/cask'
|
||||
```
|
||||
homebrew_cask 'google-chrome'
|
||||
|
||||
And then install the homebrew cask package before using this LWRP.
|
||||
|
||||
```ruby
|
||||
package "brew-cask" do
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
You can include the `homebrew::cask` recipe to do this.
|
||||
|
||||
### Examples
|
||||
|
||||
```ruby
|
||||
homebrew_cask "google-chrome"
|
||||
|
||||
homebrew_cask "google-chrome" do
|
||||
action :uncask
|
||||
homebrew_cask "Let's remove google-chrome" do
|
||||
cask_name 'google-chrome'
|
||||
install_cask false
|
||||
action :remove
|
||||
end
|
||||
```
|
||||
|
||||
Default action is `:cask` which installs the Application binary . Use `:uncask` to uninstall a an Application.
|
||||
[View the list of available Casks](https://github.com/Homebrew/homebrew-cask/tree/master/Casks)
|
||||
|
||||
[View the list of available Casks](https://github.com/caskroom/homebrew-cask/tree/master/Casks)
|
||||
## Attributes
|
||||
|
||||
# Usage
|
||||
- `node['homebrew']['owner']` - The user that will own the Homebrew installation and packages. Setting this will override the default behavior which is to use the non-privileged user that has invoked the Chef run (or the `SUDO_USER` if invoked with sudo). The default is `nil`.
|
||||
- `node['homebrew']['auto-update']` - Whether the default recipe should automatically update Homebrew each run or not. The default is `true` to maintain compatibility. Set to false or nil to disable. Note that disabling this feature may cause formula to not work.
|
||||
- `node['homebrew']['formulas']` - An Array of formula that should be installed using Homebrew by default, used only in the `homebrew::install_formulas` recipe.
|
||||
|
||||
We strongly recommend that you put "recipe[homebrew]" in your node's run list, to ensure that it is available on the system and that Homebrew itself gets installed. Putting an explicit dependency in the metadata will cause the cookbook to be downloaded and the library loaded, thus resulting in changing the package provider on Mac OS X, so if you have systems you want to use the default (Mac Ports), they would be changed to Homebrew.
|
||||
- To install the most recent version, include just the recipe name: `- simple_formula`
|
||||
- To install a specific version, specify both its name and version:
|
||||
|
||||
The default recipe also ensures that Homebrew is installed and up to date if the auto update attribute (above) is true (default).
|
||||
```yaml
|
||||
- name: special-version-formula
|
||||
version: 1.2.3
|
||||
```
|
||||
|
||||
## License and Authors
|
||||
- To install the HEAD of a formula, specify both its name and `head: true`:
|
||||
|
||||
This cookbook is maintained by CHEF. The original author, maintainer and copyright holder is Graeme Mathieson. The cookbook remains licensed under the Apache License version 2.
|
||||
```yaml
|
||||
- name: head-tracking-formula
|
||||
head: true
|
||||
```
|
||||
|
||||
[Original blog post by Graeme](https://woss.name/articles/converging-your-home-directory-with-chef/)
|
||||
- To provide other options, specify both its name and options
|
||||
|
||||
Author:: Graeme Mathieson ([mathie@woss.name](mailto:mathie@woss.name))
|
||||
```yaml
|
||||
- name: formula-with-options
|
||||
options: --with-option-1 --with-other-option
|
||||
```
|
||||
|
||||
Author:: Joshua Timberman ([joshua@chef.io](mailto:joshua@chef.io))
|
||||
- `node['homebrew']['casks']` - An Array of casks that should be installed using brew cask by default, used only in the `homebrew::install_casks` recipe.
|
||||
|
||||
```text
|
||||
Copyright:: 2011, Graeme Mathieson
|
||||
Copyright:: 2012-2016, Chef Software, Inc. <legal@chef.io>
|
||||
- `node['homebrew']['taps']` - An Array of taps that should be installed using brew tap by default, used only in the `homebrew::install_taps` recipe. For example:
|
||||
|
||||
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
|
||||
```ruby
|
||||
[
|
||||
'homebrew/science',
|
||||
# 'tap' is the only required key for the Hash
|
||||
{ 'tap' => 'homebrew/dupes', 'url' => 'https://github.com', 'full' => true }
|
||||
]
|
||||
```
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
## Usage
|
||||
|
||||
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.
|
||||
```
|
||||
We strongly recommend that you put "recipe[homebrew]" in your node's run list, to ensure that it is available on the system and that Homebrew itself gets installed. Putting an explicit dependency in the metadata will cause the cookbook to be downloaded and the library loaded, thus resulting in changing the package provider on macOS, so if you have systems you want to use the default (Mac Ports), they would be changed to Homebrew.
|
||||
|
||||
The default recipe also ensures that Homebrew is installed and up to date if the auto-update attribute (above) is true (default).
|
||||
|
||||
## Contributors
|
||||
|
||||
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!
|
||||
|
||||

|
||||
|
||||
### Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright:: 2011-2016, Chef Software, Inc.
|
||||
# Copyright:: 2011-2019, 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.
|
||||
@@ -24,6 +24,6 @@ default['homebrew']['auto-update'] = true
|
||||
default['homebrew']['casks'] = []
|
||||
default['homebrew']['formulas'] = node['homebrew']['formula'] || []
|
||||
default['homebrew']['taps'] = []
|
||||
default['homebrew']['installer']['url'] = 'https://raw.githubusercontent.com/Homebrew/install/master/install'
|
||||
default['homebrew']['installer']['url'] = 'https://raw.githubusercontent.com/Homebrew/install/master/install.sh'
|
||||
default['homebrew']['installer']['checksum'] = nil
|
||||
default['homebrew']['enable-analytics'] = true
|
||||
|
||||
115
cookbooks/homebrew/chefignore
Normal file
115
cookbooks/homebrew/chefignore
Normal file
@@ -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
|
||||
99
cookbooks/homebrew/libraries/helpers.rb
Normal file
99
cookbooks/homebrew/libraries/helpers.rb
Normal file
@@ -0,0 +1,99 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<jtimberman@chef.io>)
|
||||
# Author:: Graeme Mathieson (<mathie@woss.name>)
|
||||
# Cookbook:: homebrew
|
||||
# Library:: helpers
|
||||
#
|
||||
# Copyright:: 2011-2019, 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.
|
||||
#
|
||||
|
||||
class HomebrewUserWrapper
|
||||
require 'chef/mixin/homebrew_user'
|
||||
include Chef::Mixin::HomebrewUser
|
||||
end
|
||||
|
||||
module Homebrew
|
||||
extend self
|
||||
|
||||
require 'mixlib/shellout'
|
||||
include Chef::Mixin::ShellOut
|
||||
|
||||
def self.included(base)
|
||||
base.extend(Homebrew)
|
||||
end
|
||||
|
||||
def install_path
|
||||
arm64_test = shell_out('sysctl -n hw.optional.arm64')
|
||||
if arm64_test.stdout.chomp == '1'
|
||||
'/opt/homebrew'
|
||||
else
|
||||
'/usr/local'
|
||||
end
|
||||
end
|
||||
|
||||
def repository_path
|
||||
arm64_test = shell_out('sysctl -n hw.optional.arm64')
|
||||
if arm64_test.stdout.chomp == '1'
|
||||
'/opt/homebrew'
|
||||
else
|
||||
'/usr/local/Homebrew'
|
||||
end
|
||||
end
|
||||
|
||||
def exist?
|
||||
Chef::Log.debug('Checking to see if the homebrew binary exists')
|
||||
::File.exist?("#{HomebrewWrapper.new.install_path}/bin/brew")
|
||||
end
|
||||
|
||||
def owner
|
||||
@owner ||= begin
|
||||
# once we only support 14.0 we can switch this to find_homebrew_username
|
||||
require 'etc'
|
||||
::Etc.getpwuid(HomebrewUserWrapper.new.find_homebrew_uid).name
|
||||
rescue Chef::Exceptions::CannotDetermineHomebrewOwner
|
||||
calculate_owner
|
||||
end.tap do |owner|
|
||||
Chef::Log.debug("Homebrew owner is #{owner}")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def calculate_owner
|
||||
owner = homebrew_owner_attr || sudo_user || current_user
|
||||
if owner == 'root'
|
||||
raise Chef::Exceptions::User,
|
||||
"Homebrew owner is 'root' which is not supported. " \
|
||||
"To set an explicit owner, please set node['homebrew']['owner']."
|
||||
end
|
||||
owner
|
||||
end
|
||||
|
||||
def homebrew_owner_attr
|
||||
Chef.node['homebrew']['owner']
|
||||
end
|
||||
|
||||
def sudo_user
|
||||
ENV['SUDO_USER']
|
||||
end
|
||||
|
||||
def current_user
|
||||
ENV['USER']
|
||||
end
|
||||
end unless defined?(Homebrew)
|
||||
|
||||
class HomebrewWrapper
|
||||
include Homebrew
|
||||
end
|
||||
@@ -1,63 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<jtimberman@chef.io>)
|
||||
# Author:: Graeme Mathieson (<mathie@woss.name>)
|
||||
# Cookbook:: homebrew
|
||||
# Libraries:: homebrew_mixin
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
class Chef12HomebrewUser
|
||||
include Chef::Mixin::HomebrewUser
|
||||
end
|
||||
|
||||
module Homebrew
|
||||
# Homebrew
|
||||
module Mixin
|
||||
def homebrew_owner
|
||||
require 'etc'
|
||||
@homebrew_owner ||= ::Etc.getpwuid(Chef12HomebrewUser.new.find_homebrew_uid).name
|
||||
rescue Chef::Exceptions::CannotDetermineHomebrewOwner
|
||||
@homebrew_owner ||= calculate_owner
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def calculate_owner
|
||||
owner = homebrew_owner_attr || sudo_user || current_user
|
||||
if owner == 'root'
|
||||
raise Chef::Exceptions::User,
|
||||
"Homebrew owner is 'root' which is not supported. " \
|
||||
"To set an explicit owner, please set node['homebrew']['owner']."
|
||||
end
|
||||
owner
|
||||
end
|
||||
|
||||
def homebrew_owner_attr
|
||||
node['homebrew']['owner']
|
||||
end
|
||||
|
||||
def sudo_user
|
||||
ENV['SUDO_USER']
|
||||
end
|
||||
|
||||
def current_user
|
||||
ENV['USER']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Chef::Resource.send(:include, Homebrew::Mixin)
|
||||
Chef::Recipe.send(:include, Homebrew::Mixin)
|
||||
@@ -1,28 +0,0 @@
|
||||
if defined?(ChefSpec)
|
||||
ChefSpec.define_matcher :homebrew_package
|
||||
|
||||
def tap_homebrew_tap(tap)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:homebrew_tap, :tap, tap)
|
||||
end
|
||||
|
||||
def untap_homebrew_tap(tap)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:homebrew_tap, :untap, tap)
|
||||
end
|
||||
|
||||
def cask_homebrew_cask(cask)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:homebrew_cask, :cask, cask)
|
||||
end
|
||||
|
||||
def uncask_homebrew_cask(cask)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:homebrew_cask, :uncask, cask)
|
||||
end
|
||||
|
||||
def install_homebrew_cask(cask)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:homebrew_cask, :install, cask)
|
||||
end
|
||||
|
||||
def uninstall_homebrew_cask(cask)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:homebrew_cask, :uninstall, cask)
|
||||
end
|
||||
|
||||
end
|
||||
File diff suppressed because one or more lines are too long
11
cookbooks/homebrew/metadata.rb
Normal file
11
cookbooks/homebrew/metadata.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
name 'homebrew'
|
||||
maintainer 'Sous Chefs'
|
||||
maintainer_email 'help@sous-chefs.org'
|
||||
license 'Apache-2.0'
|
||||
description 'Install Homebrew and includes resources for working with taps and casks'
|
||||
version '5.4.1'
|
||||
supports 'mac_os_x'
|
||||
|
||||
source_url 'https://github.com/sous-chefs/homebrew'
|
||||
issues_url 'https://github.com/sous-chefs/homebrew/issues'
|
||||
chef_version '>= 15.3'
|
||||
@@ -1,47 +0,0 @@
|
||||
#
|
||||
# Cookbook:: homebrew
|
||||
# Providers:: cask
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include ::Homebrew::Mixin
|
||||
|
||||
use_inline_resources
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :install do
|
||||
execute "installing cask #{new_resource.name}" do
|
||||
command "/usr/local/bin/brew cask install #{new_resource.name} #{new_resource.options}"
|
||||
user homebrew_owner
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
not_if { new_resource.casked? }
|
||||
end
|
||||
end
|
||||
|
||||
action :uninstall do
|
||||
execute "uninstalling cask #{new_resource.name}" do
|
||||
command "/usr/local/bin/brew cask uninstall #{new_resource.name}"
|
||||
user homebrew_owner
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
only_if { new_resource.casked? }
|
||||
end
|
||||
end
|
||||
|
||||
alias_method :action_cask, :action_install
|
||||
alias_method :action_uncask, :action_uninstall
|
||||
@@ -1,58 +0,0 @@
|
||||
#
|
||||
# Author:: Joshua Timberman (<jtimberman@chef.io>)
|
||||
# Author:: Graeme Mathieson (<mathie@woss.name>)
|
||||
# Cookbook:: homebrew
|
||||
# Providers:: tap
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include ::Homebrew::Mixin
|
||||
|
||||
use_inline_resources
|
||||
|
||||
def load_current_resource
|
||||
@tap = Chef::Resource::HomebrewTap.new(new_resource.name)
|
||||
tap_dir = @tap.name.gsub('/', '/homebrew-')
|
||||
|
||||
Chef::Log.debug("Checking whether we've already tapped #{new_resource.name}")
|
||||
if ::File.directory?("/usr/local/Library/Taps/#{tap_dir}")
|
||||
@tap.tapped true
|
||||
else
|
||||
@tap.tapped false
|
||||
end
|
||||
end
|
||||
|
||||
action :tap do
|
||||
unless @tap.tapped
|
||||
execute "tapping #{new_resource.name}" do
|
||||
command "/usr/local/bin/brew tap #{new_resource.name}"
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
not_if "/usr/local/bin/brew tap | grep #{new_resource.name}"
|
||||
user homebrew_owner
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :untap do
|
||||
if @tap.tapped
|
||||
execute "untapping #{new_resource.name}" do
|
||||
command "/usr/local/bin/brew untap #{new_resource.name}"
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
only_if "/usr/local/bin/brew tap | grep #{new_resource.name}"
|
||||
user homebrew_owner
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -2,7 +2,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Recipes:: cask
|
||||
#
|
||||
# Copyright:: 2014-2016, Chef Software, Inc <legal@chef.io>
|
||||
# Copyright:: 2014-2019, Chef Software, Inc <legal@chef.io>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,10 +17,10 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
homebrew_tap 'caskroom/cask'
|
||||
homebrew_tap 'homebrew/cask'
|
||||
|
||||
directory '/Library/Caches/Homebrew/Casks' do
|
||||
owner homebrew_owner
|
||||
mode '775'
|
||||
owner Homebrew.owner
|
||||
mode '0775'
|
||||
only_if { ::Dir.exist?('/Library/Caches/Homebrew') }
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright:: 2011-2016, Chef Software, Inc.
|
||||
# Copyright:: 2011-2019, 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.
|
||||
@@ -19,29 +19,50 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
homebrew_go = "#{Chef::Config[:file_cache_path]}/homebrew_go"
|
||||
unless Homebrew.exist?
|
||||
homebrew_go = "#{Chef::Config[:file_cache_path]}/homebrew_go"
|
||||
|
||||
Chef::Log.debug("Homebrew owner is '#{homebrew_owner}'")
|
||||
# Grant Homebrew install script permission to execute
|
||||
# without passing a sudo password. Deletes itself at
|
||||
# the end of a successful run.
|
||||
sudo 'nopasswd_homebrew_installer' do
|
||||
user Homebrew.owner
|
||||
commands [
|
||||
homebrew_go,
|
||||
'/bin/chmod',
|
||||
'/bin/mkdir',
|
||||
'/bin/rm',
|
||||
'/usr/bin/chgrp',
|
||||
'/usr/bin/install',
|
||||
'/usr/bin/touch',
|
||||
'/usr/bin/xcode-select',
|
||||
'/usr/sbin/chown',
|
||||
'/usr/sbin/softwareupdate',
|
||||
]
|
||||
nopasswd true
|
||||
action :create
|
||||
notifies :delete, 'sudo[nopasswd_homebrew_installer]', :delayed
|
||||
end
|
||||
|
||||
remote_file homebrew_go do
|
||||
source node['homebrew']['installer']['url']
|
||||
checksum node['homebrew']['installer']['checksum'] unless node['homebrew']['installer']['checksum'].nil?
|
||||
mode '755'
|
||||
not_if { ::File.exist? '/usr/local/bin/brew' }
|
||||
end
|
||||
remote_file homebrew_go do
|
||||
source node['homebrew']['installer']['url']
|
||||
checksum node['homebrew']['installer']['checksum'] unless node['homebrew']['installer']['checksum'].nil?
|
||||
mode '0755'
|
||||
retries 2
|
||||
end
|
||||
|
||||
execute 'install homebrew' do
|
||||
command homebrew_go
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
user homebrew_owner
|
||||
not_if { ::File.exist? '/usr/local/bin/brew' }
|
||||
execute 'install homebrew' do
|
||||
command homebrew_go
|
||||
environment lazy { { 'HOME' => ::Dir.home(Homebrew.owner), 'USER' => Homebrew.owner, 'NONINTERACTIVE' => '1' } }
|
||||
user Homebrew.owner
|
||||
end
|
||||
end
|
||||
|
||||
execute 'set analytics' do
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
user homebrew_owner
|
||||
command "/usr/local/bin/brew analytics #{node['homebrew']['enable-analytics'] ? 'on' : 'off'}"
|
||||
only_if { shell_out('/usr/local/bin/brew analytics state', user: homebrew_owner).stdout.include?('enabled') != node['homebrew']['enable-analytics'] }
|
||||
environment lazy { { 'HOME' => ::Dir.home(Homebrew.owner), 'USER' => Homebrew.owner } }
|
||||
user Homebrew.owner
|
||||
command lazy { "#{HomebrewWrapper.new.install_path}/bin/brew analytics #{node['homebrew']['enable-analytics'] ? 'on' : 'off'}" }
|
||||
only_if { shell_out("#{HomebrewWrapper.new.install_path}/bin/brew analytics state", user: Homebrew.owner).stdout.include?('enabled') != node['homebrew']['enable-analytics'] }
|
||||
end
|
||||
|
||||
if node['homebrew']['auto-update']
|
||||
@@ -50,8 +71,8 @@ if node['homebrew']['auto-update']
|
||||
end
|
||||
|
||||
execute 'update homebrew from github' do
|
||||
environment lazy { { 'HOME' => ::Dir.home(homebrew_owner), 'USER' => homebrew_owner } }
|
||||
user homebrew_owner
|
||||
command '/usr/local/bin/brew update || true'
|
||||
environment lazy { { 'HOME' => ::Dir.home(Homebrew.owner), 'USER' => Homebrew.owner } }
|
||||
user Homebrew.owner
|
||||
command lazy { "#{HomebrewWrapper.new.install_path}/bin/brew update || true" }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Recipe:: install_casks
|
||||
#
|
||||
# Copyright:: 2014-2016, Chef Software, Inc <legal@chef.io>
|
||||
# Copyright:: 2014-2019, Chef Software, Inc <legal@chef.io>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -17,8 +17,6 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe 'homebrew::cask'
|
||||
|
||||
node['homebrew']['casks'].each do |cask|
|
||||
homebrew_cask cask
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Recipes:: install_casks
|
||||
#
|
||||
# Copyright:: 2014-2016, Chef Software, Inc <legal@chef.io>
|
||||
# Copyright:: 2014-2019, Chef Software, Inc <legal@chef.io>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Recipes:: install_taps
|
||||
#
|
||||
# Copyright:: 2015-2016, Chef Software, Inc <legal@chef.io>
|
||||
# Copyright:: 2015-2019, Chef Software, Inc <legal@chef.io>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -20,5 +20,14 @@
|
||||
include_recipe 'homebrew'
|
||||
|
||||
node['homebrew']['taps'].each do |tap|
|
||||
homebrew_tap tap
|
||||
if tap.is_a?(String)
|
||||
homebrew_tap tap
|
||||
elsif tap.is_a?(Hash)
|
||||
raise unless tap.key?('tap')
|
||||
homebrew_tap tap['tap'] do
|
||||
url tap['url'] if tap.key?('url')
|
||||
end
|
||||
else
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
17
cookbooks/homebrew/renovate.json
Normal file
17
cookbooks/homebrew/renovate.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:base"],
|
||||
"packageRules": [{
|
||||
"groupName": "Actions",
|
||||
"matchUpdateTypes": ["patch", "pin", "digest"],
|
||||
"automerge": true,
|
||||
"addLabels": ["Release: Patch", "Skip: Announcements"]
|
||||
},
|
||||
{
|
||||
"groupName": "Actions",
|
||||
"matchUpdateTypes": ["major"],
|
||||
"automerge": false,
|
||||
"addLabels": ["Release: Patch", "Skip: Announcements"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,14 +1,68 @@
|
||||
actions :cask, :uncask, :install, :uninstall
|
||||
default_action :install
|
||||
#
|
||||
# Author:: Joshua Timberman (<jtimberman@chef.io>)
|
||||
# Author:: Graeme Mathieson (<mathie@woss.name>)
|
||||
# Cookbook:: homebrew
|
||||
# Resources:: cask
|
||||
#
|
||||
# Copyright:: 2011-2019, 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.
|
||||
#
|
||||
|
||||
attribute :name,
|
||||
name_attribute: true,
|
||||
kind_of: String,
|
||||
regex: /^[\w-]+$/
|
||||
chef_version_for_provides '< 14.0' if respond_to?(:chef_version_for_provides)
|
||||
|
||||
attribute :options,
|
||||
kind_of: String
|
||||
property :cask_name, String, regex: %r{^[\w/-]+$}, name_property: true
|
||||
property :options, String
|
||||
property :install_cask, [true, false], default: true
|
||||
property :homebrew_path, String, default: lazy { "#{HomebrewWrapper.new.install_path}/bin/brew" }
|
||||
property :owner, String, default: lazy { Homebrew.owner } # lazy to prevent breaking compilation on non-macOS platforms
|
||||
|
||||
def casked?
|
||||
shell_out('/usr/local/bin/brew cask list 2>/dev/null').stdout.split.include?(name)
|
||||
action :install do
|
||||
homebrew_tap 'homebrew/cask' if new_resource.install_cask
|
||||
|
||||
unless casked?
|
||||
converge_by("install cask #{new_resource.name} #{new_resource.options}") do
|
||||
shell_out!("#{new_resource.homebrew_path} install --cask #{new_resource.name} #{new_resource.options}",
|
||||
user: new_resource.owner,
|
||||
env: { 'HOME' => ::Dir.home(new_resource.owner), 'USER' => new_resource.owner },
|
||||
cwd: ::Dir.home(new_resource.owner))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
homebrew_tap 'homebrew/cask' if new_resource.install_cask
|
||||
|
||||
if casked?
|
||||
converge_by("uninstall cask #{new_resource.name}") do
|
||||
shell_out!("#{new_resource.homebrew_path} uninstall --cask #{new_resource.name}",
|
||||
user: new_resource.owner,
|
||||
env: { 'HOME' => ::Dir.home(new_resource.owner), 'USER' => new_resource.owner },
|
||||
cwd: ::Dir.home(new_resource.owner))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action_class do
|
||||
alias_method :action_cask, :action_install
|
||||
alias_method :action_uncask, :action_remove
|
||||
alias_method :action_uninstall, :action_remove
|
||||
|
||||
def casked?
|
||||
unscoped_name = new_resource.name.split('/').last
|
||||
shell_out!("#{new_resource.homebrew_path} list --cask 2>/dev/null",
|
||||
user: new_resource.owner,
|
||||
env: { 'HOME' => ::Dir.home(new_resource.owner), 'USER' => new_resource.owner },
|
||||
cwd: ::Dir.home(new_resource.owner)).stdout.split.include?(unscoped_name)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Cookbook:: homebrew
|
||||
# Resources:: tap
|
||||
#
|
||||
# Copyright:: 2011-2016, Chef Software, Inc.
|
||||
# Copyright:: 2011-2019, 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.
|
||||
@@ -19,13 +19,37 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :tap, :untap
|
||||
default_action :tap
|
||||
chef_version_for_provides '< 14.0' if respond_to?(:chef_version_for_provides)
|
||||
|
||||
attribute :name,
|
||||
name_attribute: true,
|
||||
kind_of: String,
|
||||
regex: %r{^[\w-]+(?:\/[\w-]+)+$}
|
||||
property :tap_name, String, name_property: true, regex: %r{^[\w-]+(?:\/[\w-]+)+$}
|
||||
property :url, String
|
||||
property :full, [true, false], default: false
|
||||
property :homebrew_path, String, default: lazy { "#{HomebrewWrapper.new.install_path}/bin/brew" }
|
||||
property :owner, String, default: lazy { Homebrew.owner } # lazy to prevent breaking compilation on non-macOS platforms
|
||||
|
||||
attribute :tapped,
|
||||
kind_of: [TrueClass, FalseClass]
|
||||
action :tap do
|
||||
unless tapped?(new_resource.name)
|
||||
converge_by("tap #{new_resource.name}") do
|
||||
shell_out!("#{new_resource.homebrew_path} tap #{new_resource.full ? '--full' : ''} #{new_resource.name} #{new_resource.url || ''}",
|
||||
user: new_resource.owner,
|
||||
env: { 'HOME' => ::Dir.home(new_resource.owner), 'USER' => new_resource.owner },
|
||||
cwd: ::Dir.home(new_resource.owner))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :untap do
|
||||
if tapped?(new_resource.name)
|
||||
converge_by("untap #{new_resource.name}") do
|
||||
shell_out!("#{new_resource.homebrew_path} untap #{new_resource.name}",
|
||||
user: new_resource.owner,
|
||||
env: { 'HOME' => ::Dir.home(new_resource.owner), 'USER' => new_resource.owner },
|
||||
cwd: ::Dir.home(new_resource.owner))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def tapped?(name)
|
||||
tap_dir = name.gsub('/', '/homebrew-')
|
||||
::File.directory?("#{HomebrewWrapper.new.repository_path}/Library/Taps/#{tap_dir}")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user