poise-archive 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.kitchen.yml +3 -0
  4. data/.travis.yml +22 -0
  5. data/.yardopts +7 -0
  6. data/CHANGELOG.md +5 -0
  7. data/Gemfile +34 -0
  8. data/LICENSE +201 -0
  9. data/README.md +79 -0
  10. data/Rakefile +17 -0
  11. data/lib/poise_archive/archive_providers/base.rb +103 -0
  12. data/lib/poise_archive/archive_providers/tar.rb +121 -0
  13. data/lib/poise_archive/archive_providers/zip.rb +30 -0
  14. data/lib/poise_archive/archive_providers.rb +34 -0
  15. data/lib/poise_archive/cheftie.rb +18 -0
  16. data/lib/poise_archive/resources/poise_archive.rb +80 -0
  17. data/lib/poise_archive/resources.rb +26 -0
  18. data/lib/poise_archive/version.rb +20 -0
  19. data/lib/poise_archive.rb +21 -0
  20. data/poise-archive.gemspec +40 -0
  21. data/test/cookbook/files/myapp-1.0.0.tar +0 -0
  22. data/test/cookbook/files/myapp-1.0.0.tar.bz2 +0 -0
  23. data/test/cookbook/files/myapp-1.0.0.tar.gz +0 -0
  24. data/test/cookbook/files/myapp-1.0.0.zip +0 -0
  25. data/test/cookbook/metadata.rb +18 -0
  26. data/test/cookbook/recipes/default.rb +84 -0
  27. data/test/docker/docker.ca +29 -0
  28. data/test/docker/docker.pem +83 -0
  29. data/test/gemfiles/chef-12.1.gemfile +19 -0
  30. data/test/gemfiles/chef-12.2.gemfile +19 -0
  31. data/test/gemfiles/chef-12.3.gemfile +19 -0
  32. data/test/gemfiles/chef-12.4.gemfile +21 -0
  33. data/test/gemfiles/chef-12.5.gemfile +19 -0
  34. data/test/gemfiles/chef-12.6.gemfile +19 -0
  35. data/test/gemfiles/chef-12.gemfile +19 -0
  36. data/test/gemfiles/master.gemfile +25 -0
  37. data/test/integration/default/serverspec/default_spec.rb +66 -0
  38. data/test/spec/archive_providers/tar_spec.rb +134 -0
  39. data/test/spec/archive_providers/zip_spec.rb +32 -0
  40. data/test/spec/resources/poise_archive_spec.rb +87 -0
  41. data/test/spec/spec_helper.rb +19 -0
  42. metadata +148 -0
