stddtool 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stddtool.rb +21 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30cab6277282f2f1455de3c32054bffddc0802da
|
4
|
+
data.tar.gz: 4f60a317e4d2b2d5806f7e7ef394eb8ced0800b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ebc690eea466d533c47e5a221545c38764529b3f7acb2651988f04af2a1c1a4919ab9e06f3a4a9b2845033746d1ee18036c1e3617431db75192ed2f14425bf5
|
7
|
+
data.tar.gz: cd19cafedbed619513301a8e49c3d67e3d87886edfaea25403a6b42a88797cb67e9bb194f12c119a2c850324f165013ae4c5e1e5caec60321126128fd58cd03f
|
data/lib/stddtool.rb
CHANGED
@@ -6,15 +6,19 @@ require 'json'
|
|
6
6
|
class STDDTool
|
7
7
|
|
8
8
|
def initialize(step_mother, io, options)
|
9
|
-
@
|
10
|
-
@buildnr = Random.rand(500).to_s()
|
9
|
+
@buildnr = ENV['BUILD']
|
11
10
|
@url = ENV['URL']
|
11
|
+
@job = ENV['JOBNAME']
|
12
|
+
# Generate string as runId
|
13
|
+
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
14
|
+
@runID = (0...50).map{ o[rand(o.length)] }.join
|
15
|
+
puts @runID
|
12
16
|
puts "Initiating STDDTool formatter"
|
13
17
|
end
|
14
18
|
|
15
19
|
def before_feature(feature)
|
16
20
|
# puts feature.source_tag_names
|
17
|
-
featureObj=FeatureObj.new(@job,@buildnr,feature.title,feature.description,feature.file,feature.source_tag_names)
|
21
|
+
featureObj=FeatureObj.new(@job,@buildnr,feature.title,feature.description,feature.file,feature.source_tag_names,@runID)
|
18
22
|
postFeature(featureObj)
|
19
23
|
end
|
20
24
|
|
@@ -64,8 +68,18 @@ require 'json'
|
|
64
68
|
request.add_field('X-Auth-Token', '97f0ad9e24ca5e0408a269748d7fe0a0')
|
65
69
|
request.body = featureObj.to_json
|
66
70
|
response = http.request(request)
|
67
|
-
|
71
|
+
case response.code
|
72
|
+
when /20\d/
|
73
|
+
#success
|
74
|
+
else
|
75
|
+
puts response.body
|
76
|
+
exit
|
77
|
+
end
|
68
78
|
parsed = JSON.parse(response.body)
|
79
|
+
|
80
|
+
if parsed["error"]
|
81
|
+
puts parsed["error"]
|
82
|
+
end
|
69
83
|
@featureID = parsed["_id"]
|
70
84
|
|
71
85
|
end
|
@@ -96,13 +110,14 @@ require 'json'
|
|
96
110
|
end
|
97
111
|
|
98
112
|
class FeatureObj
|
99
|
-
def initialize(job,build,title,description,file,tags)
|
113
|
+
def initialize(job,build,title,description,file,tags,runId)
|
100
114
|
@id = title.downcase.gsub(' ', '-')
|
101
115
|
@job = job
|
102
116
|
@build = build
|
103
117
|
@feature_title=title
|
104
118
|
@feature_description = description
|
105
119
|
@feature_file = file
|
120
|
+
@runID = runId
|
106
121
|
|
107
122
|
tagArr = Array.new
|
108
123
|
tags.each do |tag|
|
@@ -117,6 +132,7 @@ class FeatureObj
|
|
117
132
|
'id' => @id,
|
118
133
|
'job' => @job,
|
119
134
|
'build' => @build,
|
135
|
+
'runID' => @runID,
|
120
136
|
'title' => @feature_title,
|
121
137
|
'description' => @feature_description ,
|
122
138
|
'file' => @feature_file,
|