Class: TestLauncher::Rubymine::Launcher

Inherits:
Object
  • Object
show all
Defined in:
lib/test_launcher/rubymine/launcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(args:, shell:, request:) ⇒ Launcher

Returns a new instance of Launcher.



10
11
12
13
14
# File 'lib/test_launcher/rubymine/launcher.rb', line 10

def initialize(args:, shell:, request:)
  @args = args
  @shell = shell
  @request = request
end

Instance Method Details

#launchObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/test_launcher/rubymine/launcher.rb', line 16

def launch
  if args.any? {|a| a.match("ruby-debug-ide")}
    shell.puts "test_launcher: hijacking and debugging"

    debug_command = (
      if args.first.match(/bash/)
        "cd #{test_case.app_root} && #{args.join(" ")}"
      else
        "cd #{test_case.app_root} && bundle exec ruby -I test #{args.join(" ")}"
      end
    )

    shell.puts debug_command
    shell.exec debug_command
  else
    shell.puts "test_launcher: hijacking and running:"
    shell.puts command

    shell.exec command
  end
end