Skip to content
This repository
Browse code

Ajout de la recette git

  • Loading branch information...
commit 6b761fdda34ef74f9e47715aaf2f8c865b928698 1 parent 989a32d
authored
4  cookbooks/git/.gitignore
... ...
@@ -0,0 +1,4 @@
  1
+.bundle
  2
+.cache
  3
+.kitchen
  4
+bin
59  cookbooks/git/CHANGELOG.md
Source Rendered
... ...
@@ -0,0 +1,59 @@
  1
+## v2.2.0:
  2
+
  3
+* [COOK-2303] - git::server support for RHEL platform_family
  4
+
  5
+## v2.1.4:
  6
+
  7
+* [COOK-2110] - initial test-kitchen support (only available in GitHub
  8
+  repository).
  9
+* [COOK-2253] - pin runit dependency
  10
+
  11
+## v2.1.2:
  12
+
  13
+* [COOK-2043] - install git on ubuntu 12.04 not git-core
  14
+
  15
+## v2.1.0:
  16
+
  17
+The repository didn't have pushed commits, and so the following
  18
+changes from earlier-than-latest versions wouldn't be available on the
  19
+community site. We're releasing 2.1.0 to correct this.
  20
+
  21
+* [COOK-1943] - Update to git 1.8.0
  22
+* [COOK-2020] - Add setup option attributes to Git Windows package
  23
+  install
  24
+
  25
+## v2.0.0:
  26
+
  27
+This version uses platform_family attribute, making the cookbook incompatible
  28
+with older versions of Chef/Ohai, hence the major version bump.
  29
+
  30
+* [COOK-1668] - git cookbook fails to run due to bad platform_family
  31
+  call
  32
+* [COOK-1759] - git::source needs additional package for rhel
  33
+  platform_family
  34
+
  35
+## v1.1.2:
  36
+
  37
+* [COOK-2020] - Add setup option attributes to Git Windows package
  38
+  install
  39
+
  40
+## v1.1.0:
  41
+
  42
+* [COOK-1943] - Update to git 1.8.0
  43
+
  44
+## v1.0.2:
  45
+
  46
+* [COOK-1537] - add recipe for source installation
  47
+
  48
+## v1.0.0:
  49
+
  50
+* [COOK-1152] - Add support for Mac OS X
  51
+* [COOK-1112] - Add support for Windows
  52
+
  53
+## v0.10.0:
  54
+
  55
+* [COOK-853] - Git client installation on CentOS
  56
+
  57
+## v0.9.0:
  58
+
  59
+* Current public release.
29  cookbooks/git/CONTRIBUTING
... ...
@@ -0,0 +1,29 @@
  1
+If you would like to contribute, please open a ticket in JIRA:
  2
+
  3
+* http://tickets.opscode.com
  4
+
  5
+Create the ticket in the COOK project and use the cookbook name as the
  6
+component.
  7
+
  8
+For all code contributions, we ask that contributors sign a
  9
+contributor license agreement (CLA). Instructions may be found here:
  10
+
  11
+* http://wiki.opscode.com/display/chef/How+to+Contribute
  12
+
  13
+When contributing changes to individual cookbooks, please do not
  14
+modify the version number in the metadata.rb. Also please do not
  15
+update the CHANGELOG.md for a new version. Not all changes to a
  16
+cookbook may be merged and released in the same versions. Opscode will
  17
+handle the version updates during the release process. You are welcome
  18
+to correct typos or otherwise make updates to documentation in the
  19
+README.
  20
+
  21
+If a contribution adds new platforms or platform versions, indicate
  22
+such in the body of the commit message(s), and update the relevant
  23
+COOK ticket. When writing commit messages, it is helpful for others if
  24
+you indicate the COOK ticket. For example:
  25
+
  26
+    git commit -m '[COOK-1041] Updated pool resource to correctly delete.'
  27
+
  28
+In the ticket itself, it is also helpful if you include log output of
  29
+a successful Chef run, but this is not absolutely required.
3  cookbooks/git/Gemfile
... ...
@@ -0,0 +1,3 @@
  1
+source :rubygems
  2
+
  3
+gem 'test-kitchen', '<= 1.0'
201  cookbooks/git/LICENSE
... ...
@@ -0,0 +1,201 @@
  1
+                              Apache License
  2
+                        Version 2.0, January 2004
  3
+                     http://www.apache.org/licenses/
  4
+
  5
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  6
+
  7
