Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
102 additions
and
98 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
name 'kelseyhightower-homebrew' | ||
name 'rismoney-chocolatey' | ||
version '0.0.1' | ||
source 'https://github.com/kelseyhightower/puppet-homebrew' | ||
author 'kelseyhightower' | ||
source 'https://github.com/rismoney/puppet-chocolatey' | ||
author 'rismoeny' | ||
license 'APACHE2' | ||
summary 'Homebrew package provider' | ||
description 'Homebrew package provider' | ||
project_page 'https://github.com/kelseyhightower/puppet-homebrew' | ||
summary 'Chocolatey package provider' | ||
description 'Chocolatey package provider' | ||
project_page 'https://github.com/rismoney/puppet-chocolatey' | ||
|
||
## Add dependencies, if any: | ||
# dependency 'username/name', '>= 1.2.0' |
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
homebrew | ||
chocolatey | ||
|
||
This is a home brew package provider. Use it like this: | ||
This is a chocolatey package provider. Use it like this: | ||
|
||
class hightower::packages { | ||
pkglist = [‘postgresql’, ‘nginx’, ‘git’, ‘tmux’] | ||
class rich::packages { | ||
pkglist = [‘notepadplusplus’, ‘msysgit’] | ||
|
||
package { $pkglist: | ||
ensure => installed, | ||
provider => ‘homebrew’, | ||
provider => ‘chocolatey’, | ||
} | ||
} |
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,91 @@ | ||
require 'puppet/provider/package' | ||
|
||
Puppet::Type.type(:package).provide(:choc, :parent => Puppet::Provider::Package) do | ||
desc "Package management using Chocolatey on Windows" | ||
|
||
confine :operatingsystem => :windows | ||
|
||
has_feature :versionable | ||
|
||
#replace the line below with | ||
#commands :brew => "/usr/local/bin/brew" | ||
commands :choc => "C:\Chocolatey\chocolateyInstall.cmd" | ||
|
||
# Install packages, known as formulas, using brew. | ||
def install | ||
should = @resource[:ensure] | ||
|
||
package_name = @resource[:name] | ||
case should | ||
when true, false, Symbol | ||
# pass | ||
else | ||
package_name += "-#{should}" | ||
end | ||
|
||
output = choc(:install, package_name) | ||
|
||
# Fail hard if there is no formula available. commented lines 29-31. need to understand choc output | ||
#if output =~ /Error: No available formula/ | ||
# raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}" | ||
#end | ||
end | ||
|
||
# chocolatey doesn't support uninstalls... | ||
|
||
# def uninstall | ||
# choc(:uninstall, @resource[:name]) | ||
# end | ||
|
||
def update | ||
self.install | ||
end | ||
|
||
# def query | ||
# self.class.package_list(:justme => resource[:name]) | ||
# end | ||
|
||
# def latest | ||
# hash = self.class.package_list(:justme => resource[:name]) | ||
# hash[:ensure] | ||
# end | ||
|
||
# def self.package_list(options={}) | ||
# brew_list_command = [command(:brew), "list", "--versions"] | ||
|
||
# if name = options[:justme] | ||
# brew_list_command << name | ||
# end | ||
|
||
# begin | ||
# list = execute(brew_list_command).lines.map {|line| name_version_split(line) } | ||
# rescue Puppet::ExecutionFailure => detail | ||
# raise Puppet::Error, "Could not list packages: #{detail}" | ||
# end | ||
|
||
# if options[:justme] | ||
# return list.shift | ||
# else | ||
# return list | ||
# end | ||
# end | ||
|
||
# def self.name_version_split(line) | ||
# if line =~ (/^(\S+)\s+(.+)/) | ||
# name = $1 | ||
# version = $2 | ||
# { | ||
# :name => name, | ||
# :ensure => version, | ||
# :provider => :brew | ||
# } | ||
# else | ||
# Puppet.warning "Could not match #{line}" | ||
# nil | ||
# end | ||
# end | ||
|
||
# def self.instances(justme = false) | ||
# package_list.collect { |hash| new(hash) } | ||
# end | ||
# end |
This file was deleted.
Oops, something went wrong.