Sha256: 878a56fa64fce0c8b42cb25b166f82022b80c9b0a8c6596b40ad9c2c5bf71225

Contents?: true

Size: 1.03 KB

Versions: 278

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
require 'puppet/module_tool'

describe Puppet::ModuleTool::Tar::Gnu do
  let(:sourcefile) { '/space path/the/module.tar.gz' }
  let(:destdir)    { '/space path/the/dest/dir' }
  let(:sourcedir)  { '/space path/the/src/dir' }
  let(:destfile)   { '/space path/the/dest/file.tar.gz' }

  it "unpacks a tar file" do
    Dir.expects(:chdir).with(File.expand_path(destdir)).yields(mock)
    Puppet::Util::Execution.expects(:execute).with("gzip -dc #{Shellwords.shellescape(File.expand_path(sourcefile))} | tar xof -")
    Puppet::Util::Execution.expects(:execute).with("find . -type d -exec chmod 755 {} +")
    Puppet::Util::Execution.expects(:execute).with("find . -type f -exec chmod u+rw,g+r,a-st {} +")
    Puppet::Util::Execution.expects(:execute).with("chown -R <owner:group> .")
    subject.unpack(sourcefile, destdir, '<owner:group>')
  end

  it "packs a tar file" do
    Puppet::Util::Execution.expects(:execute).with("tar cf - #{sourcedir} | gzip -c > #{File.basename(destfile)}")
    subject.pack(sourcedir, destfile)
  end
end

Version data entries

278 entries across 278 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.4.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.0.7 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.0.7-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-5.5.12 spec/unit/module_tool/tar/gnu_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-5.5.12-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.3.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.3.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.2.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-6.2.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb