Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Implemented github widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Bunsch committed Feb 24, 2012
1 parent 02c90e6 commit 357fae1
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 28 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ gem 'mime-types'
gem 'builder'
gem 'nokogiri'
gem 'coderay'
gem 'octokit'
gem 'yajl-ruby'
19 changes: 19 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.6)
adsf (1.0.1)
rack (>= 1.0.0)
builder (3.0.0)
coderay (1.0.5)
cri (2.1.0)
faraday (0.7.5)
addressable (~> 2.2.6)
multipart-post (~> 1.1.3)
rack (>= 1.1.0, < 2)
faraday_middleware (0.7.0)
faraday (~> 0.7.3)
haml (3.1.4)
hashie (1.2.0)
kramdown (0.13.4)
mime-types (1.17.2)
multi_json (1.0.4)
multipart-post (1.1.4)
nanoc (3.3.0)
cri (~> 2.1)
nokogiri (1.5.0)
octokit (0.6.5)
addressable (~> 2.2.6)
faraday (~> 0.7.4)
faraday_middleware (~> 0.7.0)
hashie (~> 1.2.0)
multi_json (~> 1.0.2)
rack (1.4.1)
sass (3.1.15)
yajl-ruby (1.1.0)

PLATFORMS
ruby
Expand All @@ -27,4 +44,6 @@ DEPENDENCIES
mime-types
nanoc
nokogiri
octokit
sass
yajl-ruby
19 changes: 19 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,23 @@ task :build do
Nanoc::CLI.run ["compile"]
end

task :github do
require "octokit"
require 'yajl'
data = []
Octokit.repositories("futuresimple").each do |repo|
data.push({
:name => repo.name,
:description => repo.description,
:language => repo.language,
:forks => repo.forks,
:watchers => repo.watchers,
:url => repo.url,
:updated_at => repo.updated_at
})
end
json = Yajl::Encoder.encode(data)
File.open('data/github.json', 'w') do |f| f.write(json) end
end

task :default => :build
Binary file added content/images/github_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 2 additions & 27 deletions content/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,5 @@ title: Home
%a{href: article.path}= article[:title]
= article.compiled_content
.span5
%script{:charset => "utf-8", :src => "http://widgets.twimg.com/j/2/widget.js"}
:javascript
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 6,
interval: 30000,
width: 400,
height: 300,
theme: {
shell: {
background: '#cccccc',
color: '#666666'
},
tweets: {
background: '#ffffff',
color: '#666666',
links: '#2A95B3'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
behavior: 'all'
}
}).render().setUser('futuresimplelab').start();
= render "_twitter.html"
= render "_github.html"
Empty file added content/sass/github.css.sass
Empty file.
35 changes: 35 additions & 0 deletions content/sass/style.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,38 @@ article
.welcome
div
display: none

.github
.repos
.logo
text-align: center
margin-bottom: 10px
padding-bottom: 10px
border-bottom: 1px solid #eee

img
width: 100px

@include rounded(6px)
background-color: #fff
margin: 10px 35px
padding: 20px
.repo
margin-bottom: 10px
padding-bottom: 10px
border-bottom: 1px solid #eee
&:last-child
border-bottom: 0
padding-bottom: 0
margin-bottom: 0
.language
color: #999
font-size: 11px
text-transform: uppercase
.stats
float: right
.name
font-size: 16px
.description
font-style: italic
margin-top: 5px
1 change: 1 addition & 0 deletions data/github.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"obedience-core","description":"Obedience Core","language":"JavaScript","forks":0,"watchers":2,"url":"https://api.github.com/repos/futuresimple/obedience-core","updated_at":"2012-01-10T10:17:18Z"},{"name":"jessie","description":"Node runner for Jasmine JavaScript BDD testing framework","language":"JavaScript","forks":14,"watchers":90,"url":"https://api.github.com/repos/futuresimple/jessie","updated_at":"2012-02-22T07:12:10Z"},{"name":"futuresimple.github.com","description":"Future Simple's github homepage","language":null,"forks":1,"watchers":3,"url":"https://api.github.com/repos/futuresimple/futuresimple.github.com","updated_at":"2012-01-10T10:17:18Z"},{"name":"broadcast","description":"A broadcasting microframework making publishing of messages to different services easy.","language":"Ruby","forks":6,"watchers":158,"url":"https://api.github.com/repos/futuresimple/broadcast","updated_at":"2012-02-09T02:18:46Z"},{"name":"restart_butler","description":"","language":"Ruby","forks":1,"watchers":1,"url":"https://api.github.com/repos/futuresimple/restart_butler","updated_at":"2012-01-10T10:17:19Z"},{"name":"dropbox-api","description":"Dropbox API Ruby Client","language":"Ruby","forks":9,"watchers":125,"url":"https://api.github.com/repos/futuresimple/dropbox-api","updated_at":"2012-02-23T20:03:12Z"},{"name":"api_client","description":"HTTP API Client Builder","language":"Ruby","forks":1,"watchers":2,"url":"https://api.github.com/repos/futuresimple/api_client","updated_at":"2012-02-12T11:34:11Z"},{"name":"presentations","description":"All kinds of presentations delivered by FS team members","language":null,"forks":1,"watchers":1,"url":"https://api.github.com/repos/futuresimple/presentations","updated_at":"2012-01-10T10:27:54Z"},{"name":"blog-lab","description":"","language":"Ruby","forks":1,"watchers":1,"url":"https://api.github.com/repos/futuresimple/blog-lab","updated_at":"2012-02-24T12:14:44Z"}]
16 changes: 16 additions & 0 deletions layouts/_github.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.github

.repos
.logo
%img{:alt => "Github", :src => "/images/github_logo.png"}
- Yajl::Parser.parse(File.read('data/github.json')).sort { |a, b| b['watchers'].to_i <=> a['watchers'].to_i }.each do |repo|
.repo
.stats
== #{repo['watchers']} watchers, #{repo['forks']} forks
.name
%a{ :href => repo['url'] }
= repo['name']
.language
= repo['language']
.description
= repo['description']
27 changes: 27 additions & 0 deletions layouts/_twitter.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
%script{:charset => "utf-8", :src => "http://widgets.twimg.com/j/2/widget.js"}
:javascript
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 6,
interval: 30000,
width: 400,
height: 300,
theme: {
shell: {
background: '#cccccc',
color: '#666666'
},
tweets: {
background: '#ffffff',
color: '#666666',
links: '#2A95B3'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
behavior: 'all'
}
}).render().setUser('futuresimplelab').start();
3 changes: 2 additions & 1 deletion lib/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
include Nanoc::Helpers::HTMLEscape


require File.expand_path(File.join(File.dirname(__FILE__), "kramdown_with_coloring.rb"))
require File.expand_path(File.join(File.dirname(__FILE__), "kramdown_with_coloring.rb"))
require 'yajl'

0 comments on commit 357fae1

Please sign in to comment.