TagPurgeAction - removes all tags not matching any spec descriptions.
Saves any matching tags
# File lib/mspec/runner/actions/tagpurge.rb, line 29 def after(state) @matching << state.description if self === state.description end
Creates a MatchFilter for all tags.
# File lib/mspec/runner/actions/tagpurge.rb, line 21 def load @filter = nil @tags = MSpec.read_tags self desc = @tags.map { |t| t.description } @filter = MatchFilter.new(nil, *desc) unless desc.empty? end
# File lib/mspec/runner/actions/tagpurge.rb, line 47 def register super MSpec.register :unload, self end
Prints a banner about purging tags.
# File lib/mspec/runner/actions/tagpurge.rb, line 16 def start print "\nRemoving tags not matching any specs\n\n" end
Rewrites any matching tags. Prints non-matching tags. Deletes the tag file if there were no tags (this cleans up empty or malformed tag files).
# File lib/mspec/runner/actions/tagpurge.rb, line 36 def unload if @filter matched = @tags.select { |t| @matching.any? { |s| s == t.description } } MSpec.write_tags matched (@tags - matched).each { |t| print t.description, "\n" } else MSpec.delete_tags end end
Generated with the Darkfish Rdoc Generator 2.