git_helper 1.1.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8f1759701099c875fd08dd2b4fe00f55732c7d005a3437a5adea5019bbcf78b
4
- data.tar.gz: e659e2c1bc529059854e9d35daa3d8afea6f9e13877d6cd1681b621a299995f0
3
+ metadata.gz: 130ab19f392a258f0869dc46d7791b041da124d640d7d403233ea4dedb9c0877
4
+ data.tar.gz: 3be0a8d79b78e8a56e09f658dcaa7c19ee944a19b49e0da1c4c49752608454c5
5
5
  SHA512:
6
- metadata.gz: 01f01fcf9cb8e962a07488e76ae04f2ac0b0e612c089b7479da39f26598adccd8c005fa85d38bd430a5642fc8d1760e4738d3ef76759c77eb7cbce1926ff34d3
7
- data.tar.gz: 9e7b63ec6d2ed7b62ca689c1cfd33eeb5830becdfef13fffe06f068a9181834393e5f4ff3f1885df2f63b12a1a90f4f22024d4d72a3d88ea4c0c7191a8fa90a8
6
+ metadata.gz: 84351ee9438d3f8579ffa655ab10d50f156df16f8cb0421503363bff82870432683e511291a852ec47b8802ff1827b21dd15e1fe2fe4ce18fe8bc5576515ae28
7
+ data.tar.gz: 8195c5bfd1760835379de77182302e329579cd16b92b03bb5e646e042c73124a32156477a1b7623e1ed495619745aa33891aae86cbfd3c0c66d12b48aabbf8b4
data/README.md CHANGED
@@ -162,3 +162,14 @@ To submit a feature request, bug ticket, etc, please submit an official [GitHub
162
162
  To report any security vulnerabilities, please view this project's [Security Policy](https://github.com/emmasax4/git_helper/security/policy).
163
163
 
164
164
  This repository does have a standard [Code of Conduct](https://github.com/emmasax4/git_helper/blob/main/.github/code_of_conduct.md).
165
+
166
+ ## Releasing
167
+
168
+ To make a new release of this gem:
169
+
170
+ 1. Merge the pull request via the big green button
171
+ 2. Run `git tag vX.X.X` and `git push --tag`
172
+ 3. Make a new release [here](https://github.com/emmasax4/git_helper/releases/new)
173
+ 4. Run `gem build *.gemspec`
174
+ 5. Run `gem push *.gem` to push the new gem to RubyGems
175
+ 6. Run `rm *.gem` to clean up your local repository
@@ -15,7 +15,7 @@ module GitHelper
15
15
  }
16
16
 
17
17
  puts "Creating merge request: #{new_mr_title}"
18
- mr = gitlab_client.create_merge_request(local_repo, new_mr_title, options)
18
+ mr = gitlab_client.create_merge_request(local_project, new_mr_title, options)
19
19
 
20
20
  if mr.diff_refs.base_sha == mr.diff_refs.head_sha
21
21
  puts "Merge request was created, but no commits have been pushed to GitLab: #{mr.web_url}"
@@ -41,7 +41,7 @@ module GitHelper
41
41
  options[:squash_commit_message] = existing_mr_title
42
42
 
43
43
  puts "Merging merge request: #{mr_id}"
44
- merge = gitlab_client.accept_merge_request(local_repo, mr_id, options)
44
+ merge = gitlab_client.accept_merge_request(local_project, mr_id, options)
45
45
  puts "Merge request successfully merged: #{merge.merge_commit_sha}"
46
46
  rescue Gitlab::Error::MethodNotAllowed => e
47
47
  puts 'Could not merge merge request:'
@@ -55,8 +55,8 @@ module GitHelper
55
55
  end
56
56
  end
57
57
 
58
- private def local_repo
59
- # Get the repository by looking in the remote URLs for the full repository name
58
+ private def local_project
59
+ # Get the project by looking in the remote URLs for the full project name
60
60
  remotes = `git remote -v`
61
61
  return remotes.scan(/\S[\s]*[\S]+.com[\S]{1}([\S]*).git/).first.first
62
62
  end
@@ -81,7 +81,7 @@ module GitHelper
81
81
  end
82
82
 
83
83
  private def existing_mr_title
84
- @existing_mr_title ||= gitlab_client.merge_request(local_repo, mr_id).title
84
+ @existing_mr_title ||= gitlab_client.merge_request(local_project, mr_id).title
85
85
  end
86
86
 
87
87
  private def new_mr_title
@@ -101,7 +101,20 @@ module GitHelper
101
101
  end
102
102
 
103
103
  private def default_branch
104
- @default_branch ||= gitlab_client.branches(local_repo).select { |branch| branch.default }.first.name
104
+ return @default_branch if @default_branch
105
+ page_number = 1
106
+ counter = 1
107
+ branches = []
108
+
109
+ while counter > 0
110
+ break if default_branch = branches.select { |branch| branch.default }.first
111
+ page_branches = gitlab_client.branches(local_project, page: page_number, per_page: 100)
112
+ branches = page_branches
113
+ counter = page_branches.count
114
+ page_number += 1
115
+ end
116
+
117
+ @default_branch = default_branch.name
105
118
  end
106
119
 
107
120
  private def template_to_apply
@@ -1,3 +1,3 @@
1
1
  module GitHelper
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emma Sax
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-10 00:00:00.000000000 Z
11
+ date: 2020-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab