A Chef cookbook for installation of Mac App Store apps via the Mas CLI tool.
Mas requires OS X 10.10+. As of v2.0, this cookbook requires Chef 12.5+ (or Chef 12.x and the compat_resource cookbook.
A user must be logged into OS X for Mas to operate properly.
Apps can be installed by using the included custom resources in recipes of your own, or with the predefined recipe and set of attributes.
default
Installs the Mas CLI tool and an attribute-derived set of App Store apps.
default
default['mac_app_store']['username'] = nil
default['mac_app_store']['password'] = nil
Set these two attributes with the Apple ID user and password you wish to log into the App Store as.
default['mac_app_store']['apps'] = {}
Set apps as keys+values under this space, where the key is the full app name and value is true to install it or false to not. For example:
default['mac_app_store']['apps']['Growl'] = true
Mas can be installed via GitHub download (:direct
, the default) or from
:homebrew
.
default['mac_app_store']['mas']['source'] = nil
If desired, a specific version of Mas can be installed rather than the latest:
default['mac_app_store']['mas']['version'] = nil
By default, Mas will always be run as the current system user. That can be overridden:
default['mac_app_store']['mas']['system_user'] = nil
mac_app_store_mas
A custom resource to manage installation of the Mas CLI tool for interacting with the App Store.
Syntax:
mac_app_store_mas 'default' do
source :direct
version: '1.2.3'
username 'example@example.com'
password 'abc123'
system_user 'vagrant'
action %i(install sign_in)
end
Actions:
Action | Description |
---|---|
:install |
Default; install the Mas CLI |
:upgrade |
Upgrade Mas, if available |
:remove |
Uninstall Mas |
:sign_in |
Use Mas to sign into the App Store |
:sign_out |
Sign out of the App Store |
:upgrade_apps |
Install any upgrades for apps on the system |
Properties:
Property | Default | Description |
---|---|---|
source | :direct |
Install from GitHub (:direct ) or :homebrew |
version | nil |
The version of Mas to install |
username | nil |
An Apple ID username |
password | nil |
An Apple ID password |
system_user | Etc.getlogin |
The user to execute Mas commands as |
action | %i(install sign_in) |
Action(s) to perform |
mac_app_store_app
Used to install a single App Store app via Mas. Requires that an Apple ID be signed into.
Syntax:
mac_app_store_app 'Some App' do
app_name 'Some App'
system_user 'vagrant'
action :install
end
Actions:
Action | Description |
---|---|
:install |
Default; installs the given app |
:upgrade |
Upgrade or install the app |
Properties:
Property | Default | Description |
---|---|---|
app_name | resource name | App name if it doesn't match resource name |
system_user | Etc.getlogin |
The user to execute Mas commands as |
action | :install |
Action(s) to perform |
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Add tests for the new feature; ensure they pass (
bundle exec rake
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
- Watch the pull request and ensure the build passes
- Author: Jonathan Hartman j@p4nt5.com
Copyright 2015-2016, Jonathan Hartman
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.