Commit eb07a17d authored by Marius Rackwitz's avatar Marius Rackwitz Committed by Samuel E. Giddins

[Rakefile] Check fixture tarballs for pending changes

Before rebuilding tarballs or wiping changes by overwriting them by unpacking the files. This also ensures indirectly over the dependency from the spec tasks, that there will be never pending changes in the inner repo.
parent 5a69f7ce
......@@ -146,8 +146,18 @@ begin
namespace :fixture_tarballs do
task :default => :unpack
desc 'Check fixture tarballs for pending changes'
task :check_for_pending_changes do
repo_dir = 'spec/fixtures/banana-lib'
if Dir.exist?(repo_dir) && !Dir.chdir(repo_dir) { `git status --porcelain`.empty? }
puts red("[!] There are unsaved changes in '#{repo_dir}'. " \
'Please commit everything and run `rake spec:fixture_tarballs:rebuild`.')
exit 1
end
end
desc 'Rebuild all the fixture tarballs'
task :rebuild do
task :rebuild => :check_for_pending_changes do
tarballs = FileList['spec/fixtures/**/*.tar.gz']
tarballs.each do |tarball|
basename = File.basename(tarball)
......@@ -156,7 +166,13 @@ begin
end
desc 'Unpacks all the fixture tarballs'
task :unpack do
task :unpack, :force do |_t, args|
begin
Rake::Task['spec:fixture_tarballs:check_for_pending_changes'].invoke
rescue SystemExit
exit 1 unless args[:force]
puts 'Continue anyway because `force` was applied.'
end
tarballs = FileList['spec/fixtures/**/*.tar.gz']
tarballs.each do |tarball|
basename = File.basename(tarball)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment