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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a25fa8b28a96b85a5f97858c7b8a5e08f01ec457416d0e538357d60e1541a54b
4
- data.tar.gz: beac387ea06182f391494580e0f53aa1af883fd177a33fdaaf81051f783d80f2
3
+ metadata.gz: a90a5e5b80bf4e34cba67e8a6888afaf9fbbd8a06ded6cfc3d5805b7da7abbcb
4
+ data.tar.gz: 7b257bb422c0ca8570bec5f14f100c3e1edfdbfcfa276914ce568b8c89802843
5
5
  SHA512:
6
- metadata.gz: 704fa839d3c918cd3ae215978fe8cbdbebb40fcb51efc86ef1d3a042a332c843458d93adf612e78d5ce152aa965329394f6eade9d4c6e0a6eebedf9b44aa0b73
7
- data.tar.gz: b7ba49355b63dd218f6bc3a1cb48b030dcf4843eae7405e93a39cf283f354daf58c830f56a8c6864ff62f24f4b711f96c721db7c0c907a45eea3ff3b0a44a8a4
6
+ metadata.gz: 968f5f5062ae81bc5df48f33cf14597164137aa40650923bb8644ca4774615e8b2072cae867c8bfbfb4edeb0339377c1fe1343ad41e05cf8f88d1fd3ef0a2ac2
7
+ data.tar.gz: b3595c0a2381004f8dac3c0e63bab319e3ccba6294bdc0facf99c618c58483219b0ec9007f5454ffbb61ef6fefcb593860e48576620cb6d0ddda5775d257c261
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gh_coab (0.1.1)
4
+ gh_coab (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,24 +1,21 @@
1
1
  # GhCoab
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
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 UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
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 UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
+ $ gem install gh_coab
18
15
 
19
16
  ## Usage
20
17
 
21
- TODO: Write usage instructions here
18
+ `gh_coab s -u <GITHUB_USERNAME>`
22
19
 
23
20
  ## Development
24
21
 
data/exe/gh_coab CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "gh_coab"
5
+ require_relative "../lib/gh_coab.rb"
6
6
 
7
7
  GhCoab::CLI.start
8
8
  # You can add fixtures and/or initialization code here to make experimenting
@@ -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
- fail(
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
- raise raise_on_parsing_error.new, "Could not parse response: #{body}"
73
- else
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "gh_service"
2
4
  module GhCoab
3
5
  class GhCoab
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GhCoab
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/lib/gh_coab.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "thor"
2
4
  require_relative "gh_coab/gh_coab"
3
5
  # frozen_string_literal: true
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.3
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-06 00:00:00.000000000 Z
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