smqacloud 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/smqacloud.rb +38 -49
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e8a2482e93c98a196c80115066666971357b0c1
4
- data.tar.gz: 1d9e73797bbf9e2273a83d33a5de21eead9a4586
3
+ metadata.gz: ec7e98aa45de0626e486e79d59f90cbf83c8c22a
4
+ data.tar.gz: 548f14a9f4c4b2cfd419be4060c93c1e54e647b2
5
5
  SHA512:
6
- metadata.gz: 7e156a6d2e312da63e5829c33001f6d3130dbecefef4202244042e9622771bec040e7ceeeb8f05f27cafe9c98bed60c16d0f82544ba7dab4b7d32c35db12d7f1
7
- data.tar.gz: 8017e14486a92605eabdffe2f2823d1f5a2a1cb0c106fdfd00a84cf8f3d3b3cb6db0708b4bb4eb2b756854ea63c6c3a3f7024b3689f6d1d6af7209cfb7bdeb25
6
+ metadata.gz: dad6cf6415d5976ff672b45022ef56a6d70d1ca4c44cdebcebd365ddb19d8317c7fcf249304be6e03a4455944316c2ab46986a16e7f6419e2de2c8e3047e3267
7
+ data.tar.gz: dd72802e7d65dbdd7d21844f56f728675b800b7c9015fcc06c3cf599824425b7e73db35987791068efdca84f23c7d1093aa5539f9261567792a83ec7b4a55f28
data/lib/smqacloud.rb CHANGED
@@ -1,31 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'rubygems'
3
3
  require 'httparty'
4
- require 'qacloud'
5
4
  require 'smapisatqacloud'
6
- # require 'watir-webdriver'
5
+ require 'watir-webdriver'
7
6
 
8
- # get playlistID or playlistID CI id from args::
9
7
 
10
- # playlistID = ARGV[0]
11
- # = "your token id"
12
- # $add_variable = Hash.new
13
8
  $fullTaskName = nil
9
+ @found = false
14
10
 
15
- def self.req_all_scripts(path)
16
- Dir.log("#{path}/**/*.rb") do |req_all|
17
- require_relative req_all
18
- end
19
- end
20
11
 
21
- def self.get_file_full_path(taskname)
22
- Dir.log("#{path}/**/*.rb") do |rb_file|
12
+ def self.get_file_full_path(path,taskname)
13
+ Dir.glob("#{path}/**/*.rb") do |rb_file|
23
14
  filename = File.basename(rb_file,File.extname(rb_file))
24
15
  if filename == taskname then
25
16
  $fullTaskName = rb_file
26
- puts $fullTaskName
27
- end
28
- end
17
+ @found = true
18
+ end
19
+ end
20
+ if @found == false then
21
+ puts "\e[31m Script file for #{taskname} not found under path given in environment. \e[0m"
22
+ exit
23
+ else
24
+ @found = false
25
+ end
29
26
  end
30
27
 
31
28
  def self.playlist(playlistID)
@@ -46,30 +43,23 @@ $add_variable = Hash.new
46
43
  task_id = taskhash["body"]["task_id"]
47
44
  $var = taskhash["body"]["task_variables"]
48
45
  $env = taskhash["body"]["environment"]
49
- puts "\e[1mWorkflow:\e[0m #{$workflow_name}"
46
+ puts "\e[1mWorkflow:\e[0m \e[32m#{$workflow_name}\e[0m"
50
47
  $workflow_status = taskhash["body"]["test"]
51
- puts "\e[1mNow Starting Task:\e[0m #{$task_name}"
48
+ puts "\e[1mNow Starting Task:\e[0m \e[32m#{$task_name}\e[0m"
52
49
 
53
50
  begin
54
51
 
55
- if $var.has_key?("path") == true then
56
- if $var["path"].empty? == false then
57
- path = $var["path"]
58
- end
59
- else
60
- path = $env["path"]
61
- end
62
- req_all_scripts(path)
63
52
  dur1 = Time.now
64
- taskName = $task_name
65
- get_file_full_path(taskName)
66
- task_to_load = $fullTaskName
67
- load "#{task_to_load}"
68
- # send($task_name)
53
+ get_file_full_path($env["path"],$task_name)
54
+ begin
55
+ load "#{$fullTaskName}"
56
+ rescue => e
57
+ puts e
58
+ end
69
59
 
70
60
  rescue Exception => e
71
61
 
72
- puts "\e[31Exception occured, Checkpoint should have more info.\e[0m"
62
+ puts "\e[31mException occured, Checkpoint should have more info.\e[0m"
73
63
  @erro_line = e.backtrace[0].split(":")
74
64
  @error_line = @erro_line[1]
75
65
  @error_message = "#{$!}"
@@ -113,26 +103,25 @@ $add_variable = Hash.new
113
103
  # else
114
104
  # $get_variable.merge!($add_variable)
115
105
  # end
116
- puts "\e[1mWorkflow:\e[0m #{$workflow_name}"
117
- puts "\e[1mNow Starting Task:\e[0m #{$task_name}"
106
+ puts "\e[1mWorkflow:\e[0m \e[32m#{$workflow_name}\e[0m"
107
+ # $workflow_status = taskhash["body"]["test"]
108
+ puts "\e[1mNow Starting Task:\e[0m \e[32m#{$task_name}\e[0m"
118
109
  begin
119
- if $var.has_key?("path") == true then
120
- if $var["path"].empty? == false then
121
- path = $var["path"]
122
- end
123
- else
124
- path = $env["path"]
125
- end
126
- req_all_scripts(path)
127
- dur1 = Time.now
128
- taskName = $task_name
129
- get_file_full_path(taskName)
130
- task_to_load = $fullTaskName
131
- load "#{task_to_load}"
132
- # send($task_name)
110
+
111
+ dur1 = Time.now
112
+ begin
113
+ get_file_full_path($env["path"],$task_name)
114
+ rescue => e
115
+ puts e
116
+ end
117
+ begin
118
+ load "#{$fullTaskName}"
119
+ rescue => e
120
+ puts e
121
+ end
133
122
 
134
123
  rescue Exception => e
135
- puts "\e[31Exception occured, Checkpoint should have more info.\e[0m"
124
+ puts "\e[31mException occured, Checkpoint should have more info.\e[0m"
136
125
  @erro_line = e.backtrace[0].split(":")
137
126
  @error_line = @erro_line[1]
138
127
  @error_message = "#{$!}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smqacloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ravi Trivedi