geet 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/Gemfile +10 -0
  4. data/Gemfile.lock +31 -0
  5. data/README.md +0 -2
  6. data/bin/geet +50 -39
  7. data/geet.gemspec +1 -1
  8. data/lib/geet/commandline/commands.rb +14 -0
  9. data/lib/geet/{helpers/configuration_helper.rb → commandline/configuration.rb} +4 -12
  10. data/lib/geet/git/repository.rb +93 -44
  11. data/lib/geet/{git_hub → github}/abstract_issue.rb +13 -13
  12. data/lib/geet/github/account.rb +19 -0
  13. data/lib/geet/{git_hub/api_helper.rb → github/api_interface.rb} +21 -19
  14. data/lib/geet/github/collaborator.rb +17 -0
  15. data/lib/geet/{git_hub → github}/gist.rb +4 -4
  16. data/lib/geet/{git_hub → github}/issue.rb +10 -10
  17. data/lib/geet/github/label.rb +17 -0
  18. data/lib/geet/{git_hub → github}/milestone.rb +11 -11
  19. data/lib/geet/github/pr.rb +61 -0
  20. data/lib/geet/services/create_gist.rb +4 -4
  21. data/lib/geet/services/create_issue.rb +30 -25
  22. data/lib/geet/services/create_pr.rb +28 -27
  23. data/lib/geet/services/list_issues.rb +2 -2
  24. data/lib/geet/services/list_labels.rb +2 -2
  25. data/lib/geet/services/list_milestones.rb +10 -10
  26. data/lib/geet/services/list_prs.rb +2 -2
  27. data/lib/geet/services/merge_pr.rb +8 -7
  28. data/lib/geet/version.rb +1 -1
  29. data/spec/integration/create_gist_spec.rb +46 -0
  30. data/spec/integration/create_issue_spec.rb +66 -0
  31. data/spec/integration/create_pr_spec.rb +68 -0
  32. data/spec/integration/list_issues_spec.rb +52 -0
  33. data/spec/integration/list_labels_spec.rb +28 -0
  34. data/spec/integration/list_milestones_spec.rb +43 -0
  35. data/spec/integration/list_prs_spec.rb +52 -0
  36. data/spec/integration/merge_pr_spec.rb +30 -0
  37. data/spec/spec_helper.rb +121 -0
  38. data/spec/vcr_cassettes/create_gist_private.yml +80 -0
  39. data/spec/vcr_cassettes/create_gist_public.yml +80 -0
  40. data/spec/vcr_cassettes/create_issue.yml +534 -0
  41. data/spec/vcr_cassettes/create_issue_upstream.yml +235 -0
  42. data/spec/vcr_cassettes/create_pr.yml +693 -0
  43. data/spec/vcr_cassettes/create_pr_upstream.yml +313 -0
  44. data/spec/vcr_cassettes/list_issues.yml +82 -0
  45. data/spec/vcr_cassettes/list_issues_upstream.yml +84 -0
  46. data/spec/vcr_cassettes/list_labels.yml +78 -0
  47. data/spec/vcr_cassettes/list_milestones.yml +468 -0
  48. data/spec/vcr_cassettes/list_prs.yml +84 -0
  49. data/spec/vcr_cassettes/list_prs_upstream.yml +80 -0
  50. data/spec/vcr_cassettes/merge_pr.yml +156 -0
  51. metadata +36 -11
  52. data/lib/geet/git_hub/account.rb +0 -19
  53. data/lib/geet/git_hub/pr.rb +0 -57
  54. data/lib/geet/git_hub/remote_repository.rb +0 -65
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'abstract_issue'
4
- require_relative 'api_helper'
5
- require_relative 'gist'
6
- require_relative 'issue'
7
- require_relative 'milestone'
8
- require_relative 'pr'
9
-
10
- module Geet
11
- module GitHub
12
- class RemoteRepository
13
- def initialize(local_repository, api_helper)
14
- @local_repository = local_repository
15
- @api_helper = api_helper
16
- end
17
-
18
- def collaborators
19
- url = "#{@api_helper.api_repo_link}/collaborators"
20
- response = @api_helper.send_request(url, multipage: true)
21
-
22
- response.map { |user_entry| user_entry.fetch('login') }
23
- end
24
-
25
- def labels
26
- url = "#{@api_helper.api_repo_link}/labels"
27
- response = @api_helper.send_request(url, multipage: true)
28
-
29
- response.map { |label_entry| label_entry['name'] }
30
- end
31
-
32
- def create_gist(filename, content, description: nil, publik: false)
33
- Geet::GitHub::Gist.create(filename, content, @api_helper, description: description, publik: publik)
34
- end
35
-
36
- def create_issue(title, description)
37
- Geet::GitHub::Issue.create(title, description, @api_helper)
38
- end
39
-
40
- def abstract_issues(milestone: nil)
41
- Geet::GitHub::AbstractIssue.list(@api_helper, milestone: milestone)
42
- end
43
-
44
- def issues
45
- Geet::GitHub::Issue.list(@api_helper)
46
- end
47
-
48
- def milestone(number)
49
- Geet::GitHub::Milestone.find(number, @api_helper)
50
- end
51
-
52
- def milestones
53
- Geet::GitHub::Milestone.list(@api_helper)
54
- end
55
-
56
- def create_pr(title, description, head)
57
- Geet::GitHub::PR.create(@local_repository, title, description, head, @api_helper)
58
- end
59
-
60
- def prs(head: nil)
61
- Geet::GitHub::PR.list(@api_helper, head: head)
62
- end
63
- end
64
- end
65
- end