github-lister-core 0.1.0

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.
@@ -0,0 +1,113 @@
1
+ #
2
+ # Require the external gems
3
+ #
4
+ require 'json'
5
+ require 'octokit'
6
+ require 'parallel'
7
+
8
+ #
9
+ # Require the internal components
10
+ #
11
+ require_relative 'github-lister-core/client'
12
+ require_relative 'github-lister-core/errors'
13
+ require_relative 'github-lister-core/languages'
14
+ require_relative 'github-lister-core/organisations'
15
+ require_relative 'github-lister-core/preview'
16
+ require_relative 'github-lister-core/releases'
17
+ require_relative 'github-lister-core/repos'
18
+ require_relative 'github-lister-core/topics'
19
+ require_relative 'github-lister-core/users'
20
+ require_relative 'github-lister-core/utils'
21
+ require_relative 'github-lister-core/version'
22
+ require_relative 'github-lister-core/wrapper'
23
+
24
+ #
25
+ # This is the main class
26
+ #
27
+ # This class smells of :reek:RepeatedConditional
28
+ class GithubListerCore
29
+ class << self
30
+ #
31
+ # stuff goes here
32
+ #
33
+ def user_repos(options = {})
34
+ validate_options(options)
35
+ client = init_client(options)
36
+ users = get_user_list(client, options)
37
+
38
+ if flag_set?(options, :use_slugs)
39
+ user_repo_slugs_private(client, options, users)
40
+ else
41
+ user_repos_private(client, options, users)
42
+ end
43
+ end
44
+
45
+ #
46
+ # Get a list of repos got a given organisation
47
+ # If the user is authenticated and a member of the org it will list private + public
48
+ #
49
+ def org_repos(options = {})
50
+ validate_options(options)
51
+ client = init_client(options)
52
+ orgs = get_org_list(options)
53
+
54
+ if flag_set?(options, :use_slugs)
55
+ org_repo_slugs_private(client, orgs).to_json
56
+ else
57
+ org_repos_private(client, options, orgs).to_json
58
+ end
59
+ end
60
+
61
+ #
62
+ # Get a list of repos for ALL organisations that a user is a member of
63
+ # If the user is authenticated and a member of the org it will list private + public
64
+ #
65
+ def org_members_repos(options = {})
66
+ validate_options(options)
67
+ client = init_client(options)
68
+ users = get_user_list(client, options)
69
+
70
+ if flag_set?(options, :use_slugs)
71
+ org_members_repo_slugs_private(client, users).to_json
72
+ else
73
+ org_members_repos_private(client, options, users).to_json
74
+ end
75
+ end
76
+
77
+ #
78
+ # Generate a slub list of repos for all organisations that a user is a member of
79
+ #
80
+ def all_repos(options = {})
81
+ validate_options(options)
82
+ client = init_client(options)
83
+ user = get_user_list(client, options)
84
+
85
+ if flag_set?(options, :use_slugs)
86
+ all_repo_slugs_private(client, user).to_json
87
+ else
88
+ all_repos_private(client, options, user).to_json
89
+ end
90
+ end
91
+
92
+ #
93
+ # These are the public wrappers which return json encoded objects.
94
+ #
95
+
96
+ def org_membership(options = {})
97
+ validate_options(options)
98
+ client = init_client(options)
99
+ users = get_user_list(client, options)
100
+
101
+ if flag_set?(options, :use_slugs)
102
+ org_membership_slugs_private(client, users).to_json
103
+ else
104
+ org_membership_private(client, users).to_json
105
+ end
106
+ end
107
+ end
108
+ end
109
+
110
+ #
111
+ # Add an alias because the name is long
112
+ #
113
+ GLC = GithubListerCore
data/stale.yml ADDED
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: true
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This is a very simply testing script to allow for testing of local changes without having to install the gem locally
4
+ #
5
+
6
+ require 'json'
7
+
8
+ $LOAD_PATH.unshift('./lib')
9
+
10
+ require 'bundler/setup'
11
+ require 'github-lister-core'
12
+
13
+ config = {}
14
+
15
+ def count_results(results)
16
+ puts JSON.parse(results).size
17
+ end
18
+
19
+ def display_results(results)
20
+ puts JSON.pretty_generate(JSON.parse(results))
21
+ end
22
+
23
+ count_results(GithubListerCore.user_repos(config))
24
+ display_results(GithubListerCore.user_repos(config))
25
+
26
+ count_results(GithubListerCore.org_repos(config))
27
+ display_results(GithubListerCore.org_repos(config))
28
+
29
+ count_results(GithubListerCore.org_members_repos(config))
30
+ display_results(GithubListerCore.org_members_repos(config))
31
+
32
+ count_results(GithubListerCore.all_repos(config))
33
+ display_results(GithubListerCore.all_repos(config))
34
+
35
+ count_results(GithubListerCore.org_membership(config))
36
+ display_results(GithubListerCore.org_membership(config))
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github-lister-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tim Gurney aka Wolf
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: octokit
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: parallel
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: reek
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '6'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '6'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.11.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.11.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: octokit
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '4'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '4'
125
+ - !ruby/object:Gem::Dependency
126
+ name: parallel
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.2'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.2'
139
+ description: The aim of the gem is to provide a simple, fast and, clean way to extra
140
+ repository information from GitHub. It comes with a number of methods but it is
141
+ intentionally limited to repository based information.
142
+ email:
143
+ - wolf@tgwolf.com
144
+ executables: []
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".github/CODEOWNERS"
149
+ - ".github/CODE_OF_CONDUCT.md"
150
+ - ".github/CONTRIBUTING.md"
151
+ - ".github/FUNDING.yml"
152
+ - ".github/ISSUE_TEMPLATE/ask_question.md"
153
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
154
+ - ".github/ISSUE_TEMPLATE/config.yml"
155
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
156
+ - ".github/PULL_REQUEST_TEMPLATE.md"
157
+ - ".github/SECURITY.md"
158
+ - ".github/SUPPORT.md"
159
+ - ".gitignore"
160
+ - ".reek.yml"
161
+ - ".rspec"
162
+ - ".rubocop.yml"
163
+ - ".travis.yml"
164
+ - CHANGELOG.md
165
+ - Gemfile
166
+ - LICENSE.md
167
+ - README.md
168
+ - Rakefile
169
+ - VERSION.txt
170
+ - bin/console
171
+ - bin/setup
172
+ - github-lister-core.gemspec
173
+ - lib/github-lister-core.rb
174
+ - lib/github-lister-core/client.rb
175
+ - lib/github-lister-core/errors.rb
176
+ - lib/github-lister-core/languages.rb
177
+ - lib/github-lister-core/organisations.rb
178
+ - lib/github-lister-core/preview.rb
179
+ - lib/github-lister-core/releases.rb
180
+ - lib/github-lister-core/repos.rb
181
+ - lib/github-lister-core/topics.rb
182
+ - lib/github-lister-core/users.rb
183
+ - lib/github-lister-core/utils.rb
184
+ - lib/github-lister-core/version.rb
185
+ - lib/github-lister-core/wrapper.rb
186
+ - stale.yml
187
+ - testing/get-raw.rb
188
+ homepage: https://github.com/DevelopersToolbox/github-lister-core
189
+ licenses:
190
+ - MIT
191
+ metadata:
192
+ homepage_uri: https://github.com/DevelopersToolbox/github-lister-core
193
+ source_code_uri: https://github.com/DevelopersToolbox/github-lister-core
194
+ changelog_uri: https://github.com/DevelopersToolbox/github-lister-core/blob/master/CHANGELOG.md
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ required_ruby_version: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: 2.5.0
204
+ required_rubygems_version: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ requirements: []
210
+ rubygems_version: 3.1.4
211
+ signing_key:
212
+ specification_version: 4
213
+ summary: Provide a simple, fast and, clean way to extract repository information from
214
+ GitHub.
215
+ test_files: []