Sha256: 82b3d1ed3c53e0c7deb56bbde8153535e7fb99a15952023ff6244d0f42680ec5
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
#!/usr/bin/env ruby require 'fssm' def run_all_specs specs = Dir['**/*_spec*'].select { |f| File.file?(f) }.map do |x| File.expand_path(x) end run_these_specs specs end def run_these_specs specs requires = specs.map { |x| "require '#{x}'" }.join("\n") puts `ruby -e "#{requires}"` end def add_it(file, files) return if relative.index('.git') == 0 files << file end def run_it(file, files) filename = file.downcase.split('/')[-1].gsub('_spec', '') matches = files.select { |x| x.gsub('_spec', '').include?(filename) && x != file } matches << file specs = matches.select! { |x| x.include?('_spec') }.map { |x| File.expand_path x } puts specs.inspect run_these_specs specs end def delete_it(file, files) files.delete(file) end if ARGV.include? '--watch' files = Dir['**/*'] location = File.expand_path(File.dirname(Dir['**/*_spec*'].first)) FSSM.monitor(location, '**/*') do update {|base, relative| run_it relative, files } delete {|base, relative| delete_it relative, files } create {|base, relative| add_it relative, files } end else run_all_specs end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
starting_blocks-0.0.1 | bin/sb |