Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit 372f50bef0cab04414fce52a22d76f232dd3b800 @leereilly committed
173 app.rb
@@ -0,0 +1,173 @@
+$:.unshift File.join(File.dirname(__FILE__),'lib')
+
+require 'rubygems'
+require 'net/http'
+require 'sinatra'
+require 'json'
+require 'erb'
+require 'uri'
+
+require 'User'
+require 'Repo'
+
+DataMapper::Logger.new(STDOUT, :debug)
+
+disable :show_exceptions
+set :environment, :production
+
+configure :development do
+ DataMapper.setup(:default, 'sqlite:////Users/lreilly/Projects/github-scores.com/db/dbdb')
+end
+
+configure :production do
+ DataMapper.setup(:default, 'sqlite:////Users/lreilly/Projects/github-scores.com/db/db.db')
+end
+
+error do
+ @title = "404"
+ @text = "Sorry, but this cat is in another castle!"
+ @display_small_search = false
+ erb :not_found
+end
+
+get '/' do
+ begin
+ if params[:github_url]
+ @title = 'High Scores'
+ @github_url = sanitize_input params[:github_url]
+ @user = get_user_from_github_url(@github_url)
+ @repo = get_repo_from_github_url(@github_url)
+ @high_scores = get_high_scores(@user, @repo)
+ @display_small_search = true
+ redirect "/#{@user}/#{@repo}/high_scores/"
+ else
+ @title = 'High Scores'
+ @text = 'Please enter a Github repository URL'
+ @display_small_search = false
+ erb :index
+ end
+ rescue
+ @title = "404"
+ @text = "Sorry, but this cat is in another castle!"
+ @display_small_search = false
+ erb :not_found
+ end
+end
+
+get '/recent/?' do
+ @repos = Repo.all(:limit => 5, :order => [ :updated_at.desc ])
+ @display_small_search = true
+ erb :recent
+end
+
+
+get '/credits/?' do
+ erb :credits
+end
+
+get '/help/?' do
+ @display_small_search = true
+ erb :help
+end
+
+get '/about/?' do
+ @display_small_search = true
+ erb :about
+end
+
+get '/:user/:repo/?' do
+ @user = User::create_from_username(params[:user])
+ @repo = Repo::create_from_username_and_repo(params[:user], params[:repo])
+ @display_small_search = true
+ erb :repo
+end
+
+get '/:user/?' do
+ @user = User::create_from_username(params[:user])
+ @display_small_search = true
+ erb :user
+end
+
+not_found do
+ @title = "404"
+ @text = "Sorry, but this cat is in another castle!"
+ erb :not_found
+end
+
+def sanitize_input(url)
+ url = url.downcase
+
+ # Special rules for Github URLs starting with 'github.com'
+ if url[0..9] == 'github.com'
+ url = 'https://www.github.com' + url[9..url.size]
+
+ # Special rules for Github URLs starting with 'www.github.com'
+ elsif url[0..13] == 'www.github.com'
+ url = 'https://www.github.com' + url[13..url.size]
+ end
+
+ # Special rules for Github URLs ending in 'git'
+ if url[-4,4] == '.git'
+ url = url[0..-5]
+ end
+
+ url = url.gsub("http://", "https://")
+ url = url.gsub("git@github.com:", "https://www.github.com/")
+ url = url.gsub("git://", "https://www.")
+
+ # If someone just passes in user/repo e.g. leereilly/leereilly.net
+ tokens = url.split('/')
+ if tokens.size == 2
+ url = "https://www.github.com/#{tokens[0]}/#{tokens[1]}"
+ end
+
+ return url
+end
+
+def get_user_from_github_url(sanitized_github_url)
+ return sanitized_github_url.split('/')[3]
+end
+
+def get_repo_from_github_url(sanitized_github_url)
+ return sanitized_github_url.split('/')[4]
+end
+
+def get_high_scores(user, repo)
+ begin
+ # Kludge - three API calls
+ stored_user = User::create_from_username(user)
+ puts "Storing user: #{stored_user}"
+ stored_repo = Repo::create_from_username_and_repo(user, repo)
+ puts "Storing repo: #{stored_repo}"
+
+ contributors_url = "http://github.com/api/v2/json/repos/show/#{user}/#{repo}/contributors"
+
+ contributors_feed = Net::HTTP.get_response(URI.parse(contributors_url))
+ contributors = contributors_feed.body
+ contributors_result = JSON.parse(contributors)
+ repository_contributors = contributors_result['contributors']
+ contributors_array = Array.new
+ repository_contributors.each do |repository_contributor|
+ user_hash = Hash.new
+ user_hash[:login] = repository_contributor['login']
+ user_hash[:email] = repository_contributor['email']
+ user_hash[:gravatar_id] = repository_contributor['gravatar_id']
+ user_hash[:location] = repository_contributor['location']
+ user_hash[:contributions] = repository_contributor['contributions'].to_i
+ contributors_array << user_hash
+ end
+ return contributors_array
+ rescue
+ raise "Sorry, this GitHub repository doesn't seem to exist or is private"
+ end
+end
+
+
+get '/:user/:repo/high_scores/?' do
+ @title = "New"
+ @user = params[:user]
+ @repo = params[:repo]
+ @high_scores = get_high_scores(@user, @repo)
+ @display_small_search = true
+ erb :high_scores
+end
10 config.ru
@@ -0,0 +1,10 @@
+require 'rubygems'
+require 'sinatra.rb'
+
+# Sinatra defines #set at the top level as a way to set application configuration
+set :views, File.join(File.dirname(__FILE__), 'app','views')
+set :run, false
+set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
+
+require 'app/main'
+run Sinatra.application
BIN db/db.db
Binary file not shown.
48 lib/Contributor.rb
@@ -0,0 +1,48 @@
+require 'rubygems'
+require 'data_mapper'
+require 'net/http'
+require 'json'
+require 'uri'
+
+DataMapper::Logger.new($stdout, :debug)
+DataMapper.setup(:default, 'sqlite:////Users/lreilly/Projects/github-scores.com/db/db.db')
+
+class Contributor
+ include DataMapper::Resource
+
+ API_VERSION = 'v2'
+ BASE_URL = 'http://github.com/api/' + API_VERSION + '/json/user/show/'
+
+ property :id, Serial
+ property :login, String
+ property :gravatar_id, String
+ property :contributions, String
+
+ def self.create_from_user_and_repo(user, repo)
+ stored_user = User::create_from_username(user)
+ stored_repo = Repo::create_from_username_and_repo(user, repo)
+
+ contributors_url = "http://github.com/api/v2/json/repos/show/#{user}/#{repo}/contributors"
+ contributors_feed = Net::HTTP.get_response(URI.parse(contributors_url))
+ contributors = contributors_feed.body
+ contributors_result = JSON.parse(contributors)
+ repository_contributors = contributors_result['contributors']
+ contributors_array = Array.new
+
+ repository_contributors.each do |repository_contributor|
+ contributor = Contributor.new
+ contributor.login = repository_contributor['login']
+ contributor.gravatar_id = repository_contributor['gravatar_id']
+ contributor.contributions = repository_contributor['contributions']
+ contributor.save
+ end
+ end
+
+ def self.get_json_response(url)
+ Net::HTTP.get_response(URI.parse(url))
+ end
+end
+
+DataMapper::auto_upgrade!
+contributors = Contributor::create_from_user_and_repo('leereilly', 'leereilly.net')
+
84 lib/Repo.rb
@@ -0,0 +1,84 @@
+require 'rubygems'
+require 'data_mapper'
+require 'net/http'
+require 'json'
+require 'uri'
+
+DataMapper::Logger.new($stdout, :debug)
+DataMapper.setup(:default, 'sqlite:////Users/lreilly/Projects/github-scores.com/db/db.db')
+
+class Repo
+ include DataMapper::Resource
+
+ API_VERSION = 'v2'
+ BASE_URL = 'http://github.com/api/' + API_VERSION + '/json/repos/show/'
+
+ property :id, Serial
+ property :owner, String
+ property :url, String
+ property :homepage, String
+ property :name, String
+ property :description, String
+ property :parent, String
+ property :has_issues, String
+ property :source, String
+ property :watchers, String
+ property :has_downloads, String
+ property :fork, String
+ property :forks, String
+ property :has_wiki, String
+ property :pushed_at, String
+ property :open_issues, String
+ property :updated_at, DateTime
+
+ def self.create_from_username_and_repo(username, repo)
+ repo_data_url = Repo.get_repo_data_url(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
+
+ repo_data_response = get_json_response(repo_data_url)
+ repo_data = JSON.parse(repo_data_response.body)
+ repo_data = repo_data['repository']
+
+ repo.owner = repo_data['owner']
+ repo.name = repo_data['name']
+ repo.url = repo_data['url']
+ repo.homepage = repo_data['homepage']
+ repo.description = repo_data['description']
+ repo.parent = repo_data['parent']
+ repo.has_issues = repo_data['has_issues']
+ repo.source = repo_data['source']
+ repo.watchers = repo_data['watchers']
+ repo.has_downloads = repo_data['has_downloads']
+ repo.fork = repo_data['fork']
+ repo.forks = repo_data['forks']
+ repo.has_wiki = repo_data['has_wiki']
+ repo.pushed_at = repo_data['pushed_at']
+ repo.open_issues = repo_data['open_issues']
+ repo.updated_at = Time.now
+ repo.save!
+ return repo
+ end
+
+ def self.get_json_response(url)
+ Net::HTTP.get_response(URI.parse(url))
+ end
+
+ def self.get_repo_data_url(username, repo)
+ return BASE_URL + username + '/' + repo
+ end
+end
+
+DataMapper.auto_upgrade!
+
83 lib/User.rb
@@ -0,0 +1,83 @@
+require 'rubygems'
+require 'data_mapper'
+require 'net/http'
+require 'json'
+require 'uri'
+
+DataMapper::Logger.new($stdout, :debug)
+DataMapper.setup(:default, 'sqlite:////Users/lreilly/Projects/github-scores.com/db/db.db')
+
+class User
+ include DataMapper::Resource
+
+ API_VERSION = 'v2'
+ BASE_URL = 'http://github.com/api/' + API_VERSION + '/json/user/show/'
+
+ property :id, Serial
+ property :github_id, String
+ property :gravatar_id, String
+ property :login, String
+ property :email, String
+ property :name, String
+ property :blog, String
+ property :company, String
+ property :location, String
+ property :type, String
+ property :permission, String
+ property :created_at, String
+ property :public_repo_count, String
+ property :public_gist_count, String
+ property :following_count, String
+ property :followers_count, String
+ property :updated_at, DateTime
+
+
+ def self.create_from_username(username)
+ if found_user = User.first(:login => username)
+ if Time.now - Time.parse(found_user.updated_at.to_s) <= 60*60*24
+ puts "User created less than 24 hours ago. Returning DB record"
+ return found_user
+ else
+ puts "Updating current user"
+ user = found_user
+ end
+ else
+ puts "User not found; using web services"
+ user = User.new
+ end
+
+ user_data_url = User.get_user_data_url(username)
+ user_data_response = get_json_response(user_data_url)
+ user_data = JSON.parse(user_data_response.body)
+ user_data = user_data['user']
+
+ user.github_id = user_data['id']
+ user.gravatar_id = user_data['gravatar_id']
+ user.login = user_data['login']
+ user.email = user_data['email']
+ user.name = user_data['name']
+ user.blog = user_data['blog']
+ user.company = user_data['company']
+ user.location = user_data['location']
+ user.type = user_data['type']
+ user.permission = user_data['permission']
+ user.created_at = user_data['created_at']
+ user.public_repo_count = user_data['public_repo_count']
+ user.public_gist_count = user_data['public_gist_count']
+ user.following_count = user_data['following_count']
+ user.followers_count = user_data['followers_count']
+ user.updated_at = Time.now
+ user.save!
+ return user
+ end
+
+ def self.get_json_response(url)
+ Net::HTTP.get_response(URI.parse(url))
+ end
+
+ def self.get_user_data_url(username)
+ return BASE_URL + username
+ end
+end
+
+DataMapper::auto_upgrade!
3 lib/tasks/migrate.task
@@ -0,0 +1,3 @@
+task :migrate do
+ DataMapper.auto_migrate!
+end
93 public/css/style.css
@@ -0,0 +1,93 @@
+@font-face {
+ font-family: "ArcadeClassic";
+ src: url("../font/ArcadeClassic.otf") format("opentype");
+}
+
+body {
+ font-family: "ArcadeClassic";
+ letter-spacing: 2px;
+ word-spacing: 0.5em;
+ color: white;
+ background: #252525 url(/img/bg.png) top center no-repeat;
+}
+
+#wrapper {
+ margin: 0 auto;
+ width: 700px;
+}
+
+#content {
+ width: 100%;
+}
+
+a {
+ text-decoration: none;
+ color: white;
+}
+
+td {
+ font-size: 40px;
+}
+
+th {
+ font-size: 40px;
+ font-weight: bold;
+}
+
+td.small {
+ font-size: 20px;
+ padding:10px;
+}
+
+th.small {
+ font-size: 20px;
+ font-weight: bold;
+ padding:10px;
+ color: yellow;
+}
+
+table {
+ vertical-align: center;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+input {
+ color: #FFFFFF;
+ font-family: ArcadeClassic;
+ font-weight: bold;
+ font-size: 24px;
+ background-color: #72A4D2;
+}
+
+input.small {
+ font-size: 12px;
+}
+
+#header_search {
+ text-align: right;
+ float:right;
+}
+
+.header_search {
+ text-align: right;
+ float: right;
+}
+
+p.center {
+ text-align: center;
+}
+
+h1 {
+ text-align: lightblue;
+}
+
+h2 {
+ text-align: center;
+ color: lightblue;
+}
+
+h3 {
+ /**text-align: center;*/
+ color: lightblue;
+}
BIN public/font/ArcadeClassic.otf
Binary file not shown.
BIN public/img/bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN public/img/favicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN public/img/octocat.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 public/index.html
@@ -0,0 +1,76 @@
+<html>
+ <head>
+ <style>
+ @font-face {
+ font-family: "ArcadeClassic";
+ src: url("font/ArcadeClassic.otf") format("opentype");
+ }
+
+ body {
+ font-family: "ArcadeClassic";
+ /*font-size: 50px;*/
+ letter-spacing: 2px;
+ word-spacing: 0.5em;
+ background-color: black;
+ color: white;
+ }
+
+ td {
+ font-size: 40px;
+ }
+ table {
+ /*vertical-align: center;*/
+ margin-left: auto;
+ margin-right: auto;
+ }
+ </style>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+ <script src="js/pixastic.custom.js"></script>
+ <link href="favicon.png" type="image/png" rel="shortcut icon" />
+ <link href="favicon.png" type="image/png" rel="icon" />
+ </head>
+ <body>
+ <table style="width: 100%;">
+ <tr>
+
+ <td></td>
+ <td><h1 style="text-align: center; font-size: 200%;">!</h1></td>
+ <td></td>
+ </tr>
+ </table>
+ <table>
+ <tr style="color: yellow;">
+
+ <td style="text-align: right; padding-right: 1em;">15600</td>
+
+ <td style="width: 10em;">mojombo</td>
+ <td style="text-align: right">San Francisco</td>
+ <td><img src="http://1.gravatar.com/avatar/86debe7ed7ece0f968097a768dcbd5cb"></td>
+ </tr><tr style="color: white;">
+
+ <td style="text-align: right; padding-right: 1em;">5200</td>
+ <td style="width: 10em;">schacon</td>
+
+ <td style="text-align: right">San Francisco, CA</td>
+ <td><img src="http://1.gravatar.com/avatar/86debe7ed7ece0f968097a768dcbd5cb"></td>
+ </tr><tr style="color: orange;">
+
+ <td style="text-align: right; padding-right: 1em;">3400</td>
+ <td style="width: 10em;">defunkt</td>
+ <td style="text-align: right">San Francisco, CA</td>
+ <td><img src="http://1.gravatar.com/avatar/86debe7ed7ece0f968097a768dcbd5cb"></td>
+ </tr>
+ </table>
+ <!--<h2 style="text-align: center;">Sorry, but the Octobeer is another castle!</h2>
+ <center><img src = "http://puddlesgathering.com/blog/img-jb_keyboard_cats_01.png"></center>-->
+ <script>
+ var img = new Image();
+ img.onload = function() {
+ Pixastic.process(img, "mosaic", {blockSize:30});
+ }
+ document.body.appendChild(img);
+ img.src = "http://puddlesgathering.com/blog/img-jb_keyboard_cats_01.png";
+ </script>
+ </body>
+
+</html>
66 test/app_test.rb
@@ -0,0 +1,66 @@
+require 'rubygems'
+require 'test/unit'
+require 'rack/test'
+require '../app'
+
+ENV['RACK_ENV'] = 'test'
+
+class AppTest < Test::Unit::TestCase
+ include Rack::Test::Methods
+
+ def app
+ Sinatra::Application
+ end
+
+ def test_a_variety_of_urls_work
+ valid_urls = [
+ 'http://www.github.com/leereilly/leereilly.net',
+ 'https://www.github.com/leereilly/leereilly.net',
+ 'git@github.com:leereilly/leereilly.net.git',
+ 'git://github.com/leereilly/leereilly.net.git',
+ 'github.com/leereilly/leereilly.net.git',
+ 'www.github.com/leereilly/leereilly.net.git',
+ 'leereilly/leereilly.net'
+ ]
+ valid_urls.each do |valid_url|
+ get '/', params = {:github_url => valid_url}
+ assert_equal last_response.status, 302
+ follow_redirect!
+ assert_equal last_response.status, 200
+ end
+ end
+
+ def test_landing_page_works_as_expected
+ get '/', params = {:github_url => 'http://www.github.com/leereilly/leereilly.net'}
+ assert_equal last_response.status, 302
+ follow_redirect!
+ assert_equal last_response.status, 200
+ end
+
+ def test_search_redirected_to_seo_friendly_url
+
+ end
+
+ def test_cute_404_page
+ get '/lee/lee/lee'
+ assert_equal last_response.status, 404
+ assert last_response.body.include? 'Sorry, but this cat is in another castle!'
+ end
+
+ def test_that_peeps_get_credit_where_credit_is_deserved
+ get '/credits'
+ assert last_response.ok?
+ kudos_to = Array[
+ 'Ruby',
+ 'Sinatra',
+ 'Passenger',
+ 'Dreamhost',
+ 'Github',
+ 'Lee Reilly',
+ 'Al Gore']
+ kudos_to.pop
+ kudos_to.each do |kudo_to|
+ assert last_response.body.include?(kudo_to)
+ end
+ end
+end
9 views/about.erb
@@ -0,0 +1,9 @@
+<%= erb :header %>
+<h2>About</h2>
+<p><strong>Git</strong> is an extremely fast, efficient, distributed version control system ideal for the collaborative development of software.</p>
+
+<p><strong>git·hub</strong> is the best way to collaborate with others. Fork, send pull requests and manage all your <strong>public</strong> and <strong>private</strong> git repositories.</p>
+
+<p><strong>git·hub·scores</strong> is a fun way to rank software project contributors in a 8-bit, 80's-tastic viewing environment.</p>
+
+<%= erb :footer %>
7 views/credits.erb
@@ -0,0 +1,7 @@
+<%= erb :header %>
+<h2>Credits</h2>
+<p>Running with Ruby, Sinatra, Passenger on a shared Dreamhost server</p>
+<p>Powered by the Github API</p>
+<p>Written by Lee Reilly</p>
+<p>Octocat logo used with permission</p>
+<%= erb :footer %>
11 views/footer.erb
@@ -0,0 +1,11 @@
+<p class="center"><blink><a href="/credits">Credits</a> 0</blink></p>
+<p class="center"><strike>&copy; Lee Reilly 2011</strike> Fork me on Github! <a href="http://twitter.com/share?url=http%3A%2F%2Fdev.twitter.com%2Fpages%2Ftweet-button" target="_blank">TWEET THIS!</a></p>
+</p>
+<p class="center">[<a href="/about">about</a>] [contact] [<a href="/help">help</a>] [recent searches]</p>
+<!--<p class="center">&uarr; &uarr; &darr; &darr; &larr; &rarr; &larr; &rarr; B A START</p>-->
+
+</div>
+</div>
+
+ </body>
+</html>
12 views/header.erb
@@ -0,0 +1,12 @@
+<html>
+ <head>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+ <link href="/img/favicon.png" type="image/png" rel="shortcut icon" />
+ <link href="/img/favicon.png" type="image/png" rel="icon" />
+ <link href="/css/style.css" rel="stylesheet" type="text/css">
+ </head>
+ <body>
+ <%= erb :small_search if @display_small_search == true %><h1><a style="float:left;" href="/">Github High Scores</a></h1>
+ <br clear="all" />
+ <div id="wrapper">
+ <div id="content">
29 views/help.erb
@@ -0,0 +1,29 @@
+<%= erb :header %>
+
+<h2>Help</h2>
+
+<h3>What on Earth is a Git? A Github? You did what with your what now?</h3>
+<p>Please check out the '<a href='/about'>about</a>' section for a general overview.
+
+<h3>How do I view the high scores for my Github repository?</h3>
+<p>Simply enter the URL of your Github repository into the search box. Currently we support the following formats...</p>
+<ul>
+ <li>http://www.github.com/mojombo/octobeer</li>
+ <li>https://www.github.com/mojombo/octobeer</li>
+ <li>git@github.com:mojombo/octobeer</li>
+ <li>git://github.com/mojombo/octobeer</li>
+ <li>github.com/mojombo/octobeer</li>
+ <li>www.github.com/mojombo/octobeer</li>
+ <li>mojombo/octobeer</li>
+</ul>
+
+<h3>It's Not Working!</h3>
+<p>Please create an issue in the Github repository</p>
+
+<h3>I'd Like To Contribute</h3>
+<p>You know what to do! #fork #pullRequest</p>
+
+<h3>This looks like a web site from the 80s! Running it through the Geocitiesizer is actually an improvement!!!</h3>
+<p>Cheers! :BEER:</p>
+
+<%= erb :footer %>
24 views/high_scores.erb
@@ -0,0 +1,24 @@
+<%= erb :header %>
+
+<h2><a href="/<%= @user %>"><%= @user %></a> >> <a href="/<%= @user %>/<%= @repo %>"><%= @repo %></a> >> <a href="/<%= @user %>/<%= @repo %>/high_scores/">High Scores</a></h2>
+
+<table>
+ <tr>
+ <th class="small">Score</th>
+ <th class="small">Avatar</th>
+ <th class="small">User</th>
+ </tr>
+ <% @high_scores.each do |high_score| %>
+ <tr>
+ <td class="small"><%= high_score[:contributions]*100 %></td>
+ <td class="small"><img src="http://0.gravatar.com/avatar/<%= high_score[:gravatar_id] %>?s=10&d=identicon" with="50" height="50"></td>
+ <td class="small"><a href="/<%= high_score[:login] %>"><%= high_score[:login] %></a></td>
+ </tr>
+ <% end %>
+</table>
+<p>Permalink: https://github.com/<%= @user %>/<%= @repo %></p>
+
+<p><a href="http://twitter.com/share?url=http%3A%2F%2Fdev.twitter.com%2Fpages%2Ftweet-button" target="_blank">TWEET THIS!</a></p>
+
+<%= erb :footer %>
+
9 views/index.erb
@@ -0,0 +1,9 @@
+<%= erb :header %>
+<h2><%= @title %></h2>
+<p class="center"><%= @text %></p>
+
+<%= erb :search_form %>
+
+
+<%= erb :footer %>
+
11 views/not_found.erb
@@ -0,0 +1,11 @@
+<%= erb :header %>
+<center>
+<h2><%= @title %></h2>
+<p><%= @text %></p>
+<img src="/img/octocat.png">
+</center>
+<br/>
+<%= erb :search_form %>
+
+<%= erb :footer %>
+
0 views/random.erb
No changes.
9 views/recent.erb
@@ -0,0 +1,9 @@
+<%= erb :header %>
+
+<h2>Recent searches</h2>
+
+<% @repos.each do |repo| %>
+<%= "<p class=\"center\">#{repo.owner}/#{repo.name}</p>" %>
+<% end %>
+
+<%= erb :footer %>
26 views/repo.erb
@@ -0,0 +1,26 @@
+<%= erb :header %>
+
+<h2><a href="/<%= @repo.owner %>/"><%= @repo.owner %></a> >> <a href="/<%= @repo.owner %>/<%= @repo.name %>"><%= @repo.name %></a></h2>
+
+<dl>
+ <dt>ID</dt>
+ <dd><%= @repo.id %></dd>
+
+ <dt>URL</dt>
+ <dd><%= @repo.url %></dd>
+
+ <dt>Homepage</dt>
+ <dd><%= @repo.homepage %></dd>
+
+ <dt>Name</dt>
+ <dd><%= @repo.name %></dd>
+
+ <dt>Description</dt>
+ <dd><%= @repo.description %></dd>
+
+ <dt>Created by</dt>
+ <dd><%= @repo.owner %></dd>
+
+</dl>
+
+<%= erb :footer %>
6 views/search_form.erb
@@ -0,0 +1,6 @@
+<center>
+<form action='/' method="GET">
+ <input type="text" size="24" name="github_url" />
+ <input type="submit" value="1 UP" />
+</form>
+</center>
5 views/small_search.erb
@@ -0,0 +1,5 @@
+<div style="float:right;">
+ <form action='/' method="GET">
+ <input class="small" type="text" name="github_url" /> <input class="small" type="submit" value="1 UP" />
+</form>
+</div>
43 views/user.erb
@@ -0,0 +1,43 @@
+<%= erb :header %>
+
+<h2><a href="/<%= @user.login %>"><%= @user.login %></a></h2>
+
+<img alt="<%= @user.login %><" title="Photo of <%= @user.name %>" style="float:right;padding: 10px 10px 10px 10px" width="200" height="200" src="http://0.gravatar.com/avatar/<%= @user.gravatar_id %>?s=20&d=identicon">
+
+<dl>
+ <dt>ID</dt>
+ <dd><%= @user.id %></dd>
+
+ <dt>Login</dt>
+ <dd><%= @user.login %></dd>
+
+ <dt>Email</dt>
+ <dd><%= @user.email %></dd>
+
+ <dt>Blog</dt>
+ <dd><%= @user.blog %></dd>
+
+ <dt>Company</dt>
+ <dd><%= @user.company %></dd>
+
+ <dt>Location</dt>
+ <dd><%= @user.location %></dd>
+
+ <dt>Github'n since</dt>
+ <dd><%= @user.created_at %></dd>
+
+ <dt>Followers</dt>
+ <dd><a href="https://github.com/<%= @user.login %>/followers"><%= @user.followers_count %></a></dd>
+
+ <dt>Following</dt>
+ <dd><a href="https://github.com/<%= @user.login %>/following"><%= @user.following_count %></a></dd>
+
+ <dt>Public repos</dt>
+ <dd><a href="https://github.com/<%= @user.login %>/repositories"><%= @user.public_repo_count %></a></dd>
+
+ <dt>Public gists</dt>
+ <dd><a href="https://gist.github.com/<%= @user.login %>"><%= @user.public_gist_count %></a></dd>
+
+</dl>
+
+<%= erb :footer %>

0 comments on commit 372f50b

Please sign in to comment.
Something went wrong with that request. Please try again.