task/gemgem.rb in request-replay-0.6.3 vs task/gemgem.rb in request-replay-0.7.0
- old
+ new
@@ -142,24 +142,22 @@
def ignored_files
@ignored_files ||= all_files.grep(ignored_pattern)
end
def ignored_pattern
- @ignored_pattern ||= Regexp.new(expand_patterns(gitignore).join('|'))
+ @ignored_pattern ||= if gitignore.empty?
+ /^$/
+ else
+ Regexp.new(expand_patterns(gitignore).join('|'))
+ end
end
def expand_patterns pathes
# http://git-scm.com/docs/gitignore
pathes.flat_map{ |path|
- case path
- when %r{\*}
- Regexp.escape(path).gsub(/\\\*/, '[^/]*')
- when %r{^/}
- "^#{Regexp.escape(path[1..-1])}"
- else # we didn't implement negative pattern for now
- Regexp.escape(path)
- end
+ # we didn't implement negative pattern for now
+ Regexp.escape(path).sub(%r{^/}, '^').gsub(/\\\*/, '[^/]*')
}
end
def gitignore
@gitignore ||= if File.exist?(path = "#{dir}/.gitignore")
@@ -224,20 +222,20 @@
end
end
end # of gem namespace
-desc 'Run tests in memory'
+desc 'Run tests'
task :test do
next if Gemgem.test_files.empty?
require 'bacon'
Bacon.extend(Bacon::TestUnitOutput)
Bacon.summary_on_exit
Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
end
-desc 'Remove ignored files'
+desc 'Trash ignored files'
task :clean => ['gem:spec'] do
next if Gemgem.ignored_files.empty?
require 'fileutils'
trash = File.expand_path("~/.Trash/#{Gemgem.spec.name}")