jira4r 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/jira4r/jira_tool.rb +44 -45
- data/lib/jira4r.rb +4 -12
- data.tar.gz.sig +1 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adf2fa1d295d434995d5534c99dae7a8538c6aa4
|
4
|
+
data.tar.gz: ea8edcd4401daab6d4f68d71da02b060d8920057
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02913c48f876d2d9d2be1233f9bfa4242538080fb207e125c7489752c452ab57a01b4066e5948f6d0529314f7825ac47eada3b38c850cb7318e8a3465a252464
|
7
|
+
data.tar.gz: 289349ffd21f481d9e8f6783220649174c8e2128590e674d85d6fc60a724b9b98e342aa77de6462965f6c5926d7edeacbe6de72d1dbc7f125fa7727ca3c629d4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/jira4r/jira_tool.rb
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
require 'logger'
|
2
|
-
require '
|
3
|
-
gem 'soap4r'
|
2
|
+
require 'soap/rpc/standaloneServer'
|
4
3
|
|
5
4
|
module Jira4R
|
6
|
-
|
5
|
+
|
7
6
|
class JiraTool
|
8
7
|
attr_accessor :enhanced
|
9
|
-
|
8
|
+
|
10
9
|
# Create a new JiraTool
|
11
|
-
#
|
10
|
+
#
|
12
11
|
# where:
|
13
12
|
# version ... the version of the SOAP API you wish to use - currently supported versions [ 2 ]
|
14
13
|
# base_url ... the base URL of the JIRA instance - eg. http://confluence.atlassian.com
|
15
14
|
def initialize(version, base_url)
|
16
15
|
@version = version
|
17
|
-
@base_url = base_url
|
16
|
+
@base_url = base_url
|
18
17
|
@logger = Logger.new(STDERR)
|
19
18
|
@endpoint_url = "#{@base_url}/rpc/soap/jirasoapservice-v#{version}"
|
20
19
|
end
|
21
|
-
|
20
|
+
|
22
21
|
#Assign a new logger to the tool. By default a STDERR logger is used.
|
23
22
|
def logger=(logger)
|
24
23
|
@logger = logger
|
25
24
|
end
|
26
|
-
|
25
|
+
|
27
26
|
#Retrieve the driver, creating as required.
|
28
27
|
def driver()
|
29
28
|
if not @driver
|
@@ -32,7 +31,7 @@ module Jira4R
|
|
32
31
|
require "jira4r/v#{@version}/jiraService.rb"
|
33
32
|
require "jira4r/v#{@version}/JiraSoapServiceDriver.rb"
|
34
33
|
require "jira4r/v#{@version}/jiraServiceMappingRegistry.rb"
|
35
|
-
|
34
|
+
|
36
35
|
service_classname = "Jira4R::V#{@version}::JiraSoapService"
|
37
36
|
puts "Service: #{service_classname}"
|
38
37
|
service = eval(service_classname)
|
@@ -40,37 +39,37 @@ module Jira4R
|
|
40
39
|
end
|
41
40
|
@driver
|
42
41
|
end
|
43
|
-
|
42
|
+
|
44
43
|
#Assign a wiredump file prefix to the driver.
|
45
44
|
def wiredump_file_base=(base)
|
46
45
|
driver().wiredump_file_base = base
|
47
46
|
end
|
48
|
-
|
49
|
-
|
50
|
-
#Login to the JIRA instance, storing the token for later calls.
|
51
|
-
#
|
47
|
+
|
48
|
+
|
49
|
+
#Login to the JIRA instance, storing the token for later calls.
|
50
|
+
#
|
52
51
|
#This is typically the first call that is made on the JiraTool.
|
53
52
|
def login(username, password)
|
54
53
|
@token = driver().login(username, password)
|
55
54
|
end
|
56
55
|
|
57
|
-
#Clients should avoid using the authentication token directly.
|
56
|
+
#Clients should avoid using the authentication token directly.
|
58
57
|
def token()
|
59
58
|
@token
|
60
59
|
end
|
61
|
-
|
60
|
+
|
62
61
|
#Call a method on the driver, adding in the authentication token previously determined using login()
|
63
62
|
def call_driver(method_name, *args)
|
64
63
|
@logger.debug("Finding method #{method_name}")
|
65
|
-
method = driver().method(method_name)
|
66
|
-
|
64
|
+
method = driver().method(method_name)
|
65
|
+
|
67
66
|
if args.length > 0
|
68
|
-
method.call(@token, *args)
|
67
|
+
method.call(@token, *args)
|
69
68
|
else
|
70
69
|
method.call(@token)
|
71
70
|
end
|
72
71
|
end
|
73
|
-
|
72
|
+
|
74
73
|
#Retrieve a project without the associated PermissionScheme.
|
75
74
|
#This will be significantly faster for larger Jira installations.
|
76
75
|
#See: JRA-10660
|
@@ -78,17 +77,17 @@ module Jira4R
|
|
78
77
|
puts "getProjectNoScheme is deprecated. Please call getProjectNoSchemes."
|
79
78
|
getProjectNoSchemes(key)
|
80
79
|
end
|
81
|
-
|
80
|
+
|
82
81
|
def getProjectNoSchemes(key)
|
83
82
|
self.getProjectsNoSchemes().find { |project| project.key == key }
|
84
83
|
end
|
85
|
-
|
84
|
+
|
86
85
|
def getProject(key)
|
87
86
|
#Jira > 3.10 has been patched to support this method directly as getProjectByKey
|
88
87
|
puts "Using deprecated JIRA4R API call getProject(key); replace with getProjectByKey(key)"
|
89
88
|
return getProjectByKey(key)
|
90
89
|
end
|
91
|
-
|
90
|
+
|
92
91
|
def getProjectByKey( projectKey )
|
93
92
|
begin
|
94
93
|
return call_driver( "getProjectByKey", projectKey )
|
@@ -101,7 +100,7 @@ module Jira4R
|
|
101
100
|
end
|
102
101
|
end
|
103
102
|
end
|
104
|
-
|
103
|
+
|
105
104
|
def getGroup( groupName )
|
106
105
|
begin
|
107
106
|
return call_driver( "getGroup", groupName )
|
@@ -114,62 +113,62 @@ module Jira4R
|
|
114
113
|
end
|
115
114
|
end
|
116
115
|
end
|
117
|
-
|
116
|
+
|
118
117
|
def getProjectRoleByName( projectRoleName )
|
119
118
|
getProjectRoles.each{ |projectRole|
|
120
119
|
return projectRole if projectRole.name == projectRoleName
|
121
120
|
}
|
122
121
|
end
|
123
|
-
|
122
|
+
|
124
123
|
def getPermissionScheme( permissionSchemeName )
|
125
|
-
self.getPermissionSchemes().each { |permission_scheme|
|
124
|
+
self.getPermissionSchemes().each { |permission_scheme|
|
126
125
|
return permission_scheme if permission_scheme.name == permissionSchemeName
|
127
126
|
}
|
128
127
|
return nil
|
129
128
|
end
|
130
|
-
|
129
|
+
|
131
130
|
def getNotificationScheme( notificationSchemeName )
|
132
|
-
self.getNotificationSchemes().each { |notification_scheme|
|
131
|
+
self.getNotificationSchemes().each { |notification_scheme|
|
133
132
|
return notification_scheme if notification_scheme.name == notificationSchemeName
|
134
133
|
}
|
135
134
|
return nil
|
136
135
|
end
|
137
|
-
|
136
|
+
|
138
137
|
def getPermission( permissionName )
|
139
138
|
if not @permissions
|
140
139
|
@permissions = self.getAllPermissions()
|
141
140
|
end
|
142
|
-
|
141
|
+
|
143
142
|
@permissions.each { |permission|
|
144
143
|
return permission if permission.name.downcase == permissionName.downcase
|
145
144
|
}
|
146
|
-
|
145
|
+
|
147
146
|
@logger.warn("No permission #{permissionName} found")
|
148
147
|
return nil
|
149
148
|
end
|
150
|
-
|
149
|
+
|
151
150
|
def findPermission(allowedPermissions, permissionName)
|
152
151
|
allowedPermissions.each { |allowedPermission|
|
153
152
|
#puts "Checking #{allowedPermission.name} against #{permissionName} "
|
154
153
|
return allowedPermission if allowedPermission.name == permissionName
|
155
154
|
}
|
156
|
-
return nil
|
155
|
+
return nil
|
157
156
|
end
|
158
|
-
|
157
|
+
|
159
158
|
def findEntityInPermissionMapping(permissionMapping, entityName)
|
160
159
|
permissionMapping.remoteEntities.each { |entity|
|
161
160
|
return entity if entity.name == entityName
|
162
161
|
}
|
163
162
|
return nil
|
164
163
|
end
|
165
|
-
|
164
|
+
|
166
165
|
#Removes entity
|
167
166
|
def setPermissions( permissionScheme, allowedPermissions, entity)
|
168
167
|
allowedPermissions = [ allowedPermissions ].flatten.compact
|
169
168
|
#Remove permissions that are no longer allowed
|
170
169
|
permissionScheme.permissionMappings.each { |mapping|
|
171
170
|
next unless findEntityInPermissionMapping(mapping, entity.name)
|
172
|
-
|
171
|
+
|
173
172
|
allowedPermission = findPermission(allowedPermissions, mapping.permission.name)
|
174
173
|
if allowedPermission
|
175
174
|
puts "Already has #{allowedPermission.name} in #{permissionScheme.name} for #{entity.name}"
|
@@ -180,12 +179,12 @@ module Jira4R
|
|
180
179
|
puts "Deleting #{mapping.permission.name} from #{permissionScheme.name} for #{entity.name}"
|
181
180
|
deletePermissionFrom( permissionScheme, mapping.permission, entity)
|
182
181
|
}
|
183
|
-
|
182
|
+
|
184
183
|
puts allowedPermissions.inspect
|
185
184
|
allowedPermissions.each { |allowedPermission|
|
186
185
|
puts "Granting #{allowedPermission.name} to #{permissionScheme.name} for #{entity.name}"
|
187
|
-
addPermissionTo(permissionScheme, allowedPermission, entity)
|
188
|
-
}
|
186
|
+
addPermissionTo(permissionScheme, allowedPermission, entity)
|
187
|
+
}
|
189
188
|
end
|
190
189
|
|
191
190
|
private
|
@@ -198,14 +197,14 @@ private
|
|
198
197
|
end
|
199
198
|
}
|
200
199
|
end
|
201
|
-
|
200
|
+
|
202
201
|
def method_missing(method_name, *args)
|
203
202
|
args = fix_args(args)
|
204
203
|
call_driver(method_name, *args)
|
205
204
|
end
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
end
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
end
|
210
209
|
|
211
210
|
end
|
data/lib/jira4r.rb
CHANGED
@@ -1,25 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'rubygems' # i'd like to not need this
|
4
|
-
|
5
|
-
begin
|
6
|
-
gem 'soap4r'
|
7
|
-
require 'soap/rpc/driver'
|
8
|
-
rescue LoadError
|
9
|
-
raise "jira4r requires soap4r. to install: gem install soap4r"
|
10
|
-
end
|
1
|
+
gem 'soap2r'
|
2
|
+
require 'soap/rpc/driver'
|
11
3
|
|
12
4
|
require 'jira4r/jira_tool'
|
13
5
|
|
14
6
|
# Due to refactoring, this class should no longer be used.
|
15
7
|
module Jira
|
16
8
|
class JiraTool
|
17
|
-
|
9
|
+
|
18
10
|
def initialize(version, base_url)
|
19
11
|
puts "Jira::JiraTool is deprecated; use Jira4R::JiraTool"
|
20
12
|
@proxy = ::Jira4R::JiraTool.new(version, base_url)
|
21
13
|
end
|
22
|
-
|
14
|
+
|
23
15
|
def method_missing(name, *args)
|
24
16
|
@proxy.send(name, *args)
|
25
17
|
end
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
�
|
1
|
+
}����49 ��^qP;x�8]�����q6�ᩐv�?'��Q�z@)(l�{���Mo#�-�Rۨa<������h>yO�FUݥ8pT�����/�,��5���R���pY���e���W�_��_)9t���<�N&p#�g �7Y�ZS�� Kop�*�ԧ ��m
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
@@ -31,10 +31,10 @@ cert_chain:
|
|
31
31
|
y0kCSWmK6D+x/SbfS6r7Ke07MRqziJdB9GuE1+0cIRuFh8EQ+LN6HXCKM5pon/GU
|
32
32
|
ycwMXfl0
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2013-
|
34
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: soap2r
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '>='
|
metadata.gz.sig
CHANGED
Binary file
|