Class: Gitlabuddy::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlabuddy/project.rb

Class Method Summary collapse

Class Method Details

.allObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/gitlabuddy/project.rb', line 6

def self.all
  projects = JSON.parse(
    Gitlabuddy::Request.new('https://gitlab.com/api/v3/projects')
      .send
      .body
  )

  puts projects
  projects
end

.project_type(project_id) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gitlabuddy/project.rb', line 17

def self.project_type(project_id)
  files = JSON.parse(
    Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project_id}/repository/tree")
      .send
      .body
  )

  type = case files.to_s
         when /Gemfile/
           'ruby'
         when /metadata.rb/
           'cookbook'
         else
           'unknown'
         end

  puts type
  type
end