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

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

Overview

rubocop:disable Legion/Extension/RunnerIncludeHelpers

Constant Summary

Constants included from Definitions

Definitions::DEFAULTS

Class Method Summary collapse

Methods included from Definitions

definition, definition_for, definitions

Class Method Details

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



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 38

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



61
62
63
64
65
66
67
68
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 61

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



24
25
26
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 24

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

.trigger_wordsObject



12
13
14
# File 'lib/legion/extensions/exec/runners/bundler.rb', line 12

def self.trigger_words
  %w[bundle bundler gem gems install rspec rubocop test lint]
end