Class: YSI::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/yes_ship_it/executor.rb

Instance Method Summary collapse

Instance Method Details

#http_delete(url) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/yes_ship_it/executor.rb', line 29

def http_delete(url)
  begin
    RestClient.delete(url)
  rescue RestClient::Exception => e
    raise YSI::AssertionError.new(e.message)
  end
end

#http_post(url, data) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/yes_ship_it/executor.rb', line 13

def http_post(url, data)
  begin
    RestClient.post(url, data)
  rescue RestClient::Exception => e
    raise YSI::AssertionError.new(e.message)
  end
end

#http_put(url, data, options) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/yes_ship_it/executor.rb', line 21

def http_put(url, data, options)
  begin
    RestClient.put(url, data, options)
  rescue RestClient::Exception => e
    raise YSI::AssertionError.new(e.message)
  end
end

#run_command(args, working_directory: Dir.pwd) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/yes_ship_it/executor.rb', line 3

def run_command(args, working_directory: Dir.pwd)
  begin
    Dir.chdir(working_directory) do
      Cheetah.run(args, stdout: :capture)
    end
  rescue Cheetah::ExecutionFailed => e
    raise YSI::AssertionError.new(e.message)
  end
end