-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from RoboticCheese/roboticcheese/additional-pla…
…tform-support Robustify platform support
- Loading branch information
Showing
33 changed files
with
748 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
source 'https://supermarket.chef.io' | ||
|
||
metadata | ||
|
||
cookbook 'divvy_test', path: 'test/fixtures/cookbooks/divvy_test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Encoding: UTF-8 | ||
# | ||
# Cookbook Name:: divvy | ||
# Library:: provider_divvy_app_mac_os_x_direct | ||
# | ||
# Copyright 2015 Jonathan Hartman | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
require 'chef/provider/lwrp_base' | ||
require_relative 'provider_divvy_app' | ||
require_relative 'provider_divvy_app_mac_os_x' | ||
|
||
class Chef | ||
class Provider | ||
class DivvyApp < Provider::LWRPBase | ||
class MacOsX < DivvyApp | ||
# A Chef provider for OS X installs via direct download. | ||
# | ||
# @author Jonathan Hartman <j@p4nt5.com> | ||
class Direct < MacOsX | ||
URL ||= 'http://mizage.com/downloads/Divvy.zip' | ||
|
||
private | ||
|
||
# | ||
# (see DivvyApp#install!) | ||
# | ||
def install! | ||
download_package | ||
install_package | ||
super | ||
end | ||
|
||
# | ||
# Declare a remote_file resource for downloading the file. | ||
# | ||
def download_package | ||
remote_file download_path do | ||
source URL | ||
action :create | ||
only_if { !::File.exist?(PATH) } | ||
end | ||
end | ||
|
||
# | ||
# Declare an execute resource for extracting the downloaded file. | ||
# | ||
def install_package | ||
path = download_path | ||
execute 'unzip divvy' do | ||
command "unzip -d /Applications #{path}" | ||
action :run | ||
creates PATH | ||
end | ||
end | ||
|
||
# | ||
# Construct a path to download the app file to. | ||
# | ||
# @return [String] | ||
# | ||
def download_path | ||
::File.join(Chef::Config[:file_cache_path], ::File.basename(URL)) | ||
end | ||
|
||
# | ||
# (see MacOsx#app_id) | ||
# | ||
def app_id | ||
'com.mizage.direct.Divvy' | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.