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

.cookbook?(project_id) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gitlabuddy/project.rb', line 17

def self.cookbook?(project_id)
  file = JSON.parse(
    Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project_id}/repository/files?file_path=metadata.rb&ref=master")
      .send
      .body
  )

  is_cookbook = file['file_name'] ? true : false

  puts is_cookbook
  is_cookbook
end