vault-tree 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/.gitignore +26 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +43 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +118 -0
  6. data/Rakefile +17 -0
  7. data/VagrantFile +30 -0
  8. data/features/core.feature +44 -0
  9. data/features/exceptions.feature +41 -0
  10. data/features/steps/core.steps.rb +168 -0
  11. data/features/steps/exceptions.steps.rb +103 -0
  12. data/features/support/env.rb +1 -0
  13. data/features/world.rb +3 -0
  14. data/lib/vault-tree.rb +7 -0
  15. data/lib/vault-tree/config/dependencies.rb +4 -0
  16. data/lib/vault-tree/config/lib.rb +2 -0
  17. data/lib/vault-tree/config/path_helpers.rb +49 -0
  18. data/lib/vault-tree/config/string.rb +25 -0
  19. data/lib/vault-tree/contract/close_validator.rb +35 -0
  20. data/lib/vault-tree/contract/contract.rb +85 -0
  21. data/lib/vault-tree/contract/contract_presenter.rb +27 -0
  22. data/lib/vault-tree/contract/doorman.rb +112 -0
  23. data/lib/vault-tree/contract/null_vault.rb +16 -0
  24. data/lib/vault-tree/contract/open_validator.rb +20 -0
  25. data/lib/vault-tree/contract/vault.rb +96 -0
  26. data/lib/vault-tree/exceptions/empty_vault.rb +8 -0
  27. data/lib/vault-tree/exceptions/fill_attempt_master_password.rb +6 -0
  28. data/lib/vault-tree/exceptions/invalid_signature.rb +0 -0
  29. data/lib/vault-tree/exceptions/malformed_json.rb +0 -0
  30. data/lib/vault-tree/exceptions/missing_external_data.rb +6 -0
  31. data/lib/vault-tree/exceptions/missing_partner_decryption_key.rb +6 -0
  32. data/lib/vault-tree/exceptions/missing_passphrase.rb +6 -0
  33. data/lib/vault-tree/exceptions/non_unique_vault_id.rb +0 -0
  34. data/lib/vault-tree/exceptions/unsupported_keyword.rb +6 -0
  35. data/lib/vault-tree/exceptions/vault_does_not_exist.rb +6 -0
  36. data/lib/vault-tree/exceptions/vault_tree_exception.rb +6 -0
  37. data/lib/vault-tree/keywords/decryption_key.rb +14 -0
  38. data/lib/vault-tree/keywords/external_data.rb +13 -0
  39. data/lib/vault-tree/keywords/keyword.rb +19 -0
  40. data/lib/vault-tree/keywords/keyword_interpreter.rb +45 -0
  41. data/lib/vault-tree/keywords/master_passphrase.rb +9 -0
  42. data/lib/vault-tree/keywords/public_encryption_key.rb +27 -0
  43. data/lib/vault-tree/keywords/random_number.rb +9 -0
  44. data/lib/vault-tree/keywords/shared_key.rb +24 -0
  45. data/lib/vault-tree/keywords/unlocked.rb +9 -0
  46. data/lib/vault-tree/keywords/vault_contents.rb +13 -0
  47. data/lib/vault-tree/lock_smith/asymmetric_cipher.rb +31 -0
  48. data/lib/vault-tree/lock_smith/crypto_hash.rb +11 -0
  49. data/lib/vault-tree/lock_smith/digital_signature.rb +32 -0
  50. data/lib/vault-tree/lock_smith/encryption_key_pair.rb +25 -0
  51. data/lib/vault-tree/lock_smith/null_vault.rb +4 -0
  52. data/lib/vault-tree/lock_smith/random_number.rb +11 -0
  53. data/lib/vault-tree/lock_smith/shared_key_pair.rb +12 -0
  54. data/lib/vault-tree/lock_smith/signing_key_pair.rb +25 -0
  55. data/lib/vault-tree/lock_smith/symmetric_cipher.rb +25 -0
  56. data/lib/vault-tree/util/json.rb +16 -0
  57. data/lib/vault-tree/version.rb +3 -0
  58. data/spec/app/locksmith/asymmetric_cipher_spec.rb +25 -0
  59. data/spec/app/locksmith/signing_key_pair_spec.rb +22 -0
  60. data/spec/spec_helper.rb +5 -0
  61. data/spec/support/fixtures/blank_simple_test_contract.json +14 -0
  62. data/spec/support/fixtures/broken_contract.json +55 -0
  63. data/spec/support/fixtures/one_two_three-0.5.0.EXP.json +105 -0
  64. data/spec/support/fixtures/reference_contract.1.0.0.json +227 -0
  65. data/spec/support/fixtures/simple_test_contract.json +14 -0
  66. data/support/cookbooks/ark/.gitignore +12 -0
  67. data/support/cookbooks/ark/.kitchen.yml +34 -0
  68. data/support/cookbooks/ark/.travis.yml +6 -0
  69. data/support/cookbooks/ark/Berksfile +9 -0
  70. data/support/cookbooks/ark/CHANGELOG.md +87 -0
  71. data/support/cookbooks/ark/CONTRIBUTING.md +257 -0
  72. data/support/cookbooks/ark/README.md +301 -0
  73. data/support/cookbooks/ark/Rakefile +36 -0
  74. data/support/cookbooks/ark/TESTING.md +25 -0
  75. data/support/cookbooks/ark/Toftfile +15 -0
  76. data/support/cookbooks/ark/attributes/default.rb +6 -0
  77. data/support/cookbooks/ark/chefignore +96 -0
  78. data/support/cookbooks/ark/files/default/foo.tar.gz +0 -0
  79. data/support/cookbooks/ark/files/default/foo.tbz +0 -0
  80. data/support/cookbooks/ark/files/default/foo.tgz +0 -0
  81. data/support/cookbooks/ark/files/default/foo.zip +0 -0
  82. data/support/cookbooks/ark/files/default/tests/minitest/default_test.rb +0 -0
  83. data/support/cookbooks/ark/files/default/tests/minitest/support/helpers.rb +0 -0
  84. data/support/cookbooks/ark/files/default/tests/minitest/test_test.rb +94 -0
  85. data/support/cookbooks/ark/libraries/default.rb +167 -0
  86. data/support/cookbooks/ark/metadata.rb +13 -0
  87. data/support/cookbooks/ark/providers/default.rb +370 -0
  88. data/support/cookbooks/ark/recipes/default.rb +31 -0
  89. data/support/cookbooks/ark/recipes/test.rb +138 -0
  90. data/support/cookbooks/ark/resources/default.rb +54 -0
  91. data/support/cookbooks/ark/templates/default/add_to_path.sh.erb +1 -0
  92. data/support/cookbooks/ark/test/support/Gemfile +4 -0
  93. data/support/cookbooks/build-essential/README.md +24 -0
  94. data/support/cookbooks/build-essential/metadata.rb +10 -0
  95. data/support/cookbooks/build-essential/recipes/default.rb +45 -0
  96. data/support/cookbooks/chruby/.gitignore +15 -0
  97. data/support/cookbooks/chruby/.kitchen.yml +26 -0
  98. data/support/cookbooks/chruby/.ruby_version +1 -0
  99. data/support/cookbooks/chruby/Berksfile +3 -0
  100. data/support/cookbooks/chruby/Gemfile +7 -0
  101. data/support/cookbooks/chruby/LICENSE +14 -0
  102. data/support/cookbooks/chruby/README.md +92 -0
  103. data/support/cookbooks/chruby/Rakefile +7 -0
  104. data/support/cookbooks/chruby/Thorfile +6 -0
  105. data/support/cookbooks/chruby/Vagrantfile +86 -0
  106. data/support/cookbooks/chruby/attributes/default.rb +10 -0
  107. data/support/cookbooks/chruby/chefignore +96 -0
  108. data/support/cookbooks/chruby/metadata.rb +11 -0
  109. data/support/cookbooks/chruby/recipes/default.rb +43 -0
  110. data/support/cookbooks/chruby/recipes/system.rb +25 -0
  111. data/support/cookbooks/chruby/templates/default/chruby.sh.erb +22 -0
  112. data/support/cookbooks/chruby/test/integration/default/bash/embedded_test.sh +1 -0
  113. data/support/cookbooks/git/.gitignore +14 -0
  114. data/support/cookbooks/git/.kitchen.yml +46 -0
  115. data/support/cookbooks/git/Berksfile +8 -0
  116. data/support/cookbooks/git/CHANGELOG.md +87 -0
  117. data/support/cookbooks/git/CONTRIBUTING +29 -0
  118. data/support/cookbooks/git/Gemfile +3 -0
  119. data/support/cookbooks/git/LICENSE +201 -0
  120. data/support/cookbooks/git/README.md +115 -0
  121. data/support/cookbooks/git/TESTING.md +25 -0
  122. data/support/cookbooks/git/attributes/default.rb +40 -0
  123. data/support/cookbooks/git/metadata.rb +35 -0
  124. data/support/cookbooks/git/recipes/default.rb +53 -0
  125. data/support/cookbooks/git/recipes/server.rb +58 -0
  126. data/support/cookbooks/git/recipes/source.rb +49 -0
  127. data/support/cookbooks/git/recipes/windows.rb +37 -0
  128. data/support/cookbooks/git/templates/default/git-xinetd.d.erb +10 -0
  129. data/support/cookbooks/git/templates/default/sv-git-daemon-log-run.erb +2 -0
  130. data/support/cookbooks/git/templates/default/sv-git-daemon-run.erb +3 -0
  131. data/support/cookbooks/install_ruby/README.md +3 -0
  132. data/support/cookbooks/install_ruby/metadata.rb +10 -0
  133. data/support/cookbooks/install_ruby/recipes/default.rb +14 -0
  134. data/support/cookbooks/ruby_build/.gitignore +6 -0
  135. data/support/cookbooks/ruby_build/.kitchen.yml +31 -0
  136. data/support/cookbooks/ruby_build/.travis.yml +4 -0
  137. data/support/cookbooks/ruby_build/Berksfile +10 -0
  138. data/support/cookbooks/ruby_build/CHANGELOG.md +72 -0
  139. data/support/cookbooks/ruby_build/Gemfile +14 -0
  140. data/support/cookbooks/ruby_build/README.md +338 -0
  141. data/support/cookbooks/ruby_build/Rakefile +21 -0
  142. data/support/cookbooks/ruby_build/attributes/default.rb +67 -0
  143. data/support/cookbooks/ruby_build/chefignore +53 -0
  144. data/support/cookbooks/ruby_build/libraries/ruby_build_recipe_helpers.rb +40 -0
  145. data/support/cookbooks/ruby_build/metadata.rb +18 -0
  146. data/support/cookbooks/ruby_build/providers/ruby.rb +88 -0
  147. data/support/cookbooks/ruby_build/recipes/default.rb +69 -0
  148. data/support/cookbooks/ruby_build/resources/ruby.rb +33 -0
  149. data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/metadata.rb +10 -0
  150. data/support/cookbooks/ruby_build/test/cookbooks/alltherubies/recipes/default.rb +59 -0
  151. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/_verify_tests.bash +33 -0
  152. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.8.7.bats +29 -0
  153. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.2.bats +18 -0
  154. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_1.9.3.bats +18 -0
  155. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_2.0.0.bats +18 -0
  156. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_jruby.bats +20 -0
  157. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_rbx.bats +18 -0
  158. data/support/cookbooks/ruby_build/test/integration/alltherubies/bats/verify_ree.bats +19 -0
  159. data/support/cookbooks/ruby_build/test/integration/installation/bats/installation.bats +6 -0
  160. data/support/scripts/libsodium_ubuntu.sh +80 -0
  161. data/support/tasks/.gitkeep +0 -0
  162. data/support/tasks/libsodium_install.rb +57 -0
  163. data/vault-tree.gemspec +26 -0
  164. metadata +305 -0
