Class: Gotsha::Actions::Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/gotsha/actions/configure.rb

Constant Summary collapse

DESCRIPTION =
"opens Gotsha config (all your tests and their autorun conditions are configured there)"

Instance Method Summary collapse

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gotsha/actions/configure.rb', line 8

def call
  editor = ENV["EDITOR"]

  if editor.to_s.empty?
    raise(Errors::HardFail,
          "could not open config file automatically, ENV " \
          "variable `EDITOR` not set.\n\nPlease, open file" \
          "`#{Config::CONFIG_FILE}` manually.")
  end

  if Kernel.system("#{editor} #{Config::CONFIG_FILE}")
    "done"
  else
    raise Errors::HardFail,
          "something went wrong, please check whether `#{editor}` editor (set in ENV variable `EDITOR`) works"
  end
end