wireddown / ghpages-ghcomments

Let GitHub host the comments for your GitHub Pages
http://downtothewire.io/ghpages-ghcomments/
Apache License 2.0
73 stars 7 forks source link

gpgc Errors #17

Closed naveenshaji closed 9 years ago

naveenshaji commented 9 years ago

Hi, I followed the setup instructions from here. But for some reason, I keep getting these two errors. Can you help?

screen shot 2015-05-21 at 4 09 07 am

This is the repo in question.

wireddown commented 9 years ago

Would you also include the full html from the page?

wireddown commented 9 years ago

Nevermind, I found your blog from the repo yml files :-)

http://naveen.io/blog//jekyll/update/2015/05/20/welcome-to-jekyll%20copy%207.html

Do you see the double slash after blog? Perhaps your baseurl in _config.yml should be /blog.

Missing CSS

This is a bug in the diagnostics code: the script is looking for the wrong file name for the CSS. Your CSS is loading correctly, but the diagnostic information is incorrect.

https://github.com/wireddown/ghpages-ghcomments/blob/release/public/js/gpgc_core.js#L643

Missing Issue

Did you install the git hooks? If so, try re-committing and re-pushing your post _posts/2015-05-20-welcome-to-jekyll copy.markdown

Since you enabled diagnostics, the output on the command line will be quite verbose. Please post the output if you are comfortable with that. You might want to read it and redact any private or sensitive information.

wireddown commented 9 years ago

I found another bug in the diagnostic code.

When the script does not find the issue that holds the comments for the post, it uses the wrong variable name and so it will always use undefined.

https://github.com/wireddown/ghpages-ghcomments/blob/release/public/js/gpgc_core.js#L302

wireddown commented 9 years ago

I have updated the gpgc files in the release branch. If you update your blog's files, the error messages should be better behaved.

I expect that the missing CSS error will disappear, and that the missing issue error will use your post's title "Welcome to Jekyll!".

naveenshaji commented 9 years ago

Did you install the git hooks? If so, try re-committing and re-pushing your post _posts/2015-05-20-welcome-to-jekyll copy.markdown

I don't think the hooks installed correctly, because all I'm getting is this: screen

I'm pretty sure i followed the instructions correctly, and my API key had all the scopes checked.

naveenshaji commented 9 years ago

I have updated the gpgc files in the release branch. If you update your blog's files, the error messages should be better behaved.

I expect that the missing CSS error will disappear, and that the missing issue error will use your post's title "Welcome to Jekyll!".

I'll update the files and post a screenshot of the new error message when I get back.

wireddown commented 9 years ago

I don't think the hooks installed correctly

Ok, let's check those.

Is the gpgc script present and callable?

In the terminal, what output do you see from

which gpgcCreateCommentIssue.sh

If nothing prints, then move the script into your path. To see the different locations you can place it, type this at the terminal:

echo $PATH | tr ':' '\n'

Then move the script to one of those places.

If you know you moved the script, but which reports nothing, then it's likely that the script isn't executable. Make it so by typing this in the terminal:

sudo chmod +x /path/to/gpgcCreateCommentIssue.sh

Are the git hooks present?

In your repo root, check for the following two hook scripts:

ls .git/hooks/pre-commit
ls .git/hooks/pre-push

If either script is missing, then re-install the hooks. From your repo root, type:

gpgcCreateCommentIssue.sh install <personal_access_token>
naveenshaji commented 9 years ago

In the terminal, what output do you see from which gpgcCreateCommentIssue.sh

I get

Naveens-MacBook-Pro:~ naveenshaji$ which gpgcCreateCommentIssue.sh
/usr/local/bin/gpgcCreateCommentIssue.sh

In your repo root, check for the following two hook scripts:

Naveens-MacBook-Pro:~ naveenshaji$ cd github/blog
Naveens-MacBook-Pro:blog naveenshaji$ ls .git/hooks/pre-commit
.git/hooks/pre-commit
Naveens-MacBook-Pro:blog naveenshaji$ ls .git/hooks/pre-push
.git/hooks/pre-push
wireddown commented 9 years ago

Ok, great; time to dig deeper.

Compare the contents of your hooks with these below:

pre-commit

### BEGIN hook from wireddown/ghpages-ghcomments

gpgcCreateCommentIssue="\$(which gpgcCreateCommentIssue.sh)"

if test -x "\${gpgcCreateCommentIssue}"; then
  "\${gpgcCreateCommentIssue}" commit
fi

### END hook from wireddown/ghpages-ghcomments

pre-push

### BEGIN hook from wireddown/ghpages-ghcomments

gpgcCreateCommentIssue="\$(which gpgcCreateCommentIssue.sh)"

if test -x "\${gpgcCreateCommentIssue}"; then
  "\${gpgcCreateCommentIssue}" push [access_token]
fi

### END hook from wireddown/ghpages-ghcomments
naveenshaji commented 9 years ago

screen shot 2015-05-21 at 10 55 15 pm

Why do those two hooks have a different icon than the others? Does this mean they are not executable? Could that be the problem?

wireddown commented 9 years ago

Yes. Use the chmod command a few comments above, and I expect you'll see the verbose prints on your next commit and push. There's also a strong chance that you'll be in good working order.

The behavior of which on the Mac surprises me -- on Linux and Windows, it only prints if both

  1. the file is in the $PATH
  2. the file is executable

are true. On the Mac, it appears that only the first condition is used. I will update my setup instructions.

FYI -- your access token is in that image. I would retire that one and use a new one.

naveenshaji commented 9 years ago

FYI -- your access token is in that image. I would retire that one and use a new one.

Oh, wow. These things show up everywhere...

Yes. Use the chmod command a few comments above, and I expect you'll see the verbose prints on your next commit and push. There's also a strong chance that you'll be in good working order.

I get this now when i push

Naveens-MacBook-Pro:blog naveenshaji$ git push origin gh-pages
{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3"
}
For more information, set 'enable_diagnostics' to 'true' in /Users/naveenshaji/github/blog/_data/gpgc.yml
Error: could not create label "label_name: Post Comments" for "repo_owner: naveenshaji/repo_name: blog"

I double checked the scopes on the token. They are all ticked.

---EDIT---

enable_diagnostics was also set to true despite the message.

wireddown commented 9 years ago

I found another platform mismatch bug. The Mac version of sed doesn't recognize \s as a regular expression statement.

I can patch the script later today, but if you don't want to wait, there is a simple few-character change you can make:

On line 119, change

sed "s/${ymlKey}:\s\+//g"

to

sed "s/${ymlKey}:[[:space:]]//g"

wireddown commented 9 years ago

I have updated both the setup instructions and the git-hook script.

Please download the script and follow step 4 in the setup instructions. Let me know if there are more surprises.

wireddown commented 9 years ago

I am going to presume this is fixed.

Please re-open if you encounter more problems.