@@ -0,0 +1,14 @@
1
+ {
2
+ "header": {},
3
+ "vaults": {
4
+
5
+ "simple_message":{
6
+ "owner": "tester",
7
+ "fill_with": "EXTERNAL_DATA",
8
+ "lock_with": "MASTER_PASSPHRASE",
9
+ "unlock_with": "MASTER_PASSPHRASE",
10
+ "contents": ""
11
+ }
12
+
13
+ }
14
+ }
@@ -0,0 +1,12 @@
1
+ .vagrant
2
+ Berksfile.lock
3
+ Gemfile.lock
4
+ *~
5
+ *#
6
+ .#*
7
+ \#*#
8
+ .*.sw[a-z]
9
+ *.un~
10
+ /cookbooks
11
+ .kitchen
12
+ .kitchen.local.yml
@@ -0,0 +1,34 @@
1
+ ---
2
+ driver_plugin: vagrant
3
+ driver_config:
4
+ require_chef_omnibus: true
5
+
6
+ platforms:
7
+ - name: ubuntu-12.04
8
+ driver_config:
9
+ box: opscode-ubuntu-12.04
10
+ box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
11
+ run_list:
12
+ - recipe[apt]
13
+
14
+ - name: ubuntu-10.04
15
+ driver_config:
16
+ box: opscode-ubuntu-10.04
17
+ box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
18
+ run_list:
19
+ - recipe[apt]
20
+
21
+ - name: centos-6.4
22
+ driver_config:
23
+ box: opscode-centos-6.4
24
+ box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
25
+ run_list:
26
+ - recipe[yum::epel]
27
+
28
+ suites:
29
+ - name: default
30
+ run_list:
31
+ - recipe[minitest-handler]
32
+ - recipe[ark]
33
+ - recipe[ark::test]
34
+ attributes: {}
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ gemfile:
3
+ - test/support/Gemfile
4
+ rvm:
5
+ - 1.9.3
6
+ script: BUNDLE_GEMFILE=test/support/Gemfile bundle exec rake foodcritic
@@ -0,0 +1,9 @@
1
+ site :opscode
2
+
3
+ metadata
4
+
5
+ group :integration do
6
+ cookbook "apt"
7
+ cookbook "yum"
8
+ cookbook "minitest-handler"
9
+ end
@@ -0,0 +1,87 @@
1
+ ark Cookbook CHANGELOG
2
+ ======================
3
+ This file is used to list changes made in each version of the ark cookbook.
4
+
5
+
6
+ v0.4.0
7
+ ------
8
+ ### Improvement
9
+ - **[COOK-3539](https://tickets.opscode.com/browse/COOK-3539)** - Allow dumping of bz2 and gzip files
10
+
11
+ v0.3.2
12
+ ------
13
+ ### Bug
14
+ - **[COOK-3191](https://tickets.opscode.com/browse/COOK-3191)** - Propogate unzip failures
15
+ - **[COOK-3118](https://tickets.opscode.com/browse/COOK-3118)** - Set cookbook attribute in provider
16
+ - **[COOK-3055](https://tickets.opscode.com/browse/COOK-3055)** - Use proper scope in helper module
17
+ - **[COOK-3054](https://tickets.opscode.com/browse/COOK-3054)** - Fix notification resource updating
18
+
19
+ ### Improvement
20
+ - **[COOK-3179](https://tickets.opscode.com/browse/COOK-3179)** - README updates and refactor
21
+
22
+ v0.3.0
23
+ ------
24
+ ### Improvement
25
+
26
+ - [COOK-3087]: Can't use ark with chef < 11
27
+
28
+ ### Bug
29
+
30
+ - [COOK-3064]: `only_if` statements in ark's `install_with_make` and configure actions are not testing for file existence correctly.
31
+ - [COOK-3067]: ark kitchen test for `cherry_pick` is expecting the binary to be in the same parent folder as in the archive.
32
+
33
+ v0.2.4
34
+ ------
35
+ ### Bug
36
+
37
+ - [COOK-3048]: Ark provider contains a `ruby_block` resource without a block attribute
38
+ - [COOK-3063]: Ark cookbook `cherry_pick` action's unzip command does not close if statement
39
+ - [COOK-3065]: Ark install action does not symlink binaries correctly
40
+
41
+ v0.2.2
42
+ ------
43
+ - Update the README to reflect the requirement for Chef 11 to use the ark resource (`use_inline_resources`).
44
+ - Making this a release so it will also appear on the community site page.
45
+
46
+ v0.2.0
47
+ ------
48
+ ### Bug
49
+
50
+ - [COOK-2772]: Ark cookbook has foodcritic failures in provides/default.rb
51
+
52
+ ### Improvement
53
+
54
+ - [COOK-2520]: Refactor ark providers to use the '`use_inline_resources`' LWRP DSL feature
55
+
56
+ v0.1.0
57
+ ------
58
+ - [COOK-2335] - ark resource broken on Chef 11
59
+
60
+ v0.0.1
61
+ ------
62
+ - [COOK-2026] - Allow `cherry_pick` action to be used for directories as well as files
63
+
64
+ v0.0.1
65
+ ------
66
+ - [COOK-1593] - README formatting updates for better display on Community Site
67
+
68
+ v0.0.1
69
+ ------
70
+ ### Bug
71
+ - dangling "unless"
72
+
73
+ ### Improvement
74
+ - add `setup_py_*` actions
75
+ - add vagrantfile
76
+ - add foodcritic test
77
+ - travis.ci support
78
+
79
+ v0.0.10 (May 23, 2012
80
+ ------
81
+ ### Bug
82
+ - `strip_leading_dir` not working for zip files https://github.com/bryanwb/chef-ark/issues/19
83
+
84
+ ### Improvement
85
+ - use autogen.sh to generate configure script for configure action https://github.com/bryanwb/chef-ark/issues/16
86
+ - support more file extensions https://github.com/bryanwb/chef-ark/pull/18
87
+ - add extension attribute which allows you to download files which do not have the file extension as part of the URL
@@ -0,0 +1,257 @@
1
+ # Contributing to Opscode Cookbooks
2
+
3
+ We are glad you want to contribute to Opscode Cookbooks! The first
4
+ step is the desire to improve the project.
5
+
6
+ You can find the answers to additional frequently asked questions
7
+ [on the wiki](http://wiki.opscode.com/display/chef/How+to+Contribute).
8
+
9
+ You can find additional information about
10
+ [contributing to cookbooks](http://wiki.opscode.com/display/chef/How+to+Contribute+to+Opscode+Cookbooks)
11
+ on the wiki as well.
12
+
13
+ ## Quick-contribute
14
+
15
+ * Create an account on our [bug tracker](http://tickets.opscode.com)
16
+ * Sign our contributor agreement (CLA)
17
+ [ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L)
18
+ (keep reading if you're contributing on behalf of your employer)
19
+ * Create a ticket for your change on the
20
+ [bug tracker](http://tickets.opscode.com)
21
+ * Link to your patch as a rebased git branch or pull request from the
22
+ ticket
23
+ * Resolve the ticket as fixed
24
+
25
+ We regularly review contributions and will get back to you if we have
26
+ any suggestions or concerns.
27
+
28
+ ## The Apache License and the CLA/CCLA
29
+
30
+ Licensing is very important to open source projects, it helps ensure
31
+ the software continues to be available under the terms that the author
32
+ desired. Chef uses the Apache 2.0 license to strike a balance between
33
+ open contribution and allowing you to use the software however you
34
+ would like to.
35
+
36
+ The license tells you what rights you have that are provided by the
37
+ copyright holder. It is important that the contributor fully
38
+ understands what rights they are licensing and agrees to them.
39
+ Sometimes the copyright holder isn't the contributor, most often when
40
+ the contributor is doing work for a company.
41
+
42
+ To make a good faith effort to ensure these criteria are met, Opscode
43
+ requires a Contributor License Agreement (CLA) or a Corporate
44
+ Contributor License Agreement (CCLA) for all contributions. This is
45
+ without exception due to some matters not being related to copyright
46
+ and to avoid having to continually check with our lawyers about small
47
+ patches.
48
+
49
+ It only takes a few minutes to complete a CLA, and you retain the
50
+ copyright to your contribution.
51
+
52
+ You can complete our contributor agreement (CLA)
53
+ [ online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L).
54
+ If you're contributing on behalf of your employer, have your employer
55
+ fill out our
56
+ [Corporate CLA](https://secure.echosign.com/public/hostedForm?formid=PIE6C7AX856)
57
+ instead.
58
+
59
+ ## Ticket Tracker (JIRA)
60
+
61
+ The [ticket tracker](http://tickets.opscode.com) is the most important
62
+ documentation for the code base. It provides significant historical
63
+ information, such as:
64
+
65
+ * Which release a bug fix is included in
66
+ * Discussion regarding the design and merits of features
67
+ * Error output to aid in finding similar bugs
68
+
69
+ Each ticket should aim to fix one bug or add one feature.
70
+
71
+ ## Using git
72
+
73
+ You can get a quick copy of the repository for this cookbook by
74
+ running `git clone
75
+ git://github.com/opscode-coobkooks/COOKBOOKNAME.git`.
76
+
77
+ For collaboration purposes, it is best if you create a Github account
78
+ and fork the repository to your own account. Once you do this you will
79
+ be able to push your changes to your Github repository for others to
80
+ see and use.
81
+
82
+ If you have another repository in your GitHub account named the same
83
+ as the cookbook, we suggest you suffix the repository with -cookbook.
84
+
85
+ ### Branches and Commits
86
+
87
+ You should submit your patch as a git branch named after the ticket,
88
+ such as COOK-1337. This is called a _topic branch_ and allows users to
89
+ associate a branch of code with the ticket.
90
+
91
+ It is a best practice to have your commit message have a _summary
92
+ line_ that includes the ticket number, followed by an empty line and
93
+ then a brief description of the commit. This also helps other
94
+ contributors understand the purpose of changes to the code.
95
+
96
+ [COOK-1757] - platform_family and style
97
+
98
+ * use platform_family for platform checking
99
+ * update notifies syntax to "resource_type[resource_name]" instead of
100
+ resources() lookup
101
+ * COOK-692 - delete config files dropped off by packages in conf.d
102
+ * dropped debian 4 support because all other platforms have the same
103
+ values, and it is older than "old stable" debian release
104
+
105
+ Remember that not all users use Chef in the same way or on the same
106
+ operating systems as you, so it is helpful to be clear about your use
107
+ case and change so they can understand it even when it doesn't apply
108
+ to them.
109
+
110
+ ### Github and Pull Requests
111
+
112
+ All of Opscode's open source cookbook projects are available on
113
+ [Github](http://www.github.com/opscode-cookbooks).
114
+
115
+ We don't require you to use Github, and we will even take patch diffs
116
+ attached to tickets on the tracker. However Github has a lot of
117
+ convenient features, such as being able to see a diff of changes
118
+ between a pull request and the main repository quickly without
119
+ downloading the branch.
120
+
121
+ If you do choose to use a pull request, please provide a link to the
122
+ pull request from the ticket __and__ a link to the ticket from the
123
+ pull request. Because pull requests only have two states, open and
124
+ closed, we can't easily filter pull requests that are waiting for a
125
+ reply from the author for various reasons.
126
+
127
+ ### More information
128
+
129
+ Additional help with git is available on the
130
+ [Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git)
131
+ wiki page.
132
+
133
+ ## Functional and Unit Tests
134
+
135
+ This cookbook is set up to run tests under
136
+ [Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It
137
+ uses minitest-chef to run integration tests after the node has been
138
+ converged to verify that the state of the node.
139
+
140
+ Test kitchen should run completely without exception using the default
141
+ [baseboxes provided by Opscode](https://github.com/opscode/bento).
142
+ Because Test Kitchen creates VirtualBox machines and runs through
143
+ every configuration in the Kitchenfile, it may take some time for
144
+ these tests to complete.
145
+
146
+ If your changes are only for a specific recipe, run only its
147
+ configuration with Test Kitchen. If you are adding a new recipe, or
148
+ other functionality such as a LWRP or definition, please add
149
+ appropriate tests and ensure they run with Test Kitchen.
150
+
151
+ If any don't pass, investigate them before submitting your patch.
152
+
153
+ Any new feature should have unit tests included with the patch with
154
+ good code coverage to help protect it from future changes. Similarly,
155
+ patches that fix a bug or regression should have a _regression test_.
156
+ Simply put, this is a test that would fail without your patch but
157
+ passes with it. The goal is to ensure this bug doesn't regress in the
158
+ future. Consider a regular expression that doesn't match a certain
159
+ pattern that it should, so you provide a patch and a test to ensure
160
+ that the part of the code that uses this regular expression works as
161
+ expected. Later another contributor may modify this regular expression
162
+ in a way that breaks your use cases. The test you wrote will fail,
163
+ signalling to them to research your ticket and use case and accounting
164
+ for it.
165
+
166
+ If you need help writing tests, please ask on the Chef Developer's
167
+ mailing list, or the #chef-hacking IRC channel.
168
+
169
+ ## Code Review
170
+
171
+ Opscode regularly reviews code contributions and provides suggestions
172
+ for improvement in the code itself or the implementation.
173
+
174
+ We find contributions by searching the ticket tracker for _resolved_
175
+ tickets with a status of _fixed_. If we have feedback we will reopen
176
+ the ticket and you should resolve it again when you've made the
177
+ changes or have a response to our feedback. When we believe the patch
178
+ is ready to be merged, we will tag the _Code Reviewed_ field with
179
+ _Reviewed_.
180
+
181
+ Depending on the project, these tickets are then merged within a week
182
+ or two, depending on the current release cycle.
183
+
184
+ ## Release Cycle
185
+
186
+ The versioning for Opscode Cookbook projects is X.Y.Z.
187
+
188
+ * X is a major release, which may not be fully compatible with prior
189
+ major releases
190
+ * Y is a minor release, which adds both new features and bug fixes
191
+ * Z is a patch release, which adds just bug fixes
192
+
193
+ A released version of a cookbook will end in an even number, e.g.
194
+ "1.2.4" or "0.8.0". When development for the next version of the
195
+ cookbook begins, the "Z" patch number is incremented to the next odd
196
+ number, however the next release of the cookbook may be a major or
197
+ minor incrementing version.
198
+
199
+ Releases of Opscode's cookbooks are usually announced on the Chef user
200
+ mailing list. Releases of several cookbooks may be batched together
201
+ and announced on the [Opscode Blog](http://www.opscode.com/blog).
202
+
203
+ ## Working with the community
204
+
205
+ These resources will help you learn more about Chef and connect to
206
+ other members of the Chef community:
207
+
208
+ * [chef](http://lists.opscode.com/sympa/info/chef) and
209
+ [chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing
210
+ lists
211
+ * #chef and #chef-hacking IRC channels on irc.freenode.net
212
+ * [Community Cookbook site](http://community.opscode.com)
213
+ * [Chef wiki](http://wiki.opscode.com/display/chef)
214
+ * Opscode Chef [product page](http://www.opscode.com/chef)
215
+
216
+
217
+ ## Cookbook Contribution Do's and Don't's
218
+
219
+ Please do include tests for your contribution. If you need help, ask
220
+ on the
221
+ [chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev)
222
+ or the
223
+ [#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking).
224
+ Not all platforms that a cookbook supports may be supported by Test
225
+ Kitchen. Please provide evidence of testing your contribution if it
226
+ isn't trivial so we don't have to duplicate effort in testing. Chef
227
+ 10.14+ "doc" formatted output is sufficient.
228
+
229
+ Please do indicate new platform (families) or platform versions in the
230
+ commit message, and update the relevant ticket.
231
+
232
+ If a contribution adds new platforms or platform versions, indicate
233
+ such in the body of the commit message(s), and update the relevant
234
+ COOK ticket. When writing commit messages, it is helpful for others if
235
+ you indicate the COOK ticket. For example:
236
+
237
+ git commit -m '[COOK-1041] - Updated pool resource to correctly
238
+ delete.'
239
+
240
+ Please do use [foodcritic](http://acrmp.github.com/foodcritic) to
241
+ lint-check the cookbook. Except FC007, it should pass all correctness
242
+ rules. FC007 is okay as long as the dependent cookbooks are *required*
243
+ for the default behavior of the cookbook, such as to support an
244
+ uncommon platform, secondary recipe, etc.
245
+
246
+ Please do ensure that your changes do not break or modify behavior for
247
+ other platforms supported by the cookbook. For example if your changes
248
+ are for Debian, make sure that they do not break on CentOS.
249
+
250
+ Please do not modify the version number in the metadata.rb, Opscode
251
+ will select the appropriate version based on the release cycle
252
+ information above.
253
+
254
+ Please do not update the CHANGELOG.md for a new version. Not all
255
+ changes to a cookbook may be merged and released in the same versions.
256
+ Opscode will update the CHANGELOG.md when releasing a new version of
257
+ the cookbook.
@@ -0,0 +1,301 @@
1
+ # <a name="title"></a> chef-ark [![Build Status](https://secure.travis-ci.org/opscode-cookbooks/ark.png?branch=master)](https://travis-ci.org/opscode-cookbooks/ark)
2
+
3
+ Overview
4
+ ========
5
+
6
+ This cookbook provides `ark`, a resource for managing software
7
+ archives. It manages the fetch-unpack-configure-build-install process
8
+ common to installing software from source, or from binary
9
+ distributions that are not fully fledged OS packages.
10
+
11
+ This is a modified verion of Infochimp's awesome
12
+ [install_from cookbook](http://github.com/infochimps-cookbooks/install_from).
13
+ It has been heavily refactored and extended to meet different use
14
+ cases.
15
+
16
+ Given a simple project archive available at a url:
17
+
18
+ ark 'pig' do
19
+ url 'http://apache.org/pig/pig-0.8.0.tar.gz'
20
+ end
21
+
22
+ The provider will:
23
+
24
+ * fetch it to to `/var/cache/chef/`
25
+ * unpack it to the default path (`/usr/local/pig-0.8.0`)
26
+ * create a symlink for `:home_dir` (`/usr/local/pig`) pointing to path
27
+ * add specified binary commands to the enviroment `PATH` variable
28
+
29
+ By default, the ark will not run again if the `:path` is not empty.
30
+ Ark provides many actions to accommodate different use cases, such as
31
+ `:dump`, `:cherry_pick`, `:put`, and `:install_with_make`.
32
+
33
+ At this time ark only handles files available from URLs. It does not
34
+ handle local files.
35
+
36
+ Requirements
37
+ ============
38
+
39
+ This cookbook requires Chef 11 for the provider, as it uses the
40
+ `use_inline_resources` method.
41
+
42
+ More about
43
+ [use_inline_resources](http://docs.opscode.com/lwrp_common_inline_compile.html)
44
+ in the Chef documentation.
45
+
46
+ Should work on common Unix/Linux systems with typical userland
47
+ utilities like tar, gzip, etc. May require the installation of build
48
+ tools for compiling from source, but that installation is outside the
49
+ scope of this cookbook.
50
+
51
+ Attributes
52
+ ==========
53
+
54
+ Customize the attributes to suit site specific conventions and
55
+ defaults.
56
+
57
+ * `node['ark']['apache_mirror']` - if the URL is an apache mirror,
58
+ use the attribute as the default.
59
+ * `node['ark']['prefix_root']` - default base location if the
60
+ `prefix_root` is not passed into the resource.
61
+ * `node['ark']['prefix_bin']` - default binary location if the
62
+ `prefix_bin` is not passed into the resource.
63
+ * `node['ark']['prefix_home']` - default home location if the
64
+ `prefix_home` is not passed into the resource.
65
+
66
+ Resources/Providers
67
+ ===================
68
+
69
+ * `ark` - does the extract/build/configure dance
70
+
71
+ Actions
72
+ -------
73
+
74
+ - `:install`: extracts the file and creates a 'friendly' symbolic link
75
+ to the extracted directory path
76
+ - `:configure`: configure ahead of the install action
77
+ - `:install_with_make`: extracts the archive to a path, runs `make`,
78
+ and `make install`. It does _not_ run the configure step at this
79
+ time
80
+ - `:dump`: strips all directories from the archive and dumps the
81
+ contained files into a specified path
82
+ - `:cherry_pick`: extract a specified file from an archive and places
83
+ in specified path
84
+ - `:put`: extract the archive to a specified path, does not create any
85
+ symbolic links
86
+ - `:remove`: removes the extracted directory and related symlink #TODO
87
+ - `:setup_py_build`: runs the command "python setup.py build" in the
88
+ extracted directory
89
+ - `:setup_py_install`: runs the comand "python setup.py install" in
90
+ the extracted directory
91
+
92
+ ## :cherry_pick
93
+
94
+ Extract a specified file from an archive and places in specified path.
95
+
96
+ ### Relevant Attribute Parameters for :cherry_pick
97
+
98
+ - `path`: directory to place file in.
99
+ - `creates`: specific file to cherry-pick.
100
+
101
+ ## :dump
102
+
103
+ Strips all directories from the archive and dumps the contained files
104
+ into a specified path.
105
+
106
+ NOTE: This currently only works for zip archives
107
+
108
+ ### Attribute Parameters for :dump
109
+
110
+ - `path`: path to dump files to.
111
+ - `mode`: file mode for `app_home`, as an integer.
112
+ - Example: `0775`
113
+ - `creates`: if you are appending files to a given directory, ark
114
+ needs a condition to test whether the file has already been
115
+ extracted. You can specify with creates, a file whose existence
116
+ indicates the ark has previously been extracted and does not need to
117
+ be extracted again.
118
+
119
+ ## :put
120
+
121
+ Extract the archive to a specified path, does not create any symbolic
122
+ links.
123
+
124
+ ### Attribute Parameters for :put
125
+
126
+ - `path`: path to extract to.
127
+ - Default: `/usr/local`
128
+ - `has_binaries`: array of binary commands to symlink into
129
+ `/usr/local/bin/`, you must specify the relative path.
130
+ - Example: `[ 'bin/java', 'bin/javaws' ]`
131
+ - `append_env_path`: boolean, if true, append the `./bin` directory of
132
+ the extracted directory to the global `PATH` variable for all users.
133
+
134
+ Attribute Parameters
135
+ --------------------
136
+
137
+ - `name`: name of the package, defaults to the resource name.
138
+ - `url`: url for tarball, `.tar.gz`, `.bin` (oracle-specific), `.war`,
139
+ and `.zip` currently supported. Also supports special syntax
140
+ `:name:version:apache_mirror:` that will auto-magically construct
141
+ download url from the apache mirrors site.
142
+ - `version`: software version, defaults to `1`.
143
+ - `checksum`: sha256 checksum, used for security .
144
+ - `mode`: file mode for `app_home`, is an integer.
145
+ - `prefix_root`: default `prefix_root`, for use with `:install*`
146
+ actions.
147
+ - `prefix_home`: default directory prefix for a friendly symlink to
148
+ the path.
149
+ - Example: `/usr/local/maven` -> `/usr/local/maven-2.2.1`
150
+ - `prefix_bin`: default directory to place a symlink to a binary
151
+ command.
152
+ - Example: `/opt/bin/mvn` -> `/opt/maven-2.2.1/bin/mvn`, where the
153
+ `prefix_bin` is `/opt/bin`
154
+ - `path`: path to extract the ark to. The `:install*` actions
155
+ overwrite any user-provided values for `:path`.
156
+ - Default: `/usr/local/<name>-<version>` for the `:install`,
157
+ `:install_with_make` actions
158
+ - `home_dir`: symbolic link to the path `:prefix_root/:name-:version`,
159
+ does not apply to `:dump`, `:put`, or `:cherry_pick` actions.
160
+ - Default: `:prefix_root/:name`
161
+ - `has_binaries`: array of binary commands to symlink into
162
+ `/usr/local/bin/`, you must specify the relative path.
163
+ - Example: `[ 'bin/java', 'bin/javaws' ]`
164
+ - `append_env_path`: boolean, similar to `has_binaries` but less
165
+ granular. If true, append the `./bin` directory of the extracted
166
+ directory to. the `PATH` environment variable for all users, by
167
+ placing a file in `/etc/profile.d/`. The commands are symbolically
168
+ linked into `/usr/bin/*`. This option provides more granularity than
169
+ the boolean option.
170
+ - Example: `mvn`, `java`, `javac`, etc.
171
+ - `environment`: hash of environment variables to pass to invoked
172
+ shell commands like `tar`, `unzip`, `configure`, and `make`.
173
+ - `strip_leading_dir`: by default, ark strips the leading directory
174
+ from an archive, which is the default for both `unzip` and `tar`
175
+ commands
176
+ - `autoconf_opts`: an array of command line options for use with the
177
+ GNU `autoconf` script.
178
+ - Example: `[ '--include=/opt/local/include', '--force' ]`
179
+ - `make_opts`: an array of command line options for use with `make`.
180
+ - Example: `[ '--warn-undefined-variables', '--load-average=2' ]`
181
+ - `owner`: owner of extracted directory.
182
+ - Default: `root`
183
+
184
+ ### Examples
185
+
186
+ This example copies `ivy.tar.gz` to
187
+ `/var/cache/chef/ivy-2.2.0.tar.gz`, unpacks its contents to
188
+ `/usr/local/ivy-2.2.0/` -- stripping the leading directory, and
189
+ symlinks `/usr/local/ivy` to `/usr/local/ivy-2.2.0`
190
+
191
+ # install Apache Ivy dependency resolution tool
192
+ ark "ivy" do
193
+ url 'http://someurl.example.com/ivy.tar.gz'
194
+ version '2.2.0'
195
+ checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
196
+ action :install
197
+ end
198
+
199
+ This example copies `jdk-7u2-linux-x64.tar.gz` to
200
+ `/var/cache/chef/jdk-7.2.tar.gz`, unpacks its contents to
201
+ `/usr/local/jvm/jdk-7.2/` -- stripping the leading directory, symlinks
202
+ `/usr/local/jvm/default` to `/usr/local/jvm/jdk-7.2`, and adds
203
+ `/usr/local/jvm/jdk-7.2/bin/` to the global `PATH` for all users. The
204
+ user 'foobar' is the owner of the `/usr/local/jvm/jdk-7.2` directory:
205
+
206
+ ark 'jdk' do
207
+ url 'http://download.example.com/jdk-7u2-linux-x64.tar.gz'
208
+ version '7.2'
209
+ path "/usr/local/jvm/"
210
+ home_dir "/usr/local/jvm/default"
211
+ checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
212
+ append_env_path true
213
+ owner 'foobar'
214
+ end
215
+
216
+ Install Apache Ivy dependency resolution tool in <path>/resource_name in this case
217
+ `/usr/local/ivy`, do not symlink, and strip any leading directory if one
218
+ exists in the tarball:
219
+
220
+ ark "ivy" do
221
+ url 'http://someurl.example.com/ivy.tar.gz'
222
+ checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
223
+ action :put
224
+ end
225
+
226
+ Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any
227
+ leading directory if one exists:
228
+
229
+ ark "ivy" do
230
+ path "/home/foobar
231
+ url 'http://someurl.example.com/ivy.tar.gz'
232
+ checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
233
+ action :put
234
+ end
235
+
236
+ Strip all directories and dump files into path specified by the path attribute.
237
+ You must specify the `creates` attribute in order to keep the extraction from
238
+ running every time. The directory path will be created if it doesn't already exist:
239
+
240
+ ark "my_jars" do
241
+ url "http://example.com/bunch_of_jars.zip"
242
+ path "/usr/local/tomcat/lib"
243
+ creates "mysql.jar"
244
+ owner "tomcat"
245
+ action :dump
246
+ end
247
+
248
+ Extract specific files from a tarball (currently only handles one named file):
249
+
250
+ ark 'mysql-connector-java' do
251
+ url 'http://oracle.com/mysql-connector.zip'
252
+ creates 'mysql-connector-java-5.0.8-bin.jar'
253
+ path '/usr/local/tomcat/lib'
254
+ action :cherry_pick
255
+ end
256
+
257
+ Build and install haproxy and use alternave values for `prefix_root`, `prefix_home`, and `prefix_bin`:
258
+
259
+ ark "haproxy" do
260
+ url "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
261
+ version "1.5"
262
+ checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
263
+ make_opts [ 'TARGET=linux26' ]
264
+ prefix_root '/opt'
265
+ prefix_home '/opt'
266
+ prefix_bin '/opt/bin'
267
+ action :install_with_make
268
+ end
269
+
270
+ You can also pass multiple actions to ark and supply the file extension in case
271
+ the file extension can not be determined by the URL:
272
+
273
+ ark "test_autogen" do
274
+ url 'https://github.com/zeromq/libzmq/tarball/master'
275
+ extension "tar.gz"
276
+ action [ :configure, :install_with_make ]
277
+ end
278
+
279
+ License and Author
280
+ ==================
281
+
282
+ - Author: Philip (flip) Kromer - Infochimps, Inc(<coders@infochimps.com>)
283
+ - Author: Bryan W. Berry (<bryan.berry@gmail.com>)
284
+ - Author: Denis Barishev (<denis.barishev@gmail.com>)
285
+ - Author: Sean OMeara (<someara@opscode.com>)
286
+ - Copyright: 2011, Philip (flip) Kromer - Infochimps, Inc
287
+ - Copyright: 2012, Bryan W. Berry
288
+ - Copyright: 2012, Denis Barishev
289
+ - Copyright: 2013, Opscode, Inc
290
+
291
+ Licensed under the Apache License, Version 2.0 (the "License");
292
+ you may not use this file except in compliance with the License.
293
+ You may obtain a copy of the License at
294
+
295
+ http://www.apache.org/licenses/LICENSE-2.0
296
+
297
+ Unless required by applicable law or agreed to in writing, software
298
+ distributed under the License is distributed on an "AS IS" BASIS,
299
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
300
+ See the License for the specific language governing permissions and
301
+ limitations under the License.