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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e4c2767e4d4858d3ed4f8791d0dc82577e9fdf051aff59b1f6516c4f13bd4a4
4
- data.tar.gz: 686894c11b437666221793b475cdf81eb1c99437fcc1ee87aef6a3c07d33e9a4
3
+ metadata.gz: 34ec4f36cbe8b3cf3875894ee4670a5ca704ce4f67abeac7df2d5778f48a474f
4
+ data.tar.gz: 51721de128e9639c61c321ef0454c141cad5f91f4ec52ef5aa2161e6bb531c32
5
5
  SHA512:
6
- metadata.gz: 32ba80af9ea352cd22c035ecb5e16c2315bae91c9f2b6b3f49a8d5518ffdc4bd533c9b38e6a8652798bd78672e439ba489d8e58346935f3d43ec21dbc3f248ab
7
- data.tar.gz: '093a11e7c9d46548ad0127d31c101a1fcf69e0aba7c7a1e4c1873dbebadb78bb2f3791175c3702b081fb36d788c1bb4cbe0149833ee58180f038269eeb1f2523'
6
+ metadata.gz: 6f2a22415758219d80055e4ebdb0b954f49bdfb27d2023badea8d0f45e2be151e16d0683c351fd1dd890f7ef864ee5e4291d545af369936e1d65ee0ff14195b4
7
+ data.tar.gz: e2bdae4669a0331f84ecc50c7f60b1af00e987556ec2644abbe4c0e44cd45185c16820f4d508c451ad4883adf4e19c4a5dac89670bb6b500c2a700ffd0214ac4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_helper (2.0.2)
4
+ git_helper (3.0.0)
5
5
  gitlab (~> 4.16)
6
6
  gli (~> 2.13)
7
7
  highline (~> 2.0)
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: GITHUB-USERNAME
12
+ :github_user: GITHUB-USERNAME
13
13
  :github_token: GITHUB-TOKEN
14
- :gitlab_user: GITLAB-USERNAME
14
+ :gitlab_user: GITLAB-USERNAME
15
15
  :gitlab_token: GITLAB-TOKEN
16
16
  ```
17
17
 
18
- To view the help screen, run:
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 code request templates found at any `*/pull_request_template.md` file or any file in `.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 `*/merge_request_template.md` file or any file in `.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. If a GitLab project automatically adds a template, then it may create a merge request with a default template anyway.
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(template_identifiers)
88
+ def template_options(identifiers)
89
89
  nested_templates = Dir.glob(
90
- File.join("**/#{template_identifiers[:nested_directory_name]}", "*.md"),
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("**", "#{template_identifiers[:non_nested_file_name]}.md"),
94
+ File.join(identifiers[:template_directory], "#{identifiers[:non_nested_file_name]}.md"),
95
95
  File::FNM_DOTMATCH | File::FNM_CASEFOLD
96
96
  )
97
- nested_templates.concat(non_nested_templates).uniq
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
  })
@@ -94,6 +94,7 @@ module GitHelper
94
94
 
95
95
  private def pr_template_options
96
96
  @pr_template_options ||= local_code.template_options({
97
+ template_directory: '.github',
97
98
  nested_directory_name: 'PULL_REQUEST_TEMPLATE',
98
99
  non_nested_file_name: 'pull_request_template'
99
100
  })
@@ -1,3 +1,3 @@
1
1
  module GitHelper
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.1'
3
3
  end
@@ -164,6 +164,7 @@ describe GitHelper::LocalCode do
164
164
  describe '#template_options' do
165
165
  let(:template_identifiers) do
166
166
  {
167
+ template_directory: '.github',
167
168
  nested_directory_name: 'PULL_REQUEST_TEMPLATE',
168
169
  non_nested_file_name: 'pull_request_template'
169
170
  }
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.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-15 00:00:00.000000000 Z
11
+ date: 2020-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab