Permalink
Browse files

Removed iCal support from master

  • Loading branch information...
1 parent ea26383 commit e320da9174288e352efe69b68636640e29b71ce9 @leereilly committed Oct 20, 2011
Showing with 0 additions and 111 deletions.
  1. +0 −12 README.md
  2. +0 −2 app.rb
  3. +0 −61 lib/Commit.rb
  4. +0 −3 lib/Repo.rb
  5. +0 −30 views/ical.erb
  6. +0 −3 views/repo.erb
View
@@ -2,18 +2,6 @@
Github High Scores is a fun way to rank Github repository contributors in a 8-bit, 80's-tastic viewing environment.
-## iCalendar
-
-This is an extension to convert the most recent commit log of a repo into [iCalendar](http://tools.ietf.org/html/rfc5545) format, to be included into iCal.
-
-This will generate events which are 30 minutes in duration -- there is no really easy way to specify a duration for a commit.
-
-To use:
- http://example.com/<user>/<repo>.ics
- http://example.com/<user>/<repo>/<branch>.ics
-
-branch defaults to master, if not provided.
-
## Installation
git clone git://github.com/leereilly/github-high-scores.git
View
@@ -24,7 +24,6 @@
require 'helpers'
require 'User'
require 'Repo'
-require 'Commit'
disable :show_exceptions
set :environment, :production
@@ -62,7 +61,6 @@
get '/recent_searches/?' do
@repos = Repo.all(:limit => 5, :order => [ :updated_at.desc ])
- puts @repos.inspect
@display_small_search = true
erb :recent_searches
end
View
@@ -1,61 +0,0 @@
-require 'rubygems'
-require 'data_mapper'
-require 'net/http'
-require 'json'
-require 'uri'
-
-# This will probably blow away the database, so regenerate on each request!
-# Caching is not really possible since the content of each page will change
-# page=1 always being the most recent.
-class Commit < BaseModel
-
- def initialize(json_data)
- @json = json_data
- end
-
- def to_ical
- dtstart = DateTime.parse(@json['committed_date']).new_offset(0)
- dtstamp = DateTime.now.new_offset(0)
- url = "https://github.com%s" % @json["url"]
- summary = "Commit by %s (%s)" % [@json["author"]["name"], @json["author"]["email"]]
-
- (<<-EOF).remove_indent + "\n"
- BEGIN:VEVENT
- SEQUENCE:1
- TRANSP:OPAQUE
- UID:#{@json["id"]}
- DTSTART:#{dtstart.ical_timestamp}
- DTSTAMP:#{dtstamp.ical_timestamp}
- SUMMARY:#{summary}
- DESCRIPTION:#{@json['message'].gsub(/\n/,'\n')}
- CREATED:#{dtstamp.ical_timestamp}
- DTEND:#{(dtstart + 1/48.0).ical_timestamp}
- LOCATION:#{url}
- END:VEVENT
- EOF
- end
-
- def self.find_for(repo_obj, branch_name, get_all=false)
- commits, page_num = [], 1
- loop do
- jsonstr = get_json_response(github_api_url(repo_obj.owner, repo_obj.name,
- branch_name, page_num)).body
- objs = JSON.parse(jsonstr)
- break if objs["error"]
- objs["commits"].each { |commit| commits << Commit.new(commit) }
- get_all ? page_num += 1 : break
- end
- commits
- end
-
- def self.github_api_url(username, reponame, branch=nil, page_num=nil)
- COMMITS_BASE_URL + ("%s/%s/%s?page=%d" % [username, reponame,
- branch || "master", page_num || 1])
- end
-
- def self.get_json_response(url)
- Net::HTTP.get_response(URI.parse(url))
- end
-end
-
-
View
@@ -35,14 +35,11 @@ def self.create_from_username_and_repo(username, repo)
if found_repo = Repo.first(:owner => username, :name => repo)
if Time.now - Time.parse(found_repo.updated_at.to_s) <= 60*60*24
- puts "Repo created less than 24 hours ago. Returning DB record"
return found_repo
else
- puts "Updating current repo"
repo = found_repo
end
else
- puts "User not found; using web services"
repo = Repo.new
end
View
@@ -1,30 +0,0 @@
-BEGIN:VCALENDAR
-METHOD:PUBLISH
-X-WR-TIMEZONE:Europe/Berlin
-PRODID:-//Apple Inc.//iCal 3.0//EN
-CALSCALE:GREGORIAN
-X-WR-CALNAME:GitHub: <%= @repo.owner %>/<%= @repo.name %>
-VERSION:2.0
-X-WR-RELCALID:<%= @repo.ical_uuid %>
-X-APPLE-CALENDAR-COLOR:#0252D4
-BEGIN:VTIMEZONE
-TZID:Europe/Berlin
-BEGIN:DAYLIGHT
-TZOFFSETFROM:+0100
-TZOFFSETTO:+0200
-DTSTART:19810329T020000
-RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
-TZNAME:CEST
-END:DAYLIGHT
-BEGIN:STANDARD
-TZOFFSETFROM:+0200
-TZOFFSETTO:+0100
-DTSTART:19961027T030000
-RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
-TZNAME:CET
-END:STANDARD
-END:VTIMEZONE
-<% @commits.each do |commit| %>
-<%= commit.to_ical %>
-<% end %>
-END:VCALENDAR
View
@@ -21,9 +21,6 @@
<dt>Created by</dt>
<dd><%= @repo.owner %></dd>
- <dt>Commit Log</dt>
- <dd>iCal: <a href="/<%= @repo.owner %>/<%= @repo.name %>.ics"><%= request.url %>.ics</a></dd>
-
</dl>
<%= erb :footer %>

0 comments on commit e320da9

Please sign in to comment.