@@ -0,0 +1,32 @@
1
+ #
2
+ # Copyright 2016, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe PoiseArchive::ArchiveProviders::Zip do
20
+ # step_into(:poise_archive)
21
+ let(:archive_provider) { chef_run.poise_archive('myapp').provider_for_action(:unpack) }
22
+
23
+ context 'with a .zip path' do
24
+ recipe do
25
+ poise_archive 'myapp' do
26
+ path 'myapp.zip'
27
+ end
28
+ end
29
+
30
+ it { expect(archive_provider).to be_a described_class }
31
+ end # /context with a .zip path
32
+ end
@@ -0,0 +1,87 @@
1
+ #
2
+ # Copyright 2016, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'spec_helper'
18
+
19
+ describe PoiseArchive::Resources::PoiseArchive do
20
+ context 'an absolute path' do
21
+ context 'an implicit destination' do
22
+ recipe do
23
+ poise_archive '/tmp/myapp.tar'
24
+ end
25
+
26
+ it { is_expected.to unpack_poise_archive('/tmp/myapp.tar').with(absolute_path: '/tmp/myapp.tar', absolute_destination: '/tmp/myapp') }
27
+ end # /context an implicit destination
28
+
29
+ context 'an explicit destination' do
30
+ recipe do
31
+ poise_archive '/tmp/myapp.tar' do
32
+ destination '/opt/myapp'
33
+ end
34
+ end
35
+
36
+ it { is_expected.to unpack_poise_archive('/tmp/myapp.tar').with(absolute_path: '/tmp/myapp.tar', absolute_destination: '/opt/myapp') }
37
+ end # /context an explicit destination
38
+ end # /context an absolute path
39
+
40
+ context 'a relative path' do
41
+ # Backup and restore the cache path.
42
+ around do |ex|
43
+ begin
44
+ old_cache_path = Chef::Config[:file_cache_path]
45
+ ex.run
46
+ ensure
47
+ Chef::Config[:file_cache_path] = old_cache_path
48
+ end
49
+ end
50
+
51
+ context 'an implicit destination' do
52
+ recipe do
53
+ Chef::Config[:file_cache_path] = '/var/chef/cache'
54
+ poise_archive 'myapp.tar'
55
+ end
56
+
57
+ it { is_expected.to unpack_poise_archive('myapp.tar').with(absolute_path: '/var/chef/cache/myapp.tar', absolute_destination: '/var/chef/cache/myapp') }
58
+ end # /context an implicit destination
59
+
60
+ context 'an explicit destination' do
61
+ recipe do
62
+ Chef::Config[:file_cache_path] = '/var/chef/cache'
63
+ poise_archive 'myapp.tar' do
64
+ destination '/opt/myapp'
65
+ end
66
+ end
67
+
68
+ it { is_expected.to unpack_poise_archive('myapp.tar').with(absolute_path: '/var/chef/cache/myapp.tar', absolute_destination: '/opt/myapp') }
69
+ end # /context an explicit destination
70
+ end # /context a relative path
71
+
72
+ context 'with a two-extension path' do
73
+ recipe do
74
+ poise_archive '/tmp/myapp.tar.gz'
75
+ end
76
+
77
+ it { is_expected.to unpack_poise_archive('/tmp/myapp.tar.gz').with(absolute_path: '/tmp/myapp.tar.gz', absolute_destination: '/tmp/myapp') }
78
+ end # /context with a two-extension path
79
+
80
+ context 'with a hidden file' do
81
+ recipe do
82
+ poise_archive '/tmp/.myapp.tar'
83
+ end
84
+
85
+ it { is_expected.to unpack_poise_archive('/tmp/.myapp.tar').with(absolute_path: '/tmp/.myapp.tar', absolute_destination: '/tmp/myapp') }
86
+ end # /context with a hidden file
87
+ end
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright 2016, Noah Kantrowitz
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'poise_boiler/spec_helper'
18
+ require 'poise_archive'
19
+ require 'poise_archive/cheftie'
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: poise-archive
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Noah Kantrowitz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: halite
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: poise
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: poise-boiler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.7'
55
+ description: A Chef cookbook for unpacking file archives like tar and zip.
56
+ email:
57
+ - noah@coderanger.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".kitchen.yml"
64
+ - ".travis.yml"
65
+ - ".yardopts"
66
+ - CHANGELOG.md
67
+ - Gemfile
68
+ - LICENSE
69
+ - README.md
70
+ - Rakefile
71
+ - lib/poise_archive.rb
72
+ - lib/poise_archive/archive_providers.rb
73
+ - lib/poise_archive/archive_providers/base.rb
74
+ - lib/poise_archive/archive_providers/tar.rb
75
+ - lib/poise_archive/archive_providers/zip.rb
76
+ - lib/poise_archive/cheftie.rb
77
+ - lib/poise_archive/resources.rb
78
+ - lib/poise_archive/resources/poise_archive.rb
79
+ - lib/poise_archive/version.rb
80
+ - poise-archive.gemspec
81
+ - test/cookbook/files/myapp-1.0.0.tar
82
+ - test/cookbook/files/myapp-1.0.0.tar.bz2
83
+ - test/cookbook/files/myapp-1.0.0.tar.gz
84
+ - test/cookbook/files/myapp-1.0.0.zip
85
+ - test/cookbook/metadata.rb
86
+ - test/cookbook/recipes/default.rb
87
+ - test/docker/docker.ca
88
+ - test/docker/docker.pem
89
+ - test/gemfiles/chef-12.1.gemfile
90
+ - test/gemfiles/chef-12.2.gemfile
91
+ - test/gemfiles/chef-12.3.gemfile
92
+ - test/gemfiles/chef-12.4.gemfile
93
+ - test/gemfiles/chef-12.5.gemfile
94
+ - test/gemfiles/chef-12.6.gemfile
95
+ - test/gemfiles/chef-12.gemfile
96
+ - test/gemfiles/master.gemfile
97
+ - test/integration/default/serverspec/default_spec.rb
98
+ - test/spec/archive_providers/tar_spec.rb
99
+ - test/spec/archive_providers/zip_spec.rb
100
+ - test/spec/resources/poise_archive_spec.rb
101
+ - test/spec/spec_helper.rb
102
+ homepage: https://github.com/poise/poise-archive
103
+ licenses:
104
+ - Apache 2.0
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubyforge_project:
122
+ rubygems_version: 2.6.2
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: A Chef cookbook for unpacking file archives like tar and zip.
126
+ test_files:
127
+ - test/cookbook/files/myapp-1.0.0.tar
128
+ - test/cookbook/files/myapp-1.0.0.tar.bz2
129
+ - test/cookbook/files/myapp-1.0.0.tar.gz
130
+ - test/cookbook/files/myapp-1.0.0.zip
131
+ - test/cookbook/metadata.rb
132
+ - test/cookbook/recipes/default.rb
133
+ - test/docker/docker.ca
134
+ - test/docker/docker.pem
135
+ - test/gemfiles/chef-12.1.gemfile
136
+ - test/gemfiles/chef-12.2.gemfile
137
+ - test/gemfiles/chef-12.3.gemfile
138
+ - test/gemfiles/chef-12.4.gemfile
139
+ - test/gemfiles/chef-12.5.gemfile
140
+ - test/gemfiles/chef-12.6.gemfile
141
+ - test/gemfiles/chef-12.gemfile
142
+ - test/gemfiles/master.gemfile
143
+ - test/integration/default/serverspec/default_spec.rb
144
+ - test/spec/archive_providers/tar_spec.rb
145
+ - test/spec/archive_providers/zip_spec.rb
146
+ - test/spec/resources/poise_archive_spec.rb
147
+ - test/spec/spec_helper.rb
148
+ has_rdoc: