git_helper 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -4
- data/lib/git_helper/local_code.rb +8 -4
- data/lib/git_helper/merge_request.rb +1 -0
- data/lib/git_helper/pull_request.rb +1 -0
- data/lib/git_helper/version.rb +1 -1
- data/spec/git_helper/local_code_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34ec4f36cbe8b3cf3875894ee4670a5ca704ce4f67abeac7df2d5778f48a474f
|
4
|
+
data.tar.gz: 51721de128e9639c61c321ef0454c141cad5f91f4ec52ef5aa2161e6bb531c32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f2a22415758219d80055e4ebdb0b954f49bdfb27d2023badea8d0f45e2be151e16d0683c351fd1dd890f7ef864ee5e4291d545af369936e1d65ee0ff14195b4
|
7
|
+
data.tar.gz: e2bdae4669a0331f84ecc50c7f60b1af00e987556ec2644abbe4c0e44cd45185c16820f4d508c451ad4883adf4e19c4a5dac89670bb6b500c2a700ffd0214ac4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,13 +9,15 @@ gem install git_helper
|
|
9
9
|
Some of the commands in this gem can be used without any additional configuration. However, others utilize special GitHub or GitLab configuration. To provide access tokens for this, create a `~/.git_helper/config.yml` file. The contents should look like this:
|
10
10
|
|
11
11
|
```
|
12
|
-
:github_user:
|
12
|
+
:github_user: GITHUB-USERNAME
|
13
13
|
:github_token: GITHUB-TOKEN
|
14
|
-
:gitlab_user:
|
14
|
+
:gitlab_user: GITLAB-USERNAME
|
15
15
|
:gitlab_token: GITLAB-TOKEN
|
16
16
|
```
|
17
17
|
|
18
|
-
To
|
18
|
+
To create or see what access tokens you have, look [here for GitHub personal access tokens](https://github.com/settings/tokens) and [here for GitLab access tokens](https://gitlab.com/profile/personal_access_tokens). You could either have one set of tokens for each computer you use, or just have one set of tokens for all computers that you rotate periodically.
|
19
|
+
|
20
|
+
Once the gem is installed, run this to view the help screen:
|
19
21
|
```bash
|
20
22
|
git-helper --help
|
21
23
|
```
|
@@ -122,7 +124,7 @@ If you're trying to create a code request, the command will provide an autogener
|
|
122
124
|
|
123
125
|
The command will also ask you if the default branch of the repository is the proper base branch to use. You can say 'yes' or 'no'. If you respond 'no', then you can give the command your chosen base base.
|
124
126
|
|
125
|
-
Lastly, for GitHub, it'll ask the user to apply any
|
127
|
+
Lastly, for GitHub, it'll ask the user to apply any pull request templates found at `.github/pull_request_template.md`, `./pull_request_template.md`, or `.github/PULL_REQUEST_TEMPLATE/*.md`. Applying any template is optional, and a user can make an empty pull request if they desire. For GitLab, it'll ask the user to apply any merge request templates found at any `.gitlab/merge_request_template.md`, `./merge_request_template.md`, or `.gitlab/merge_request_templates/*.md`. Applying any template is optional, and from the command's standpoint, a user can make an empty merge request if they desire (although GitLab may still add a merge request template if the project itself requires one). When searching for templates, the code ignores cases, so the file could be named with all capital letters or all lowercase letters.
|
126
128
|
|
127
129
|
If you're requesting to merge a code request, the command will ask you the number ID of the code request you wish to merge. For GitHub, the command will also ask you what type of merge to do: regular merging, squashing, or rebasing. The commit message to use during the merge/squash/rebase will be the title of the pull request. For GitLab, the command will also ask you what type of merge to do: regular merging or squashing. The commit message to use during the merge/squash will be the title of the merge request.
|
128
130
|
|
@@ -85,16 +85,20 @@ module GitHelper
|
|
85
85
|
`git symbolic-ref refs/remotes/origin/HEAD | sed "s@^refs/remotes/origin/@@" | tr -d "\n"`
|
86
86
|
end
|
87
87
|
|
88
|
-
def template_options(
|
88
|
+
def template_options(identifiers)
|
89
89
|
nested_templates = Dir.glob(
|
90
|
-
File.join("
|
90
|
+
File.join("#{identifiers[:template_directory]}/#{identifiers[:nested_directory_name]}", '*.md'),
|
91
91
|
File::FNM_DOTMATCH | File::FNM_CASEFOLD
|
92
92
|
)
|
93
93
|
non_nested_templates = Dir.glob(
|
94
|
-
File.join(
|
94
|
+
File.join(identifiers[:template_directory], "#{identifiers[:non_nested_file_name]}.md"),
|
95
95
|
File::FNM_DOTMATCH | File::FNM_CASEFOLD
|
96
96
|
)
|
97
|
-
|
97
|
+
root_templates = Dir.glob(
|
98
|
+
File.join('.', "#{identifiers[:non_nested_file_name]}.md"),
|
99
|
+
File::FNM_DOTMATCH | File::FNM_CASEFOLD
|
100
|
+
)
|
101
|
+
nested_templates.concat(non_nested_templates).concat(root_templates).uniq
|
98
102
|
end
|
99
103
|
|
100
104
|
def read_template(file_name)
|
@@ -97,6 +97,7 @@ module GitHelper
|
|
97
97
|
|
98
98
|
private def mr_template_options
|
99
99
|
@mr_template_options ||= local_code.template_options({
|
100
|
+
template_directory: '.gitlab',
|
100
101
|
nested_directory_name: 'merge_request_templates',
|
101
102
|
non_nested_file_name: 'merge_request_template'
|
102
103
|
})
|
data/lib/git_helper/version.rb
CHANGED
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: 3.0.
|
4
|
+
version: 3.0.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-10-
|
11
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|