Permalink
Browse files

first working version

  • Loading branch information...
0 parents commit 99e151ca271ba8bf0f1e200a363649ceebf66daa @guilhem guilhem committed Oct 4, 2012
Showing with 161 additions and 0 deletions.
  1. +62 −0 README.md
  2. 0 attributes/default.rb
  3. +9 −0 metadata.rb
  4. +56 −0 providers/default.rb
  5. +23 −0 recipes/default.rb
  6. +11 −0 resources/default.rb
@@ -0,0 +1,62 @@
+Description
+===========
+
+Manage an htpasswd file.
+If htpasswd exe isn't found, we install a python implementation.
+
+Requirements
+============
+
+Work on Windows
+
+Resource/Provider
+=================
+
+This cookbook includes LWRPs for managing:
+* chocolatey
+
+htpasswd
+--------
+
+# Actions
+
+- :install: Install a chocolatey package (default)
+- :upgrade: Update a chocolatey package
+- :remove: Uninstall a chocolatey package
+
+# Attribute Parameters
+
+- package_name: string or package to manage
+- package: package to manage (default package_name)
+- version
+- source
+- args: arguments to the installation
+
+
+# Example
+
+chocolatey "sysinternals"
+
+chocolatey "7zip"
+
+chocolatey "notepadplusplus"
+
+chocolatey "GoogleChrome"
+
+chocolatey "Console2"
+
+chocolatey "bash" do
+ source "cygwin"
+end
+
+chocolatey "openssh" do
+ source "cygwin"
+end
+
+chocolatey "grep" do
+ source "cygwin"
+end
+
+chocolatey "DotNet4.5"
+
+chocolatey "PowerShell"
No changes.
@@ -0,0 +1,9 @@
+maintainer "Guilhem Lettron"
+maintainer_email "guilhem.lettron@youscribe.com"
+license "Apache 2.0"
+description "Install chocolatey and packages on Windows"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.0.1"
+
+depends "powershell"
+supports "windows"
@@ -0,0 +1,56 @@
+#
+# Cookbook Name:: htpasswd
+# Provider:: htpasswd
+# Author:: Guilhem Lettron <guilhem.lettron@youscribe.com>
+#
+# Copyright 20012, Societe Publica.
+#
+# 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.
+#
+
+def initialize(*args)
+ super
+ @action = :install
+end
+
+def cmd_build
+ output = ""
+ if new_resource.version
+ output << " -version #{new_resource.version}"
+ end
+ if new_resource.source
+ output << " -source #{new_resource.source}"
+ end
+ if new_resource.args
+ output << " -installArgs #{new_resource.args}"
+ end
+ return output
+end
+
+action :install do
+ execute "install package" do
+ command "cinst " + new_resource.package + cmd_build
+ end
+end
+
+action :upgrade do
+ execute "update package" do
+ command "chocolatey update " + new_resource.package + cmd_build
+ end
+end
+
+action :remove do
+ execute "uninstall package" do
+ command "chocolatey uninstall " + new_resource.package + cmd_build
+ end
+end
@@ -0,0 +1,23 @@
+#
+# Cookbook Name:: chocolatey
+# recipe:: default
+# Author:: Guilhem Lettron <guilhem.lettron@youscribe.com>
+#
+# Copyright 2012, Societe Publica.
+#
+# 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.
+#
+
+powershell "install chocolatey" do
+ code 'iex ((new-object net.webclient).DownloadString("http://bit.ly/psChocInstall"))'
+end
@@ -0,0 +1,11 @@
+actions :install, :remove, :upgrade
+
+attribute :package, :kind_of => String, :name_attribute => true
+attribute :source, :kind_of => String
+attribute :version, :kind_of => String
+attribute :args, :kind_of => String
+
+def initialize(*args)
+ super
+ @action = :install
+end

0 comments on commit 99e151c

Please sign in to comment.