gitlabuddy 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gitlabuddy/cli.rb +9 -3
- data/lib/gitlabuddy/merge_request.rb +9 -6
- data/lib/gitlabuddy/project.rb +30 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e22a05f426115fce0c5ff467d20bd76746297082
|
4
|
+
data.tar.gz: ade344198790fc7ef69ca8b9a8e17f04514966b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db22b2a02ecedb51dc4fe7e97e213c0400b45e6b27da59c9dba829b98e1bc57cbfcbf3cd6dbfd157d5f2dd5318fe3287ecf96f6b741c2d00e4291539a1e8e6c7
|
7
|
+
data.tar.gz: 0645613be9f4b0ec7f550b8a91ee29d958160e573773012d22c7f3b2608d0d79f0de2d530a0f2a16729b763344854c0921a97ac6bc85eadf064bf20151494561
|
data/lib/gitlabuddy/cli.rb
CHANGED
@@ -5,19 +5,25 @@ module Gitlabuddy
|
|
5
5
|
desc 'projects', 'This will list all your projects on Gitlab'
|
6
6
|
def projects
|
7
7
|
require 'gitlabuddy/project'
|
8
|
-
Gitlabuddy::Project.all
|
8
|
+
puts Gitlabuddy::Project.all
|
9
9
|
end
|
10
10
|
|
11
11
|
desc 'merge_requests', 'This will list all your merge_requests on Gitlab'
|
12
12
|
def merge_requests
|
13
13
|
require 'gitlabuddy/merge_request'
|
14
|
-
Gitlabuddy::MergeRequest.all
|
14
|
+
puts Gitlabuddy::MergeRequest.all
|
15
15
|
end
|
16
16
|
|
17
17
|
desc 'project_type PROJECT_ID', 'This will return the project type of a certain project'
|
18
18
|
def project_type(project_id)
|
19
19
|
require 'gitlabuddy/project'
|
20
|
-
Gitlabuddy::Project.project_type(project_id)
|
20
|
+
puts Gitlabuddy::Project.project_type(project_id)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'projects_dump', 'This will return the project type of a certain project'
|
24
|
+
def projects_dump
|
25
|
+
require 'gitlabuddy/project'
|
26
|
+
puts Gitlabuddy::Project.dump
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
@@ -7,16 +7,19 @@ module Gitlabuddy
|
|
7
7
|
def self.all
|
8
8
|
merge_requests = []
|
9
9
|
|
10
|
-
Gitlabuddy::Project.all.each do |project|
|
10
|
+
JSON.parse(Gitlabuddy::Project.all).each do |project|
|
11
11
|
JSON.parse(
|
12
|
-
|
13
|
-
|
14
|
-
.body
|
15
|
-
).each { |request| merge_requests.push request if request['state'] == 'opened' }
|
12
|
+
by_project(project['id'])
|
13
|
+
).each { |merge_request| merge_requests.push merge_request if merge_request['state'] == 'opened' }
|
16
14
|
end
|
17
15
|
|
18
|
-
puts merge_requests.to_json
|
19
16
|
merge_requests.to_json
|
20
17
|
end
|
18
|
+
|
19
|
+
def self.by_project(project_id)
|
20
|
+
Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project_id}/merge_requests")
|
21
|
+
.send
|
22
|
+
.body
|
23
|
+
end
|
21
24
|
end
|
22
25
|
end
|
data/lib/gitlabuddy/project.rb
CHANGED
@@ -10,8 +10,7 @@ module Gitlabuddy
|
|
10
10
|
.body
|
11
11
|
)
|
12
12
|
|
13
|
-
|
14
|
-
projects
|
13
|
+
projects.to_json
|
15
14
|
end
|
16
15
|
|
17
16
|
def self.project_type(project_id)
|
@@ -30,8 +29,36 @@ module Gitlabuddy
|
|
30
29
|
'unknown'
|
31
30
|
end
|
32
31
|
|
33
|
-
puts type
|
34
32
|
type
|
35
33
|
end
|
34
|
+
|
35
|
+
def self.branches(project_id)
|
36
|
+
Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project_id}/repository/branches")
|
37
|
+
.send
|
38
|
+
.body
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.dump
|
42
|
+
projects = JSON.parse(
|
43
|
+
Gitlabuddy::Request.new('https://gitlab.com/api/v3/projects')
|
44
|
+
.send
|
45
|
+
.body
|
46
|
+
)
|
47
|
+
|
48
|
+
dump = []
|
49
|
+
|
50
|
+
puts projects
|
51
|
+
|
52
|
+
projects.each do |project|
|
53
|
+
dump.push project.merge!(custom:
|
54
|
+
{
|
55
|
+
project_type: [], #project_type(project['id']),
|
56
|
+
merge_requests: [], #JSON.parse(Gitlabuddy::MergeRequest.by_project(project['id'])),
|
57
|
+
branches: [] #JSON.parse(branches(project['id']))
|
58
|
+
})
|
59
|
+
end
|
60
|
+
|
61
|
+
dump.to_json
|
62
|
+
end
|
36
63
|
end
|
37
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlabuddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infralovers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|