+1. Definitions.
  8
+
  9
+   "License" shall mean the terms and conditions for use, reproduction,
  10
+   and distribution as defined by Sections 1 through 9 of this document.
  11
+
  12
+   "Licensor" shall mean the copyright owner or entity authorized by
  13
+   the copyright owner that is granting the License.
  14
+
  15
+   "Legal Entity" shall mean the union of the acting entity and all
  16
+   other entities that control, are controlled by, or are under common
  17
+   control with that entity. For the purposes of this definition,
  18
+   "control" means (i) the power, direct or indirect, to cause the
  19
+   direction or management of such entity, whether by contract or
  20
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
  21
+   outstanding shares, or (iii) beneficial ownership of such entity.
  22
+
  23
+   "You" (or "Your") shall mean an individual or Legal Entity
  24
+   exercising permissions granted by this License.
  25
+
  26
+   "Source" form shall mean the preferred form for making modifications,
  27
+   including but not limited to software source code, documentation
  28
+   source, and configuration files.
  29
+
  30
+   "Object" form shall mean any form resulting from mechanical
  31
+   transformation or translation of a Source form, including but
  32
+   not limited to compiled object code, generated documentation,
  33
+   and conversions to other media types.
  34
+
  35
+   "Work" shall mean the work of authorship, whether in Source or
  36
+   Object form, made available under the License, as indicated by a
  37
+   copyright notice that is included in or attached to the work
  38
+   (an example is provided in the Appendix below).
  39
+
  40
+   "Derivative Works" shall mean any work, whether in Source or Object
  41
+   form, that is based on (or derived from) the Work and for which the
  42
+   editorial revisions, annotations, elaborations, or other modifications
  43
+   represent, as a whole, an original work of authorship. For the purposes
  44
+   of this License, Derivative Works shall not include works that remain
  45
+   separable from, or merely link (or bind by name) to the interfaces of,
  46
+   the Work and Derivative Works thereof.
  47
+
  48
+   "Contribution" shall mean any work of authorship, including
  49
+   the original version of the Work and any modifications or additions
  50
+   to that Work or Derivative Works thereof, that is intentionally
  51
+   submitted to Licensor for inclusion in the Work by the copyright owner
  52
+   or by an individual or Legal Entity authorized to submit on behalf of
  53
+   the copyright owner. For the purposes of this definition, "submitted"
  54
+   means any form of electronic, verbal, or written communication sent
  55
+   to the Licensor or its representatives, including but not limited to
  56
+   communication on electronic mailing lists, source code control systems,
  57
+   and issue tracking systems that are managed by, or on behalf of, the
  58
+   Licensor for the purpose of discussing and improving the Work, but
  59
+   excluding communication that is conspicuously marked or otherwise
  60
+   designated in writing by the copyright owner as "Not a Contribution."
  61
+
  62
+   "Contributor" shall mean Licensor and any individual or Legal Entity
  63
+   on behalf of whom a Contribution has been received by Licensor and
  64
+   subsequently incorporated within the Work.
  65
+
  66
+2. Grant of Copyright License. Subject to the terms and conditions of
  67
+   this License, each Contributor hereby grants to You a perpetual,
  68
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  69
+   copyright license to reproduce, prepare Derivative Works of,
  70
+   publicly display, publicly perform, sublicense, and distribute the
  71
+   Work and such Derivative Works in Source or Object form.
  72
+
  73
+3. Grant of Patent License. Subject to the terms and conditions of
  74
+   this License, each Contributor hereby grants to You a perpetual,
  75
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  76
+   (except as stated in this section) patent license to make, have made,
  77
+   use, offer to sell, sell, import, and otherwise transfer the Work,
  78
+   where such license applies only to those patent claims licensable
  79
+   by such Contributor that are necessarily infringed by their
  80
+   Contribution(s) alone or by combination of their Contribution(s)
  81
+   with the Work to which such Contribution(s) was submitted. If You
  82
