sonarqube-client 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sonarqube-client.rb +8 -8
- data/lib/{sonarqube → sonarqube-client}/client.rb +0 -0
- data/lib/{sonarqube → sonarqube-client}/issues.rb +0 -0
- data/lib/{sonarqube → sonarqube-client}/logger.rb +0 -0
- data/lib/{sonarqube → sonarqube-client}/projects.rb +16 -13
- data/lib/{sonarqube → sonarqube-client}/timemachine.rb +0 -0
- data/lib/{sonarqube → sonarqube-client}/version.rb +0 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64c7070d55e7746cbfe8ec2a8dd088f53a25a273
|
4
|
+
data.tar.gz: 369e824b95082c608fea15d9141313d0dacc1bab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfbbb0d549ee281fc1de3f1cfd8082b17cf12ef18bf48597d484c529b8e7d0cc9ec7ba4106e3e9fbd69e8fe668f13e704ea67d951ba66d35144be306120b4ecb
|
7
|
+
data.tar.gz: f539a01d8c48bcaa8f24862bd236afbd232d675842e40cbd98e4c68341510cbcd7ec32c179f9fc1e2efae002f313a25c6f0185f557e38f37ef09b0685254388a
|
data/lib/sonarqube-client.rb
CHANGED
@@ -20,12 +20,12 @@ require 'nokogiri'
|
|
20
20
|
require 'json'
|
21
21
|
require 'logger'
|
22
22
|
|
23
|
-
require File.dirname(__FILE__) + '/sonarqube/client.rb'
|
24
|
-
require File.dirname(__FILE__) + '/sonarqube/issues.rb'
|
25
|
-
require File.dirname(__FILE__) + '/sonarqube/logger.rb'
|
26
|
-
require File.dirname(__FILE__) + '/sonarqube/projects.rb'
|
27
|
-
require File.dirname(__FILE__) + '/sonarqube/timemachine.rb'
|
28
|
-
require File.dirname(__FILE__) + '/sonarqube/version.rb'
|
23
|
+
require File.dirname(__FILE__) + '/sonarqube-client/client.rb'
|
24
|
+
require File.dirname(__FILE__) + '/sonarqube-client/issues.rb'
|
25
|
+
require File.dirname(__FILE__) + '/sonarqube-client/logger.rb'
|
26
|
+
require File.dirname(__FILE__) + '/sonarqube-client/projects.rb'
|
27
|
+
require File.dirname(__FILE__) + '/sonarqube-client/timemachine.rb'
|
28
|
+
require File.dirname(__FILE__) + '/sonarqube-client/version.rb'
|
29
29
|
|
30
30
|
|
31
31
|
|
@@ -75,9 +75,9 @@ module SonarQube
|
|
75
75
|
|
76
76
|
def sonarqube(server_url, username='', password='')
|
77
77
|
if [username, password].reduce(:+) == ''
|
78
|
-
proc {|endpoint| RestClient::Resource.new server_url + endpoint}.curry
|
78
|
+
proc {|endpoint| JSON.parse((RestClient::Resource.new server_url + endpoint).get)}.curry
|
79
79
|
else
|
80
|
-
proc {|endpoint| RestClient::Resource.new server_url + endpoint,
|
80
|
+
proc {|endpoint| JSON.parse((RestClient::Resource.new server_url + endpoint, username, password).get)}.curry
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -16,6 +16,8 @@
|
|
16
16
|
|
17
17
|
module SonarQube
|
18
18
|
module Projects
|
19
|
+
require 'ostruct'
|
20
|
+
|
19
21
|
class Projects
|
20
22
|
@@endpoint='/api/projects/'
|
21
23
|
|
@@ -29,37 +31,38 @@ module SonarQube
|
|
29
31
|
|
30
32
|
#Returns all projects
|
31
33
|
#
|
32
|
-
# @return [
|
33
|
-
#
|
34
|
+
# @return [Array<OpenStruct>] An Array of OpenStruct objects containing the project details (e.g. [#<OpenStruct id="1", k="bad:project", nm="My bad project", sc="PRJ", qu="TRK">]).
|
34
35
|
def get
|
35
|
-
JSON.parse(@connector["#{@@endpoint}index?format=json"].get)
|
36
|
+
response = JSON.parse(@connector["#{@@endpoint}index?format=json"].get, object_class: OpenStruct)
|
37
|
+
return response.length > 0 ? response : nil
|
36
38
|
end
|
37
39
|
|
38
40
|
#Search for a project using the project index number (id)
|
39
41
|
#
|
40
42
|
# @param [String] index project index number to use in the search
|
41
|
-
# @example puts \"this will return
|
42
|
-
# @return [
|
43
|
+
# @example puts \"this will return the project with id 47: #\\{search_by_key 47\}\"
|
44
|
+
# @return [OpenStruct, nil] An OpenStruct object containing the project details (e.g. #<OpenStruct id="1", k="bad:project", nm="My bad project", sc="PRJ", qu="TRK">) or nil.
|
43
45
|
def search_by_index index
|
44
|
-
JSON.parse(@connector["#{@@endpoint}index?key=#{index}"].get)
|
46
|
+
JSON.parse(@connector["#{@@endpoint}index?format=json&key=#{index}"].get, object_class: OpenStruct)[0]
|
45
47
|
end
|
46
48
|
|
47
49
|
#Search for a project using the project key
|
48
50
|
#
|
49
51
|
# @param [String] key project key to use in the search
|
50
|
-
# @example puts \"this will return all the
|
51
|
-
# @return [
|
52
|
+
# @example puts \"this will return all the project with key \'my:awesome:project\': #\\{search_by_key 'my:awesome:project'\}\"
|
53
|
+
# @return [OpenStruct] An OpenStruct object containing the project details (e.g. #<OpenStruct id="1", k="bad:project", nm="My bad project", sc="PRJ", qu="TRK">) or nil.
|
52
54
|
def search_by_key key
|
53
|
-
JSON.parse(@connector["#{@@endpoint}index?key=#{key}"].get)
|
55
|
+
JSON.parse(@connector["#{@@endpoint}index?format=json&key=#{key}"].get, object_class: OpenStruct)[0]
|
54
56
|
end
|
55
57
|
|
56
58
|
#Return all projects that their name contains the provided string
|
57
59
|
#
|
58
60
|
# @param [String] search_string search string to search with
|
59
|
-
# @return [JSON] A JSON object, containing all the project details (what details?).
|
60
61
|
# @example puts \"this will return all the projects that their name contains the string \'java\': #\\{name_contains 'java'\}\"
|
62
|
+
# @return [Array<OpenStruct>, nil] An Array of OpenStruct objects containing the project details (e.g. [#<OpenStruct id="1", k="bad:project", nm="My bad project", sc="PRJ", qu="TRK">]) or nil.
|
61
63
|
def name_contains search_string
|
62
|
-
JSON.parse(@connector["#{@@endpoint}index?search=#{search_string}"].get)
|
64
|
+
response = JSON.parse(@connector["#{@@endpoint}index?format=json&search=#{search_string}"].get, object_class: OpenStruct)
|
65
|
+
return response.length > 0 ? response : nil
|
63
66
|
end
|
64
67
|
|
65
68
|
#Delete a project with the specified id
|
@@ -86,7 +89,7 @@ module SonarQube
|
|
86
89
|
# @return A JSON object, containing all the projects.
|
87
90
|
#
|
88
91
|
def get
|
89
|
-
|
92
|
+
'api/projects/index?format=json'
|
90
93
|
end
|
91
94
|
|
92
95
|
#Search for a project by key (functional interface)
|
@@ -101,7 +104,7 @@ module SonarQube
|
|
101
104
|
#http://localhost:9000/api/projects/index?key=35
|
102
105
|
#http://localhost:9000/api/projects/index?key=java-sonar-runner-simple
|
103
106
|
def search_by_key key
|
104
|
-
'api/projects/index?key=' + key
|
107
|
+
'/api/projects/index?key=' + key
|
105
108
|
end
|
106
109
|
|
107
110
|
#Search for a project by name
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonarqube-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
|
- Dimitrios Dimas
|
@@ -75,12 +75,12 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- lib/sonarqube-client.rb
|
78
|
-
- lib/sonarqube/client.rb
|
79
|
-
- lib/sonarqube/issues.rb
|
80
|
-
- lib/sonarqube/logger.rb
|
81
|
-
- lib/sonarqube/projects.rb
|
82
|
-
- lib/sonarqube/timemachine.rb
|
83
|
-
- lib/sonarqube/version.rb
|
78
|
+
- lib/sonarqube-client/client.rb
|
79
|
+
- lib/sonarqube-client/issues.rb
|
80
|
+
- lib/sonarqube-client/logger.rb
|
81
|
+
- lib/sonarqube-client/projects.rb
|
82
|
+
- lib/sonarqube-client/timemachine.rb
|
83
|
+
- lib/sonarqube-client/version.rb
|
84
84
|
homepage: http://rubygems.org/gems/sonarqube-client
|
85
85
|
licenses:
|
86
86
|
- GPL-2.0
|
@@ -104,6 +104,6 @@ rubyforge_project:
|
|
104
104
|
rubygems_version: 2.5.1
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
|
-
summary: SonarQube client
|
107
|
+
summary: A SonarQube client
|
108
108
|
test_files: []
|
109
109
|
has_rdoc:
|