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,13 @@
1
+ name "ark"
2
+ maintainer "Bryan W. Berry"
3
+ maintainer_email "bryan.berry@gmail.com"
4
+ license "Apache 2.0"
5
+ description "Installs/Configures ark"
6
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
+ version "0.4.1"
8
+
9
+ %w{ debian ubuntu centos redhat fedora }.each do |os|
10
+ supports os
11
+ end
12
+
13
+ recipe "ark::default", "Installs and configures ark"
@@ -0,0 +1,370 @@
1
+ #
2
+ # Cookbook Name:: ark
3
+ # Provider:: Ark
4
+ #
5
+ # Author:: Bryan W. Berry <bryan.berry@gmail.com>
6
+ # Author:: Sean OMeara <someara@opscode.com
7
+ # Copyright 2012, Bryan W. Berry
8
+ # Copyright 2013, Opscode, Inc.
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ #
22
+
23
+ use_inline_resources if defined?(use_inline_resources)
24
+ include ::Opscode::Ark::ProviderHelpers
25
+
26
+ # From resources/default.rb
27
+ # :install, :put, :dump, :cherry_pick, :install_with_make, :configure, :setup_py_build, :setup_py_install, :setup_py
28
+
29
+ # Used in test.rb
30
+ # :install, :put, :dump, :cherry_pick, :install_with_make, :configure
31
+
32
+ #################
33
+ # action :install
34
+ #################
35
+ action :install do
36
+ set_paths
37
+
38
+ directory new_resource.path do
39
+ recursive true
40
+ action :create
41
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
42
+ end
43
+
44
+ remote_file new_resource.release_file do
45
+ Chef::Log.debug("DEBUG: new_resource.release_file")
46
+ source new_resource.url
47
+ if new_resource.checksum then checksum new_resource.checksum end
48
+ action :create
49
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
50
+ end
51
+
52
+ # unpack based on file extension
53
+ _unpack_command = unpack_command
54
+ execute "unpack #{new_resource.release_file}" do
55
+ command _unpack_command
56
+ cwd new_resource.path
57
+ environment new_resource.environment
58
+ notifies :run, "execute[set owner on #{new_resource.path}]"
59
+ action :nothing
60
+ end
61
+
62
+ # set_owner
63
+ execute "set owner on #{new_resource.path}" do
64
+ command "/bin/chown -R #{new_resource.owner}:#{new_resource.group} #{new_resource.path}"
65
+ action :nothing
66
+ end
67
+
68
+ # symlink binaries
69
+ new_resource.has_binaries.each do |bin|
70
+ link ::File.join(new_resource.prefix_bin, ::File.basename(bin)) do
71
+ to ::File.join(new_resource.path, bin)
72
+ end
73
+ end
74
+
75
+ # action_link_paths
76
+ link new_resource.home_dir do
77
+ to new_resource.path
78
+ end
79
+
80
+ # Add to path for interactive bash sessions
81
+ template "/etc/profile.d/#{new_resource.name}.sh" do
82
+ cookbook "ark"
83
+ source "add_to_path.sh.erb"
84
+ owner "root"
85
+ group "root"
86
+ mode "0755"
87
+ cookbook "ark"
88
+ variables( :directory => "#{new_resource.path}/bin" )
89
+ only_if { new_resource.append_env_path }
90
+ end
91
+
92
+ # Add to path for the current chef-client converge.
93
+ bin_path = ::File.join(new_resource.path, 'bin')
94
+ ruby_block "adding '#{bin_path}' to chef-client ENV['PATH']" do
95
+ block do
96
+ ENV['PATH'] = bin_path + ':' + ENV['PATH']
97
+ end
98
+ only_if{ new_resource.append_env_path and ENV['PATH'].scan(bin_path).empty? }
99
+ end
100
+ end
101
+
102
+
103
+ ##############
104
+ # action :put
105
+ ##############
106
+ action :put do
107
+ set_put_paths
108
+
109
+ directory new_resource.path do
110
+ recursive true
111
+ action :create
112
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
113
+ end
114
+
115
+ # download
116
+ remote_file new_resource.release_file do
117
+ source new_resource.url
118
+ if new_resource.checksum then checksum new_resource.checksum end
119
+ action :create
120
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
121
+ end
122
+
123
+ # unpack based on file extension
124
+ _unpack_command = unpack_command
125
+ execute "unpack #{new_resource.release_file}" do
126
+ command _unpack_command
127
+ cwd new_resource.path
128
+ environment new_resource.environment
129
+ notifies :run, "execute[set owner on #{new_resource.path}]"
130
+ action :nothing
131
+ end
132
+
133
+ # set_owner
134
+ execute "set owner on #{new_resource.path}" do
135
+ command "/bin/chown -R #{new_resource.owner}:#{new_resource.group} #{new_resource.path}"
136
+ action :nothing
137
+ end
138
+ end
139
+
140
+ ###########################
141
+ # action :dump
142
+ ###########################
143
+ action :dump do
144
+ set_dump_paths
145
+
146
+ directory new_resource.path do
147
+ recursive true
148
+ action :create
149
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
150
+ end
151
+
152
+ # download
153
+ remote_file new_resource.release_file do
154
+ Chef::Log.debug("DEBUG: new_resource.release_file #{new_resource.release_file}")
155
+ source new_resource.url
156
+ if new_resource.checksum then checksum new_resource.checksum end
157
+ action :create
158
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
159
+ end
160
+
161
+ # unpack based on file extension
162
+ _dump_command = dump_command
163
+ execute "unpack #{new_resource.release_file}" do
164
+ command _dump_command
165
+ cwd new_resource.path
166
+ environment new_resource.environment
167
+ notifies :run, "execute[set owner on #{new_resource.path}]"
168
+ action :nothing
169
+ end
170
+
171
+ # set_owner
172
+ execute "set owner on #{new_resource.path}" do
173
+ command "/bin/chown -R #{new_resource.owner}:#{new_resource.group} #{new_resource.path}"
174
+ action :nothing
175
+ end
176
+ end
177
+
178
+ ###########################
179
+ # action :unzip
180
+ ###########################
181
+ action :unzip do
182
+ set_dump_paths
183
+
184
+ directory new_resource.path do
185
+ recursive true
186
+ action :create
187
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
188
+ end
189
+
190
+ # download
191
+ remote_file new_resource.release_file do
192
+ Chef::Log.debug("DEBUG: new_resource.release_file #{new_resource.release_file}")
193
+ source new_resource.url
194
+ if new_resource.checksum then checksum new_resource.checksum end
195
+ action :create
196
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
197
+ end
198
+
199
+ # unpack based on file extension
200
+ _unzip_command = unzip_command
201
+ execute "unpack #{new_resource.release_file}" do
202
+ command _unzip_command
203
+ cwd new_resource.path
204
+ environment new_resource.environment
205
+ notifies :run, "execute[set owner on #{new_resource.path}]"
206
+ action :nothing
207
+ end
208
+
209
+ # set_owner
210
+ execute "set owner on #{new_resource.path}" do
211
+ command "/bin/chown -R #{new_resource.owner}:#{new_resource.group} #{new_resource.path}"
212
+ action :nothing
213
+ end
214
+ end
215
+
216
+ #####################
217
+ # action :cherry_pick
218
+ #####################
219
+ action :cherry_pick do
220
+ set_dump_paths
221
+ Chef::Log.debug("DEBUG: new_resource.creates #{new_resource.creates}")
222
+
223
+ directory new_resource.path do
224
+ recursive true
225
+ action :create
226
+ notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]"
227
+ end
228
+
229
+ # download
230
+ remote_file new_resource.release_file do
231
+ source new_resource.url
232
+ if new_resource.checksum then checksum new_resource.checksum end
233
+ action :create
234
+ notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]"
235
+ end
236
+
237
+ _unpack_type = unpack_type
238
+ _cherry_pick_command = cherry_pick_command
239
+ execute "cherry_pick #{new_resource.creates} from #{new_resource.release_file}" do
240
+ Chef::Log.debug("DEBUG: unpack_type: #{_unpack_type}")
241
+ command _cherry_pick_command
242
+ creates "#{new_resource.path}/#{new_resource.creates}"
243
+ notifies :run, "execute[set owner on #{new_resource.path}]"
244
+ action :nothing
245
+ end
246
+
247
+ # set_owner
248
+ execute "set owner on #{new_resource.path}" do
249
+ command "/bin/chown -R #{new_resource.owner}:#{new_resource.group} #{new_resource.path}"
250
+ action :nothing
251
+ end
252
+ end
253
+
254
+
255
+ ###########################
256
+ # action :install_with_make
257
+ ###########################
258
+ action :install_with_make do
259
+ set_paths
260
+
261
+ directory new_resource.path do
262
+ recursive true
263
+ action :create
264
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
265
+ end
266
+
267
+ remote_file new_resource.release_file do
268
+ Chef::Log.debug("DEBUG: new_resource.release_file")
269
+ source new_resource.url
270
+ if new_resource.checksum then checksum new_resource.checksum end
271
+ action :create
272
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
273
+ end
274
+
275
+ # unpack based on file extension
276
+ _unpack_command = unpack_command
277
+ execute "unpack #{new_resource.release_file}" do
278
+ command _unpack_command
279
+ cwd new_resource.path
280
+ environment new_resource.environment
281
+ notifies :run, "execute[autogen #{new_resource.path}]"
282
+ notifies :run, "execute[configure #{new_resource.path}]"
283
+ notifies :run, "execute[make #{new_resource.path}]"
284
+ notifies :run, "execute[make install #{new_resource.path}]"
285
+ action :nothing
286
+ end
287
+
288
+ execute "autogen #{new_resource.path}" do
289
+ command "./autogen.sh"
290
+ only_if { ::File.exist? "#{new_resource.path}/autogen.sh" }
291
+ cwd new_resource.path
292
+ environment new_resource.environment
293
+ action :nothing
294
+ ignore_failure true
295
+ end
296
+
297
+ execute "configure #{new_resource.path}" do
298
+ command "./configure #{new_resource.autoconf_opts.join(' ')}"
299
+ only_if { ::File.exist? "#{new_resource.path}/configure" }
300
+ cwd new_resource.path
301
+ environment new_resource.environment
302
+ action :nothing
303
+ end
304
+
305
+ execute "make #{new_resource.path}" do
306
+ command "make #{new_resource.make_opts.join(' ')}"
307
+ cwd new_resource.path
308
+ environment new_resource.environment
309
+ action :nothing
310
+ end
311
+
312
+ execute "make install #{new_resource.path}" do
313
+ command "make install #{new_resource.make_opts.join(' ')}"
314
+ cwd new_resource.path
315
+ environment new_resource.environment
316
+ action :nothing
317
+ end
318
+
319
+ # unless new_resource.creates and ::File.exists? new_resource.creates
320
+ # end
321
+ end
322
+
323
+
324
+
325
+
326
+ action :configure do
327
+ set_paths
328
+
329
+ directory new_resource.path do
330
+ recursive true
331
+ action :create
332
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
333
+ end
334
+
335
+ remote_file new_resource.release_file do
336
+ Chef::Log.debug("DEBUG: new_resource.release_file")
337
+ source new_resource.url
338
+ if new_resource.checksum then checksum new_resource.checksum end
339
+ action :create
340
+ notifies :run, "execute[unpack #{new_resource.release_file}]"
341
+ end
342
+
343
+ # unpack based on file extension
344
+ _unpack_command = unpack_command
345
+ execute "unpack #{new_resource.release_file}" do
346
+ command _unpack_command
347
+ cwd new_resource.path
348
+ environment new_resource.environment
349
+ notifies :run, "execute[autogen #{new_resource.path}]"
350
+ notifies :run, "execute[configure #{new_resource.path}]"
351
+ action :nothing
352
+ end
353
+
354
+ execute "autogen #{new_resource.path}" do
355
+ command "./autogen.sh"
356
+ only_if { ::File.exist? "#{new_resource.path}/autogen.sh" }
357
+ cwd new_resource.path
358
+ environment new_resource.environment
359
+ action :nothing
360
+ ignore_failure true
361
+ end
362
+
363
+ execute "configure #{new_resource.path}" do
364
+ command "./configure #{new_resource.autoconf_opts.join(' ')}"
365
+ only_if { ::File.exist? "#{new_resource.path}/configure" }
366
+ cwd new_resource.path
367
+ environment new_resource.environment
368
+ action :nothing
369
+ end
370
+ end
@@ -0,0 +1,31 @@
1
+ #
2
+ # Cookbook Name:: ark
3
+ # Recipe:: default
4
+ #
5
+ # Author:: Bryan W. Berry <bryan.berry@gmail.com>
6
+ # Copyright 2012, Bryan W. Berry
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
+
21
+
22
+ package "unzip"
23
+ package "libtool"
24
+ package "rsync"
25
+ package "autoconf"
26
+ package "make"
27
+ package "autogen" unless platform_family?("rhel", "fedora")
28
+
29
+ if platform?("freebsd")
30
+ package "gtar"
31
+ end
@@ -0,0 +1,138 @@
1
+ # require 'fileutils'
2
+
3
+ # remove file so we can test sending notification on its creation
4
+ if ::File.exist? "/tmp/foobarbaz/foo1.txt"
5
+ FileUtils.rm_f "/tmp/foobarbaz/foo1.txt"
6
+ end
7
+
8
+ ruby_block "test_notification" do
9
+ block do
10
+ if ::File.exist? "/tmp/foobarbaz/foo1.txt"
11
+ FileUtils.touch "/tmp/foobarbaz/notification_successful.txt"
12
+ end
13
+ end
14
+ action :nothing
15
+ end
16
+
17
+ user 'foobarbaz'
18
+
19
+ directory "/opt/bin" do
20
+ recursive true
21
+ end
22
+
23
+ ark "foo" do
24
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tar.gz'
25
+ checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
26
+ version '2'
27
+ prefix_root "/usr/local"
28
+ owner "foobarbaz"
29
+ group 'foobarbaz'
30
+ has_binaries [ 'bin/do_foo', 'bin/do_more_foo' ]
31
+ action :install
32
+ end
33
+
34
+ ark 'test_put' do
35
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tar.gz'
36
+ checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
37
+ owner 'foobarbaz'
38
+ group 'foobarbaz'
39
+ action :put
40
+ end
41
+
42
+ ark "test_dump" do
43
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.zip'
44
+ checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
45
+ path '/usr/local/foo_dump'
46
+ creates 'foo1.txt'
47
+ owner 'foobarbaz'
48
+ group 'foobarbaz'
49
+ action :dump
50
+ end
51
+
52
+ ark 'cherry_pick_test' do
53
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tar.gz'
54
+ checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
55
+ path '/usr/local/foo_cherry_pick'
56
+ owner 'foobarbaz'
57
+ group 'foobarbaz'
58
+ creates "foo_sub/foo1.txt"
59
+ action :cherry_pick
60
+ end
61
+
62
+ ark 'cherry_pick_with_zip' do
63
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.zip'
64
+ checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
65
+ path '/usr/local/foo_cherry_pick_from_zip'
66
+ creates "foo_sub/foo1.txt"
67
+ action :cherry_pick
68
+ end
69
+
70
+ ark "foo_append_env" do
71
+ version "7.0.26"
72
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tar.gz'
73
+ checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
74
+ append_env_path true
75
+ action :install
76
+ end
77
+
78
+ ark "foo_dont_strip" do
79
+ version "2"
80
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tar.gz'
81
+ checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
82
+ strip_leading_dir false
83
+ action :install
84
+ end
85
+
86
+ ark "foo_zip_strip" do
87
+ version "2"
88
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.zip'
89
+ checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
90
+ action :install
91
+ end
92
+
93
+ ark "haproxy" do
94
+ url "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
95
+ version "1.5"
96
+ checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
97
+ make_opts [ 'TARGET=linux26' ]
98
+ action :install_with_make
99
+ end unless platform?("freebsd")
100
+
101
+ ark "foo_alt_bin" do
102
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tar.gz'
103
+ checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
104
+ version '3'
105
+ prefix_root "/opt"
106
+ prefix_home "/opt"
107
+ prefix_bin "/opt/bin"
108
+ owner "foobarbaz"
109
+ group 'foobarbaz'
110
+ has_binaries [ 'bin/do_foo' ]
111
+ action :install
112
+ end
113
+
114
+ ark "foo_tbz" do
115
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tbz'
116
+ version '3'
117
+ end
118
+
119
+ ark "foo_tgz" do
120
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.tgz'
121
+ version '3'
122
+ end
123
+
124
+ ark "test notification" do
125
+ url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.zip'
126
+ path "/tmp/foobarbaz"
127
+ creates "foo1.txt"
128
+ action :dump
129
+ notifies :create, "ruby_block[test_notification]", :immediately
130
+ end
131
+
132
+ ark "test_autogen" do
133
+ url 'https://github.com/zeromq/libzmq/tarball/master'
134
+ extension "tar.gz"
135
+ action :configure
136
+ # autoconf in RHEL < 6 is too old
137
+ not_if { platform_family?('rhel') && node['platform_version'].to_f < 6.0 }
138
+ end