whatsup_github 0.4.1 → 0.4.2

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: d76d974b6feb2663b6234906cde7aee2011f6fe1c87c2e90f7e4791e4f2b04a7
4
- data.tar.gz: fb62023682520d065cfdf326300f576b38e85fea9fcf7e203b8105cae4278b94
3
+ metadata.gz: 47baad7941df565f9c94827246aac88071c87bda1a975500e7365f0e225ec558
4
+ data.tar.gz: de4dc002c57c8a5cf7adb7a440ece5cbd135ba0941b450c3406308838a492ddc
5
5
  SHA512:
6
- metadata.gz: d50707d1f9eb818a36aec8bdc46d19d3543b037b94f9452b3734888184cf77c319364bdd5dc1a5675a4cd90718c808ad7b12052ffcba80d0ac43bd4652eb3d70
7
- data.tar.gz: 2032e86160a162ba96521fcb3f7f4ae042c9494e12786e22e28ac4a75d0fcb0ae5c3154f03fe69c1616e0f1cd81eacc2c4166393287708d9535dd1e79eaf46cd
6
+ metadata.gz: 83358141ba037b13e106d49e9d1bf23c22b2f41ddada945e87c8e3a5319c9f26e664f67e3db68a27799786f866d93b634cf6f9949ef3e0266a91dd2bfa65d3d6
7
+ data.tar.gz: 55babd4c4a276620f8c4ba198c1e6cd0e40eabc9385b674d6567d6f4607be2bb8b2ba19fa25164fae49c5f327f5b52dae55022f7defc09c6f93f3d1a3f8ec1b1
@@ -0,0 +1,11 @@
1
+ ---
2
+ #######################
3
+ # Rubocop Config file #
4
+ #######################
5
+
6
+ inherit_gem:
7
+ rubocop-github:
8
+ - config/default.yml
9
+
10
+ Style/StringLiterals:
11
+ EnforcedStyle: single_quotes
@@ -0,0 +1,48 @@
1
+ ---
2
+ ###########################
3
+ ###########################
4
+ ## Linter GitHub Actions ##
5
+ ###########################
6
+ ###########################
7
+ name: Lint Code Base
8
+
9
+ #
10
+ # Documentation:
11
+ # https://help.github.com/en/articles/workflow-syntax-for-github-actions
12
+ #
13
+
14
+ ###################################
15
+ # Start the job on a pull request #
16
+ ###################################
17
+ on:
18
+ pull_request
19
+
20
+ ###############
21
+ # Set the Job #
22
+ ###############
23
+ jobs:
24
+ super-lint:
25
+ # Set the agent to run on
26
+ runs-on: ubuntu-latest
27
+
28
+ ##################
29
+ # Load all steps #
30
+ ##################
31
+ steps:
32
+ ##########################
33
+ # Checkout the code base #
34
+ ##########################
35
+ - name: Checkout Code
36
+ uses: actions/checkout@v2
37
+ with:
38
+ # Full git history is needed to get a proper list of changed files within `super-linter`
39
+ fetch-depth: 0
40
+
41
+ ################################
42
+ # Run Linter against code base #
43
+ ################################
44
+ - name: Lint Code Base
45
+ uses: github/super-linter@v3
46
+ env:
47
+ VALIDATE_ALL_CODEBASE: false
48
+ DEFAULT_BRANCH: main
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ Fixes:
6
+
7
+ - Fixed a bug with non-working membership
8
+
9
+ Maintenance:
10
+
11
+ - Added code linting
12
+
3
13
  ## 0.4.1
4
14
 
5
15
  - Added authentication via an environment variable `WHATSUP_GITHUB_ACCESS_TOKEN`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whatsup_github (0.4.1)
4
+ whatsup_github (0.4.2)
5
5
  netrc (~> 0.11)
6
6
  octokit (~> 4.20)
