Module: Lanes::GuardTasks

Defined in:
lib/lanes/guard_tasks.rb

Defined Under Namespace

Classes: CustomMatchers

Class Method Summary collapse

Class Method Details

.run(dsl, options) {|matchers| ... } ⇒ Object

Yields:

  • (matchers)


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
# File 'lib/lanes/guard_tasks.rb', line 23

def self.run(dsl, options, &block)
    app_name = options[:name] || Pathname.getwd.basename.to_s
    matchers = CustomMatchers.new
    yield matchers

    config = client_config || ::Lanes::Command::Jest.new.configure.config

    jest_options = options.merge(
        logger: Lanes.logger,
        silent: false,
        jest_cmd: './node_modules/.bin/jest',
        config_file: config.directory.join('jest.config.json')
    )
    dsl.guard :jest, jest_options

    rspec_options = {
        all_on_start: false,
        cmd: 'bundle exec rspec'
    }
    dsl.guard :rspec, rspec_options do
#                dsl.watch(%r{^spec/server/spec_helper\.rb}) { 'spec' }
        dsl.watch(%r{^spec/server/.*_spec\.rb})
        # dsl.watch(%r{^spec/fixtures/#{app_name}/(.+)s\.yml})   { |m| "spec/server/#{m[1]}_spec.rb" }
        # dsl.watch(%r{^lib/#{app_name}/(.+)\.rb})               { |m| "spec/server/#{m[1]}_spec.rb" }
        # matchers.server_matches.call if matchers.server_matches
    end

    dsl.guard :reloadable_sinatra do
        dsl.watch(%r{^lib/.*\.rb})

    end
end