Module: Legion::Extensions::Exec::Runners::Bundler

Defined in:
lib/legion/extensions/exec/runners/bundler.rb

Overview

rubocop:disable Legion/Extension/RunnerIncludeHelpers

Class Method Summary collapse

Class Method Details

.exec_rspec(path:, format: 'progress') ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 14

def exec_rspec(path:, format: 'progress', **)
  result = Runners::Shell.execute(
    command: "bundle exec rspec --format #{format}",
    cwd:     path,
    timeout: 300_000
  )
  return result unless result[:stdout] || result[:stderr] # rubocop:disable Legion/Extension/RunnerReturnHash

  raw     = result[:stdout] || result[:stderr] || ''
  parsed  = Helpers::ResultParser.parse_rspec(raw)
  result.merge(parsed: parsed)
end

.exec_rubocop(path:, autocorrect: false) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 27

def exec_rubocop(path:, autocorrect: false, **)
  cmd    = autocorrect ? 'bundle exec rubocop -A' : 'bundle exec rubocop'
  result = Runners::Shell.execute(command: cmd, cwd: path, timeout: 120_000)
  return result unless result[:stdout] # rubocop:disable Legion/Extension/RunnerReturnHash

  parsed = Helpers::ResultParser.parse_rubocop(result[:stdout] || '')
  result.merge(parsed: parsed)
end

.install(path:) ⇒ Object



10
11
12
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 10

def install(path:, **)
  Runners::Shell.execute(command: 'bundle install', cwd: path, timeout: 300_000)
end