Sha256: db64530c052cbb99f83e17ea55d9bbb680641c4e6d2c920f1728522114ab31e9

Contents?: true

Size: 1.09 KB

Versions: 340

Compression:

Stored size: 1.09 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
    expect(Dir).to receive(:chdir).with(File.expand_path(destdir)).and_yield
    expect(Puppet::Util::Execution).to receive(:execute).with("gzip -dc #{Shellwords.shellescape(File.expand_path(sourcefile))} | tar xof -")
    expect(Puppet::Util::Execution).to receive(:execute).with("find . -type d -exec chmod 755 {} +")
    expect(Puppet::Util::Execution).to receive(:execute).with("find . -type f -exec chmod u+rw,g+r,a-st {} +")
    expect(Puppet::Util::Execution).to receive(:execute).with("chown -R <owner:group> .")
    subject.unpack(sourcefile, destdir, '<owner:group>')
  end

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

Version data entries

340 entries across 340 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.4.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.4.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.28.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.28.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.1 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-8.3.1-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.27.0 spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/module_tool/tar/gnu_spec.rb
puppet-7.27.0-universal-darwin spec/unit/module_tool/tar/gnu_spec.rb