Skip to content

Commit

Permalink
Merge pull request #155 from terkill/master
Browse files Browse the repository at this point in the history
Create seven_zip unpack command when strip_components is 0
  • Loading branch information
tas50 committed Jul 3, 2016
2 parents c99b77b + ba8bd06 commit 6c0d801
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions libraries/sevenzip_command_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def initialize(resource)

def sevenzip_command
if resource.strip_components <= 0
sevenzip_command_builder(resource.path, 'x')
return
return sevenzip_command_builder(resource.path, 'x')
end

tmpdir = make_temp_directory
Expand Down
10 changes: 10 additions & 0 deletions spec/libraries/sevenzip_command_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,14 @@
expect(subject.cherry_pick).to eq(expected_command)
end
end

context 'strip_components == 0' do
describe '#unpack' do
it 'generates the correct command' do
allow(resource).to receive(:strip_components).and_return(0)
expected_command = '"C:\\Program Files\\7-zip\\7z.exe" x "release_file" -so | "C:\\Program Files\\7-zip\\7z.exe" x -aoa -si -ttar -o"path" -uy'
expect(subject.unpack).to eq(expected_command)
end
end
end
end

0 comments on commit 6c0d801

Please sign in to comment.