Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rearrange stuff

  • Loading branch information...
commit 6c7d609b39f83d925ff8ad1ac7e3e40e571da241 1 parent ff143e3
@tenderlove authored
View
9 README.rdoc
@@ -9,13 +9,12 @@ First clone the repo:
$ git clone git://github.com/tenderlove/rubycommitters.org.git
$ cd rubycommitters.org
-Then import committer data
+Generate the website
- $ bundle install
- $ rake import
+ $ rake
-Start your server
+Open the index
- $ ruby script/rails server
+ $ open public/index.html
Have fun hacking!
View
35 Rakefile
@@ -1,13 +1,9 @@
+$: << "lib"
+
require 'erb'
require 'account'
require 'pathname'
-module Rails
- def self.root
- Pathname.new File.dirname __FILE__
- end
-end
-
class WEBSITE
attr_accessor :fox_count
@@ -16,6 +12,10 @@ class WEBSITE
@locals = {}
end
+ def root
+ Pathname.new File.dirname __FILE__
+ end
+
def accounts
Account.import File.open 'ruby-committers.yml'
end
@@ -38,7 +38,6 @@ class WEBSITE
if string.tainted?
string = ERB::Util.h string
end
-
string.untaint
end
@@ -97,14 +96,28 @@ class WEBSITE
end
end
-task :website do
- erb = ERB.new File.read('app/views/layouts/application.html.erb')
+require 'net/http'
+
+def make_website
+ erb = ERB.new File.read('app/views/layouts/application.html.erb'), 0, '<>-'
ws = WEBSITE.new
binding = ws.get_binding do
fn = 'app/views/accounts/index.html.erb'
- inner = ERB.new File.read(fn)
+ inner = ERB.new File.read(fn), 0, '<>-'
inner.filename = fn
inner.result(ws.get_binding)
end
- puts erb.result(binding)
+ erb.result(binding)
+end
+
+file 'ruby-committers.yml' do
+ url = URI.parse 'https://raw.github.com/yugui/rubycommitters/master/ruby-committers.yml'
+ res = Net::HTTP.get_response(url)
+ File.open('ruby-committers.yml', 'wb') { |f| f.write res.body }
end
+
+file 'public/index.html' => 'ruby-committers.yml' do
+ File.open('public/index.html', 'wb') { |f| f.write make_website }
+end
+
+task :default => 'public/index.html'
View
2  app/views/accounts/_account.html.erb
@@ -1,7 +1,7 @@
<li class="account">
<div class="picture">
<div class="image-wrapper">
- <% if File.exist?(Rails.root.join('public', 'images', 'people', 'lines', "#{account.username}.png").to_s) -%>
+ <% if File.exist?(root.join('public', 'images', 'people', 'lines', "#{account.username}.png").to_s) -%>
<%= image_tag "people/lines/#{account.username}.png", :onmouseover => "this.src = this.src.replace(/lines/, 'photos').replace(/png/, 'jpg');", :onmouseout => "this.src = this.src.replace(/photos/, 'lines').replace(/jpg/, 'png');" -%>
<% else -%>
<%= image_tag "people/lines/fox#{fox_count}.png", :onmouseover => "this.src = this.src.replace(/lines/, 'photos')", :onmouseout => "this.src = this.src.replace(/photos/, 'lines')" -%>
View
0  app/models/account.rb → lib/account.rb
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.