Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

authenticate octokit (for higher API limits), closes #80

  • Loading branch information...
commit 4ec1b276dae8177d4d524c81c533b4880213a1b5 1 parent 73543bb
@cboettig authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 _plugins/jekyll-labnotebook-plugins/octokit.rb
View
9 _plugins/jekyll-labnotebook-plugins/octokit.rb
@@ -15,6 +15,7 @@
require 'octokit'
require 'time'
require 'chronic'
+require 'yaml'
module Jekyll
class OctokitIssues < Liquid::Tag
@@ -24,7 +25,9 @@ def initialize(tag_name, text, tokens)
@address = "cboettig/"+"#{@text}"
end
def render(context) # learn how to write this to take an argument!
- repo = Octokit.issues(@address) # grab the data. Can this go in "initialize?"
+ cred = YAML.load_file("/home/cboettig/.github_cred.yml")
+ client = Octokit::Client.new(:login => cred[:username], :password => cred[:password])
+ repo = client.issues(@address) # grab the data. Can this go in "initialize?"
# repo = Octokit.issues(@address, :status => "closed") # (Gets closed issues??)
# Generate a list of all open issues, linking to github issue page.
out = "<ul>"
@@ -67,7 +70,9 @@ def render(context)
# @until = Chronic.parse("Now") #(day + 60*60*24).iso8601
# @since = Chronic.parse("One day ago") #day.iso8601
# repo = Octokit.commits(@address, "master", {:since => @since, :until => @until})
- repo = Octokit.commits(@address, "master")
+ cred = YAML.load_file("/home/cboettig/.github_cred.yml")
+ client = Octokit::Client.new(:login => cred[:username], :password => cred[:password])
+ repo = client.commits(@address, "master")
out = "<ul>"
for i in 0 ... [repo.size, 5].min
out = out + "<li>" +
Please sign in to comment.
Something went wrong with that request. Please try again.