7
7
  thor (~> 1.1)
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'singleton'
4
+
5
+ # Client authorization
6
+ module WhatsupGithub
7
+ # Create a singleton object for Client.
8
+ # Authorize with a GitHub token from $WHATSUP_GITHUB_ACCESS_TOKEN if available
9
+ # Otherwise, use credentials from ~/.netrc
10
+ # Otherwise, continue as a Guest
11
+ class Client
12
+ include Singleton
13
+
14
+ WHATSUP_GITHUB_ACCESS_TOKEN = ENV['WHATSUP_GITHUB_ACCESS_TOKEN']
15
+ private_constant :WHATSUP_GITHUB_ACCESS_TOKEN
16
+
17
+ def initialize
18
+ @client =
19
+ if WHATSUP_GITHUB_ACCESS_TOKEN
20
+ Octokit::Client.new(access_token: WHATSUP_GITHUB_ACCESS_TOKEN)
21
+ elsif File.exist? "#{ENV['HOME']}/.netrc"
22
+ Octokit::Client.new(netrc: true)
23
+ else
24
+ Octokit::Client.new
25
+ end
26
+ end
27
+
28
+ def search_issues(query)
29
+ @client.search_issues(query)
30
+ end
31
+
32
+ def pull_request(repo, number)
33
+ @client.pull_request(repo, number)
34
+ end
35
+
36
+ def org_members(org)
37
+ @client.org_members(org)
38
+ end
39
+ end
40
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'octokit'
4
4
  require_relative 'config_reader'
5
+ require_relative 'client'
5
6
 
6
7
  module WhatsupGithub
7
8
  # Gets issues found on GitHub by query
@@ -51,16 +52,7 @@ module WhatsupGithub
51
52
  # Otherwise, use credentials from ~/.netrc
52
53
  # Otherwise, continue as a Guest
53
54
  def client
54
- return @client if @client
55
-
56
- @client =
57
- if ENV['WHATSUP_GITHUB_ACCESS_TOKEN']
58
- Octokit::Client.new(access_token: ENV['WHATSUP_GITHUB_ACCESS_TOKEN'])
59
- elsif File.exist? "#{ENV['HOME']}/.netrc"
60
- Octokit::Client.new(netrc: true)
61
- else
62
- Octokit::Client.new
63
- end
55
+ Client.instance
64
56
  end
65
57
 
66
58
  def search_issues(label)
@@ -3,7 +3,6 @@
3
3
  require_relative 'row'
4
4
  require_relative 'pulls'
5
5
  require_relative 'config_reader'
6
- require_relative 'members'
7
6
 
8
7
  module WhatsupGithub
9
8
  # Creates Row objects for the future table
@@ -82,7 +81,7 @@ module WhatsupGithub
82
81
  def load_members
83
82
  return if @members
84
83
 
85
- @members = Members.new(config.membership).members
84
+ @members = client.org_members(config.membership)
86
85
  end
87
86
 
88
87
  def member_logins
@@ -93,5 +92,9 @@ module WhatsupGithub
93
92
  def config
94
93
  Config.instance
95
94
  end
95
+
96
+ def client
97
+ Client.instance
98
+ end
96
99
  end
97
100
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhatsupGithub
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whatsup_github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dima Shevtsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-06 00:00:00.000000000 Z
11
+ date: 2021-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: netrc
@@ -144,6 +144,8 @@ executables:
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
+ - ".github/linters/.ruby-lint.yml"
148
+ - ".github/workflows/linter.yml"
147
149
  - ".gitignore"
148
150
  - ".rspec"
149
151
  - ".ruby-version"
@@ -160,9 +162,9 @@ files:
160
162
  - lib/template/.whatsup.yml
161
163
  - lib/whatsup_github.rb
162
164
  - lib/whatsup_github/cli.rb
165
+ - lib/whatsup_github/client.rb
163
166
  - lib/whatsup_github/config_reader.rb
164
167
  - lib/whatsup_github/generator.rb
165
- - lib/whatsup_github/members.rb
166
168
  - lib/whatsup_github/pulls.rb
167
169
  - lib/whatsup_github/row.rb
168
170
  - lib/whatsup_github/row_collector.rb
@@ -193,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
195
  - !ruby/object:Gem::Version
194
196
  version: '0'
195
197
  requirements: []
196
- rubygems_version: 3.1.4
198
+ rubygems_version: 3.0.9
197
199
  signing_key:
198
200
  specification_version: 4
199
201
  summary: Collect info from GitHub pull requests.
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module WhatsupGithub
4
- # Members of an organization
5
- class Members
6
- def initialize(org)
7
- @org = org
8
- end
9
-
10
- def client
11
- Octokit::Client.new(netrc: true)
12
- end
13
-
14
- def members
15
- client.org_members @org
16
- end
17
- end
18
- end