+   institute patent litigation against any entity (including a
  83
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
  84
+   or a Contribution incorporated within the Work constitutes direct
  85
+   or contributory patent infringement, then any patent licenses
  86
+   granted to You under this License for that Work shall terminate
  87
+   as of the date such litigation is filed.
  88
+
  89
+4. Redistribution. You may reproduce and distribute copies of the
  90
+   Work or Derivative Works thereof in any medium, with or without
  91
+   modifications, and in Source or Object form, provided that You
  92
+   meet the following conditions:
  93
+
  94
+   (a) You must give any other recipients of the Work or
  95
+       Derivative Works a copy of this License; and
  96
+
  97
+   (b) You must cause any modified files to carry prominent notices
  98
+       stating that You changed the files; and
  99
+
  100
+   (c) You must retain, in the Source form of any Derivative Works
  101
+       that You distribute, all copyright, patent, trademark, and
  102
+       attribution notices from the Source form of the Work,
  103
+       excluding those notices that do not pertain to any part of
  104
+       the Derivative Works; and
  105
+
  106
+   (d) If the Work includes a "NOTICE" text file as part of its
  107
+       distribution, then any Derivative Works that You distribute must
  108
+       include a readable copy of the attribution notices contained
  109
+       within such NOTICE file, excluding those notices that do not
  110
+       pertain to any part of the Derivative Works, in at least one
  111
+       of the following places: within a NOTICE text file distributed
  112
+       as part of the Derivative Works; within the Source form or
  113
+       documentation, if provided along with the Derivative Works; or,
  114
+       within a display generated by the Derivative Works, if and
  115
+       wherever such third-party notices normally appear. The contents
  116
+       of the NOTICE file are for informational purposes only and
  117
+       do not modify the License. You may add Your own attribution
  118
+       notices within Derivative Works that You distribute, alongside
  119
+       or as an addendum to the NOTICE text from the Work, provided
  120
+       that such additional attribution notices cannot be construed
  121
+       as modifying the License.
  122
+
  123
+   You may add Your own copyright statement to Your modifications and
  124
+   may provide additional or different license terms and conditions
  125
+   for use, reproduction, or distribution of Your modifications, or
  126
+   for any such Derivative Works as a whole, provided Your use,
  127
+   reproduction, and distribution of the Work otherwise complies with
  128
+   the conditions stated in this License.
  129
+
  130
+5. Submission of Contributions. Unless You explicitly state otherwise,
  131
+   any Contribution intentionally submitted for inclusion in the Work
  132
+   by You to the Licensor shall be under the terms and conditions of
  133
+   this License, without any additional terms or conditions.
  134
+   Notwithstanding the above, nothing herein shall supersede or modify
  135
+   the terms of any separate license agreement you may have executed
  136
+   with Licensor regarding such Contributions.
  137
+
  138
+6. Trademarks. This License does not grant permission to use the trade
  139
+   names, trademarks, service marks, or product names of the Licensor,
  140
+   except as required for reasonable and customary use in describing the
  141
+   origin of the Work and reproducing the content of the NOTICE file.
  142
+
  143
+7. Disclaimer of Warranty. Unless required by applicable law or
  144
+   agreed to in writing, Licensor provides the Work (and each
  145
+   Contributor provides its Contributions) on an "AS IS" BASIS,
  146
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  147
+   implied, including, without limitation, any warranties or conditions
  148
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  149
+   PARTICULAR PURPOSE. You are solely responsible for determining the
  150
+   appropriateness of using or redistributing the Work and assume any
  151
+   risks associated with Your exercise of permissions under this License.
  152
+
  153
+8. Limitation of Liability. In no event and under no legal theory,
  154
+   whether in tort (including negligence), contract, or otherwise,
  155
+   unless required by applicable law (such as deliberate and grossly
  156
+   negligent acts) or agreed to in writing, shall any Contributor be
  157
+   liable to You for damages, including any direct, indirect, special,
  158
+   incidental, or consequential damages of any character arising as a
  159
+   result of this License or out of the use or inability to use the
  160
+   Work (including but not limited to damages for loss of goodwill,
  161
+   work stoppage, computer failure or malfunction, or any and all
  162
+   other commercial damages or losses), even if such Contributor
  163
+   has been advised of the possibility of such damages.
  164
+
  165
+9. Accepting Warranty or Additional Liability. While redistributing
  166
+   the Work or Derivative Works thereof, You may choose to offer,
  167
+   and charge a fee for, acceptance of support, warranty, indemnity,
  168
+   or other liability obligations and/or rights consistent with this
  169
+   License. However, in accepting such obligations, You may act only
  170
+   on Your own behalf and on Your sole responsibility, not on behalf
  171
+   of any other Contributor, and only if You agree to indemnify,
  172
+   defend, and hold each Contributor harmless for any liability
  173
+   incurred by, or claims asserted against, such Contributor by reason
  174
+   of your accepting any such warranty or additional liability.
  175
+
  176
+END OF TERMS AND CONDITIONS
  177
+
  178
+APPENDIX: How to apply the Apache License to your work.
  179
+
  180
+   To apply the Apache License to your work, attach the following
  181
+   boilerplate notice, with the fields enclosed by brackets "[]"
  182
+   replaced with your own identifying information. (Don't include
  183
+   the brackets!)  The text should be enclosed in the appropriate
  184
+   comment syntax for the file format. We also recommend that a
  185
+   file or class name and description of purpose be included on the
  186
+   same "printed page" as the copyright notice for easier
  187
+   identification within third-party archives.
  188
+
  189
+Copyright [yyyy] [name of copyright owner]
  190
+
  191
+Licensed under the Apache License, Version 2.0 (the "License");
  192
+you may not use this file except in compliance with the License.
  193
+You may obtain a copy of the License at
  194
+
  195
+    http://www.apache.org/licenses/LICENSE-2.0
  196
+
  197
+Unless required by applicable law or agreed to in writing, software
  198
+distributed under the License is distributed on an "AS IS" BASIS,
  199
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  200
+See the License for the specific language governing permissions and
  201
+limitations under the License.
115  cookbooks/git/README.md
Source Rendered
... ...
@@ -0,0 +1,115 @@
  1
+Description
  2
+===========
  3
+
  4
+Installs git and optionally sets up a git server as a daemon under runit.
  5
+
  6
+Requirements
  7
+============
  8
+## Ohai and Chef:
  9
+
  10
+* Ohai: 6.14.0+
  11
+
  12
+This cookbook makes use of `node['platform_family']` to simplify platform
  13
+selection logic. This attribute was introduced in Ohai v0.6.12.
  14
+
  15
+## Platform:
  16
+
  17
+The following platform families are supported:
  18
+
  19
+* Debian
  20
+* Arch
  21
+* RHEL
  22
+* Fedora
  23
+* Mac OS X (10.6.0+)
  24
+* Windows
  25
+
  26
+## Cookbooks:
  27
+
  28
+* runit (for `git::server`)
  29
+* build-essential (for `git::source`)
  30
+* dmg (for OS X installation)
  31
+* yum (for RHEL 5 installation)
  32
+
  33
+### Windows Dependencies
  34
+The [`windows_package`](https://github.com/opscode-cookbooks/windows#windows_package) resource from the Windows cookbook is required to
  35
+install the git package on Windows.
  36
+
  37
+## Attributes
  38
+
  39
+### default
  40
+The following attributes are platform-specific.
  41
+
  42
+#### Windows
  43
+
  44
+* `node['git']['version']` - git version to install
  45
+* `node['git']['url']` - URL to git package
  46
+* `node['git']['checksum']` - package SHA256 checksum
  47
+* `node['git']['display_name']` - `windows_package` resource Display Name (makes the package install idempotent) 
  48
+
  49
+#### Mac OS X
  50
+
  51
+* `node['git']['osx_dmg']['url']` - URL to git package
  52
+* `node['git']['osx_dmg']['checksum']` - package SHA256 checksum
  53
+
  54
+#### Linux
  55
+
  56
+* `node['git']['prefix']` - git install directory
  57
+* `node['git']['version']` - git version to install
  58
+* `node['git']['url']` - URL to git tarball
  59
+* `node['git']['checksum']` - tarball SHA256 checksum
  60
+
  61
+Recipes
  62
+=======
  63
+
  64
+## default
  65
+
  66
+Installs base git packages based on platform.
  67
+
  68
+## server
  69
+
  70
+Sets up a git daemon to provide a server.
  71
+
  72
+## source
  73
+
  74
+Installs git from source.
  75
+
  76
+## windows
  77
+
  78
+Installs git client on Windows
  79
+
  80
+Usage
  81
+=====
  82
+
  83
+
  84
+This cookbook primarily installs git core packages. It can also be
  85
+used to serve git repositories.
  86
+
  87
+To install git client (all supported platforms):
  88
+
  89
+    include_recipe 'git'
  90
+
  91
+To install git server:
  92
+
  93
+    include_recipe "git::server"
  94
+
  95
+This creates the directory specified by git/server/base_path (default is /srv/git)
  96
+and starts a git daemon, exporting all repositories found. Repositories need to be
  97
+added manually, but will be available once they are created.
  98
+
  99
+License and Author
  100
+==================
  101
+
  102
+- Author:: Joshua Timberman (<joshua@opscode.com>)
  103
+- Copyright:: 2009-2012, Opscode, Inc.
  104
+
  105
+Licensed under the Apache License, Version 2.0 (the "License");
  106
+you may not use this file except in compliance with the License.
  107
+You may obtain a copy of the License at
  108
+
  109
+    http://www.apache.org/licenses/LICENSE-2.0
  110
+
  111
+Unless required by applicable law or agreed to in writing, software
  112
+distributed under the License is distributed on an "AS IS" BASIS,
  113
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  114
+See the License for the specific language governing permissions and
  115
+limitations under the License.
40  cookbooks/git/attributes/default.rb
... ...
@@ -0,0 +1,40 @@
  1
+#
  2
+# Author:: Jamie Winsor (<jamie@vialstudios.com>)
  3
+# Cookbook Name:: git
  4
+# Attributes:: default
  5
+#
  6
+# Copyright 2008-2012, Opscode, Inc.
  7
+#
  8
+# Licensed under the Apache License, Version 2.0 (the "License");
  9
+# you may not use this file except in compliance with the License.
  10
+# You may obtain a copy of the License at
  11
+#
  12
+#     http://www.apache.org/licenses/LICENSE-2.0
  13
+#
  14
+# Unless required by applicable law or agreed to in writing, software
  15
+# distributed under the License is distributed on an "AS IS" BASIS,
  16
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17
+# See the License for the specific language governing permissions and
  18
+# limitations under the License.
  19
+
  20
+case node['platform_family']
  21
+when 'windows'
  22
+  default['git']['version'] = "1.8.0-preview20121022"
  23
+  default['git']['url'] = "http://github.com/downloads/msysgit/git/Git-#{node['git']['version']}.exe"
  24
+  default['git']['checksum'] = "8ec19d04912fd27d7350823c857a4807b550fa63a3744bf6fd2841de8cfa9a0f"
  25
+  default['git']['display_name'] = "Git version #{ node['git']['version'] }"
  26
+when "mac_os_x"
  27
+  default['git']['osx_dmg']['app_name']    = "git-1.8.0-intel-universal-snow-leopard"
  28
+  default['git']['osx_dmg']['volumes_dir'] = "Git 1.8.0 Snow Leopard Intel Universal"
  29
+  default['git']['osx_dmg']['package_id']  = "GitOSX.Installer.git180.git.pkg"
  30
+  default['git']['osx_dmg']['url']         = "https://github.com/downloads/timcharper/git_osx_installer/git-1.8.0-intel-universal-snow-leopard.dmg"
  31
+  default['git']['osx_dmg']['checksum']    = "da83499f3305061792358bec26c20faa997b7ad9990713d1be2b03cbb5fbce12"
  32
+else
  33
+  default['git']['prefix'] = "/usr/local"
  34
+  default['git']['version'] = "1.8.0"
  35
+  default['git']['url'] = "https://github.com/git/git/tarball/v#{node['git']['version']}"
  36
+  default['git']['checksum'] = "24f1895fa74a23b3d9233fa89a9ef04d83a1cd952d659720d6ea231bbd0c973c"
  37
+end
  38
+
  39
+default['git']['server']['base_path'] = "/srv/git"
  40
+default['git']['server']['export_all'] = "true"
77  cookbooks/git/metadata.json
... ...
@@ -0,0 +1,77 @@
  1
+{
  2
+  "name": "git",
  3
+  "description": "Installs git and/or sets up a Git server daemon",
  4
+  "long_description": "Description\n===========\n\nInstalls git and optionally sets up a git server as a daemon under runit.\n\nRequirements\n============\n## Ohai and Chef:\n\n* Ohai: 6.14.0+\n\nThis cookbook makes use of `node['platform_family']` to simplify platform\nselection logic. This attribute was introduced in Ohai v0.6.12.\n\n## Platform:\n\nThe following platform families are supported:\n\n* Debian\n* Arch\n* RHEL\n* Fedora\n* Mac OS X (10.6.0+)\n* Windows\n\n## Cookbooks:\n\n* runit (for `git::server`)\n* build-essential (for `git::source`)\n* dmg (for OS X installation)\n* yum (for RHEL 5 installation)\n\n### Windows Dependencies\nThe [`windows_package`](https://github.com/opscode-cookbooks/windows#windows_package) resource from the Windows cookbook is required to\ninstall the git package on Windows.\n\n## Attributes\n\n### default\nThe following attributes are platform-specific.\n\n#### Windows\n\n* `node['git']['version']` - git version to install\n* `node['git']['url']` - URL to git package\n* `node['git']['checksum']` - package SHA256 checksum\n* `node['git']['display_name']` - `windows_package` resource Display Name (makes the package install idempotent) \n\n#### Mac OS X\n\n* `node['git']['osx_dmg']['url']` - URL to git package\n* `node['git']['osx_dmg']['checksum']` - package SHA256 checksum\n\n#### Linux\n\n* `node['git']['prefix']` - git install directory\n* `node['git']['version']` - git version to install\n* `node['git']['url']` - URL to git tarball\n* `node['git']['checksum']` - tarball SHA256 checksum\n\nRecipes\n=======\n\n## default\n\nInstalls base git packages based on platform.\n\n## server\n\nSets up a git daemon to provide a server.\n\n## source\n\nInstalls git from source.\n\n## windows\n\nInstalls git client on Windows\n\nUsage\n=====\n\n\nThis cookbook primarily installs git core packages. It can also be\nused to serve git repositories.\n\nTo install git client (all supported platforms):\n\n    include_recipe 'git'\n\nTo install git server:\n\n    include_recipe \"git::server\"\n\nThis creates the directory specified by git/server/base_path (default is /srv/git)\nand starts a git daemon, exporting all repositories found. Repositories need to be\nadded manually, but will be available once they are created.\n\nLicense and Author\n==================\n\n- Author:: Joshua Timberman (<joshua@opscode.com>)\n- Copyright:: 2009-2012, Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
  5
+  "maintainer": "Opscode, Inc.",
  6
+  "maintainer_email": "cookbooks@opscode.com",
  7
+  "license": "Apache 2.0",
  8
+  "platforms": {
  9
+    "amazon": ">= 0.0.0",
  10
+    "arch": ">= 0.0.0",
  11
+    "centos": ">= 0.0.0",
  12
+    "debian": ">= 0.0.0",
  13
+    "fedora": ">= 0.0.0",
  14
+    "redhat": ">= 0.0.0",
  15
+    "scientific": ">= 0.0.0",
  16
+    "oracle": ">= 0.0.0",
  17
+    "ubuntu": ">= 0.0.0",
  18
+    "windows": ">= 0.0.0",
  19
+    "mac_os_x": ">= 10.6.0"
  20
+  },
  21
+  "dependencies": {
  22
+    "dmg": ">= 0.0.0",
  23
+    "build-essential": ">= 0.0.0",
  24
+    "yum": ">= 0.0.0",
  25
+    "windows": ">= 0.0.0",
  26
+    "runit": "<= 0.16.2"
  27
+  },
  28
+  "recommendations": {
  29
+  },
  30
+  "suggestions": {
  31
+  },
  32
+  "conflicting": {
  33
+  },
  34
+  "providing": {
  35
+  },
  36
+  "replacing": {
  37
+  },
  38
+  "attributes": {
  39
+    "git/server/base_path": {
  40
+      "display_name": "Git Daemon Base Path",
  41
+      "description": "A directory containing git repositories to be exposed by the git-daemon",
  42
+      "default": "/srv/git",
  43
+      "recipes": [
  44
+        "git::server"
  45
+      ],
  46
+      "choice": [
  47
+
  48
+      ],
  49
+      "calculated": false,
  50
+      "type": "string",
  51
+      "required": "optional"
  52
+    },
  53
+    "git/server/export_all": {
  54
+      "display_name": "Git Daemon Export All",
  55
+      "description": "Adds the --export-all option to the git-daemon parameters, making all repositories publicly readable even if they lack the \"git-daemon-export-ok\" file",
  56
+      "choice": [
  57
+        "true",
  58
+        "false"
  59
+      ],
  60
+      "default": "true",
  61
+      "recipes": [
  62
+        "git::server"
  63
+      ],
  64
+      "calculated": false,
  65
+      "type": "string",
  66
+      "required": "optional"
  67
+    }
  68
+  },
  69
+  "groupings": {
  70
+  },
  71
+  "recipes": {
  72
+    "git": "Installs git",
  73
+    "git::server": "Sets up a runit_service for git daemon",
  74
+    "git::source": "Installs git from source"
  75
+  },
  76
+  "version": "2.2.0"
  77
+}
35  cookbooks/git/metadata.rb
... ...
@@ -0,0 +1,35 @@
  1
+name              "git"
  2
+maintainer        "Opscode, Inc."
  3
+maintainer_email  "cookbooks@opscode.com"
  4
+license           "Apache 2.0"
  5
+description       "Installs git and/or sets up a Git server daemon"
  6
+long_description  IO.read(File.join(File.dirname(__FILE__), 'README.md'))
  7
+version           "2.2.0"
  8
+recipe            "git", "Installs git"
  9
+recipe            "git::server", "Sets up a runit_service for git daemon"
  10
+recipe            "git::source", "Installs git from source"
  11
+
  12
+%w{ amazon arch centos debian fedora redhat scientific oracle amazon ubuntu windows }.each do |os|
  13
+  supports os
  14
+end
  15
+
  16
+supports "mac_os_x", ">= 10.6.0"
  17
+
  18
+%w{ dmg build-essential yum windows }.each do |cookbook|
  19
+  depends cookbook
  20
+end
  21
+
  22
+depends "runit", "<= 0.16.2"
  23
+
  24
+attribute "git/server/base_path",
  25
+  :display_name => "Git Daemon Base Path",
  26
+  :description => "A directory containing git repositories to be exposed by the git-daemon",
  27
+  :default => "/srv/git",
  28
+  :recipes => ["git::server"]
  29
+
  30
+attribute "git/server/export_all",
  31
+  :display_name => "Git Daemon Export All",
  32
+  :description => "Adds the --export-all option to the git-daemon parameters, making all repositories publicly readable even if they lack the \"git-daemon-export-ok\" file",
  33
+  :choice => ["true", "false"],
  34
+  :default => "true",
  35
+  :recipes => ["git::server"]
46  cookbooks/git/recipes/default.rb
... ...
@@ -0,0 +1,46 @@
  1
+#
  2
+# Cookbook Name:: git
  3
+# Recipe:: default
  4
+#
  5
+# Copyright 2008-2009, Opscode, Inc.
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+#     http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+
  19
+case node['platform_family']
  20
+when "debian"
  21
+  if node['platform'] == "ubuntu" && node['platform_version'].to_f < 10.10
  22
+    package "git-core"
  23
+  else
  24
+    package "git"
  25
+  end
  26
+when "rhel","fedora"
  27
+  case node['platform_version'].to_i
  28
+  when 5
  29
+    include_recipe "yum::epel"
  30
+  end
  31
+  package "git"
  32
+when "windows"
  33
+  include_recipe 'git::windows'
  34
+when "mac_os_x"
  35
+  dmg_package "GitOSX-Installer" do
  36
+    app node['git']['osx_dmg']['app_name']
  37
+    package_id node['git']['osx_dmg']['package_id']
  38
+    volumes_dir node['git']['osx_dmg']['volumes_dir']
  39
+    source node['git']['osx_dmg']['url']
  40
+    checksum node['git']['osx_dmg']['checksum']
  41
+    type "pkg"
  42
+    action :install
  43
+  end
  44
+else
  45
+  package "git"
  46
+end
55  cookbooks/git/recipes/server.rb
... ...
@@ -0,0 +1,55 @@
  1
+#
  2
+# Cookbook Name:: git
  3
+# Recipe:: server
  4
+#
  5
+# Copyright 2009, Opscode, Inc.
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+#     http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+
  19
+if node["platform"] == "windows"
  20
+  return "#{node['platform']} is not supported by the #{cookbook_name}::#{recipe_name} recipe"
  21
+end
  22
+
  23
+include_recipe "git"
  24
+
  25
+directory node["git"]["server"]["base_path"] do
  26
+  owner "root"
  27
+  group "root"
  28
+  mode 00755
  29
+end
  30
+
  31
+case node['platform_family']
  32
+when "debian"
  33
+  include_recipe "runit"
  34
+
  35
+  package "git-daemon-run"
  36
+
  37
+  runit_service "git-daemon"
  38
+when "rhel"
  39
+  package "git-daemon"
  40
+
  41
+  template "/etc/xinetd.d/git" do
  42
+    backup false
  43
+    source "git-xinetd.d.erb"
  44
+    owner "root"
  45
+    group "root"
  46
+    mode 00644
  47
+  end
  48
+
  49
+  service "xinetd" do
  50
+    action [:enable, :restart]
  51
+  end
  52
+else
  53
+  log "Platform requires setting up a git daemon service script."
  54
+  log "Hint: /usr/bin/git daemon --export-all --user=nobody --group=daemon --base-path=#{node["git"]["server"]["base_path"]}"
  55
+end
48  cookbooks/git/recipes/source.rb
... ...
@@ -0,0 +1,48 @@
  1
+#
  2
+# Cookbook Name:: git
  3
+# Recipe:: source
  4
+#
  5
+# Copyright 2012, Brian Flad, Fletcher Nichol
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+#     http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+
  19
+if node["platform"] == "windows"
  20
+  return "#{node['platform']} is not supported by the #{cookbook_name}::#{recipe_name} recipe"
  21
+end
  22
+
  23
+include_recipe "build-essential"
  24
+
  25
+pkgs = value_for_platform_family(
  26
+  ["rhel"] => %w{ expat-devel gettext-devel libcurl-devel openssl-devel perl-ExtUtils-MakeMaker zlib-devel }
  27
+)
  28
+
  29
+pkgs.each do |pkg|
  30
+  package pkg
  31
+end
  32
+
  33
+remote_file "#{Chef::Config['file_cache_path']}/git-#{node['git']['version']}.tar.gz" do
  34
+  source    node['git']['url']
  35
+  checksum  node['git']['checksum']
  36
+  mode      00644
  37
+  not_if "test -f #{Chef::Config['file_cache_path']}/git-#{node['git']['version']}.tar.gz"
  38
+end
  39
+
  40
+execute "Extracting and Building Git #{node['git']['version']} from Source" do
  41
+  cwd Chef::Config['file_cache_path']
  42
+  command <<-COMMAND
  43
+    (mkdir git-#{node['git']['version']} && tar -zxf git-#{node['git']['version']}.tar.gz -C git-#{node['git']['version']} --strip-components 1)
  44
+    (cd git-#{node['git']['version']} && make prefix=#{node['git']['prefix']} install)
  45
+  COMMAND
  46
+  creates "node['git']['prefix']}/bin/git"
  47
+  not_if "git --version | grep #{node['git']['version']}"
  48
+end
32  cookbooks/git/recipes/windows.rb
... ...
@@ -0,0 +1,32 @@
  1
+#
  2
+# Cookbook Name:: git
  3
+# Recipe:: windows
  4
+#
  5
+# Copyright 2008-2009, Opscode, Inc.
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+#     http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+
  19
+windows_package node['git']['display_name'] do
  20
+  action :install
  21
+  source node['git']['url']
  22
+  checksum node['git']['checksum']
  23
+  installer_type :inno
  24
+end
  25
+
  26
+# Git is installed to Program Files (x86) on 64-bit machines and
  27
+# 'Program Files' on 32-bit machines
  28
+PROGRAM_FILES = ENV['ProgramFiles(x86)'] || ENV['ProgramFiles']
  29
+
  30
+windows_path "#{ PROGRAM_FILES }\\Git\\Cmd" do
  31
+  action :add
  32
+end
10  cookbooks/git/templates/default/git-xinetd.d.erb
... ...
@@ -0,0 +1,10 @@
  1
+service git
  2
+{
  3
+        disable         = no
  4
+        socket_type     = stream
  5
+        wait            = no
  6
+        user            = nobody
  7
+        server          = /usr/libexec/git-core/git-daemon
  8
+        server_args     = --base-path=<%= node["git"]["server"]["base_path"] %> <% if node["git"]["server"]["export_all"] == "true" %>--export-all <% end %>--syslog --inetd --verbose
  9
+        log_on_failure  += USERID
  10
+}
2  cookbooks/git/templates/default/sv-git-daemon-log-run.erb
... ...
@@ -0,0 +1,2 @@
  1
+#!/bin/sh
  2
+exec svlogd -tt ./main
3  cookbooks/git/templates/default/sv-git-daemon-run.erb
... ...
@@ -0,0 +1,3 @@
  1
+#!/bin/sh
  2
+exec 2>&1
  3
+exec /usr/bin/git daemon <% if node["git"]["server"]["export_all"] == "true" %>--export-all <% end %>--user=nobody --group=daemon --syslog --base-path=<%= node["git"]["server"]["base_path"] %> <%= node["git"]["server"]["base_path"] %>

0 notes on commit 6b761fd

Please sign in to comment.
Something went wrong with that request. Please try again.