Skip to content

Commit

Permalink
sync up
Browse files Browse the repository at this point in the history
  • Loading branch information
caleywoods committed Mar 26, 2011
2 parents 93754db + 8b63e32 commit 3d05a05
Show file tree
Hide file tree
Showing 29 changed files with 381 additions and 135 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ gem "rdiscount"
gem "ostatus"
gem "osub"
gem "opub"
gem "redfinger"
gem "nokogiri", "= 1.4.4"
gem "newrelic_rpm"

Expand Down
9 changes: 7 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GEM
faraday (0.5.7)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
rack (>= 1.1.0, < 2)
faraday_middleware (0.3.2)
faraday (~> 0.5.4)
ffi (1.0.7)
Expand Down Expand Up @@ -125,6 +125,10 @@ GEM
rack (>= 1.0)
rake (0.8.7)
rdiscount (1.6.8)
redfinger (0.1.0)
hashie
nokogiri (>= 1.4.0)
rest-client (>= 1.5.0)
rest-client (1.6.1)
mime-types (>= 1.16)
rocco (0.6)
Expand All @@ -144,7 +148,7 @@ GEM
simple_oauth (0.1.4)
sinatra (1.2.1)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
tilt (>= 1.2.2, < 2.0)
sinatra-content-for (0.2)
sinatra
tilt (1.2.2)
Expand Down Expand Up @@ -189,6 +193,7 @@ DEPENDENCIES
rack-flash
rack-test
rdiscount
redfinger
rocco
sinatra
sinatra-content-for
Expand Down
71 changes: 1 addition & 70 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,73 +1,4 @@
require 'rake/testtask'
require 'rake/clean'

Rake::TestTask.new do |t|
t.pattern = "test/*_test.rb"
end

# coffee-script tasks
require 'coffee-script'

namespace :js do
desc "compile coffee-scripts from ./src to ./public/js"
task :compile do
source = "#{File.dirname(__FILE__)}/src/"
javascripts = "#{File.dirname(__FILE__)}/public/js/"

Dir.foreach(source) do |cf|
unless cf == '.' || cf == '..'
js = CoffeeScript.compile File.read("#{source}#{cf}")
open "#{javascripts}#{cf.gsub('.coffee', '.js')}", 'w' do |f|
f.puts js
end
end
end
end
end

# Bring in Rocco tasks
require 'rocco/tasks'
Rocco::make 'docs/', ["*.rb", "models/*.rb", "Rakefile"]

desc 'Build rocco docs'
task :docs => :rocco
directory 'docs/'

desc 'Build docs and open in browser for the reading'
task :read => :docs do
sh 'open docs/rstatus.html'
end

# Make index.html a copy of rstatus.html
file 'docs/index.html' => 'docs/rstatus.html' do |f|
cp 'docs/rstatus.html', 'docs/index.html', :preserve => true
end
task :docs => 'docs/index.html'
CLEAN.include 'docs/index.html'

# Alias for docs task
task :doc => :docs

# GITHUB PAGES ===============================================================

desc 'Update gh-pages branch'
task :pages => ['docs/.git', :docs] do
rev = `git rev-parse --short HEAD`.strip
Dir.chdir 'docs' do
sh "git add *.html"
sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
if ok
verbose { puts "gh-pages updated" }
sh "git push -q o HEAD:gh-pages"
end
end
end
end

# Update the pages/ directory clone
file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f|
sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name)
sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
end
CLOBBER.include 'docs/.git'

Dir.glob("tasks/*.rake").each { |r| import r }
2 changes: 1 addition & 1 deletion models/feed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def ping_hubs(feed_url)
OPub::Publisher.new(feed_url, hubs).ping_hubs
end

def local
def local?
url.start_with?("/")
end

Expand Down
10 changes: 6 additions & 4 deletions models/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Update

key :remote_url
key :referral_id

def referral
Update.first(:id => referral_id)
end

def url
feed.local ? "/updates/#{id}" : remote_url
feed.local? ? "/updates/#{id}" : remote_url
end

def url=(the_url)
Expand All @@ -31,7 +31,7 @@ def to_html

