poise-archive 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.kitchen.yml +3 -0
- data/.travis.yml +22 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +34 -0
- data/LICENSE +201 -0
- data/README.md +79 -0
- data/Rakefile +17 -0
- data/lib/poise_archive/archive_providers/base.rb +103 -0
- data/lib/poise_archive/archive_providers/tar.rb +121 -0
- data/lib/poise_archive/archive_providers/zip.rb +30 -0
- data/lib/poise_archive/archive_providers.rb +34 -0
- data/lib/poise_archive/cheftie.rb +18 -0
- data/lib/poise_archive/resources/poise_archive.rb +80 -0
- data/lib/poise_archive/resources.rb +26 -0
- data/lib/poise_archive/version.rb +20 -0
- data/lib/poise_archive.rb +21 -0
- data/poise-archive.gemspec +40 -0
- data/test/cookbook/files/myapp-1.0.0.tar +0 -0
- data/test/cookbook/files/myapp-1.0.0.tar.bz2 +0 -0
- data/test/cookbook/files/myapp-1.0.0.tar.gz +0 -0
- data/test/cookbook/files/myapp-1.0.0.zip +0 -0
- data/test/cookbook/metadata.rb +18 -0
- data/test/cookbook/recipes/default.rb +84 -0
- data/test/docker/docker.ca +29 -0
- data/test/docker/docker.pem +83 -0
- data/test/gemfiles/chef-12.1.gemfile +19 -0
- data/test/gemfiles/chef-12.2.gemfile +19 -0
- data/test/gemfiles/chef-12.3.gemfile +19 -0
- data/test/gemfiles/chef-12.4.gemfile +21 -0
- data/test/gemfiles/chef-12.5.gemfile +19 -0
- data/test/gemfiles/chef-12.6.gemfile +19 -0
- data/test/gemfiles/chef-12.gemfile +19 -0
- data/test/gemfiles/master.gemfile +25 -0
- data/test/integration/default/serverspec/default_spec.rb +66 -0
- data/test/spec/archive_providers/tar_spec.rb +134 -0
- data/test/spec/archive_providers/zip_spec.rb +32 -0
- data/test/spec/resources/poise_archive_spec.rb +87 -0
- data/test/spec/spec_helper.rb +19 -0
- metadata +148 -0
@@ -0,0 +1,121 @@
|
|
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 'fileutils'
|
18
|
+
require 'tmpdir'
|
19
|
+
|
20
|
+
require 'poise_archive/archive_providers/base'
|
21
|
+
|
22
|
+
|
23
|
+
module PoiseArchive
|
24
|
+
module ArchiveProviders
|
25
|
+
# The `tar` provider class for `poise_archive` to install from TAR archives.
|
26
|
+
#
|
27
|
+
# @see PoiseArchive::Resources::PoiseArchive::Resource
|
28
|
+
# @provides poise_archive
|
29
|
+
class Tar < Base
|
30
|
+
provides_extension(/\.t(ar|gz|bz|xz)/)
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def unpack_archive
|
35
|
+
notifying_block do
|
36
|
+
install_prereqs
|
37
|
+
end
|
38
|
+
unpack_tar
|
39
|
+
end
|
40
|
+
|
41
|
+
# Install any needed prereqs.
|
42
|
+
#
|
43
|
+
# @return [void]
|
44
|
+
def install_prereqs
|
45
|
+
# Various platforms that either already come with tar or that we don't
|
46
|
+
# want to try installing it on yet (read: Windows). This is mostly here
|
47
|
+
# for minimalist Linux container images, most normal Linux servers have
|
48
|
+
# all of these already.
|
49
|
+
return if node.platform_family?('windows', 'mac_os_x', 'aix', 'solaris2')
|
50
|
+
utils = ['tar']
|
51
|
+
utils << 'bzip2' if new_resource.path =~ /\.t?bz/
|
52
|
+
utils << 'xz-utils' if new_resource.path =~ /\.t?xz/
|
53
|
+
package utils
|
54
|
+
end
|
55
|
+
|
56
|
+
# Unpack the archive and process `strip_components`.
|
57
|
+
#
|
58
|
+
# @return [void]
|
59
|
+
def unpack_tar
|
60
|
+
# Build the tar command. -J for xz isn't going to work on non-GNU tar,
|
61
|
+
# cry me a river.
|
62
|
+
cmd = %w{tar}
|
63
|
+
cmd << if new_resource.path =~ /\.t?gz/
|
64
|
+
'-xzvf'
|
65
|
+
elsif new_resource.path =~ /\.t?bz/
|
66
|
+
'-xjvf'
|
67
|
+
elsif new_resource.path =~ /\.t?xz/
|
68
|
+
'-xJvf'
|
69
|
+
else
|
70
|
+
'-xvf'
|
71
|
+
end
|
72
|
+
cmd << new_resource.path
|
73
|
+
|
74
|
+
# Create a temp directory to unpack in to. Do I want to try and force
|
75
|
+
# this to be on the same filesystem as the target?
|
76
|
+
self.class.mktmpdir do |dir|
|
77
|
+
# Change the temp dir to be owned by the unpack user if needed.
|
78
|
+
FileUtils.chown(new_resource.user, new_resource.group, dir) if new_resource.user || new_resource.group
|
79
|
+
|
80
|
+
# Run the unpack into the temp dir.
|
81
|
+
poise_shell_out!(cmd, cwd: dir, group: new_resource.group, user: new_resource.user)
|
82
|
+
|
83
|
+
# Re-implementation of the logic for tar --strip-components because
|
84
|
+
# that option isn't part of non-GNU tar (read: Solaris and AIX).
|
85
|
+
entries_at_depth(dir, new_resource.strip_components).each do |source|
|
86
|
+
# At some point this might need to fall back to a real copy.
|
87
|
+
::File.rename(source, ::File.join(new_resource.absolute_destination, ::File.basename(source)))
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Find the absolute paths for entries under a path at a depth.
|
93
|
+
#
|
94
|
+
# @param path [String] Base path to search under.
|
95
|
+
# @param depth [Integer] Number of intermediary directories to skip.
|
96
|
+
# @return [Array<String>]
|
97
|
+
def entries_at_depth(path, depth)
|
98
|
+
entries = [path]
|
99
|
+
current_depth = 0
|
100
|
+
while current_depth <= depth
|
101
|
+
entries.map! do |ent|
|
102
|
+
if ::File.directory?(ent)
|
103
|
+
Dir.entries(ent).select {|e| e != '.' && e != '..' }.map {|e| ::File.join(ent, e) }
|
104
|
+
else
|
105
|
+
[]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
entries.flatten!
|
109
|
+
current_depth += 1
|
110
|
+
end
|
111
|
+
entries
|
112
|
+
end
|
113
|
+
|
114
|
+
# Indirection so I can stub this for testing without breaking RSpec.
|
115
|
+
def self.mktmpdir(*args, &block)
|
116
|
+
Dir.mktmpdir(*args, &block)
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,30 @@
|
|
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_archive/archive_providers/base'
|
18
|
+
|
19
|
+
|
20
|
+
module PoiseArchive
|
21
|
+
module ArchiveProviders
|
22
|
+
# The `zip` provider class for `poise_archive` to install from ZIP archives.
|
23
|
+
#
|
24
|
+
# @see PoiseArchive::Resources::PoiseArchive::Resource
|
25
|
+
# @provides poise_archive
|
26
|
+
class Zip < Base
|
27
|
+
provides_extension(/\.zip$/)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
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 'chef/platform/provider_priority_map'
|
18
|
+
|
19
|
+
require 'poise_archive/archive_providers/tar'
|
20
|
+
require 'poise_archive/archive_providers/zip'
|
21
|
+
|
22
|
+
|
23
|
+
module PoiseArchive
|
24
|
+
# Providers for the poise_archive resource.
|
25
|
+
#
|
26
|
+
# @since 1.0.0
|
27
|
+
module ArchiveProviders
|
28
|
+
# Set up priority maps
|
29
|
+
Chef::Platform::ProviderPriorityMap.instance.priority(:poise_archive, [
|
30
|
+
PoiseArchive::ArchiveProviders::Tar,
|
31
|
+
PoiseArchive::ArchiveProviders::Zip,
|
32
|
+
])
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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_archive/resources'
|
18
|
+
require 'poise_archive/archive_providers'
|
@@ -0,0 +1,80 @@
|
|
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 'chef/resource'
|
18
|
+
require 'poise'
|
19
|
+
|
20
|
+
|
21
|
+
module PoiseArchive
|
22
|
+
module Resources
|
23
|
+
# (see PoiseArchive::Resource)
|
24
|
+
# @since 1.0.0
|
25
|
+
module PoiseArchive
|
26
|
+
# A `poise_archive` resource to unpack archives.
|
27
|
+
#
|
28
|
+
# @provides poise_archive
|
29
|
+
# @action unpack
|
30
|
+
# @example
|
31
|
+
# poise_archive '/opt/myapp.tgz'
|
32
|
+
class Resource < Chef::Resource
|
33
|
+
include Poise
|
34
|
+
provides(:poise_archive)
|
35
|
+
actions(:unpack)
|
36
|
+
|
37
|
+
# @!attribute path
|
38
|
+
# Path to the archive. If relative, it is taken as a file inside
|
39
|
+
# `Chef::Config[:file_cache_path]`.
|
40
|
+
# @return [String]
|
41
|
+
attribute(:path, kind_of: String, name_attribute: true)
|
42
|
+
# @!attribute destination
|
43
|
+
# Path to unpack the archive to. If not specified, the path of the
|
44
|
+
# archive without the file extension is used.
|
45
|
+
# @return [String, nil, false]
|
46
|
+
attribute(:destination, kind_of: [String, NilClass, FalseClass])
|
47
|
+
# @!attribute group
|
48
|
+
# Group to run the unpack as.
|
49
|
+
# @return [String, Integer, nil, false]
|
50
|
+
attribute(:group, kind_of: [String, Integer, NilClass, FalseClass])
|
51
|
+
# @!attribute keep_existing
|
52
|
+
# Keep existing files in the destination directory when unpacking.
|
53
|
+
# @return [Boolean]
|
54
|
+
attribute(:keep_existing, equal_to: [true, false], default: false)
|
55
|
+
# @!attribute strip_components
|
56
|
+
# Number of intermediary directories to skip when unpacking. Works
|
57
|
+
# like GNU tar's --strip-components.
|
58
|
+
# @return [Integer]
|
59
|
+
attribute(:strip_components, kind_of: Integer, default: 1)
|
60
|
+
# @!attribute group
|
61
|
+
# User to run the unpack as.
|
62
|
+
# @return [String, Integer, nil, false]
|
63
|
+
attribute(:user, kind_of: [String, Integer, NilClass, FalseClass])
|
64
|
+
|
65
|
+
def absolute_path
|
66
|
+
::File.expand_path(path, Chef::Config[:file_cache_path])
|
67
|
+
end
|
68
|
+
|
69
|
+
def absolute_destination
|
70
|
+
destination || begin
|
71
|
+
basename = ::File.basename(path)
|
72
|
+
::File.join(::File.dirname(absolute_path), basename.split(/\./).find {|part| !part.empty? } || basename)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Providers can be found in archive_providers/.
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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_archive/resources/poise_archive'
|
18
|
+
|
19
|
+
|
20
|
+
module PoiseArchive
|
21
|
+
# Chef resources and providers for poise-archive.
|
22
|
+
#
|
23
|
+
# @since 1.0.0
|
24
|
+
module Resources
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
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
|
+
|
18
|
+
module PoiseArchive
|
19
|
+
VERSION = '1.0.0'
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
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
|
+
|
18
|
+
module PoiseArchive
|
19
|
+
autoload :Resources, 'poise_archive/resources'
|
20
|
+
autoload :VERSION, 'poise_archive/version'
|
21
|
+
end
|
@@ -0,0 +1,40 @@
|
|
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
|
+
lib = File.expand_path('../lib', __FILE__)
|
18
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
19
|
+
require 'poise_archive/version'
|
20
|
+
|
21
|
+
Gem::Specification.new do |spec|
|
22
|
+
spec.name = 'poise-archive'
|
23
|
+
spec.version = PoiseArchive::VERSION
|
24
|
+
spec.authors = ['Noah Kantrowitz']
|
25
|
+
spec.email = %w{noah@coderanger.net}
|
26
|
+
spec.description = 'A Chef cookbook for unpacking file archives like tar and zip.'
|
27
|
+
spec.summary = spec.description
|
28
|
+
spec.homepage = 'https://github.com/poise/poise-archive'
|
29
|
+
spec.license = 'Apache 2.0'
|
30
|
+
|
31
|
+
spec.files = `git ls-files`.split($/)
|
32
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
33
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
34
|
+
spec.require_paths = %w{lib}
|
35
|
+
|
36
|
+
spec.add_dependency 'halite', '~> 1.2'
|
37
|
+
spec.add_dependency 'poise', '~> 2.6'
|
38
|
+
|
39
|
+
spec.add_development_dependency 'poise-boiler', '~> 1.7'
|
40
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,18 @@
|
|
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
|
+
name 'poise-archive_test'
|
18
|
+
depends 'poise-archive'
|
@@ -0,0 +1,84 @@
|
|
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
|
+
# Holding directory for fixtures.
|
18
|
+
directory '/test' do
|
19
|
+
mode '777'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Tests for each fixture file.
|
23
|
+
%w{tar tar.gz tar.bz2}.each do |ext|
|
24
|
+
cookbook_file "/test/myapp-1.0.0.#{ext}" do
|
25
|
+
source "myapp-1.0.0.#{ext}"
|
26
|
+
end
|
27
|
+
|
28
|
+
poise_archive "/test/myapp-1.0.0.#{ext}" do
|
29
|
+
destination "/test/#{ext}"
|
30
|
+
end
|
31
|
+
|
32
|
+
poise_archive "/test/myapp-1.0.0.#{ext}_0" do
|
33
|
+
path "/test/myapp-1.0.0.#{ext}"
|
34
|
+
destination "/test/#{ext}_0"
|
35
|
+
strip_components 0
|
36
|
+
end
|
37
|
+
|
38
|
+
poise_archive "/test/myapp-1.0.0.#{ext}_2" do
|
39
|
+
path "/test/myapp-1.0.0.#{ext}"
|
40
|
+
destination "/test/#{ext}_2"
|
41
|
+
strip_components 2
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Some general tests for core features.
|
46
|
+
# Test user-specific unpacking.
|
47
|
+
group 'poise' do
|
48
|
+
system true
|
49
|
+
end
|
50
|
+
|
51
|
+
user 'poise' do
|
52
|
+
group 'poise'
|
53
|
+
system true
|
54
|
+
end
|
55
|
+
|
56
|
+
directory '/test/user' do
|
57
|
+
group 'poise'
|
58
|
+
mode '700'
|
59
|
+
owner 'poise'
|
60
|
+
end
|
61
|
+
|
62
|
+
poise_archive '/test/myapp-1.0.0.tar' do
|
63
|
+
destination '/test/user'
|
64
|
+
user 'poise'
|
65
|
+
end
|
66
|
+
|
67
|
+
# Test keep_existing true.
|
68
|
+
directory '/test/keep'
|
69
|
+
|
70
|
+
file '/test/keep/EXISTING'
|
71
|
+
|
72
|
+
poise_archive '/test/myapp-1.0.0.tar' do
|
73
|
+
destination '/test/keep'
|
74
|
+
keep_existing true
|
75
|
+
end
|
76
|
+
|
77
|
+
# Test keep_existing false.
|
78
|
+
directory '/test/existing'
|
79
|
+
|
80
|
+
file '/test/existing/EXISTING'
|
81
|
+
|
82
|
+
poise_archive '/test/myapp-1.0.0.tar' do
|
83
|
+
destination '/test/existing'
|
84
|
+
end
|