gitlabuddy 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeeb03b7c68802d829e2e840f2121ab3a5fd2b4c
4
- data.tar.gz: 859c5ad16cec533dee3a09cbf33c225af2ac9873
3
+ metadata.gz: e22a05f426115fce0c5ff467d20bd76746297082
4
+ data.tar.gz: ade344198790fc7ef69ca8b9a8e17f04514966b3
5
5
  SHA512:
6
- metadata.gz: 7479349662d0e605b1693df9f3dafd3f074b217089dbb4d2613f80cd8a2bd0222e536ac2be8a9bff46154c6a648ee9079b4a765a252eb7a5a278b6f82769e8c1
7
- data.tar.gz: cb3414700e2f3af53fc818f3970fe560c035312be6a6a6aabc3183170daf9073e7f2e53dfb2600f32ea94b4a0b1e70ac53b20c7c08527d40e8e08d6dc64ab19b
6
+ metadata.gz: db22b2a02ecedb51dc4fe7e97e213c0400b45e6b27da59c9dba829b98e1bc57cbfcbf3cd6dbfd157d5f2dd5318fe3287ecf96f6b741c2d00e4291539a1e8e6c7
7
+ data.tar.gz: 0645613be9f4b0ec7f550b8a91ee29d958160e573773012d22c7f3b2608d0d79f0de2d530a0f2a16729b763344854c0921a97ac6bc85eadf064bf20151494561
@@ -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
- Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project['id']}/merge_requests")
13
- .send
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
@@ -10,8 +10,7 @@ module Gitlabuddy
10
10
  .body
11
11
  )
12
12
 
13
- puts projects
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.3
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-14 00:00:00.000000000 Z
11
+ date: 2016-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor