Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

rake hubstats:setup : NoMethodError: undefined method `has_key?' for nil:NilClass #105

Open
zbentahar opened this issue Jun 13, 2016 · 4 comments

Comments

@zbentahar
Copy link

When I run rake hubstats:setup, I got this error :

NoMethodError: undefined method has_key?' for nil:NilClass /Users/zakariabentahar/Downloads/hubstats-master/lib/hubstats/github_api.rb:55:inget_repos'
/Users/zakariabentahar/Downloads/hubstats-master/lib/tasks/populate_task.rake:7:in block (3 levels) in <top (required)>' /Users/zakariabentahar/Downloads/hubstats-master/lib/tasks/hubstats_tasks.rake:11:inblock (2 levels) in <top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'

Any idea ? thx

@emmahsax
Copy link
Contributor

emmahsax commented Sep 28, 2016

Sorry this has taken us so long to get back. Where this looks to be breaking is this line:

if Hubstats.config.github_config.has_key?("org_name") == false

at https://github.com/sportngin/hubstats/blob/master/lib/hubstats/github_api.rb#L55. My guess is that you don't have a config file setup correctly, and that's why Hubstats.config.github_config is coming out nil.

Your config file should look like this:

github_auth: # Must include either access_token || (client_id && client_secret)
   access_token: # your access token
  # client_id: <CLIENT ID>
  # client_secret: <CLIENT SECRET>

github_config: # Must include org_name. The repo_list, team_list, and ignore_users_list are optional.
   org_name: sportngin  # or whatever your org name is
   team_list: # your list of teams; but this is optional
   - Team 1
   - Team 2
   - Team 3
   repo_list:  # or your list of repos; this is optional
   - sportngin/hubstats
   - sportngin/sport_ngin_aws_auditor
   - sportngin/rds-pgbadger
   ignore_users_list: # this is optional
   - hubstats

webhook_secret: #<40 CHARACTER ACCESS TOKEN >
webhook_endpoint: #<url of webhook endpoint>

@pilipenok
Copy link

pilipenok commented Jul 14, 2017

@emmasax4
I also got this issue yesterday on mobile_service.
The problem is that https://github.com/sportngin/mobile_service/blob/master/config/octokit_example.yml has like ENV format config with default, development and test scopes.
But Hubstats wants github_config without any scopes

@emmahsax
Copy link
Contributor

@pilipenok I believe this issue has to do with the original setup of Hubstats, which doesn't read the .octokit.yml of our repos.

@pilipenok
Copy link

pilipenok commented Jul 14, 2017

@emmasax4
agreed with .octokit.yml (in the repo's root)
but I have the same issue with repo's config/octokit.yml

works for me when I add Hubstat config keys there without scopes.
but I believe you should know this case

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants