├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── Gemfile
├── Gemfile.lock
├── LICENSE
├── README.md
├── lib
└── puppet
│ ├── provider
│ ├── osx_chsh
│ │ └── dscl.rb
│ ├── osx_login_item
│ │ └── osascript.rb
│ └── osx_spotlight_exclude
│ │ └── plistbuddy.rb
│ └── type
│ ├── osx_chsh.rb
│ ├── osx_login_item.rb
│ └── osx_spotlight_exclude.rb
├── manifests
├── disable_app_quarantine.pp
├── dock.pp
├── dock
│ ├── 2d.pp
│ ├── autohide.pp
│ ├── clear_dock.pp
│ ├── dim_hidden_apps.pp
│ ├── disable.pp
│ ├── disable_dashboard.pp
│ ├── hide_indicator_lights.pp
│ ├── hot_corner.pp
│ ├── hot_corners.pp
│ ├── icon_size.pp
│ ├── magnification.pp
│ ├── pin_position.pp
│ └── position.pp
├── finder.pp
├── finder
│ ├── empty_trash_securely.pp
│ ├── enable_quicklook_text_selection.pp
│ ├── no_file_extension_warnings.pp
│ ├── show_all_filename_extensions.pp
│ ├── show_all_on_desktop.pp
│ ├── show_external_hard_drives_on_desktop.pp
│ ├── show_hard_drives_on_desktop.pp
│ ├── show_hidden_files.pp
│ ├── show_mounted_servers_on_desktop.pp
│ ├── show_removable_media_on_desktop.pp
│ ├── show_warning_before_changing_an_extension.pp
│ ├── show_warning_before_emptying_trash.pp
│ └── unhide_library.pp
├── global
│ ├── disable_autocorrect.pp
│ ├── disable_key_press_and_hold.pp
│ ├── disable_remote_control_ir_receiver.pp
│ ├── enable_dark_mode.pp
│ ├── enable_dark_mode_shortcut.pp
│ ├── enable_keyboard_control_access.pp
│ ├── enable_standard_function_keys.pp
│ ├── expand_print_dialog.pp
│ ├── expand_save_dialog.pp
│ ├── key_repeat_delay.pp
│ ├── key_repeat_rate.pp
│ ├── natural_mouse_scrolling.pp
│ └── tap_to_click.pp
├── keyboard
│ └── capslock_to_control.pp
├── menubar.pp
├── menubar
│ └── show_battery_percent.pp
├── mouse
│ ├── button_mode.pp
│ ├── smart_zoom.pp
│ └── swipe_between_pages.pp
├── no_network_dsstores.pp
├── recovery_message.pp
├── safari
│ └── enable_developer_mode.pp
├── software_update.pp
├── sound
│ └── interface_sound_effects.pp
└── universal_access
│ ├── ctrl_mod_zoom.pp
│ ├── cursor_size.pp
│ └── enable_scrollwheel_zoom.pp
├── script
├── cardboard-exec
├── cibuild
├── lint
├── specs
└── syntax
└── spec
├── classes
├── disable_app_quarantine_spec.rb
├── dock
│ ├── 2d_spec.rb
│ ├── autohide_spec.rb
│ ├── clear_dock_spec.rb
│ ├── dim_hidden_apps_spec.rb
│ ├── disable_dashboard_spec.rb
│ ├── disable_spec.rb
│ ├── hide_indicator_lights_spec.rb
│ ├── hot_corners_spec.rb
│ ├── icon_size_spec.rb
│ ├── magnification_spec.rb
│ ├── pin_position_spec.rb
│ └── position_spec.rb
├── dock_spec.rb
├── finder
│ ├── empty_trash_securely_spec.rb
│ ├── enable_quicklook_text_selection_spec.rb
│ ├── no_file_extension_warnings_spec.rb
│ ├── show_all_filename_extensions_spec.rb
│ ├── show_all_on_desktop_spec.rb
│ ├── show_external_hard_drives_on_desktop_spec.rb
│ ├── show_hard_drives_on_desktop_spec.rb
│ ├── show_hidden_files_spec.rb
│ ├── show_mounted_servers_on_desktop_spec.rb
│ ├── show_removable_media_on_desktop_spec.rb
│ ├── show_warning_before_changing_an_extension_spec.rb
│ ├── show_warning_before_emptying_trash_spec.rb
│ └── unhide_library_spec.rb
├── finder_spec.rb
├── global
│ ├── disable_autocorrect_spec.rb
│ ├── disable_key_press_and_hold_spec.rb
│ ├── disable_remote_control_ir_receiver_spec.rb
│ ├── enable_keyboard_control_access_spec.rb
│ ├── enable_standard_function_keys_spec.rb
│ ├── expand_print_dialog_spec.rb
│ ├── expand_save_dialog_spec.rb
│ ├── key_repeat_delay_spec.rb
│ ├── key_repeat_rate_spec.rb
│ ├── natural_mouse_scrolling_spec.rb
│ └── tap_to_click_spec.rb
├── keyboard
│ └── capslock_to_control_spec.rb
├── menubar
│ └── show_battery_percent_spec.rb
├── menubar_spec.rb
├── mouse
│ ├── button_mode.rb
│ ├── smart_zoom_spec.rb
│ └── swipe_between_pages_spec.rb
├── no_network_dsstores_spec.rb
├── safari
│ └── enable_developer_mode_spec.rb
├── software_update_spec.rb
├── sound
│ └── interface_sound_effects_spec.rb
└── universal_access
│ ├── ctrl_mod_zoom_spec.rb
│ ├── cursor_size_spec.rb
│ └── enable_scrollwheel_zoom_spec.rb
├── defines
├── hot_corner_spec.rb
└── recovery_message_spec.rb
├── fixtures
├── Puppetfile
├── Puppetfile.lock
├── manifests
│ └── site.pp
└── modules
│ └── osx
│ ├── lib
│ └── manifests
└── spec_helper.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | /.bundle
2 | /.ruby-version
3 | /spec/fixtures/.librarian
4 | /spec/fixtures/.tmp
5 | /spec/fixtures/Puppetfile.lock
6 | /spec/fixtures/modules
7 | /spec/fixtures/vendor
8 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ---
2 | script: "./script/cibuild"
3 | gemfile: "this/does/not/exist"
4 | rvm:
5 | - "1.8.7"
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Thanks for contributing to Boxen! A couple of notes to help you out:
2 |
3 | * We're conservative with version bumps, especially on services. We
4 | tend to keep things aligned with what we're personally using in
5 | development. If that doesn't work for your team, fork the module and
6 | use it in your Boxen instead.
7 |
8 | * Otherwise, go crazy! Fork it, fix it, test it, pull request it.
9 | Remember that a PR is the start of a conversation, not the end of one.
10 |
11 | :heart:,
12 | Boxen
13 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | gem "cardboard", "~> 1.0"
4 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | addressable (2.3.4)
5 | ansi (1.4.3)
6 | boxen (1.2.1)
7 | ansi (~> 1.4)
8 | hiera (~> 1.0)
9 | highline (~> 1.6)
10 | json_pure (>= 1.7.7, < 2.0)
11 | librarian-puppet (~> 0.9.9)
12 | octokit (~> 1.15)
13 | puppet (~> 3.0)
14 | cardboard (1.0.1)
15 | boxen (~> 1.0)
16 | puppet-lint (~> 0.3)
17 | puppetlabs_spec_helper (~> 0.4)
18 | rspec-puppet (~> 0.1)
19 | diff-lcs (1.2.4)
20 | facter (1.7.1)
21 | faraday (0.8.7)
22 | multipart-post (~> 1.1)
23 | faraday_middleware (0.9.0)
24 | faraday (>= 0.7.4, < 0.9)
25 | hashie (2.0.5)
26 | hiera (1.2.1)
27 | json_pure
28 | highline (1.6.19)
29 | json (1.8.0)
30 | json_pure (1.8.0)
31 | librarian-puppet (0.9.9)
32 | json
33 | thor (~> 0.15)
34 | metaclass (0.0.1)
35 | mocha (0.14.0)
36 | metaclass (~> 0.0.1)
37 | multi_json (1.7.3)
38 | multipart-post (1.2.0)
39 | netrc (0.7.7)
40 | octokit (1.24.0)
41 | addressable (~> 2.2)
42 | faraday (~> 0.8)
43 | faraday_middleware (~> 0.9)
44 | hashie (~> 2.0)
45 | multi_json (~> 1.3)
46 | netrc (~> 0.7.7)
47 | puppet (3.1.1)
48 | facter (~> 1.6)
49 | hiera (~> 1.0)
50 | puppet-lint (0.3.2)
51 | puppetlabs_spec_helper (0.4.1)
52 | mocha (>= 0.10.5)
53 | rake
54 | rspec (>= 2.9.0)
55 | rspec-puppet (>= 0.1.1)
56 | rake (10.0.4)
57 | rspec (2.13.0)
58 | rspec-core (~> 2.13.0)
59 | rspec-expectations (~> 2.13.0)
60 | rspec-mocks (~> 2.13.0)
61 | rspec-core (2.13.1)
62 | rspec-expectations (2.13.0)
63 | diff-lcs (>= 1.1.3, < 2.0)
64 | rspec-mocks (2.13.1)
65 | rspec-puppet (0.1.6)
66 | rspec
67 | thor (0.18.1)
68 |
69 | PLATFORMS
70 | ruby
71 |
72 | DEPENDENCIES
73 | cardboard (~> 1.0)
74 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013 GitHub, Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OSX Defaults Module for Puppet
2 |
3 | [](https://travis-ci.org/boxen/puppet-osx)
4 |
5 | Provides classes for setting various defaults in Mac OS X. Also provides a means
6 | to set a "recovery message" to be displayed on the login and lock screens.
7 |
8 | ## Recovery Message Usage
9 |
10 | Displays the given message on the lock and login screens.
11 |
12 | ```puppet
13 | osx::recovery_message { 'If this Mac is found, please call 123-456-7890': }
14 | ```
15 |
16 | ## One-Shot Settings
17 |
18 | Just `include` any of these in your manifest.
19 |
20 | ### Global Settings
21 |
22 | * `osx::global::disable_key_press_and_hold` - disable press-and-hold for
23 | accented character entry
24 | * `osx::global::enable_keyboard_control_access` - enables the keyboard for
25 | navigating controls in dialogs
26 | * `osx::global::enable_standard_function_keys` - enables the F1, F2, etc.
27 | keys to be treated as standard function keys
28 | * `osx::global::expand_print_dialog` - expand the print dialog by default
29 | * `osx::global::expand_save_dialog` - expand the save dialog by default
30 | * `osx::global::disable_remote_control_ir_receiver` - disable remote control infrared receiver
31 | * `osx::global::disable_autocorrect` - disables spelling autocorrection
32 | * `osx::global::tap_to_click` - enables tap to click
33 | * `osx::global::enable_dark_mode` - enables "dark mode"
34 | * `osx::global::enable_dark_mode_shortcut` - enables `command + option + control + t` to toggle "dark mode"
35 |
36 | ### Dock Settings
37 |
38 | * `osx::dock::2d` - use the old flat dock style
39 | * `osx::dock::autohide` - automatically hide the dock
40 | * `osx::dock::clear_dock` - ensures the dock only contains apps that are running
41 | * `osx::dock::disable` - disable the dock by setting a long autohide-delay
42 | * `osx::dock::disable_dashboard` - disable the dashboard
43 | * `osx::dock::dim_hidden_apps` - dims icons of hidden apps
44 | * `osx::dock::hide_indicator_lights` - remove the indicator lights below running
45 | apps
46 |
47 | ### Finder Settings
48 |
49 | * `osx::finder::show_external_hard_drives_on_desktop`
50 | * `osx::finder::show_hard_drives_on_desktop`
51 | * `osx::finder::show_mounted_servers_on_desktop`
52 | * `osx::finder::show_removable_media_on_desktop`
53 | * `osx::finder::show_all_on_desktop` - does all of the above
54 | * `osx::finder::empty_trash_securely` - enable Secure Empty Trash
55 | * `osx::finder::unhide_library` - unsets the hidden flag on ~/Library
56 | * `osx::finder::show_hidden_files`
57 | * `osx::finder::enable_quicklook_text_selection`
58 | * `osx::finder::show_warning_before_emptying_trash`
59 | * `osx::finder::show_warning_before_changing_an_extension`
60 | * `osx::finder::show_all_filename_extensions`
61 | * `osx::finder::no_file_extension_warnings`
62 |
63 | ### Universal Access Settings
64 |
65 | * `osx::universal_access::ctrl_mod_zoom` - enables zoom by scrolling while
66 | holding Control
67 | * `osx::universal_access::enable_scrollwheel_zoom` - enables zoom using the
68 | scroll wheel
69 |
70 | ### Safari Settings
71 |
72 | * `include osx::safari::enable_developer_mode` - enables developer mode in safari
73 |
74 | ### Miscellaneous Settings
75 |
76 | * `osx::disable_app_quarantine` - disable the downloaded app quarantine
77 | * `osx::no_network_dsstores` - disable creation of .DS_Store files on network
78 | shares
79 | * `osx::software_update` - download and install software updates
80 | * `osx::keyboard::capslock_to_control` - remaps capslock to control on attached keyboards
81 |
82 | ## Customizable Settings
83 |
84 | These settings can be used like one-shots or customized.
85 |
86 | `osx::global::key_repeat_delay` - the amount of time (in ms) before a key starts
87 | repeating
88 |
89 | ```puppet
90 | # Set the default value (35)
91 | include osx::global::key_repeat_delay
92 |
93 | # ... or set your own
94 | class { 'osx::global::key_repeat_delay':
95 | delay => 10
96 | }
97 | ```
98 |
99 | `osx::global::key_repeat_rate` - the amount of time (in ms) before key repeat
100 | 'presses'
101 |
102 | ```puppet
103 | # Set the default value (0)
104 | include osx::global::key_repeat_rate
105 |
106 | # ... or set your own
107 | class { 'osx::global::key_repeat_rate':
108 | rate => 2
109 | }
110 | ```
111 |
112 | `osx::global::natural_mouse_scrolling` - enable/disable 'natural' mouse scrolling. *Requires re-login for new settings to initialize.*
113 |
114 | ```puppet
115 | # Set the default value (enabled=true)
116 | include osx::global::natural_mouse_scrolling
117 |
118 | # ... or set your own
119 | class { 'osx::global::natural_mouse_scrolling':
120 | enabled => false
121 | }
122 | ```
123 |
124 |
125 | `osx::universal_access::cursor_size` - the amount the cursor will be zoomed
126 |
127 | ```puppet
128 | # Set the default value (1.5)
129 | include osx::universal_access::cursor_size
130 |
131 | # ... or set your own
132 | class { 'osx::universal_access::cursor_size':
133 | zoom => 2
134 | }
135 | ```
136 |
137 | `osx::dock::icon_size` - the size of the dock icons, in pixels
138 |
139 | ```puppet
140 | # Set the default value (36)
141 | include osx::dock::icon_size
142 |
143 | # ... or set your own
144 | class { 'osx::dock::icon_size':
145 | size => 36
146 | }
147 | ```
148 |
149 | `osx::dock::position` - the location of the dock on the screen ('right', 'left', 'top', 'bottom')
150 |
151 | ```puppet
152 | # Set the default value ('right')
153 | include osx::dock::position
154 |
155 | # ... or set your own
156 | class { 'osx::dock::position':
157 | position => 'right'
158 | }
159 | ```
160 |
161 | `osx::dock::pin_position` - the location to pin the dock to ('start', 'middle', 'end')
162 |
163 | ```puppet
164 | # Set the default value ('start')
165 | include osx::dock::pin_position
166 |
167 | # ... or set your own
168 | class { 'osx::dock::pin_position':
169 | position => 'start'
170 | }
171 | ```
172 |
173 | `osx::dock::hot_corner` - configure the action for a hot corner
174 |
175 | ```puppet
176 | # Make the top left corner display the Dashboard
177 | osx::dock::hot_corner { 'Top Left':
178 | action => 'Dashboard'
179 | }
180 |
181 | # Make the bottom right corner show the desktop
182 | osx::dock::hot_corner { 'Show the desktop':
183 | position => 'Bottom Right',
184 | action => 'Desktop'
185 | }
186 | ```
187 |
188 | `osx::dock::hot_corners` - configure the hot corners
189 |
190 | ```puppet
191 | # Make the top right corner start the screen saver and the bottom left corner launch Mission Control
192 | class { 'osx::dock::hot_corners':
193 | top_right => "Start Screen Saver",
194 | bottom_left => "Mission Control"
195 | }
196 | ```
197 |
198 | `osx::sound::interface_sound_effects` - enable interface sound effects (true, false)
199 |
200 | ```puppet
201 | # Set the default value (true)
202 | include osx::sound::interface_sound_effects
203 |
204 | # ... or set your own
205 | class { 'osx::sound::interface_sound_effects':
206 | enable => false
207 | }
208 | ```
209 |
210 | `osx::mouse::button_mode` - the button mode for multitouch mice (1, 2) *Requires re-login for new settings to initialize.*
211 |
212 | ```puppet
213 | # Set the default mode (1)
214 | include osx::mouse::button_mode
215 |
216 | # ... or set your own
217 | class { 'osx::mouse::button_mode':
218 | mode => 2
219 | }
220 | ```
221 |
222 | `osx::mouse::smart_zoom` - enable/disable smart zoom for multitouch mice *Requires re-login for new settings to initialize.*
223 |
224 | ```puppet
225 | # Set the default value (enabled=false)
226 | include osx::mouse::smart_zoom
227 |
228 | # ... or set your own
229 | class { 'osx::mouse::smart_zoom':
230 | enabled => true
231 | }
232 | ```
233 |
234 | `osx::mouse::swipe_between_pages` - enable/disable swipe between pages for multitouch mice *Requires re-login for new settings to initialize.*
235 |
236 | ```puppet
237 | # Set the default value (enabled=false)
238 | include osx::mouse::swipe_between_pages
239 |
240 | # ... or set your own
241 | class { 'osx::mouse::swipe_between_pages':
242 | enabled => true
243 | }
244 | ```
245 |
246 | `osx::dock::magnification` - size of dock icon magnification
247 |
248 | ```puppet
249 | # Set the default value (true, 128)
250 | include osx::dock::magnification
251 |
252 | # ... or set your own
253 | class { 'osx::dock::magnification':
254 | magnification => true,
255 | magnification_size => 84
256 | }
257 | ```
258 |
259 | ## Required Puppet Modules
260 |
261 | * boxen
262 | * puppetlabs-stdlib
263 |
264 | ## Developing
265 |
266 | Write code.
267 |
268 | Run `script/cibuild`.
269 |
--------------------------------------------------------------------------------
/lib/puppet/provider/osx_chsh/dscl.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.type(:osx_chsh).provide(:dscl) do
2 | desc "dscl support"
3 |
4 | commands :dscl => '/usr/bin/dscl'
5 |
6 | def shell
7 | @cached_shell ||= Proc.new {
8 | output = dscl('.', '-read', "/Users/#{resource[:name]}", 'UserShell')
9 | output.split(':').last.strip
10 | }.call
11 | end
12 |
13 | def shell=(value)
14 | dscl '.', '-change', "/Users/#{resource[:name]}", 'UserShell', self.shell, resource[:shell]
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/lib/puppet/provider/osx_login_item/osascript.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.type(:osx_login_item).provide(:osascript) do
2 | def create
3 | props = [
4 | "{",
5 | "name:\"#{resource[:name]}\",",
6 | "path:\"#{resource[:path]}\",",
7 | "hidden:#{resource[:hidden].to_s}",
8 | "}",
9 | ].join
10 |
11 | run_script <<-EOF
12 | tell application "System Events" to make login item at end with
13 | properties #{props}
14 | EOF
15 | end
16 |
17 | def destroy
18 | run_script <<-EOF
19 | tell application "System Events" to delete (the first login item whose
20 | name is equal to "#{resource[:name]}")
21 | EOF
22 | end
23 |
24 | def exists?
25 | output = run_script <<-EOF
26 | tell application "System Events" to get the name of every login item
27 | EOF
28 |
29 | output.strip.split(', ').include? resource[:name]
30 | end
31 |
32 | def hidden
33 | get_property_value('hidden')
34 | end
35 |
36 | def hidden=(value)
37 | set_property_value('hidden', value)
38 | end
39 |
40 | private
41 | def get_property_value(property)
42 | output = run_script <<-EOF
43 | tell application "System Events" to get #{property} of the first login
44 | item whose name is equal to "#{resource[:name]}"
45 | EOF
46 | output.strip
47 | end
48 |
49 | def set_property_value(property, value)
50 | run_script <<-EOF
51 | tell application "System Events" to set #{property} of (the first login
52 | item whose name is equal to "#{resource[:name]}") to #{value}
53 | EOF
54 | end
55 |
56 | def run_script(script)
57 | %x{/usr/bin/osascript -e '#{script.gsub(/\n/, ' ').squeeze(' ').strip}'}
58 | end
59 | end
60 |
--------------------------------------------------------------------------------
/lib/puppet/provider/osx_spotlight_exclude/plistbuddy.rb:
--------------------------------------------------------------------------------
1 | require 'rexml/document'
2 |
3 | Puppet::Type.type(:osx_spotlight_exclude).provide(:plistbuddy) do
4 | commands :plutil => 'plutil',
5 | :plistbuddy => '/usr/libexec/PlistBuddy'
6 |
7 | FILE = '/.Spotlight-V100/VolumeConfiguration.plist'
8 |
9 | def create
10 | @property_hash = {
11 | :name => @resource[:name],
12 | :ensure => :present,
13 | }
14 | plistbuddy '-c', "Add Exclusions: string '#{@property_hash[:name]}'", FILE
15 | end
16 |
17 | def destroy
18 | plistbuddy '-c', "Delete Exclusions:#{@property_hash[:index]}", FILE
19 | @property_hash.clear
20 | end
21 |
22 | def exists?
23 | !(@property_hash[:ensure] == :absent or @property_hash.empty?)
24 | end
25 |
26 | def self.instances
27 | xml = plutil '-convert', 'xml1', '-o', '/dev/stdout', FILE
28 | doc = REXML::Document.new(xml).root
29 |
30 | instances = []
31 | index = 0
32 |
33 | doc.elements['//key[.="Exclusions"]'].next_element.each_element('string') do |e|
34 | instances << new({
35 | :name => e.text,
36 | :index => index,
37 | :ensure => :present,
38 | :provider => self.name,
39 | })
40 | index += 1
41 | end
42 | instances
43 | end
44 |
45 | def self.prefetch(resources)
46 | instances.each do |provider|
47 | if resource = resources[provider.name.to_s]
48 | resource.provider = provider
49 | end
50 | end
51 | end
52 | end
53 |
--------------------------------------------------------------------------------
/lib/puppet/type/osx_chsh.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:osx_chsh) do
2 | @doc = ""
3 |
4 | newparam :user do
5 | desc "The user whose shell is to be changed"
6 | isnamevar
7 | end
8 |
9 | newproperty :shell do
10 | desc "The full path to the shell"
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/lib/puppet/type/osx_login_item.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:osx_login_item) do
2 | @doc = "Manage OSX login items."
3 |
4 | ensurable do
5 | newvalue :present do
6 | provider.create
7 | end
8 |
9 | newvalue :absent do
10 | provider.destroy
11 | end
12 |
13 | defaultto :present
14 | end
15 |
16 | newparam :name do
17 | desc "The name of the login item."
18 | end
19 |
20 | newparam :path do
21 | desc "The path to the application to be run at login."
22 | end
23 |
24 | newproperty :hidden do
25 | desc "Should the application be hidden when launched."
26 | newvalues :true, :false
27 | defaultto :false
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/lib/puppet/type/osx_spotlight_exclude.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:osx_spotlight_exclude) do
2 | @doc = <<-EOF.strip
3 | A type for managing directories that should be excluded from the Spotlight
4 | index.
5 |
6 | osx_spotlight_exclude { '/home/myuser/.vagrant': }
7 | EOF
8 |
9 | ensurable do
10 | desc <<-EOF.strip
11 | The desired state of the Spotlight exclusion.
12 | EOF
13 |
14 | newvalue(:present) do
15 | provider.create
16 | end
17 |
18 | newvalue(:absent) do
19 | provider.destroy
20 | end
21 |
22 | defaultto :present
23 | end
24 |
25 | newparam(:path) do
26 | desc <<-EOF.strip
27 | The path to exclude from Spotlight indexing.
28 | EOF
29 |
30 | isnamevar
31 | end
32 |
33 | newparam(:index) do
34 | desc <<-EOF.strip
35 | A read-only parameter set by Puppet. Manually specifying this value may
36 | cause bad things to happen to your machine.
37 | EOF
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/manifests/disable_app_quarantine.pp:
--------------------------------------------------------------------------------
1 | # Public: Disable the App Quarantine feature so you can run apps you download.
2 | class osx::disable_app_quarantine {
3 | boxen::osx_defaults { 'Disable the downloaded app quarantine':
4 | user => $::boxen_user,
5 | key => 'LSQuarantine',
6 | domain => 'com.apple.LaunchServices',
7 | value => false;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/manifests/dock.pp:
--------------------------------------------------------------------------------
1 | # Internal: Restart the Dock when necessary.
2 | #
3 | # Example
4 | #
5 | # boxen::osx_defaults { 'Do a thing':
6 | # # ... other stuff here ...
7 | # notify => Exec['killall Dock'];
8 | # }
9 | class osx::dock {
10 | exec { 'killall Dock':
11 | refreshonly => true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/manifests/dock/2d.pp:
--------------------------------------------------------------------------------
1 | # Public: Disables the 3d dock in favor of a simpler, 2d style.
2 | class osx::dock::2d {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Use a flat, 2d style for the Dock':
6 | user => $::boxen_user,
7 | key => 'no-glass',
8 | domain => 'com.apple.dock',
9 | value => true,
10 | notify => Exec['killall Dock'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/dock/autohide.pp:
--------------------------------------------------------------------------------
1 | # Public: Causes the dock to hide itself when you're not pointing at it.
2 | class osx::dock::autohide {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Automatically hide the dock':
6 | user => $::boxen_user,
7 | key => 'autohide',
8 | domain => 'com.apple.dock',
9 | value => true,
10 | notify => Exec['killall Dock'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/dock/clear_dock.pp:
--------------------------------------------------------------------------------
1 | # Public: Clears the dock of 'pinned' application icons.
2 | class osx::dock::clear_dock {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Prevent launchpad from reappearing':
6 | user => $::boxen_user,
7 | domain => 'com.apple.dock',
8 | key => 'checked-for-launchpad',
9 | value => true,
10 | notify => Exec['killall Dock'];
11 | }
12 |
13 | boxen::osx_defaults { 'Remove all the pinned icons':
14 | user => $::boxen_user,
15 | domain => 'com.apple.dock',
16 | key => 'persistent-apps',
17 | value => '()',
18 | notify => Exec['killall Dock'];
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/manifests/dock/dim_hidden_apps.pp:
--------------------------------------------------------------------------------
1 | # Public: Dims the dock icons for apps that are hidden.
2 | class osx::dock::dim_hidden_apps {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Dim hidden apps':
6 | user => $::boxen_user,
7 | domain => 'com.apple.dock',
8 | key => 'showhidden',
9 | value => true,
10 | notify => Exec['killall Dock'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/dock/disable.pp:
--------------------------------------------------------------------------------
1 | # Public: Disables the dock by setting a long autohide-delay
2 | class osx::dock::disable {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Disable the dock':
6 | user => $::boxen_user,
7 | key => 'autohide-delay',
8 | type => 'float',
9 | domain => 'com.apple.dock',
10 | value => 999999,
11 | notify => Exec['killall Dock'];
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/manifests/dock/disable_dashboard.pp:
--------------------------------------------------------------------------------
1 | # Public: Disable the dashboard
2 | class osx::dock::disable_dashboard {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Disable the dashboard':
6 | user => $::boxen_user,
7 | key => 'mcx-disabled',
8 | domain => 'com.apple.dashboard',
9 | value => true,
10 | notify => Exec['killall Dock'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/dock/hide_indicator_lights.pp:
--------------------------------------------------------------------------------
1 | # Public: Removes the dots that indicate a running application.
2 | class osx::dock::hide_indicator_lights {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'Hide indicator lights under running applications':
6 | user => $::boxen_user,
7 | domain => 'com.apple.dock',
8 | key => 'show-process-indicators',
9 | value => false,
10 | notify => Exec['killall Dock'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/dock/hot_corner.pp:
--------------------------------------------------------------------------------
1 | # Public: Define action for a hot corner
2 | #
3 | # Parameters
4 | #
5 | # action: Action of the hot corner
6 | # ['Mission Control'|'Application Windows'|'Desktop'|'Start Screen Saver'|'Disable Screen Saver'|'Dashboard'|'Put Display to Sleep'|'Launchpad'|'Notification Center']
7 | #
8 | # position: Position of the hot corner (default value: $name)
9 | # ['Top Left'|'Top Right'|'Bottom Left'|'Bottom Right']
10 | #
11 | # Examples
12 | #
13 | # osx::dock::hot_corner { 'Name':
14 | # $action => 'Desktop'
15 | # $position => 'Top Left'
16 | # }
17 | #
18 | # osx::dock::hot_corner { 'Top Right':
19 | # $action => 'Desktop'
20 | # }
21 | #
22 | define osx::dock::hot_corner (
23 | $action = undef,
24 | $position = $name
25 | ) {
26 | include osx::dock
27 |
28 | validate_re($position, ['Top Left', 'Top Right', 'Bottom Left', 'Bottom Right'])
29 | validate_re($action, ['Mission Control', 'Application Windows', 'Desktop', 'Start Screen Saver', 'Disable Screen Saver', 'Dashboard', 'Put Display to Sleep', 'Launchpad', 'Notification Center'])
30 |
31 | $position_value = $position ? {
32 | 'Top Left' => 'tl',
33 | 'Top Right' => 'tr',
34 | 'Bottom Left' => 'bl',
35 | 'Bottom Right' => 'br'
36 | }
37 |
38 | $action_value = $action ? {
39 | 'Mission Control' => 2,
40 | 'Application Windows' => 3,
41 | 'Desktop' => 4,
42 | 'Start Screen Saver' => 5,
43 | 'Disable Screen Saver' => 6,
44 | 'Dashboard' => 7,
45 | 'Put Display to Sleep' => 10,
46 | 'Launchpad' => 11,
47 | 'Notification Center' => 12
48 | }
49 |
50 | boxen::osx_defaults { "Hot Corners ${position} Action":
51 | domain => 'com.apple.dock',
52 | key => "wvous-${position_value}-corner",
53 | type => int,
54 | value => $action_value,
55 | user => $::boxen_user,
56 | notify => Exec['killall Dock'];
57 | }
58 |
59 | boxen::osx_defaults { "Hot Corners ${position} Modifier":
60 | domain => 'com.apple.dock',
61 | key => "wvous-${position_value}-modifier",
62 | type => int,
63 | value => 0,
64 | user => $::boxen_user,
65 | notify => Exec['killall Dock'];
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/manifests/dock/hot_corners.pp:
--------------------------------------------------------------------------------
1 | # Public: Define actions for hot corners
2 | #
3 | # Parameters
4 | #
5 | # The available actions are: ['Mission Control'|'Application Windows'|'Desktop'|'Start Screen Saver'|'Disable Screen Saver'|'Dashboard'|'Put Display to Sleep'|'Launchpad'|'Notification Center']
6 | #
7 | # top_left: Action for the top left corner
8 | # top_right: Action for the top right corner
9 | # bottom_left: Action for the bottom left corner
10 | # bottom_right: Action for the bottom right corner
11 | #
12 | # Examples
13 | #
14 | # class { 'osx::dock::hot_corners':
15 | # top_left => 'Desktop'
16 | # top_right => 'Application Windows'
17 | # bottom_right => 'Dashboard'
18 | # }
19 | #
20 | class osx::dock::hot_corners (
21 | $top_left = undef,
22 | $top_right = undef,
23 | $bottom_left = undef,
24 | $bottom_right = undef
25 | ) {
26 | if ($top_left) {
27 | osx::dock::hot_corner { 'Top Left':
28 | action => $top_left
29 | }
30 | }
31 |
32 | if ($top_right) {
33 | osx::dock::hot_corner { 'Top Right':
34 | action => $top_right
35 | }
36 | }
37 |
38 | if ($bottom_left) {
39 | osx::dock::hot_corner { 'Bottom Left':
40 | action => $bottom_left
41 | }
42 | }
43 |
44 | if ($bottom_right) {
45 | osx::dock::hot_corner { 'Bottom Right':
46 | action => $bottom_right
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/manifests/dock/icon_size.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets the icons's size
2 | class osx::dock::icon_size($size = 36) {
3 | include osx::dock
4 |
5 | boxen::osx_defaults { 'icon size':
6 | domain => 'com.apple.dock',
7 | key => 'tilesize',
8 | type => 'int',
9 | value => $size,
10 | user => $::boxen_user,
11 | notify => Exec['killall Dock'];
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/manifests/dock/magnification.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets dock icon magnification
2 | #
3 | # Examples
4 | #
5 | # # Set dock icon magnification to true, with 128px magnified icons
6 | # include osx::dock::magnification
7 | #
8 | # # ...or manage the icon size yourself!
9 | # class { 'osx::dock::magnification':
10 | # magnification => [true|false]
11 | # magnification_size => [16-128]
12 | # }
13 | #
14 | #
15 |
16 |
17 | class osx::dock::magnification ($magnification = true, $magnification_size = '128'){
18 | include osx::dock
19 |
20 | boxen::osx_defaults { 'magnification':
21 | domain => 'com.apple.dock',
22 | key => 'magnification',
23 | type => 'bool',
24 | value => $magnification,
25 | user => $::boxen_user,
26 | notify => Exec['killall Dock'];
27 | }
28 |
29 | boxen::osx_defaults { 'magnification_size':
30 | domain => 'com.apple.dock',
31 | key => 'largesize',
32 | type => int,
33 | value => $magnification_size,
34 | user => $::boxen_user,
35 | notify => Exec['killall Dock'];
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/manifests/dock/pin_position.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets the icons's size
2 | # Can be 'start', 'middle', or 'end'
3 | # System Default: 'middle'
4 | class osx::dock::pin_position($position = 'start') {
5 | include osx::dock
6 |
7 | boxen::osx_defaults { 'pin position':
8 | domain => 'com.apple.dock',
9 | key => 'pinning',
10 | type => 'string',
11 | value => $position,
12 | user => $::boxen_user,
13 | notify => Exec['killall Dock'];
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/manifests/dock/position.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets the dock position
2 | #
3 | # position - 'bottom', 'top', 'right', 'left'
4 | #
5 | # Examples
6 | #
7 | # # set the position to be on the bottom
8 | # include osx::dock::position
9 | #
10 | # # ...or pick your own position!
11 | # class { 'osx::dock::position':
12 | # position => 'left'
13 | # }
14 | class osx::dock::position($position = 'right') {
15 | include osx::dock
16 |
17 | boxen::osx_defaults { 'position':
18 | domain => 'com.apple.dock',
19 | key => 'orientation',
20 | type => 'string',
21 | value => $position,
22 | user => $::boxen_user,
23 | notify => Exec['killall Dock'];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/manifests/finder.pp:
--------------------------------------------------------------------------------
1 | # Internal: Restart finder when necessary.
2 | class osx::finder {
3 | exec { 'killall Finder':
4 | refreshonly => true
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/manifests/finder/empty_trash_securely.pp:
--------------------------------------------------------------------------------
1 | # Public: Use Secure Empty Trash by default.
2 | class osx::finder::empty_trash_securely {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Securely Empty Trash':
6 | user => $::boxen_user,
7 | key => 'EmptyTrashSecurely',
8 | domain => 'com.apple.finder',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/enable_quicklook_text_selection.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables text selection on Quick Look preview windows
2 | class osx::finder::enable_quicklook_text_selection {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Enable Quick Look text selection':
6 | user => $::boxen_user,
7 | domain => 'com.apple.finder',
8 | key => 'QLEnableTextSelection',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/no_file_extension_warnings.pp:
--------------------------------------------------------------------------------
1 | # Public: Disable file extension warnings.
2 | class osx::finder::no_file_extension_warnings {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Disable file extension change warnings':
6 | user => $::boxen_user,
7 | domain => 'com.apple.finder',
8 | key => 'FXEnableExtensionChangeWarning',
9 | value => false,
10 | type => 'bool',
11 | notify => Exec['killall Finder'];
12 | }
13 | }
--------------------------------------------------------------------------------
/manifests/finder/show_all_filename_extensions.pp:
--------------------------------------------------------------------------------
1 | # Public: Show all filename extensions.
2 | class osx::finder::show_all_filename_extensions {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show all filename extensions':
6 | user => $::boxen_user,
7 | key => 'AppleShowAllExtensions',
8 | domain => 'com.apple.finder',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_all_on_desktop.pp:
--------------------------------------------------------------------------------
1 | # Public: Shows internal and external hard drives, removable media, and mounted servers on the desktop.
2 | class osx::finder::show_all_on_desktop {
3 | include osx::finder::show_hard_drives_on_desktop
4 | include osx::finder::show_external_hard_drives_on_desktop
5 | include osx::finder::show_mounted_servers_on_desktop
6 | include osx::finder::show_removable_media_on_desktop
7 | }
8 |
--------------------------------------------------------------------------------
/manifests/finder/show_external_hard_drives_on_desktop.pp:
--------------------------------------------------------------------------------
1 | # Public: Show external hard drives on the desktop.
2 | class osx::finder::show_external_hard_drives_on_desktop {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show external drives on the desktop':
6 | user => $::boxen_user,
7 | domain => 'com.apple.finder',
8 | key => 'ShowExternalHardDrivesOnDesktop',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_hard_drives_on_desktop.pp:
--------------------------------------------------------------------------------
1 | # Public: Show internal drives on the desktop.
2 | class osx::finder::show_hard_drives_on_desktop {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show internal drives on the desktop':
6 | user => $::boxen_user,
7 | domain => 'com.apple.finder',
8 | key => 'ShowHardDrivesOnDesktop',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_hidden_files.pp:
--------------------------------------------------------------------------------
1 | # Public: Show Hidden Files by default.
2 | class osx::finder::show_hidden_files {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show Hidden Files':
6 | user => $::boxen_user,
7 | key => 'AppleShowAllFiles',
8 | domain => 'com.apple.finder',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_mounted_servers_on_desktop.pp:
--------------------------------------------------------------------------------
1 | # Public: Show mounted servers on the desktop.
2 | class osx::finder::show_mounted_servers_on_desktop {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show mounted servers on the desktop':
6 | user => $::boxen_user,
7 | domain => 'com.apple.finder',
8 | key => 'ShowMountedServersOnDesktop',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_removable_media_on_desktop.pp:
--------------------------------------------------------------------------------
1 | # Public: Show removable media on the desktop.
2 | class osx::finder::show_removable_media_on_desktop {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show mounted media on the desktop':
6 | user => $::boxen_user,
7 | domain => 'com.apple.finder',
8 | key => 'ShowRemovableMediaOnDesktop',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_warning_before_changing_an_extension.pp:
--------------------------------------------------------------------------------
1 | # Public: Show warning before changing an extension.
2 | class osx::finder::show_warning_before_changing_an_extension {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show warning before changing an extension':
6 | user => $::boxen_user,
7 | key => 'FXEnableExtensionChangeWarning',
8 | domain => 'com.apple.finder',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/show_warning_before_emptying_trash.pp:
--------------------------------------------------------------------------------
1 | # Public: Show warning before emptying the trash.
2 | class osx::finder::show_warning_before_emptying_trash {
3 | include osx::finder
4 |
5 | boxen::osx_defaults { 'Show warning before emptying the trash':
6 | user => $::boxen_user,
7 | key => 'WarnOnEmptyTrash',
8 | domain => 'com.apple.finder',
9 | value => true,
10 | notify => Exec['killall Finder'];
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/manifests/finder/unhide_library.pp:
--------------------------------------------------------------------------------
1 | # Public: Unhide ~/Library in Finder.
2 | class osx::finder::unhide_library {
3 | $home = "/Users/${::boxen_user}"
4 |
5 | exec { 'Unhide ~/Library':
6 | command => "chflags nohidden ${home}/Library",
7 | onlyif => "ls -Ol ${home} | grep Library | grep hidden";
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/manifests/global/disable_autocorrect.pp:
--------------------------------------------------------------------------------
1 | # Public: Disables spelling autocorrect.
2 | class osx::global::disable_autocorrect {
3 | boxen::osx_defaults { 'Disable autocorrect':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => 'NSAutomaticSpellingCorrectionEnabled',
7 | value => false,
8 | user => $::boxen_user;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/manifests/global/disable_key_press_and_hold.pp:
--------------------------------------------------------------------------------
1 | # Public: Disables keyboard press-and-hold for accented character entry.
2 | class osx::global::disable_key_press_and_hold {
3 | boxen::osx_defaults { 'Disable press-and-hold for accented characters':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => 'ApplePressAndHoldEnabled',
7 | value => false,
8 | user => $::boxen_user;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/manifests/global/disable_remote_control_ir_receiver.pp:
--------------------------------------------------------------------------------
1 | # Public: Disable remote control infrared receiver. Requires re-login.
2 | class osx::global::disable_remote_control_ir_receiver {
3 | boxen::osx_defaults { 'Disable remote control infrared receiver':
4 | ensure => present,
5 | domain => '/Library/Preferences/com.apple.driver.AppleIRController',
6 | key => 'DeviceEnabled',
7 | type => 'boolean',
8 | value => false,
9 | user => root;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/manifests/global/enable_dark_mode.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables dark mode
2 | class osx::global::enable_dark_mode {
3 | boxen::osx_defaults { 'Enable "dark mode"':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => 'AppleInterfaceStyle',
7 | value => 'Dark',
8 | type => string,
9 | user => $::boxen_user;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/manifests/global/enable_dark_mode_shortcut.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables dark mode toggler shortcut
2 | class osx::global::enable_dark_mode_shortcut {
3 | boxen::osx_defaults { 'Enable "dark mode" shortcut':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => '_HIEnableThemeSwitchHotKey',
7 | value => true,
8 | type => bool,
9 | user => $::boxen_user;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/manifests/global/enable_keyboard_control_access.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables keyboard access for dialog controls.
2 | class osx::global::enable_keyboard_control_access {
3 | boxen::osx_defaults { 'Enable full keyboard access for all controls':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => 'AppleKeyboardUIMode',
7 | value => 3,
8 | user => $::boxen_user;
9 | }
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/manifests/global/enable_standard_function_keys.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets function keys to be standard function keys (instead of always sending Fn). Requires re-login.
2 | class osx::global::enable_standard_function_keys($enabled = true) {
3 | boxen::osx_defaults { 'Keyboard, Use all F1, F2, etc. keys as standard function keys':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => 'com.apple.keyboard.fnState',
7 | type => 'boolean',
8 | value => $enabled,
9 | user => $::boxen_user;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/manifests/global/expand_print_dialog.pp:
--------------------------------------------------------------------------------
1 | # Public: Expands Print panel by default.
2 | class osx::global::expand_print_dialog {
3 | boxen::osx_defaults { 'Expand print panel by default':
4 | user => $::boxen_user,
5 | key => 'PMPrintingExpandedStateForPrint',
6 | domain => 'NSGlobalDomain',
7 | value => true;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/manifests/global/expand_save_dialog.pp:
--------------------------------------------------------------------------------
1 | # Public: Expand the Save panel by default.
2 | class osx::global::expand_save_dialog {
3 | boxen::osx_defaults { 'Expand save panel by default':
4 | user => $::boxen_user,
5 | key => 'NSNavPanelExpandedStateForSaveMode',
6 | domain => 'NSGlobalDomain',
7 | value => true;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/manifests/global/key_repeat_delay.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets the delay before held keys repeat.
2 | #
3 | # delay - ms before key starts repeating. Defaults to 35.
4 | #
5 | # Examples
6 | #
7 | # # set the repeat delay to 35 (the default)...
8 | # include osx::global::key_repeat_delay
9 | #
10 | # # ...or pick your own delay!
11 | # class { 'osx::global::key_repeat_delay':
12 | # delay => 10
13 | # }
14 | class osx::global::key_repeat_delay($delay = 35) {
15 | boxen::osx_defaults { 'key repeat delay':
16 | domain => 'NSGlobalDomain',
17 | type => 'int',
18 | key => 'InitialKeyRepeat',
19 | value => $delay,
20 | user => $::boxen_user
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/manifests/global/key_repeat_rate.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets the repeat rate for held keys.
2 | #
3 | # rate - the delay between key 'presses'. Defaults to 0.
4 | #
5 | # Examples
6 | #
7 | # # set the repeat rate to 0 (the default)...
8 | # include osx::global::key_repeat_rate
9 | #
10 | # # ...or pick your own repeat rate!
11 | # class { 'osx::global::key_repeat_rate':
12 | # rate => 2
13 | # }
14 | class osx::global::key_repeat_rate($rate = 0) {
15 | boxen::osx_defaults { 'key repeat rate':
16 | domain => 'NSGlobalDomain',
17 | type => 'int',
18 | key => 'KeyRepeat',
19 | value => $rate,
20 | user => $::boxen_user;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/manifests/global/natural_mouse_scrolling.pp:
--------------------------------------------------------------------------------
1 | # Public: Modify 'natural' mouse scrolling (enable or disable). Requires re-login.
2 | class osx::global::natural_mouse_scrolling($enabled = true) {
3 | boxen::osx_defaults { 'Disable natural mouse scrolling':
4 | ensure => present,
5 | domain => 'NSGlobalDomain',
6 | key => 'com.apple.swipescrolldirection',
7 | type => 'boolean',
8 | value => $enabled,
9 | user => $::boxen_user;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/manifests/global/tap_to_click.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables Tap to click
2 | class osx::global::tap_to_click {
3 | boxen::osx_defaults { 'Tap-To-Click Bluetooth':
4 | ensure => present,
5 | domain => 'com.apple.driver.AppleBluetoothMultitouch.trackpad',
6 | key => 'Clicking',
7 | value => true,
8 | type => bool,
9 | user => $::boxen_user;
10 | }
11 |
12 | boxen::osx_defaults { 'Tap-To-Click Mouse':
13 | ensure => present,
14 | domain => 'NSGlobalDomain',
15 | key => 'com.apple.mouse.tapBehavior',
16 | value => 1,
17 | type => int,
18 | user => $::boxen_user;
19 | }
20 |
21 | boxen::osx_defaults { 'Tap-To-Click Current Host':
22 | ensure => present,
23 | domain => 'NSGlobalDomain',
24 | key => 'com.apple.mouse.tapBehavior',
25 | value => 1,
26 | type => int,
27 | host => 'currentHost',
28 | user => $::boxen_user;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/manifests/keyboard/capslock_to_control.pp:
--------------------------------------------------------------------------------
1 | # Public: Remaps capslock to control on attached keyboards.
2 | #
3 | # Example
4 | #
5 | # include osx::keyboard::capslock_to_control
6 | #
7 | class osx::keyboard::capslock_to_control {
8 | # Remap capslock to control on all attached keyboards
9 | $keyboard_ids = 'ioreg -n IOHIDKeyboard -r | grep -E \'VendorID"|ProductID\' | awk \'{ print $4 }\' | paste -s -d\'-\n\' -'
10 | $check = 'xargs -I{} sh -c \'defaults -currentHost read -g "com.apple.keyboard.modifiermapping.{}-0" | grep "Dst = 2" > /dev/null\''
11 | $remap = 'xargs -I{} defaults -currentHost write -g "com.apple.keyboard.modifiermapping.{}-0" -array "HIDKeyboardModifierMappingDst2HIDKeyboardModifierMappingSrc0"'
12 | exec { 'Remap capslock to control on all keyboards':
13 | command => "${keyboard_ids} | ${remap}",
14 | unless => "${keyboard_ids} | ${check}"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/manifests/menubar.pp:
--------------------------------------------------------------------------------
1 | # Internal: Restart the Menubar aka the SystemUIServer when necessary.
2 | #
3 | # Example
4 | #
5 | # boxen::osx_defaults { 'Do a thing':
6 | # # ... other stuff here ...
7 | # notify => Exec['killall SystemUIServer'];
8 | # }
9 | class osx::menubar {
10 | exec { 'killall SystemUIServer':
11 | refreshonly => true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/manifests/menubar/show_battery_percent.pp:
--------------------------------------------------------------------------------
1 | # Public: Shows battery percentage
2 | #
3 | # Example
4 | #
5 | # include osx::menubar::show_battery_percent
6 | #
7 | class osx::menubar::show_battery_percent {
8 | include osx::menubar
9 |
10 | boxen::osx_defaults { 'Shows battery percentage':
11 | domain => 'com.apple.menuextra.battery',
12 | key => 'ShowPercent',
13 | type => 'string',
14 | value => 'YES',
15 | user => $::boxen_user,
16 | notify => Exec['killall SystemUIServer'];
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/manifests/mouse/button_mode.pp:
--------------------------------------------------------------------------------
1 | # Public: Enable one or two button mode for multitouch mice (default = 1). Requires re-login.
2 | class osx::mouse::button_mode($mode = 1) {
3 | $value = $mode ? {
4 | 1 => 'OneButton',
5 | 2 => 'TwoButton'
6 | }
7 |
8 | boxen::osx_defaults { 'Set the button mode for multitouch mice':
9 | user => $::boxen_user,
10 | domain => 'com.apple.driver.AppleBluetoothMultitouch.mouse',
11 | key => 'MouseButtonMode',
12 | value => $value,
13 | type => 'string'
14 | }
15 | }
--------------------------------------------------------------------------------
/manifests/mouse/smart_zoom.pp:
--------------------------------------------------------------------------------
1 | # Public: Enable/disable smart zoom for multitouch mice (default = disabled). Requires re-login.
2 | class osx::mouse::smart_zoom($enabled = false) {
3 | $value = $enabled ? {
4 | false => 0,
5 | true => 1
6 | }
7 |
8 | boxen::osx_defaults { 'Enable smart zoom for multitouch mice':
9 | user => $::boxen_user,
10 | domain => 'com.apple.driver.AppleBluetoothMultitouch.mouse',
11 | key => 'MouseOneFingerDoubleTapGesture',
12 | value => $value,
13 | type => 'integer'
14 | }
15 | }
--------------------------------------------------------------------------------
/manifests/mouse/swipe_between_pages.pp:
--------------------------------------------------------------------------------
1 | # Public: Enable/disable swipe between pages for multitouch mice (default = disabled). Requires re-login.
2 | class osx::mouse::swipe_between_pages($enabled = false) {
3 | boxen::osx_defaults { 'Enable swipe between pages for multitouch mice':
4 | user => $::boxen_user,
5 | domain => 'NSGlobalDomain',
6 | key => 'AppleEnableMouseSwipeNavigateWithScrolls',
7 | value => $enabled,
8 | type => 'boolean'
9 | }
10 | }
--------------------------------------------------------------------------------
/manifests/no_network_dsstores.pp:
--------------------------------------------------------------------------------
1 | # Public: Disable creation of .DS_Store files on network drives.
2 | class osx::no_network_dsstores {
3 | boxen::osx_defaults { 'Do not create .DS_Store on network shares':
4 | key => 'DSDontWriteNetworkStores',
5 | domain => 'com.apple.desktopservices',
6 | value => true,
7 | user => $::boxen_user
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/manifests/recovery_message.pp:
--------------------------------------------------------------------------------
1 | # Public: Add a recovery message to the OS X Lock Screen
2 | #
3 | # Examples
4 | #
5 | # osx::recovery_message { 'If this Mac is found, please call 123-123-1234': }
6 | define osx::recovery_message(
7 | $ensure = 'present',
8 | $value = $name,
9 | ) {
10 | $kextdir = '/System/Library/Extensions'
11 | $eficachedir = '/System/Library/Caches/com.apple.corestorage/EFILoginLocalizations'
12 |
13 | # The recovery message cannot contain an apostrophe (') because we're passing
14 | # it into a single-quoted exec. If it does contain an apostrophe, fail and
15 | # alert the user
16 | if '\'' in $value {
17 | fail('Your osx::recovery_message declaration contains an apostrophe (\'),',
18 | 'which will cause the exec used to set the message to fail. Please',
19 | "remove the apostrophe and try again. Your message: \"${value}\"")
20 | }
21 |
22 | # The CoreStorage kext cache needs to be updated so the recovery message
23 | # is displayed on the FDE pre-boot screen.
24 | #
25 | # The CS cache can be updated directly by touching $eficachedir, if it exists.
26 | # Otherwise you will need to touch $kextdir to generate it.
27 | exec { 'Refresh system kext cache':
28 | command => "/usr/bin/touch ${kextdir}",
29 | creates => $eficachedir,
30 | refreshonly => true,
31 | user => root
32 | }
33 |
34 | exec { 'Refresh CoreStorage EFI Cache':
35 | command => "/usr/bin/touch ${eficachedir}",
36 | onlyif => "test -d ${eficachedir}",
37 | refreshonly => true,
38 | user => root
39 | }
40 |
41 | if $ensure == 'present' {
42 | if $value != undef {
43 | boxen::osx_defaults { 'Set OS X Recovery Message':
44 | ensure => present,
45 | domain => '/Library/Preferences/com.apple.loginwindow.plist',
46 | key => 'LoginwindowText',
47 | value => $value,
48 | user => 'root',
49 | notify => [
50 | Exec['Refresh system kext cache'],
51 | Exec['Refresh CoreStorage EFI Cache']
52 | ]
53 | }
54 |
55 | exec { 'Set OS X Recovery Message NVRAM Variable':
56 | command => "nvram good-samaritan-message='${value}'",
57 | unless => "nvram good-samaritan-message | cut -c24- | grep '^${value}$'",
58 | user => root
59 | }
60 | } else {
61 | fail('Cannot set an OS X recovery message without a value')
62 | }
63 | } else {
64 | boxen::osx_defaults { 'Remove OS X Recovery Message':
65 | ensure => absent,
66 | domain => '/Library/Preferences/com.apple.loginwindow.plist',
67 | key => 'LoginwindowText',
68 | user => 'root',
69 | notify => [
70 | Exec['Refresh system kext cache'],
71 | Exec['Refresh CoreStorage EFI Cache']
72 | ]
73 | }
74 |
75 | exec { 'Remove OS X Recovery Message NVRAM Variable':
76 | command => 'nvram -d good-samaritan-message',
77 | onlyif => 'nvram -p | grep good-samaritan-message',
78 | user => root
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/manifests/safari/enable_developer_mode.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables developer mode in Safari
2 | #
3 | # Examples
4 | #
5 | # include osx::safari::enable_developer_mode
6 | #
7 | class osx::safari::enable_developer_mode {
8 | boxen::osx_defaults { 'enable developer mode':
9 | ensure => present,
10 | domain => 'com.apple.Safari',
11 | key => 'IncludeDevelopMenu',
12 | type => 'bool',
13 | value => true,
14 | user => $::boxen_user
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/manifests/software_update.pp:
--------------------------------------------------------------------------------
1 | # Public: Install updates from Apple
2 | class osx::software_update {
3 | exec {
4 | 'OSX Software Update':
5 | command => 'softwareupdate -i -a',
6 | schedule => 'update_schedule',
7 | timeout => 0,
8 | user => 'root'
9 | }
10 |
11 | schedule { 'update_schedule':
12 | period => 'weekly'
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/manifests/sound/interface_sound_effects.pp:
--------------------------------------------------------------------------------
1 | # Public: Manages interface sound effects
2 | class osx::sound::interface_sound_effects (
3 | $enable = true
4 | ) {
5 |
6 | $value = $enable ? {
7 | false => 0,
8 | default => 1
9 | }
10 |
11 | boxen::osx_defaults { 'Manage interface sound effects':
12 | user => $::boxen_user,
13 | key => 'com.apple.sound.uiaudio.enabled',
14 | domain => 'com.apple.systemsound',
15 | value => $value,
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/manifests/universal_access/ctrl_mod_zoom.pp:
--------------------------------------------------------------------------------
1 | # Public: Enables Ctrl-scroll to zoom.
2 | class osx::universal_access::ctrl_mod_zoom {
3 | boxen::osx_defaults { 'Use scroll gesture with the Ctrl (^) key to zoom':
4 | user => $::boxen_user,
5 | domain => 'com.apple.universalaccess',
6 | key => 'HIDScrollZoomModifierMask',
7 | value => 262144;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/manifests/universal_access/cursor_size.pp:
--------------------------------------------------------------------------------
1 | # Public: Sets the size of the cursor.
2 | #
3 | # zoom - the factor by which the cursor will be zoomed. Defaults to 1.5.
4 | #
5 | # Examples
6 | #
7 | # # set the cursor zoom to 1.5 (the default)...
8 | # include osx::universal_access::cursor_size
9 | #
10 | # # ...or pick your own multiplier!
11 | # class { 'osx::universal_access::cursor_size':
12 | # zoom => 2
13 | # }
14 | class osx::universal_access::cursor_size($zoom = 1.5) {
15 | boxen::osx_defaults { 'cursor size':
16 | user => $::boxen_user,
17 | domain => 'com.apple.universalaccess',
18 | key => 'mouseDriverCursorSize',
19 | value => $zoom;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/manifests/universal_access/enable_scrollwheel_zoom.pp:
--------------------------------------------------------------------------------
1 | # Public: Enable use of mousewheel for zooming.
2 | class osx::universal_access::enable_scrollwheel_zoom {
3 | boxen::osx_defaults { 'Use mouse wheel (scroll gesture) to zoom':
4 | user => $::boxen_user,
5 | domain => 'com.apple.universalaccess',
6 | key => 'closeViewScrollWheelToggle',
7 | value => true;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/script/cardboard-exec:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Make sure deps are available and run a Cardboard command.
3 |
4 | set -e
5 |
6 | cd $(dirname "$0")/..
7 |
8 | BUNDLE=.bundle
9 | BIN=$BUNDLE/binstubs
10 | SCRIPT=$(basename "$0")
11 |
12 | BUNDLE_ARGS="--binstubs $BIN --path $BUNDLE --quiet"
13 | [ "cibuild" = "$SCRIPT" ] && BUNDLE_ARGS="$BUNDLE_ARGS --no-quiet"
14 |
15 | rm -rf {$BIN,$BUNDLE/config}
16 | bundle install $BUNDLE_ARGS
17 |
18 | bundle exec cardboard bootstrap
19 | exec bundle exec cardboard "$SCRIPT" "$@"
20 |
--------------------------------------------------------------------------------
/script/cibuild:
--------------------------------------------------------------------------------
1 | cardboard-exec
--------------------------------------------------------------------------------
/script/lint:
--------------------------------------------------------------------------------
1 | cardboard-exec
--------------------------------------------------------------------------------
/script/specs:
--------------------------------------------------------------------------------
1 | cardboard-exec
--------------------------------------------------------------------------------
/script/syntax:
--------------------------------------------------------------------------------
1 | cardboard-exec
--------------------------------------------------------------------------------
/spec/classes/disable_app_quarantine_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::disable_app_quarantine' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Disable the downloaded app quarantine').with({
8 | :key => 'LSQuarantine',
9 | :domain => 'com.apple.LaunchServices',
10 | :value => false,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/dock/2d_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::2d' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults('Use a flat, 2d style for the Dock').with({
10 | :key => 'no-glass',
11 | :domain => 'com.apple.dock',
12 | :value => true,
13 | :notify => 'Exec[killall Dock]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/dock/autohide_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::autohide' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults('Automatically hide the dock').with({
10 | :key => 'autohide',
11 | :domain => 'com.apple.dock',
12 | :value => true,
13 | :notify => 'Exec[killall Dock]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/dock/clear_dock_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::clear_dock' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults('Prevent launchpad from reappearing').with({
10 | :key => 'checked-for-launchpad',
11 | :domain => 'com.apple.dock',
12 | :value => true,
13 | :notify => 'Exec[killall Dock]',
14 | :user => facts[:boxen_user]
15 | })
16 |
17 | should contain_boxen__osx_defaults('Remove all the pinned icons').with({
18 | :key => 'persistent-apps',
19 | :domain => 'com.apple.dock',
20 | :value => '()',
21 | :notify => 'Exec[killall Dock]',
22 | :user => facts[:boxen_user]
23 | })
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/spec/classes/dock/dim_hidden_apps_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::dim_hidden_apps' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults('Dim hidden apps').with({
10 | :key => 'showhidden',
11 | :domain => 'com.apple.dock',
12 | :value => true,
13 | :notify => 'Exec[killall Dock]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/dock/disable_dashboard_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::disable_dashboard' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults('Disable the dashboard').with({
10 | :key => 'mcx-disabled',
11 | :domain => 'com.apple.dashboard',
12 | :value => true,
13 | :notify => 'Exec[killall Dock]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/dock/disable_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::disable' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults('Disable the dock').with({
10 | :key => 'autohide-delay',
11 | :domain => 'com.apple.dock',
12 | :type => 'float',
13 | :value => 999999,
14 | :notify => 'Exec[killall Dock]',
15 | :user => facts[:boxen_user]
16 | })
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/classes/dock/hide_indicator_lights_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::hide_indicator_lights' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 |
9 | should contain_boxen__osx_defaults("Hide indicator lights under running applications").with({
10 | :key => 'show-process-indicators',
11 | :domain => 'com.apple.dock',
12 | :value => false,
13 | :notify => 'Exec[killall Dock]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/dock/hot_corners_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::hot_corners' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | {'top_left' => 'Top Left', 'top_right' => 'Top Right', 'bottom_left' => 'Bottom Left', 'bottom_right' => 'Bottom Right'}.each_pair do |parameter_name, position|
7 | context "with #{parameter_name} parameter" do
8 | let(:params) { {parameter_name => 'Dashboard'} }
9 |
10 | it do
11 | should contain_osx__dock__hot_corner(position).with({
12 | :action => 'Dashboard'
13 | })
14 | end
15 | end
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/dock/icon_size_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::icon_size' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 | should contain_boxen__osx_defaults('icon size').with_value(36)
9 | end
10 |
11 | describe 'with parameters' do
12 | let(:params) { {:size => 1} }
13 |
14 | it 'allows you to pass a size' do
15 | should include_class('osx::dock')
16 |
17 | should contain_boxen__osx_defaults('icon size').with({
18 | :key => 'tilesize',
19 | :domain => 'com.apple.dock',
20 | :value => 1,
21 | :notify => 'Exec[killall Dock]',
22 | :user => facts[:boxen_user]
23 | })
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/spec/classes/dock/magnification_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::magnification' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('magnification').with({
8 | :key => 'magnification',
9 | :domain => 'com.apple.dock',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 |
15 | it do
16 | should contain_boxen__osx_defaults('magnification_size').with({
17 | :key => 'largesize',
18 | :domain => 'com.apple.dock',
19 | :value => '128',
20 | :user => facts[:boxen_user]
21 | })
22 | end
23 |
24 | context 'given false' do
25 | let(:params) { { :magnification => false } }
26 | it do
27 | should contain_boxen__osx_defaults('magnification').with({
28 | :key => 'magnification',
29 | :domain => 'com.apple.dock',
30 | :value => false,
31 | :user => facts[:boxen_user]
32 | })
33 | end
34 | end
35 |
36 | context 'given a magnification_size' do
37 | let(:params) { { :magnification_size => 64 } }
38 | it do
39 | should contain_boxen__osx_defaults('magnification_size').with({
40 | :key => 'largesize',
41 | :domain => 'com.apple.dock',
42 | :value => 64,
43 | :user => facts[:boxen_user]
44 | })
45 | end
46 | end
47 |
48 | end
49 |
--------------------------------------------------------------------------------
/spec/classes/dock/pin_position_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::pin_position' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 | should contain_boxen__osx_defaults('pin position').with_value('start')
9 | end
10 |
11 | describe 'with parameters' do
12 | let(:params) { {:position => 'end'} }
13 |
14 | it 'allows you to pass a position' do
15 | should include_class('osx::dock')
16 |
17 | should contain_boxen__osx_defaults('pin position').with({
18 | :key => 'pinning',
19 | :domain => 'com.apple.dock',
20 | :value => 'end',
21 | :notify => 'Exec[killall Dock]',
22 | :user => facts[:boxen_user]
23 | })
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/spec/classes/dock/position_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::position' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::dock')
8 | should contain_boxen__osx_defaults('position').with_value('right')
9 | end
10 |
11 | describe 'with parameters' do
12 | let(:params) { {:position => 'left'} }
13 |
14 | it 'allows you to pass a position' do
15 | should include_class('osx::dock')
16 |
17 | should contain_boxen__osx_defaults('position').with({
18 | :key => 'orientation',
19 | :domain => 'com.apple.dock',
20 | :value => 'left',
21 | :notify => 'Exec[killall Dock]',
22 | :user => facts[:boxen_user]
23 | })
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/spec/classes/dock_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock' do
4 | it do
5 | should contain_exec('killall Dock').with( {:refreshonly => true} )
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/spec/classes/finder/empty_trash_securely_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::empty_trash_securely' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Securely Empty Trash').with({
10 | :key => 'EmptyTrashSecurely',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/enable_quicklook_text_selection_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::enable_quicklook_text_selection' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Enable Quick Look text selection').with(
10 | :user => facts[:boxen_user],
11 | :domain => 'com.apple.finder',
12 | :key => 'QLEnableTextSelection',
13 | :value => true,
14 | :notify => 'Exec[killall Finder]'
15 | )
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/no_file_extension_warnings_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::no_file_extension_warnings' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Disable file extension change warnings').with({
10 | :key => 'FXEnableExtensionChangeWarning',
11 | :domain => 'com.apple.finder',
12 | :value => false,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_all_filename_extensions_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_all_filename_extensions' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show all filename extensions').with({
10 | :key => 'AppleShowAllExtensions',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_all_on_desktop_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_all_on_desktop' do
4 | it do
5 | should include_class('osx::finder::show_hard_drives_on_desktop')
6 | should include_class('osx::finder::show_external_hard_drives_on_desktop')
7 | should include_class('osx::finder::show_mounted_servers_on_desktop')
8 | should include_class('osx::finder::show_removable_media_on_desktop')
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_external_hard_drives_on_desktop_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_external_hard_drives_on_desktop' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show external drives on the desktop').with({
10 | :key => 'ShowExternalHardDrivesOnDesktop',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_hard_drives_on_desktop_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_hard_drives_on_desktop' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show internal drives on the desktop').with({
10 | :key => 'ShowHardDrivesOnDesktop',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_hidden_files_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_hidden_files' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show Hidden Files').with({
10 | :key => 'AppleShowAllFiles',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_mounted_servers_on_desktop_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_mounted_servers_on_desktop' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show mounted servers on the desktop').with({
10 | :key => 'ShowMountedServersOnDesktop',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_removable_media_on_desktop_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_removable_media_on_desktop' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show mounted media on the desktop').with({
10 | :key => 'ShowRemovableMediaOnDesktop',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_warning_before_changing_an_extension_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_warning_before_changing_an_extension' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show warning before changing an extension').with({
10 | :key => 'FXEnableExtensionChangeWarning',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/show_warning_before_emptying_trash_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::show_warning_before_emptying_trash' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should include_class('osx::finder')
8 |
9 | should contain_boxen__osx_defaults('Show warning before emptying the trash').with({
10 | :key => 'WarnOnEmptyTrash',
11 | :domain => 'com.apple.finder',
12 | :value => true,
13 | :notify => 'Exec[killall Finder]',
14 | :user => facts[:boxen_user]
15 | })
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/spec/classes/finder/unhide_library_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder::unhide_library' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_exec('Unhide ~/Library').with({
8 | :command => "chflags nohidden /Users/#{facts[:boxen_user]}/Library",
9 | :onlyif => "ls -Ol /Users/#{facts[:boxen_user]} | grep Library | grep hidden"
10 | })
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/classes/finder_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::finder' do
4 | it do
5 | should contain_exec('killall Finder').with( {:refreshonly => true} )
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/spec/classes/global/disable_autocorrect_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::disable_autocorrect' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Disable autocorrect').with({
8 | :key => 'NSAutomaticSpellingCorrectionEnabled',
9 | :domain => 'NSGlobalDomain',
10 | :value => false,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/global/disable_key_press_and_hold_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::disable_key_press_and_hold' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Disable press-and-hold for accented characters').with({
8 | :key => 'ApplePressAndHoldEnabled',
9 | :domain => 'NSGlobalDomain',
10 | :value => false,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/global/disable_remote_control_ir_receiver_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::disable_remote_control_ir_receiver' do
4 | it do
5 | should contain_boxen__osx_defaults('Disable remote control infrared receiver').with({
6 | :domain => '/Library/Preferences/com.apple.driver.AppleIRController',
7 | :key => 'DeviceEnabled',
8 | :user => 'root',
9 | :value => false,
10 | })
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/classes/global/enable_keyboard_control_access_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::enable_keyboard_control_access' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Enable full keyboard access for all controls').with({
8 | :key => 'AppleKeyboardUIMode',
9 | :domain => 'NSGlobalDomain',
10 | :value => 3,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/global/enable_standard_function_keys_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::enable_standard_function_keys' do
4 | let(:facts) { {:boxen_user => 'ieatbees'} }
5 |
6 | it 'os x defaults' do
7 | should contain_boxen__osx_defaults('Keyboard, Use all F1, F2, etc. keys as standard function keys').with({
8 | :key => 'com.apple.keyboard.fnState',
9 | :domain => 'NSGlobalDomain',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 |
15 | describe 'with parameters' do
16 | let(:params) { {:enabled => false} }
17 | it do
18 | should contain_boxen__osx_defaults('Keyboard, Use all F1, F2, etc. keys as standard function keys').with({
19 | :key => 'com.apple.keyboard.fnState',
20 | :domain => 'NSGlobalDomain',
21 | :value => false,
22 | :user => facts[:boxen_user]
23 | })
24 | end
25 | end
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/spec/classes/global/expand_print_dialog_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::expand_print_dialog' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Expand print panel by default').with({
8 | :key => 'PMPrintingExpandedStateForPrint',
9 | :domain => 'NSGlobalDomain',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/global/expand_save_dialog_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::expand_save_dialog' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Expand save panel by default').with({
8 | :key => 'NSNavPanelExpandedStateForSaveMode',
9 | :domain => 'NSGlobalDomain',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/global/key_repeat_delay_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::key_repeat_delay' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('key repeat delay').with_value(35)
8 | end
9 |
10 | describe 'with parameters' do
11 | let(:params) { {:delay => 10} }
12 |
13 | it 'allows you to pass a delay value' do
14 | should contain_boxen__osx_defaults('key repeat delay').with({
15 | :domain => 'NSGlobalDomain',
16 | :type => 'int',
17 | :key => 'InitialKeyRepeat',
18 | :value => params[:delay],
19 | :user => facts[:boxen_user]
20 | })
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/spec/classes/global/key_repeat_rate_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::key_repeat_rate' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('key repeat rate').with_value(0)
8 | end
9 |
10 | describe 'with parameters' do
11 | let(:params) { {:rate => 10} }
12 |
13 | it 'allows you to pass a rate value' do
14 | should contain_boxen__osx_defaults('key repeat rate').with({
15 | :domain => 'NSGlobalDomain',
16 | :type => 'int',
17 | :key => 'KeyRepeat',
18 | :value => params[:rate],
19 | :user => facts[:boxen_user]
20 | })
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/spec/classes/global/natural_mouse_scrolling_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::natural_mouse_scrolling' do
4 | let(:facts) { {:boxen_user => 'ieatbees'} }
5 |
6 | it 'os x defaults' do
7 | should contain_boxen__osx_defaults('Disable natural mouse scrolling').with({
8 | :key => 'com.apple.swipescrolldirection',
9 | :domain => 'NSGlobalDomain',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 |
15 | describe 'with parameters' do
16 | let(:params) { {:enabled => false} }
17 | it do
18 | should contain_boxen__osx_defaults('Disable natural mouse scrolling').with({
19 | :key => 'com.apple.swipescrolldirection',
20 | :domain => 'NSGlobalDomain',
21 | :value => false,
22 | :user => facts[:boxen_user]
23 | })
24 | end
25 | end
26 |
27 | end
28 |
--------------------------------------------------------------------------------
/spec/classes/global/tap_to_click_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::global::tap_to_click' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Tap-To-Click Bluetooth').with({
8 | :key => 'Clicking',
9 | :domain => 'com.apple.driver.AppleBluetoothMultitouch.trackpad',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 |
15 | it do
16 | should contain_boxen__osx_defaults('Tap-To-Click Mouse').with({
17 | :key => 'com.apple.mouse.tapBehavior',
18 | :domain => 'NSGlobalDomain',
19 | :value => 1,
20 | :user => facts[:boxen_user]
21 | })
22 | end
23 |
24 | it do
25 | should contain_boxen__osx_defaults('Tap-To-Click Current Host').with({
26 | :key => 'com.apple.mouse.tapBehavior',
27 | :domain => 'NSGlobalDomain',
28 | :value => 1,
29 | :user => facts[:boxen_user],
30 | :host => 'currentHost'
31 | })
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/spec/classes/keyboard/capslock_to_control_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::keyboard::capslock_to_control' do
4 | let(:command_str) do
5 | "ioreg -n IOHIDKeyboard -r | grep -E 'VendorID\"|ProductID' | " \
6 | "awk '{ print $4 }' | paste -s -d'-\\n' - | xargs -I{} defaults " \
7 | "-currentHost write -g \"com.apple.keyboard.modifiermapping.{}-0\" " \
8 | "-array \"HIDKeyboardModifierMappingDst" \
9 | "2HIDKeyboardModifierMappingSrc" \
10 | "0\""
11 | end
12 |
13 | let(:unless_str) do
14 | "ioreg -n IOHIDKeyboard -r | grep -E 'VendorID\"|ProductID' | " \
15 | "awk '{ print $4 }' | paste -s -d'-\\n' - | xargs -I{} sh -c 'defaults" \
16 | " -currentHost read -g \"com.apple.keyboard.modifiermapping.{}-0\" | " \
17 | "grep \"Dst = 2\" > /dev/null'"
18 | end
19 |
20 | it do
21 | should contain_exec('Remap capslock to control on all keyboards').
22 | with(:command => command_str, :unless => unless_str)
23 | end
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/spec/classes/menubar/show_battery_percent_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::menubar::show_battery_percent' do
4 | should contain_boxen__osx_defaults('Shows battery percentage').with({
5 | :key => 'ShowPercent',
6 | :domain => 'com.apple.menuextra.battery',
7 | :value => 'YES',
8 | :user => facts[:boxen_user],
9 | :notify => 'Exec[killall SystemUIServer]'
10 | })
11 | end
12 |
--------------------------------------------------------------------------------
/spec/classes/menubar_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::menubar' do
4 | it do
5 | should contain_exec('killall SystemUIServer').with( {:refreshonly => true} )
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/spec/classes/mouse/button_mode.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::mouse::button_mode' do
4 | let(:facts) { {:boxen_user => 'ieatbees'} }
5 |
6 | it 'os x defaults' do
7 | should contain_boxen__osx_defaults('Set the button mode for multitouch mice').with({
8 | :key => 'MouseButtonMode',
9 | :domain => 'com.apple.driver.AppleBluetoothMultitouch.mouse',
10 | :value => 'OneButton',
11 | :user => facts[:boxen_user],
12 | :type => 'string'
13 | })
14 | end
15 |
16 | describe 'with parameters' do
17 | let(:params) { {:mode => 2} }
18 | it do
19 | should contain_boxen__osx_defaults('Set the button mode for multitouch mice').with({
20 | :key => 'MouseButtonMode',
21 | :domain => 'com.apple.driver.AppleBluetoothMultitouch.mouse',
22 | :value => 'TwoButton',
23 | :user => facts[:boxen_user],
24 | :type => 'string'
25 | })
26 | end
27 | end
28 |
29 | end
30 |
--------------------------------------------------------------------------------
/spec/classes/mouse/smart_zoom_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::mouse::smart_zoom' do
4 | let(:facts) { {:boxen_user => 'ieatbees'} }
5 |
6 | it 'os x defaults' do
7 | should contain_boxen__osx_defaults('Enable smart zoom for multitouch mice').with({
8 | :key => 'MouseOneFingerDoubleTapGesture',
9 | :domain => 'com.apple.driver.AppleBluetoothMultitouch.mouse',
10 | :value => 0,
11 | :user => facts[:boxen_user],
12 | :type => 'integer'
13 | })
14 | end
15 |
16 | describe 'with parameters' do
17 | let(:params) { {:enabled => true} }
18 | it do
19 | should contain_boxen__osx_defaults('Enable smart zoom for multitouch mice').with({
20 | :key => 'MouseOneFingerDoubleTapGesture',
21 | :domain => 'com.apple.driver.AppleBluetoothMultitouch.mouse',
22 | :value => 1,
23 | :user => facts[:boxen_user],
24 | :type => 'integer'
25 | })
26 | end
27 | end
28 |
29 | end
30 |
--------------------------------------------------------------------------------
/spec/classes/mouse/swipe_between_pages_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::mouse::swipe_between_pages' do
4 | let(:facts) { {:boxen_user => 'ieatbees'} }
5 |
6 | it 'os x defaults' do
7 | should contain_boxen__osx_defaults('Enable swipe between pages for multitouch mice').with({
8 | :key => 'AppleEnableMouseSwipeNavigateWithScrolls',
9 | :domain => 'NSGlobalDomain',
10 | :value => false,
11 | :user => facts[:boxen_user],
12 | :type => 'boolean'
13 | })
14 | end
15 |
16 | describe 'with parameters' do
17 | let(:params) { {:enabled => true} }
18 | it do
19 | should contain_boxen__osx_defaults('Enable swipe between pages for multitouch mice').with({
20 | :key => 'AppleEnableMouseSwipeNavigateWithScrolls',
21 | :domain => 'NSGlobalDomain',
22 | :value => true,
23 | :user => facts[:boxen_user],
24 | :type => 'boolean'
25 | })
26 | end
27 | end
28 |
29 | end
30 |
--------------------------------------------------------------------------------
/spec/classes/no_network_dsstores_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::no_network_dsstores' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Do not create .DS_Store on network shares').with({
8 | :key => 'DSDontWriteNetworkStores',
9 | :domain => 'com.apple.desktopservices',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/safari/enable_developer_mode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::safari::enable_developer_mode' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('enable developer mode').with({
8 | :key => 'IncludeDevelopMenu',
9 | :domain => 'com.apple.Safari',
10 | :type => 'bool',
11 | :value => true,
12 | :user => facts[:boxen_user]
13 | })
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/spec/classes/software_update_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::software_update' do
4 | it do
5 | should contain_exec('OSX Software Update').with({
6 | :command => 'softwareupdate -i -a',
7 | :schedule => 'update_schedule',
8 | :timeout => 0,
9 | :user => 'root'
10 | })
11 | end
12 |
13 | it do
14 | should contain_schedule('update_schedule').with({
15 | :period => 'weekly'
16 | })
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/classes/sound/interface_sound_effects_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::sound::interface_sound_effects' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | describe 'default' do
7 | it do
8 | should contain_boxen__osx_defaults('Manage interface sound effects').with({
9 | :key => 'com.apple.sound.uiaudio.enabled',
10 | :domain => 'com.apple.systemsound',
11 | :value => 1,
12 | :user => facts[:boxen_user]
13 | })
14 | end
15 | end
16 |
17 | describe 'enable' do
18 | let(:params) { {:enable => true} }
19 | it do
20 | should contain_boxen__osx_defaults('Manage interface sound effects').with({
21 | :key => 'com.apple.sound.uiaudio.enabled',
22 | :domain => 'com.apple.systemsound',
23 | :value => 1,
24 | :user => facts[:boxen_user]
25 | })
26 | end
27 | end
28 |
29 | describe 'disable' do
30 | let(:params) { {:enable => false} }
31 | it do
32 | should contain_boxen__osx_defaults('Manage interface sound effects').with({
33 | :key => 'com.apple.sound.uiaudio.enabled',
34 | :domain => 'com.apple.systemsound',
35 | :value => 0,
36 | :user => facts[:boxen_user]
37 | })
38 | end
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/spec/classes/universal_access/ctrl_mod_zoom_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::universal_access::ctrl_mod_zoom' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Use scroll gesture with the Ctrl (^) key to zoom').with({
8 | :key => 'HIDScrollZoomModifierMask',
9 | :domain => 'com.apple.universalaccess',
10 | :value => 262144,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/classes/universal_access/cursor_size_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::universal_access::cursor_size' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('cursor size').with_value(1.5)
8 | end
9 |
10 | describe 'with parameters' do
11 | let(:params) { {:zoom => 2} }
12 |
13 | it 'allows you to pass a zoom value' do
14 | should contain_boxen__osx_defaults('cursor size').with({
15 | :domain => 'com.apple.universalaccess',
16 | :key => 'mouseDriverCursorSize',
17 | :value => params[:zoom],
18 | :user => facts[:boxen_user]
19 | })
20 | end
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/spec/classes/universal_access/enable_scrollwheel_zoom_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::universal_access::enable_scrollwheel_zoom' do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | it do
7 | should contain_boxen__osx_defaults('Use mouse wheel (scroll gesture) to zoom').with({
8 | :key => 'closeViewScrollWheelToggle',
9 | :domain => 'com.apple.universalaccess',
10 | :value => true,
11 | :user => facts[:boxen_user]
12 | })
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/spec/defines/hot_corner_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::dock::hot_corner', :type => :define do
4 | let(:facts) { {:boxen_user => 'ilikebees'} }
5 |
6 | {'Top Left' => 'tl', 'Top Right' => 'tr', 'Bottom Left' => 'bl', 'Bottom Right' => 'br'}.each_pair do |position, position_value|
7 | context "for #{position} corner" do
8 |
9 | {'Mission Control' => 2, 'Application Windows' => 3, 'Desktop' => 4,
10 | 'Start Screen Saver' => 5, 'Disable Screen Saver' => 6, 'Dashboard' => 7,
11 | 'Put Display to Sleep' => 10, 'Launchpad' => 11, 'Notification Center' => 12}.each_pair do |action, action_value|
12 |
13 | context "and action '#{action}'" do
14 |
15 | context "using type title" do
16 | let :title do
17 | position
18 | end
19 |
20 | let :params do
21 | { :action => action }
22 | end
23 |
24 | it do
25 | should contain_class('osx::dock')
26 |
27 | should contain_boxen__osx_defaults("Hot Corners #{position} Action").with({
28 | :key => "wvous-#{position_value}-corner",
29 | :domain => 'com.apple.dock',
30 | :type => 'int',
31 | :value => action_value,
32 | :user => facts[:boxen_user],
33 | :notify => 'Exec[killall Dock]'
34 | })
35 |
36 | should contain_boxen__osx_defaults("Hot Corners #{position} Modifier").with({
37 | :key => "wvous-#{position_value}-modifier",
38 | :domain => 'com.apple.dock',
39 | :type => 'int',
40 | :value => 0,
41 | :user => facts[:boxen_user],
42 | :notify => 'Exec[killall Dock]'
43 | })
44 | end
45 | end
46 |
47 | context "using position parameter" do
48 | let :title do
49 | "Active Corner"
50 | end
51 |
52 | let :params do
53 | { :action => action, :position => position }
54 | end
55 |
56 | it do
57 | should contain_class('osx::dock')
58 |
59 | should contain_boxen__osx_defaults("Hot Corners #{position} Action").with({
60 | :key => "wvous-#{position_value}-corner",
61 | :domain => 'com.apple.dock',
62 | :type => 'int',
63 | :value => action_value,
64 | :user => facts[:boxen_user],
65 | :notify => 'Exec[killall Dock]'
66 | })
67 |
68 | should contain_boxen__osx_defaults("Hot Corners #{position} Modifier").with({
69 | :key => "wvous-#{position_value}-modifier",
70 | :domain => 'com.apple.dock',
71 | :type => 'int',
72 | :value => 0,
73 | :user => facts[:boxen_user],
74 | :notify => 'Exec[killall Dock]'
75 | })
76 | end
77 | end
78 |
79 | end
80 | end
81 | end
82 | end
83 | end
84 |
--------------------------------------------------------------------------------
/spec/defines/recovery_message_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe 'osx::recovery_message' do
4 | let(:title) { 'foo' }
5 | let(:kextdir) { '/System/Library/Extensions' }
6 | let(:eficachedir) { '/System/Library/Caches/com.apple.corestorage/EFILoginLocalizations' }
7 |
8 | it do
9 | should contain_exec('Refresh system kext cache').with({
10 | :command => "/usr/bin/touch #{kextdir}",
11 | :creates => eficachedir,
12 | :refreshonly => true,
13 | :user => 'root'
14 | })
15 |
16 | should contain_exec('Refresh CoreStorage EFI Cache').with({
17 | :command => "/usr/bin/touch #{eficachedir}",
18 | :onlyif => "test -d #{eficachedir}",
19 | :refreshonly => true,
20 | :user => 'root'
21 | })
22 | end
23 |
24 | context 'given a name' do
25 | let(:title) { 'If this Mac is found, please call 123-123-1234' }
26 |
27 | it do
28 | should contain_boxen__osx_defaults('Set OS X Recovery Message').with({
29 | :ensure => 'present',
30 | :domain => '/Library/Preferences/com.apple.loginwindow.plist',
31 | :key => 'LoginwindowText',
32 | :value => title,
33 | :user => 'root'
34 | })
35 |
36 | should contain_exec('Set OS X Recovery Message NVRAM Variable').with({
37 | :command => "nvram good-samaritan-message='#{title}'",
38 | :unless => "nvram good-samaritan-message | cut -c24- | grep '^#{title}$'",
39 | :user => 'root'
40 | })
41 | end
42 | end
43 |
44 | context 'with ensure => absent' do
45 | let(:title) { 'foo' }
46 | let(:params) { {:ensure => 'absent'} }
47 |
48 | it do
49 | should contain_boxen__osx_defaults('Remove OS X Recovery Message').with({
50 | :ensure => 'absent',
51 | :domain => '/Library/Preferences/com.apple.loginwindow.plist',
52 | :key => 'LoginwindowText',
53 | :user => 'root'
54 | })
55 |
56 | should contain_exec('Remove OS X Recovery Message NVRAM Variable').with({
57 | :command => 'nvram -d good-samaritan-message',
58 | :onlyif => 'nvram -p | grep good-samaritan-message',
59 | :user => 'root'
60 | })
61 | end
62 | end
63 |
64 | context 'Given a value with an apostrophe' do
65 | let(:title) { "Jack's message with an apostrophe" }
66 | let(:error) { "Your osx::recovery_message declaration contains an apostrophe" }
67 |
68 | it do
69 | expect {
70 | should contain_exec('Set OS X Recovery Message NVRAM Variable')
71 | }.to raise_error(Puppet::Error, /#{error}/)
72 | end
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/spec/fixtures/Puppetfile:
--------------------------------------------------------------------------------
1 | mod "boxen", "2.0.0", :github_tarball => "boxen/puppet-boxen"
2 | mod "puppetlabs-stdlib", "4.2.1", :github_tarball => "puppetlabs/puppetlabs-stdlib"
--------------------------------------------------------------------------------
/spec/fixtures/Puppetfile.lock:
--------------------------------------------------------------------------------
1 | GITHUBTARBALL
2 | remote: boxen/puppet-boxen
3 | specs:
4 | boxen (2.0.0)
5 |
6 | GITHUBTARBALL
7 | remote: puppetlabs/puppetlabs-stdlib
8 | specs:
9 | puppetlabs-stdlib (4.2.1)
10 |
11 | DEPENDENCIES
12 | boxen (= 2.0.0)
13 | puppetlabs-stdlib (= 4.2.1)
14 |
15 |
--------------------------------------------------------------------------------
/spec/fixtures/manifests/site.pp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/boxen/puppet-osx/2aa59f8da76507b43ae4651b6be04a04383531ee/spec/fixtures/manifests/site.pp
--------------------------------------------------------------------------------
/spec/fixtures/modules/osx/lib:
--------------------------------------------------------------------------------
1 | ../../../../lib
--------------------------------------------------------------------------------
/spec/fixtures/modules/osx/manifests:
--------------------------------------------------------------------------------
1 | ../../../../manifests
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'rspec-puppet'
2 |
3 | fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
4 |
5 | RSpec.configure do |c|
6 | c.module_path = File.join(fixture_path, 'modules')
7 | c.manifest_dir = File.join(fixture_path, 'manifests')
8 | end
9 |
--------------------------------------------------------------------------------