zephyr_client 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +51 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +6 -0
- data/bin/config.json +10 -0
- data/bin/zc.rb +58 -0
- data/lib/zephyr_client.rb +12 -4
- data/lib/zephyr_client/base/client.rb +225 -0
- data/lib/zephyr_client/base/http_client.rb +27 -0
- data/lib/zephyr_client/base/q_response.rb +36 -0
- data/lib/zephyr_client/utils/utils.rb +91 -0
- data/lib/zephyr_client/version.rb +3 -0
- data/zephyr_client.gemspec +37 -0
- metadata +78 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f930397a3c988e0d19ad8b2ac9f12d193a2b72f7
|
4
|
+
data.tar.gz: 6009dfd571e24c8dde585648b43ba428e3109d8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2bda3558d1e450ab086134c37d473cf3dbc88ce4c677b4c45d62453049f39bab2a0a1f10c69ebe67e2ac625bc9409cac4ae6d5542d38e01c480cb35cb0613e1
|
7
|
+
data.tar.gz: 987c3614e24a84000f058ce56cdbb9e17323d5ce9bae4585f7eeb02fad4eb24e20d75fc23be603c86e4e40851930338e98276895da8e4249fd5b8a7ac5ec206f
|
data/.gitignore
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/private
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
## Specific to RubyMotion:
|
18
|
+
.dat*
|
19
|
+
.repl_history
|
20
|
+
build/
|
21
|
+
*.bridgesupport
|
22
|
+
build-iPhoneOS/
|
23
|
+
build-iPhoneSimulator/
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
|
39
|
+
## Environment normalization:
|
40
|
+
/.bundle/
|
41
|
+
/vendor/bundle
|
42
|
+
/lib/bundler/man/
|
43
|
+
|
44
|
+
# for a library or gem, you might want to ignore these files since the code is
|
45
|
+
# intended to run in multiple environments; otherwise, check them in:
|
46
|
+
# Gemfile.lock
|
47
|
+
# .ruby-version
|
48
|
+
# .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 H20Dragon - Application Model Based Automation Framework
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
# ZephyrClient
|
3
|
+
|
4
|
+
## Description
|
5
|
+
|
6
|
+
Convenient Zephyr client library to manage Zephyr Cycles.
|
7
|
+
|
8
|
+
|
9
|
+
# References
|
10
|
+
1. https://github.com/sumoheavy/jira-ruby
|
11
|
+
1. https://docs.ruby-lang.org/en/2.3.0/Net/HTTP.html#class-Net::HTTP-label-GET
|
12
|
+
1. http://www.rubyinside.com/nethttp-cheat-sheet-2940.html
|
13
|
+
1. http://zetcode.com/web/rubyhttpclient/
|
14
|
+
1. http://www.rubydoc.info/gems/zephyr/1.2.1/Zephyr
|
15
|
+
1. https://stackoverflow.com/questions/9680227/curl-task-with-ruby-nethttp
|
16
|
+
1. https://stackoverflow.com/questions/5244887/eoferror-end-of-file-reached-issue-with-nethttp
|
17
|
+
1. HTTP Party
|
18
|
+
* https://stackoverflow.com/questions/2024805/ruby-send-json-request
|
19
|
+
|
20
|
+
# Zephyr
|
21
|
+
## Examples
|
22
|
+
1. http://jira.concur.com/jira/rest/api/2/search
|
23
|
+
1. http://jira.concur.com/jira/rest/zapi/latest/cycle?projectId=12610&projectKey=CORUI
|
24
|
+
1. http://jira.concur.com/jira/rest/zapi/latest/execution?projectId=12610&cycleId=541
|
25
|
+
|
26
|
+
# Run Tests
|
27
|
+
```
|
28
|
+
rspec spec
|
29
|
+
|
30
|
+
```
|
data/Rakefile
ADDED
data/bin/config.json
ADDED
data/bin/zc.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require_relative '../lib/zephyr_client'
|
2
|
+
#require 'zephyr_client'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
opts = ZephyrClient::Utils::parseCommandLine();
|
6
|
+
#puts __FILE__ + (__LINE__).to_s + " OPTS => #{opts}" if opts[:verbose]
|
7
|
+
|
8
|
+
z = ZephyrClient::Client.new(opts[:config])
|
9
|
+
z.setUser( {:username => opts[:user], :password => 'Eruption1978!' })
|
10
|
+
|
11
|
+
#puts opts
|
12
|
+
|
13
|
+
|
14
|
+
rc = z.getProjectPerRelease(opts[:project], opts[:release], opts[:cycle], opts[:debug])
|
15
|
+
|
16
|
+
if opts[:verbose]
|
17
|
+
puts '-' * 72
|
18
|
+
puts "== PROJECT PER RELEASE =="
|
19
|
+
puts __FILE__ + (__LINE__).to_s + " => #{rc}"
|
20
|
+
puts ' -- Executions --'
|
21
|
+
end
|
22
|
+
|
23
|
+
executions = z.getExecutions(rc)
|
24
|
+
puts "Total Records: #{executions['recordsCount']}"
|
25
|
+
|
26
|
+
|
27
|
+
if opts.has_key?(:jira)
|
28
|
+
filterKey = 'issueKey'
|
29
|
+
i=0
|
30
|
+
filter = { filterKey => opts[:jira]} # CORUI-3212
|
31
|
+
|
32
|
+
|
33
|
+
executions['executions'].each do |e|
|
34
|
+
if filter[filterKey] && e.has_key?(filterKey) && (e[filterKey] == filter[filterKey])
|
35
|
+
puts "#{i}. #{e}" if opts[:verbose]
|
36
|
+
|
37
|
+
|
38
|
+
if opts.has_key?(:status)
|
39
|
+
|
40
|
+
operationRc = z.updateTestStatus(e['id'], opts[:status]) # pass, fail, wip, blocked, unexecuted
|
41
|
+
|
42
|
+
opStatus = 'Unsuccessfully'
|
43
|
+
if operationRc.is_a?(Net::HTTPOK)
|
44
|
+
opStatus = 'Successfully'
|
45
|
+
end
|
46
|
+
puts "#{opStatus} updated status to '#{opts[:status]}' : #{e['issueKey']} : #{e['summary']}"
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
i+=1
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
else
|
56
|
+
puts '*' * 72
|
57
|
+
pp executions['executions']
|
58
|
+
end
|
data/lib/zephyr_client.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
|
2
|
-
class ZephyrClient
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
end
|
3
|
+
module ZephyrClient
|
4
|
+
ROOT_DIR = File.join(File.dirname(File.expand_path(__FILE__)), 'zephyr_client').freeze
|
7
5
|
|
6
|
+
ZSTATUS = {
|
7
|
+
'pass' => 1,
|
8
|
+
'fail' => 2,
|
9
|
+
'wip' => 3,
|
10
|
+
'blocked' => 4,
|
11
|
+
'unexecuted' => -1
|
12
|
+
}
|
13
|
+
|
14
|
+
Dir["#{ROOT_DIR}/*.rb"].each { |f| require f }
|
15
|
+
Dir["#{ROOT_DIR}/**/*.rb"].each { |f| require f }
|
8
16
|
end
|
9
17
|
|
@@ -0,0 +1,225 @@
|
|
1
|
+
|
2
|
+
require 'pp'
|
3
|
+
require_relative '../utils/utils'
|
4
|
+
|
5
|
+
module ZephyrClient
|
6
|
+
|
7
|
+
class Client
|
8
|
+
|
9
|
+
# TODO: Leverage command pattern.
|
10
|
+
EXECUTION_CMD="/jira/rest/zapi/latest/execution"
|
11
|
+
|
12
|
+
|
13
|
+
ZAPI_LIST = {
|
14
|
+
:cycle => "/jira/rest/zapi/latest/cycle"
|
15
|
+
}
|
16
|
+
|
17
|
+
attr_accessor :debug
|
18
|
+
attr_accessor :user
|
19
|
+
|
20
|
+
def initialize(*p)
|
21
|
+
|
22
|
+
@user=nil
|
23
|
+
puts __FILE__ + (__LINE__).to_s + " size : #{p.size}" if @debug
|
24
|
+
|
25
|
+
if p.size==1 && p[0].is_a?(Hash)
|
26
|
+
;
|
27
|
+
elsif p.size==1 && p[0].is_a?(String)
|
28
|
+
# Load form from a JSON file
|
29
|
+
@options = JSON.parse(File.read(p[0].to_s))
|
30
|
+
pp @options if @debug
|
31
|
+
elsif p.size==2
|
32
|
+
@user=p[0]
|
33
|
+
server=p[1]
|
34
|
+
puts __FILE__ + (__LINE__).to_s + " ZephyrClient::Client.new(#{user}, #{server})" if @debug
|
35
|
+
@options = {
|
36
|
+
'site' => server,
|
37
|
+
'context_path' => "/jira",
|
38
|
+
'rest_base_path' => "/jira/rest/api/2",
|
39
|
+
'ssl_verify_mode' => 1,
|
40
|
+
'use_ssl' => true,
|
41
|
+
'auth_type' => :basic,
|
42
|
+
'http_debug' => true,
|
43
|
+
'read_timeout' => 100
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def setUser(u)
|
50
|
+
@user = u
|
51
|
+
end
|
52
|
+
|
53
|
+
def connect(uri=@options['site'])
|
54
|
+
if @debug
|
55
|
+
puts __FILE__ + (__LINE__).to_s + " [enter]:http_con(#{uri})"
|
56
|
+
puts __FILE__ + (__LINE__).to_s + " | options"
|
57
|
+
pp @options
|
58
|
+
end
|
59
|
+
|
60
|
+
ZephyrClient::Utils::connect(@options['site'], @options)
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
def sendRequest(path, headers = {'Accept' => 'application/json'})
|
65
|
+
request = ZephyrClient::Utils::createRequest(@user, 'get', path, nil, headers)
|
66
|
+
connection = connect(@options['site'])
|
67
|
+
|
68
|
+
puts __FILE__ + (__LINE__).to_s + " connection => #{connection.class}" if @debug
|
69
|
+
response = connection.request(request)
|
70
|
+
response
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
def getCycles(id)
|
75
|
+
response = sendRequest("#{ZAPI_LIST[:cycle]}/#{id}")
|
76
|
+
puts __FILE__ + (__LINE__).to_s + " ==== Cycles #{id} ====\n" if @debug
|
77
|
+
response.body
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
def getCyclesByProjectId(projectId, versionId)
|
82
|
+
response = sendRequest("/jira/rest/zapi/latest/cycle?projectId=#{projectId}&versionId=#{versionId}")
|
83
|
+
puts __FILE__ + (__LINE__).to_s + " ==== Cycles for Project #{projectId} ====\n" if @debug
|
84
|
+
|
85
|
+
QResponse.new(response)
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def getProjects()
|
90
|
+
response = sendRequest("/jira/rest/api/2/project/")
|
91
|
+
puts __FILE__ + (__LINE__).to_s + " ==== All Projects ====\n" if @debug
|
92
|
+
QResponse.new(response)
|
93
|
+
end
|
94
|
+
|
95
|
+
def getProject(projectId)
|
96
|
+
response = sendRequest("/jira/rest/api/2/project/#{projectId}")
|
97
|
+
puts __FILE__ + (__LINE__).to_s + " ==== Project #{projectId} ====\n" if @debug
|
98
|
+
|
99
|
+
QResponse.new(response)
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
def getProjectByKey(k)
|
104
|
+
#puts __FILE__ + (__LINE__).to_s + " [getProjectByKey]: #{k}"
|
105
|
+
matches=[]
|
106
|
+
hits = getProjects().to_json
|
107
|
+
hits.each do |p|
|
108
|
+
if p.is_a?(Hash)
|
109
|
+
if p.has_key?('key') && p['key']==k
|
110
|
+
matches << p
|
111
|
+
end
|
112
|
+
|
113
|
+
else
|
114
|
+
raise "UNEXPECTED::TypeError::#{p.class}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
matches
|
119
|
+
end
|
120
|
+
|
121
|
+
def getProjectCycles(projectId)
|
122
|
+
response = sendRequest("/jira/rest/zapi/latest/cycle?projectId=#{projectId}")
|
123
|
+
puts __FILE__ + (__LINE__).to_s + " ==== Cycles for Project #{projectId} ====\n"
|
124
|
+
|
125
|
+
response.body
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def getProjectPerRelease(projectKey, expected_release, cycle, debug = @debug)
|
130
|
+
projectId = nil
|
131
|
+
cycleId = nil
|
132
|
+
versionId = nil
|
133
|
+
|
134
|
+
hits = getProjectByKey(projectKey)
|
135
|
+
|
136
|
+
|
137
|
+
if hits.size==1
|
138
|
+
|
139
|
+
projectId = hits[0]['id']
|
140
|
+
|
141
|
+
puts "\n\n=========== getProject(#{projectId} ============" if @debug
|
142
|
+
project = getProject(projectId).to_json
|
143
|
+
|
144
|
+
if debug
|
145
|
+
puts __FILE__ + (__LINE__).to_s + " hits => #{project.keys.sort.to_s}"
|
146
|
+
pp project
|
147
|
+
puts '*' * 72
|
148
|
+
end
|
149
|
+
|
150
|
+
project['versions'].each do |v|
|
151
|
+
puts __FILE__ + (__LINE__).to_s + " KEY #{v} => " if @debug
|
152
|
+
|
153
|
+
if v['name'].match(/#{expected_release}/)
|
154
|
+
puts "RELEASE: #{v['id']} : #{v['name']}" if @debug
|
155
|
+
versionId = v['id']
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
if versionId
|
160
|
+
|
161
|
+
## Find the Cycle (e.g. Sprint)
|
162
|
+
## We have the projectID, versionId, now let's get the CycleID
|
163
|
+
rc = getCyclesByProjectId(projectId, versionId)
|
164
|
+
pp rc.to_json if @debug
|
165
|
+
|
166
|
+
rc.to_json.each_pair do |k, v|
|
167
|
+
|
168
|
+
if v.is_a?(Hash) && v.has_key?('name') && v['name'].match(/#{cycle}/)
|
169
|
+
cycleId = k.to_s
|
170
|
+
|
171
|
+
if @debug
|
172
|
+
puts __FILE__ + (__LINE__).to_s + " cycleId #{k.to_s}"
|
173
|
+
pp k
|
174
|
+
end
|
175
|
+
|
176
|
+
elsif !v.is_a?(Hash)
|
177
|
+
puts "#{k} => #{v}" if @debug
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
end
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
{ :projectId => projectId, :cycleId => cycleId, :versionId => versionId }
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
def getExecutions(opt)
|
190
|
+
rc = nil
|
191
|
+
if opt[:projectId] && opt[:versionId] && opt[:cycleId]
|
192
|
+
response = sendRequest("/jira/rest/zapi/latest/execution?projectId=#{opt[:projectId]}&versionId=#{opt[:versionId]}&cycleId=#{opt[:cycleId]}", {'Accept' => 'application/json'})
|
193
|
+
rc = QResponse.new(response).to_json
|
194
|
+
end
|
195
|
+
|
196
|
+
rc
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
# body = { "status" => "3"}
|
201
|
+
def updateTestStatus(id, status)
|
202
|
+
|
203
|
+
unless ZephyrClient::ZSTATUS.has_key?(status.downcase)
|
204
|
+
raise "UNKNOWN::STATUS::#{status.to_s}"
|
205
|
+
end
|
206
|
+
|
207
|
+
body = "{ \"status\" : \"#{ZephyrClient::ZSTATUS[status.downcase]}\" }"
|
208
|
+
|
209
|
+
request = ZephyrClient::Utils::createRequest(@user, 'PUT', "#{EXECUTION_CMD}/#{id}/execute", body, {'Content-Type' => 'application/json'})
|
210
|
+
httpReq = connect(@options['site'])
|
211
|
+
response = httpReq.request(request)
|
212
|
+
|
213
|
+
if ZephyrClient::Utils::isVerbose()
|
214
|
+
puts ">>>>> TEST STATUS <<<<<<"
|
215
|
+
puts response
|
216
|
+
end
|
217
|
+
|
218
|
+
response
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/https'
|
3
|
+
require 'cgi/cookie'
|
4
|
+
require 'pp'
|
5
|
+
require 'uri'
|
6
|
+
|
7
|
+
|
8
|
+
class HTTPClient
|
9
|
+
|
10
|
+
attr_accessor :debug
|
11
|
+
attr_accessor :user
|
12
|
+
attr_accessor :request
|
13
|
+
|
14
|
+
def initialize(user)
|
15
|
+
@debug = false
|
16
|
+
@user = user
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.createRequest(user, http_method='get', path=nil, body=nil, headers={})
|
20
|
+
request = Net::HTTP.const_get(http_method.to_s.capitalize).new(path, headers)
|
21
|
+
request.body = body unless body.nil?
|
22
|
+
request.basic_auth(user[:username], user[:password])
|
23
|
+
request
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
|
4
|
+
class QResponse
|
5
|
+
attr_accessor :results
|
6
|
+
attr_accessor :debug
|
7
|
+
|
8
|
+
def initialize(s)
|
9
|
+
@results = s
|
10
|
+
@debug=false
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_json
|
14
|
+
rc=nil
|
15
|
+
begin
|
16
|
+
rc = JSON.parse(@results.body)
|
17
|
+
rescue => ex
|
18
|
+
;
|
19
|
+
end
|
20
|
+
rc
|
21
|
+
end
|
22
|
+
|
23
|
+
def dump()
|
24
|
+
h = to_json
|
25
|
+
|
26
|
+
if h.is_a?(Array)
|
27
|
+
puts __FILE__ + (__LINE__).to_s + " SIZE : #{h.length.to_s}"
|
28
|
+
i=0
|
29
|
+
h.each do |arr|
|
30
|
+
puts "#{i}. #{arr}"
|
31
|
+
i+=1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'net/https'
|
3
|
+
require 'cgi/cookie'
|
4
|
+
require 'pp'
|
5
|
+
require 'uri'
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
|
9
|
+
module ZephyrClient::Utils
|
10
|
+
|
11
|
+
extend self
|
12
|
+
|
13
|
+
def self.createRequest(user, http_method='get', path=nil, body=nil, headers={})
|
14
|
+
request = Net::HTTP.const_get(http_method.to_s.capitalize).new(path, headers)
|
15
|
+
request.body = body unless body.nil?
|
16
|
+
request.basic_auth(user[:username], user[:password])
|
17
|
+
request
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def self.connect(uri, options)
|
22
|
+
#puts __FILE__ + (__LINE__).to_s + " [ Utils.connect( #{uri} ) ]"
|
23
|
+
|
24
|
+
targetUri = URI.parse(uri)
|
25
|
+
http_class = Net::HTTP
|
26
|
+
httpReq = http_class.new(targetUri.host, targetUri.port)
|
27
|
+
httpReq.use_ssl = options['use_ssl']
|
28
|
+
httpReq.verify_mode = options['ssl_verify_mode']
|
29
|
+
httpReq.read_timeout = options['read_timeout']
|
30
|
+
|
31
|
+
#puts __FILE__ + (__LINE__).to_s + " => #{httpReq}"
|
32
|
+
|
33
|
+
httpReq
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.parseCommandLine(args=nil)
|
37
|
+
options={ :verbose => false }
|
38
|
+
|
39
|
+
opt_parser = OptionParser.new do |opt|
|
40
|
+
|
41
|
+
opt.on('-c', '--cycle Cycle') { |o|
|
42
|
+
options[:cycle] = o
|
43
|
+
}
|
44
|
+
|
45
|
+
opt.on('--cfg', '--cfg Config') { |o|
|
46
|
+
options[:config] = o
|
47
|
+
}
|
48
|
+
|
49
|
+
opt.on('-r', '--release Release') { |o|
|
50
|
+
options[:release] = o
|
51
|
+
}
|
52
|
+
|
53
|
+
opt.on('-p', '--project ProjectKey') { |o|
|
54
|
+
options[:project] = o
|
55
|
+
}
|
56
|
+
|
57
|
+
opt.on('--password', '--password Password') { |o|
|
58
|
+
options[:password] = o
|
59
|
+
}
|
60
|
+
opt.on('u', '--user UserId') { |o|
|
61
|
+
options[:user] = o
|
62
|
+
}
|
63
|
+
opt.on('--jira', '--jira JIRA') { |o|
|
64
|
+
options[:jira] = o
|
65
|
+
}
|
66
|
+
|
67
|
+
opt.on('--status', '--status Status') { |o|
|
68
|
+
options[:status] = o
|
69
|
+
}
|
70
|
+
|
71
|
+
opt.on('-v', '--verbose') { |o|
|
72
|
+
options[:verbose] = o
|
73
|
+
}
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
if !args.nil?
|
79
|
+
opt_parser.parse!(args)
|
80
|
+
else
|
81
|
+
opt_parser.parse!
|
82
|
+
end
|
83
|
+
|
84
|
+
@options=options
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.isVerbose()
|
88
|
+
@options[:verbose]
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'zephyr_client/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "zephyr_client"
|
9
|
+
spec.version = ZephyrClient::VERSION
|
10
|
+
spec.authors = ["H20Dragon"]
|
11
|
+
spec.email = ["h20dragon@outlook.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{Lightweight Zephyr (JIRA) client.}
|
14
|
+
spec.description = %q{Conveniently query, filter, and update Zephyr Cycles/Executions.}
|
15
|
+
spec.homepage = "http://github.com/h20dragon."
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
|
24
|
+
# require 'json'
|
25
|
+
# require 'net/https'
|
26
|
+
# require 'cgi/cookie'
|
27
|
+
# require 'pp'
|
28
|
+
# require 'uri'
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler"
|
31
|
+
spec.add_development_dependency "rake"
|
32
|
+
spec.add_development_dependency "rspec"
|
33
|
+
spec.add_development_dependency "json"
|
34
|
+
# spec.add_development_dependency "net/https"
|
35
|
+
# spec.add_development_dependency "uri"
|
36
|
+
# spec.add_development_dependency "cgi/cookie"
|
37
|
+
end
|
metadata
CHANGED
@@ -1,23 +1,94 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zephyr_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- H20Dragon
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
12
|
-
dependencies:
|
13
|
-
|
14
|
-
|
11
|
+
date: 2017-08-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Conveniently query, filter, and update Zephyr Cycles/Executions.
|
70
|
+
email:
|
71
|
+
- h20dragon@outlook.com
|
15
72
|
executables: []
|
16
73
|
extensions: []
|
17
74
|
extra_rdoc_files: []
|
18
75
|
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/config.json
|
83
|
+
- bin/zc.rb
|
19
84
|
- lib/zephyr_client.rb
|
20
|
-
|
85
|
+
- lib/zephyr_client/base/client.rb
|
86
|
+
- lib/zephyr_client/base/http_client.rb
|
87
|
+
- lib/zephyr_client/base/q_response.rb
|
88
|
+
- lib/zephyr_client/utils/utils.rb
|
89
|
+
- lib/zephyr_client/version.rb
|
90
|
+
- zephyr_client.gemspec
|
91
|
+
homepage: http://github.com/h20dragon.
|
21
92
|
licenses:
|
22
93
|
- MIT
|
23
94
|
metadata: {}
|