gh_coab 0.1.3 → 0.1.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -7
- data/exe/gh_coab +1 -1
- data/lib/gh_coab/gh_client.rb +6 -10
- data/lib/gh_coab/gh_coab.rb +2 -0
- data/lib/gh_coab/gh_service.rb +2 -0
- data/lib/gh_coab/version.rb +1 -1
- data/lib/gh_coab.rb +2 -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: a90a5e5b80bf4e34cba67e8a6888afaf9fbbd8a06ded6cfc3d5805b7da7abbcb
|
4
|
+
data.tar.gz: 7b257bb422c0ca8570bec5f14f100c3e1edfdbfcfa276914ce568b8c89802843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968f5f5062ae81bc5df48f33cf14597164137aa40650923bb8644ca4774615e8b2072cae867c8bfbfb4edeb0339377c1fe1343ad41e05cf8f88d1fd3ef0a2ac2
|
7
|
+
data.tar.gz: b3595c0a2381004f8dac3c0e63bab319e3ccba6294bdc0facf99c618c58483219b0ec9007f5454ffbb61ef6fefcb593860e48576620cb6d0ddda5775d257c261
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,21 @@
|
|
1
1
|
# GhCoab
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gh_coab`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
This is a very simple gem. It helps you get the "Co-authored-by" text to add a co-author to a commit. You call the method in your terminal `gh_coab s -u <GITHUB_USERNAME>` and the gem does an api call to the public events of the author to find emails associated with it.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
7
|
|
11
8
|
Install the gem and add to the application's Gemfile by executing:
|
12
9
|
|
13
|
-
$ bundle add
|
10
|
+
$ bundle add gh_coab
|
14
11
|
|
15
12
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
13
|
|
17
|
-
$ gem install
|
14
|
+
$ gem install gh_coab
|
18
15
|
|
19
16
|
## Usage
|
20
17
|
|
21
|
-
|
18
|
+
`gh_coab s -u <GITHUB_USERNAME>`
|
22
19
|
|
23
20
|
## Development
|
24
21
|
|
data/exe/gh_coab
CHANGED
data/lib/gh_coab/gh_client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "net/http"
|
2
4
|
require "benchmark"
|
3
5
|
require "json"
|
@@ -45,11 +47,7 @@ class GhClient
|
|
45
47
|
unless success?(response)
|
46
48
|
error_message = "ERROR - code: #{response.code} - #{response.message} - #{response.body}"
|
47
49
|
|
48
|
-
|
49
|
-
client_error_class.new(
|
50
|
-
error_message
|
51
|
-
)
|
52
|
-
)
|
50
|
+
raise client_error_class, error_message
|
53
51
|
end
|
54
52
|
|
55
53
|
parsed_response
|
@@ -68,11 +66,9 @@ class GhClient
|
|
68
66
|
rescue JSON::ParserError
|
69
67
|
Rails.logger.error("Failed to parse response that was expected to be JSON: #{body}")
|
70
68
|
|
71
|
-
if raise_on_parsing_error
|
72
|
-
|
73
|
-
|
74
|
-
{}
|
75
|
-
end
|
69
|
+
raise raise_on_parsing_error.new, "Could not parse response: #{body}" if raise_on_parsing_error
|
70
|
+
|
71
|
+
{}
|
76
72
|
end
|
77
73
|
end
|
78
74
|
|
data/lib/gh_coab/gh_coab.rb
CHANGED
data/lib/gh_coab/gh_service.rb
CHANGED
@@ -5,6 +5,7 @@ class GhService
|
|
5
5
|
class GhClientError < StandardError; end
|
6
6
|
|
7
7
|
attr_reader :client_error_class
|
8
|
+
|
8
9
|
def initialize
|
9
10
|
@client_error_class = GhClientError
|
10
11
|
end
|
@@ -13,6 +14,7 @@ class GhService
|
|
13
14
|
response = client.get_events(username)
|
14
15
|
response.map do |event|
|
15
16
|
next if event.dig(:payload, :commits).nil?
|
17
|
+
|
16
18
|
event[:payload][:commits].map do |commit|
|
17
19
|
{name: commit[:author][:name], email: commit[:author][:email]}
|
18
20
|
end
|
data/lib/gh_coab/version.rb
CHANGED
data/lib/gh_coab.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh_coab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- george kosmopoulos
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "Get co-authors from github \n in your terminal type gh_coab s -u <github_username>
|
14
14
|
\n or gh_coab show -u <github_username> \n and you will get the message you need
|