forked from sozialhelden/wheelmap-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
35 lines (28 loc) · 984 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
include Rake::DSL
begin
require "rspec/core/rake_task"
# Grab recently touched specs
def recent_specs(touched_since)
recent_specs = FileList['app/**/*'].map do |path|
if File.mtime(path) > touched_since
spec = File.join('spec', File.dirname(path).split("/")[1..-1].join('/'),
"#{File.basename(path, ".*")}_spec.rb")
spec if File.exists?(spec)
end
end.compact
recent_specs += FileList['spec/**/*_spec.rb'].select do |path|
File.mtime(path) > touched_since
end
recent_specs.uniq
end
desc 'Run recent specs'
RSpec::Core::RakeTask.new("spec:recent") do |t|
t.pattern = recent_specs(Time.now - 600) # 10 min.
end
rescue LoadError
end
Wheelmap::Application.load_tasks