# we let almost anything be in a username, except those that mess with urls. but you can't end in a .:;, or !
#also ignore container chars [] () "" '' {}
# XXX: the _correct_ solution will be to use an email validator
# XXX: the _correct_ solution will be to use an email validator
out.gsub!(/(^|[ \t\n\r\f"'\(\[{]+)@([^ \t\n\r\f&?=@%\/\#]*[^ \t\n\r\f&?=@%\/\#.!:;,"'\]}\)])/) do |match|
if u = User.first(:username => /^#{$2}$/i)
"#{$1}<a href='/users/#{u.username}'>@#{$2}</a>"
Expand All @@ -40,7 +40,9 @@ def to_html
end
end
out.gsub!(/(http[s]?:\/\/\S+[a-zA-Z0-9\/])/, "<a href='\\1'>\\1</a>")
out.gsub!(/#(\w+)/, "<a href='/hashtags/\\1'>#\\1</a>")
out.gsub!(/(^|\s+)#(\w+)/) do |match|
"#{$1}<a href='/hashtags/#{$2}'>##{$2}</a>"
end
out
end

Expand Down
6 changes: 3 additions & 3 deletions models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def reset_perishable_token
end

def url
feed.local ? "/users/#{feed.author.username}" : feed.author.url
feed.local? ? "/users/#{feed.author.username}" : feed.author.url
end

key :following_ids, Array
Expand All @@ -64,7 +64,7 @@ def follow! feed_url
following << f
save

if f.local
if f.local?
followee = User.first(:author_id => f.author.id)
followee.followers << self.feed
followee.save
Expand All @@ -77,7 +77,7 @@ def follow! feed_url
def unfollow! followed_feed
following_ids.delete(followed_feed.id)
save
if followed_feed.local
if followed_feed.local?
followee = User.first(:author_id => followed_feed.author.id)
followee.followers_ids.delete(self.feed.id)
followee.save
Expand Down
31 changes: 26 additions & 5 deletions public/css/_shared.less
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,36 @@ body {
word-wrap: break-word;
font-size: 1.1em;
}
.date {
.date, .in-reply {
float: left
}
.links {

.in-reply {
.avatar, .name, .links {
display: inline;
}

.avatar {
float: none;
width: 18px;
padding: 0 2px;
img {
width: 18px;
margin-bottom: -4px;
}
}
}

.end-links {
float: right;
}
.links, .date {
.links, .date, .in-reply {
font-size: 0.9em;
color: #aaa;
color: #aaa;
line-height: 2em;
}
.in-reply {
margin-left: 0.5em;
}
}

Expand Down Expand Up @@ -147,4 +168,4 @@ body {
padding-right: 1em;
}
}
}
}
25 changes: 22 additions & 3 deletions public/css/external.css
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,31 @@ body {
word-wrap: break-word;
font-size: 1.1em;
}
.updates .update .content .date {
.updates .update .content .date, .updates .update .content .in-reply {
float: left;
}
.updates .update .content .links {
.updates .update .content .in-reply .avatar, .updates .update .content .in-reply .name, .updates .update .content .in-reply .links {
display: inline;
}
.updates .update .content .in-reply .avatar {
float: none;
width: 18px;
padding: 0 2px;
}
.updates .update .content .in-reply .avatar img {
width: 18px;
margin-bottom: -4px;
}
.updates .update .content .end-links {
float: right;
}
.updates .update .content .links, .updates .update .content .date {
.updates .update .content .links, .updates .update .content .date, .updates .update .content .in-reply {
font-size: 0.9em;
color: #aaa;
line-height: 2em;
}
.updates .update .content .in-reply {
margin-left: 0.5em;
}
.updates .empty {
background: white;
Expand Down Expand Up @@ -874,3 +890,6 @@ body {
#home-bottom #recent .updates h4 {
padding-top: 1em;
}
#home-bottom #recent .updates .world-link {
text-align: right;
}
6 changes: 5 additions & 1 deletion public/css/external.less
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
h4 {
padding-top: 1em;
}

.world-link {
text-align: right;
}
}
}
}
}
22 changes: 19 additions & 3 deletions public/css/internal.css
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,31 @@ body {
word-wrap: break-word;
font-size: 1.1em;
}
.updates .update .content .date {
.updates .update .content .date, .updates .update .content .in-reply {
float: left;
}
.updates .update .content .links {
.updates .update .content .in-reply .avatar, .updates .update .content .in-reply .name, .updates .update .content .in-reply .links {
display: inline;
}
.updates .update .content .in-reply .avatar {
float: none;
width: 18px;
padding: 0 2px;
}
.updates .update .content .in-reply .avatar img {
width: 18px;
margin-bottom: -4px;
}
.updates .update .content .end-links {
float: right;
}
.updates .update .content .links, .updates .update .content .date {
.updates .update .content .links, .updates .update .content .date, .updates .update .content .in-reply {
font-size: 0.9em;
color: #aaa;
line-height: 2em;
}
.updates .update .content .in-reply {
margin-left: 0.5em;
}
.updates .empty {
background: white;
Expand Down
36 changes: 34 additions & 2 deletions public/css/update.css
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,19 @@ body {
.updates .update .content .date {
float: left;
}
.updates .update .content .links {
.updates .update .content .in-reply .avatar, .updates .update .content .in-reply .name, .updates .update .content .in-reply .links {
display: inline;
}
.updates .update .content .in-reply .avatar {
float: none;
width: 18px;
padding: 0 2px;
}
.updates .update .content .in-reply .avatar img {
width: 18px;
margin-bottom: -4px;
}
.updates .update .content .end-links {
float: right;
}
.updates .update .content .links, .updates .update .content .date {
Expand Down Expand Up @@ -803,7 +815,27 @@ body {
#fourohfour .update .byline .links, #update .update .byline .links {
float: right;
}
#fourohfour .update .remove-update, #update .update .remove-update {
#fourohfour .update .in-reply .avatar,
#update .update .in-reply .avatar,
#fourohfour .update .in-reply .name,
#update .update .in-reply .name,
#fourohfour .update .in-reply .links,
#update .update .in-reply .links {
display: inline;
}
#fourohfour .update .in-reply .avatar, #update .update .in-reply .avatar {
float: none;
width: 18px;
padding: 0 2px;
}
#fourohfour .update .in-reply .avatar img, #update .update .in-reply .avatar img {
width: 18px;
margin-bottom: -4px;
}
#fourohfour .update .links, #update .update .links {
float: right;
}
#fourohfour .update .remove-update, #update .update .remove-update, .update .remove-update {
cursor: pointer;
float: right;
border: none;
Expand Down
Loading

0 comments on commit 3d05a05

Please sign in to comment.