gitlabuddy 0.0.2 → 0.0.3

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: 0ddce23f909bd5564fc08cd02b113975393bdf94
4
- data.tar.gz: 4993a67e63af91da706655ccdd03a2fa9d97f82f
3
+ metadata.gz: eeeb03b7c68802d829e2e840f2121ab3a5fd2b4c
4
+ data.tar.gz: 859c5ad16cec533dee3a09cbf33c225af2ac9873
5
5
  SHA512:
6
- metadata.gz: 0d5168baf748dbc418964fd343f2a6e6729f3bd85e027e319f2350f927de3c91040ca388855dfae4cd936d1d35283aeb8d87b20bbeb2538ca121f327791019ad
7
- data.tar.gz: 1d9767b9780d36bf89016f45160a4ed24679e6ff960113da0cb0d5df1760c9c8a76de0d1cf8088984c487fbc1e3bb983f8492c00defb62349ad059542f4417a7
6
+ metadata.gz: 7479349662d0e605b1693df9f3dafd3f074b217089dbb4d2613f80cd8a2bd0222e536ac2be8a9bff46154c6a648ee9079b4a765a252eb7a5a278b6f82769e8c1
7
+ data.tar.gz: cb3414700e2f3af53fc818f3970fe560c035312be6a6a6aabc3183170daf9073e7f2e53dfb2600f32ea94b4a0b1e70ac53b20c7c08527d40e8e08d6dc64ab19b
@@ -14,10 +14,10 @@ module Gitlabuddy
14
14
  Gitlabuddy::MergeRequest.all
15
15
  end
16
16
 
17
- desc 'cookbook PROJECT_ID', 'This will check if a certain project is a cookbook'
18
- def cookbook(project_id)
17
+ desc 'project_type PROJECT_ID', 'This will return the project type of a certain project'
18
+ def project_type(project_id)
19
19
  require 'gitlabuddy/project'
20
- Gitlabuddy::Project.cookbook?(project_id)
20
+ Gitlabuddy::Project.project_type(project_id)
21
21
  end
22
22
  end
23
23
  end
@@ -14,17 +14,24 @@ module Gitlabuddy
14
14
  projects
15
15
  end
16
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")
17
+ def self.project_type(project_id)
18
+ files = JSON.parse(
19
+ Gitlabuddy::Request.new("https://gitlab.com/api/v3/projects/#{project_id}/repository/tree")
20
20
  .send
21
21
  .body
22
22
  )
23
23
 
24
- is_cookbook = file['file_name'] ? true : false
24
+ type = case files.to_s
25
+ when /Gemfile/
26
+ 'ruby'
27
+ when /metadata.rb/
28
+ 'cookbook'
29
+ else
30
+ 'unknown'
31
+ end
25
32
 
26
- puts is_cookbook
27
- is_cookbook
33
+ puts type
34
+ type
28
35
  end
29
36
  end
30
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlabuddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infralovers