Class: Scirocco::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/scirocco/cli.rb

Instance Method Summary collapse

Instance Method Details

#abort_allObject



61
62
63
64
# File 'lib/scirocco/cli.rb', line 61

def abort_all
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.abort_all
end

#abort_testObject



55
56
57
58
# File 'lib/scirocco/cli.rb', line 55

def abort_test
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.abort_test(options[:test_job_id])
end

#appsObject



99
100
101
102
# File 'lib/scirocco/cli.rb', line 99

def apps
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.apps(options[:project_id])
end

#check_testObject



48
49
50
51
# File 'lib/scirocco/cli.rb', line 48

def check_test
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.check_test(options[:test_job_id])
end

#devicesObject



74
75
76
77
# File 'lib/scirocco/cli.rb', line 74

def devices
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.devices(options[:project_id], options)
end

#get_device_idObject



87
88
89
90
91
92
93
94
95
# File 'lib/scirocco/cli.rb', line 87

def get_device_id
  client = Scirocco::Client.new(options[:api_key], options)
  devices = client.devices(options[:project_id], options)["devices"]
  if devices.length > 0
    p devices[0]["device_id"]
  else
    p ""
  end
end

#projectsObject



12
13
14
15
# File 'lib/scirocco/cli.rb', line 12

def projects
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.projects()
end

#run_testObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/scirocco/cli.rb', line 28

def run_test
  client = Scirocco::Client.new(options[:api_key], options)
  test_job = client.run_test(options[:test_class_id], options[:device_id])["test_job"]
  puts "* test_job:"
  pp test_job
  if options[:poll]
    test_status = client.poll_test_result(test_job["test_job_id"])
    if test_status["status"] == "passed"
      puts "**** PASSED ****"
      pp test_status
    elsif test_status["status"] == "failed"
      puts "**** FAILED ****"
      pp test_status
      raise SciroccoTestError.new(test_status["result"])
    end
  end
end

#testsObject



19
20
21
22
# File 'lib/scirocco/cli.rb', line 19

def tests
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.tests(options[:project_id])
end

#upload_appObject



107
108
109
110
# File 'lib/scirocco/cli.rb', line 107

def upload_app
  client = Scirocco::Client.new(options[:api_key], options)
  pp client.upload_app(options[:project_id], options[:app_path])
end