Skip to content
Browse files

Add appraisal:cleanup task to cleanup the generated gemfiles

  • Loading branch information...
1 parent 76f8059 commit fda896d7b612c5b826d6357ca31e44904c69e2e9 @sikachu sikachu committed May 29, 2011
Showing with 14 additions and 0 deletions.
  1. +8 −0 features/appraisals.feature
  2. +6 −0 lib/appraisal/task.rb
View
8 features/appraisals.feature
@@ -74,3 +74,11 @@ Feature: run a rake task through several appraisals
But the output should not contain "Fail 1.3.0"
And the exit status should be 1
+ @disable-bundler
+ Scenario: run a cleanup task
+ When I run `bundle exec rake appraisal:cleanup --trace`
+ Then a file named "gemfiles/1.3.0.gemfile" should not exist
+ And a file named "gemfiles/1.3.0.gemfile.lock" should not exist
+ And a file named "gemfiles/1.3.2.gemfile" should not exist
+ And a file named "gemfiles/1.3.2.gemfile.lock" should not exist
+
View
6 lib/appraisal/task.rb
@@ -21,6 +21,12 @@ def initialize
end
end
+ desc "Remove all generated gemfiles from gemfiles/ folder"
+ task :cleanup do
+ require 'fileutils'
+ FileUtils.rm_f Dir['gemfiles/*.{gemfile,gemfile.lock}']
+ end
+
File.each do |appraisal|
desc "Run the given task for appraisal #{appraisal.name}"
task appraisal.name do

0 comments on commit fda896d

Please sign in to comment.
Something went wrong with that request. Please try again.