-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile
56 lines (45 loc) · 1.47 KB
/
Guardfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# frozen_string_literal: true
guard :rspec, cmd: 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)
# RSpec files
watch(dsl.rspec.spec_helper) { dsl.rspec.spec_dir }
watch(dsl.rspec.spec_files)
# Ruby files
dsl.watch_spec_files_for(dsl.ruby.lib_files)
end
# # TODO: refactor the following into a new version of guard-mutant
# require 'mutant'
# require 'dry/inflector'
# require 'guard/compat/plugin'
# # NOTE: :: is mandatory for inline guards
# module ::Guard
# class Mutant < Plugin
# def initialize(options = {})
# opts = options.dup
# # @my_option = opts.delete(:my_special_option)
# super(opts) # important to call + avoid passing options Guard doesn't understand
# end
# # TODO: how would this make sense?
# # def run_all; end
# def run_on_modifications(paths)
# inflector = Dry::Inflector.new
# subjects = paths.map do |path|
# match = path.match(%r{(?:spec|lib)\/(.*?)(?:_spec)?.rb}).captures.first
# inflector.camelize match
# end
# succesful = ::Mutant::CLI.run(%w[--use rspec --fail-fast] + subjects)
# throw :task_has_failed unless succesful
# self
# end
# end
# end
# guard :mutant do
# require 'guard/rspec/dsl'
# dsl = Guard::RSpec::Dsl.new(self)
# # RSpec files
# # watch(dsl.rspec.spec_helper) { dsl.rspec.spec_dir }
# watch(dsl.rspec.spec_files)
# # Ruby files
# dsl.watch_spec_files_for(dsl.ruby.lib_files)
# end