gitlabuddy 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 +7 -0
- data/lib/gitlabuddy/cli.rb +23 -0
- data/lib/gitlabuddy/merge_request.rb +22 -0
- data/lib/gitlabuddy/project.rb +30 -0
- data/lib/gitlabuddy/request.rb +17 -0
- data/lib/gitlabuddy.rb +4 -0
- metadata +63 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e33c794f03911c92eb41a630e23bfd8513fe5cc
|
4
|
+
data.tar.gz: 4788495acbedde1f0829b0cdf44ca061117789ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b79758152901c32661e2fa64abb60e692812bddcca2c959484ec4fb460c34cacf1d1b86bec87917272140e634659a4ae4dbeaeb2a1dafd403e32ac1a600d626
|
7
|
+
data.tar.gz: 45ac877a6f084d8c6ab326e64c0ce52d3bc88e56fe1d108cb60796a65b8318feca0c2ddecfc1c9c365a869987ee56222ac4cf5a93e00e4ce1fb03b8ae5b6872c
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Gitlabuddy
|
4
|
+
class Cli < Thor
|
5
|
+
desc 'projects', 'This will list all your projects on Gitlab'
|
6
|
+
def projects
|
7
|
+
require 'gitlabuddy/project'
|
8
|
+
Gitlabuddy::Project.all
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'merge_requests', 'This will list all your merge_requests on Gitlab'
|
12
|
+
def merge_requests
|
13
|
+
require 'gitlabuddy/merge_request'
|
14
|
+
Gitlabuddy::MergeRequest.all
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'cookbook PROJECT_ID', 'This will check if a certain project is a cookbook'
|
18
|
+
def cookbook(project_id)
|
19
|
+
require 'gitlabuddy/project'
|
20
|
+
Gitlabuddy::Project.cookbook?(project_id)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Gitlabuddy
|
2
|
+
class MergeRequest
|
3
|
+
require 'gitlabuddy/request'
|
4
|
+
require 'gitlabuddy/project'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
def self.all
|
8
|
+
merge_requests = []
|
9
|
+
|
10
|
+
Gitlabuddy::Project.all.each do |project|
|
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' }
|
16
|
+
end
|
17
|
+
|
18
|
+
puts merge_requests.to_json
|
19
|
+
merge_requests.to_json
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Gitlabuddy
|
2
|
+
class Project
|
3
|
+
require 'gitlabuddy/request'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
def self.all
|
7
|
+
projects = JSON.parse(
|
8
|
+
Gitlabuddy::Request.new('https://gitlab.com/api/v3/projects')
|
9
|
+
.send
|
10
|
+
.body
|
11
|
+
)
|
12
|
+
|
13
|
+
puts projects
|
14
|
+
projects
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.cookbook?(project_id)
|
18
|
+
file = JSON.parse(
|
19
|
+
Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project_id}/repository/files?file_path=metadata.rb&ref=master")
|
20
|
+
.send
|
21
|
+
.body
|
22
|
+
)
|
23
|
+
|
24
|
+
is_cookbook = file['file_name'] ? true : false
|
25
|
+
|
26
|
+
puts is_cookbook
|
27
|
+
is_cookbook
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Gitlabuddy
|
2
|
+
class Request
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
def initialize(url)
|
6
|
+
@url = URI(url)
|
7
|
+
end
|
8
|
+
|
9
|
+
def send
|
10
|
+
req = Net::HTTP::Get.new(@url)
|
11
|
+
req['PRIVATE-TOKEN'] = ENV['GITLAB_PRIVATE_TOKEN']
|
12
|
+
http = Net::HTTP.new(@url.host, @url.port)
|
13
|
+
http.use_ssl = (@url.scheme == 'https')
|
14
|
+
http.request(req)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/gitlabuddy.rb
ADDED
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitlabuddy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Infralovers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.19.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.19.1
|
27
|
+
description: A gem to interact with GitLab
|
28
|
+
email: team@infralovers.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- lib/gitlabuddy.rb
|
34
|
+
- lib/gitlabuddy/cli.rb
|
35
|
+
- lib/gitlabuddy/merge_request.rb
|
36
|
+
- lib/gitlabuddy/project.rb
|
37
|
+
- lib/gitlabuddy/request.rb
|
38
|
+
homepage: http://rubygems.org/gems/gitlabuddy
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 2.6.4
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Gitlabuddy!
|
62
|
+
test_files: []
|
63
|
+
has_rdoc:
|