From 90856da2e8f500c168a53257a6bc8cbfa536af93 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 13:56:17 -0600 Subject: [PATCH 01/10] use ruby daemons instead of rack to control facebook application --- facebook.ru | 10 ---------- facebook_daemon.rb | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) delete mode 100644 facebook.ru create mode 100755 facebook_daemon.rb diff --git a/facebook.ru b/facebook.ru deleted file mode 100644 index 160f4f2..0000000 --- a/facebook.ru +++ /dev/null @@ -1,10 +0,0 @@ -require 'rubygems' -require 'sinatra' - -Sinatra::Application.default_options.merge!( - :run => false, - :env => :production -) - -require 'binaryattraction_facebooker' -run Sinatra.application diff --git a/facebook_daemon.rb b/facebook_daemon.rb new file mode 100755 index 0000000..23dcb69 --- /dev/null +++ b/facebook_daemon.rb @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +require 'rubygems' +require 'daemons' + +opts = { + :app_name => 'binaryattraction_facebooker', + :dir_mode => :script, + :dir => '/log', + :backtrace => true, + :multiple => true, + :log_output => true +} + +Daemons.run(File.dirname(__FILE__) + '/binaryattraction_facebooker.rb', opts) From f72f33afaf3ce1d005f9adaee24d81727ff3f0e2 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 14:10:56 -0600 Subject: [PATCH 02/10] renaming script file --- facebook_daemon.rb => facebook_daemon | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename facebook_daemon.rb => facebook_daemon (100%) diff --git a/facebook_daemon.rb b/facebook_daemon similarity index 100% rename from facebook_daemon.rb rename to facebook_daemon From ffd48aef82928be12c08bb7d5d632085db520fe8 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 14:55:23 -0600 Subject: [PATCH 03/10] reduce size of photo browser and only display 16 images per page --- binaryattraction_facebooker.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binaryattraction_facebooker.rb b/binaryattraction_facebooker.rb index 7e172e8..328e3e7 100755 --- a/binaryattraction_facebooker.rb +++ b/binaryattraction_facebooker.rb @@ -111,7 +111,7 @@ end # subtract all of the ones already added into ba post '/add_photos' do @page = params[:page].to_i - per_page = 20 + per_page = 16 if params[:save] (0..per_page).each do |pidx| fb_photo_id = params["photo_ids[#{pidx}]"] @@ -264,7 +264,7 @@ __END__ overflow: hidden padding: 0 position: relative - width: 750px + width: 95% .table_wrapper padding: 0 5px margin: 0 @@ -488,7 +488,7 @@ __END__ %div.table_wrapper %table %tbody - - @fb_photos.each_slice(5) do |slice| + - @fb_photos.each_slice(4) do |slice| %tr - slice.each do |photo| %td.photos_table_cell From b0a2d54c3e2689ace959f09b75d7d7937d9cd2e3 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 14:55:38 -0600 Subject: [PATCH 04/10] use thin and rack for deployment. it plays nicer with monit --- config.ru | 11 +++++++++++ config.yml | 14 ++++++++++++++ facebook_daemon | 15 --------------- 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 config.ru create mode 100644 config.yml delete mode 100755 facebook_daemon diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..2c0fefd --- /dev/null +++ b/config.ru @@ -0,0 +1,11 @@ +require 'rubygems' +require 'sinatra' + +Sinatra::Application.default_options.merge!( + :run => false, + :env => :production +) + +require 'binaryattraction_facebooker' +run Sinatra.application + diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..74c7007 --- /dev/null +++ b/config.yml @@ -0,0 +1,14 @@ +--- + environment: production + chdir: /webapp/binaryattraction + address: 127.0.0.1 + user: webapp + group: webapp + port: 12501 + pid: /webapp/binaryattraction/log/sinatra.pid + rackup: /webapp/binaryattraction/config.ru + log: /webapp/binaryattraction/sinatra.log + max_conns: 1024 + timeout: 30 + max_persistent_conns: 512 + daemonize: true diff --git a/facebook_daemon b/facebook_daemon deleted file mode 100755 index 23dcb69..0000000 --- a/facebook_daemon +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubygems' -require 'daemons' - -opts = { - :app_name => 'binaryattraction_facebooker', - :dir_mode => :script, - :dir => '/log', - :backtrace => true, - :multiple => true, - :log_output => true -} - -Daemons.run(File.dirname(__FILE__) + '/binaryattraction_facebooker.rb', opts) From d65155b17b74d7a14056722505e14ea1a1e6b4ba Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 15:06:32 -0600 Subject: [PATCH 05/10] photo box needs to be a bit wider --- binaryattraction_facebooker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaryattraction_facebooker.rb b/binaryattraction_facebooker.rb index 328e3e7..b0ebd94 100755 --- a/binaryattraction_facebooker.rb +++ b/binaryattraction_facebooker.rb @@ -264,7 +264,7 @@ __END__ overflow: hidden padding: 0 position: relative - width: 95% + width: 100% .table_wrapper padding: 0 5px margin: 0 From 43514cd26b895228f22e81615b92414062b51db1 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 15:09:39 -0600 Subject: [PATCH 06/10] wrong log location --- config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yml b/config.yml index 74c7007..5cb780d 100644 --- a/config.yml +++ b/config.yml @@ -7,7 +7,7 @@ port: 12501 pid: /webapp/binaryattraction/log/sinatra.pid rackup: /webapp/binaryattraction/config.ru - log: /webapp/binaryattraction/sinatra.log + log: /webapp/binaryattraction/log/sinatra.log max_conns: 1024 timeout: 30 max_persistent_conns: 512 From 607589db21cb3d6bdcc247cdfe07303a043d6bb3 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 15:11:12 -0600 Subject: [PATCH 07/10] need fixed width --- binaryattraction_facebooker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaryattraction_facebooker.rb b/binaryattraction_facebooker.rb index b0ebd94..f36367c 100755 --- a/binaryattraction_facebooker.rb +++ b/binaryattraction_facebooker.rb @@ -264,7 +264,7 @@ __END__ overflow: hidden padding: 0 position: relative - width: 100% + width: 644px .table_wrapper padding: 0 5px margin: 0 From f852c1576e2a8588f70ea0258e709d46fda01258 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 15:21:01 -0600 Subject: [PATCH 08/10] oh, i can make that wider in facebook --- binaryattraction_facebooker.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/binaryattraction_facebooker.rb b/binaryattraction_facebooker.rb index f36367c..7e172e8 100755 --- a/binaryattraction_facebooker.rb +++ b/binaryattraction_facebooker.rb @@ -111,7 +111,7 @@ end # subtract all of the ones already added into ba post '/add_photos' do @page = params[:page].to_i - per_page = 16 + per_page = 20 if params[:save] (0..per_page).each do |pidx| fb_photo_id = params["photo_ids[#{pidx}]"] @@ -264,7 +264,7 @@ __END__ overflow: hidden padding: 0 position: relative - width: 644px + width: 750px .table_wrapper padding: 0 5px margin: 0 @@ -488,7 +488,7 @@ __END__ %div.table_wrapper %table %tbody - - @fb_photos.each_slice(4) do |slice| + - @fb_photos.each_slice(5) do |slice| %tr - slice.each do |photo| %td.photos_table_cell From e4665f631aeecd6f0fe729adc4820f9c349b90cb Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 15:31:50 -0600 Subject: [PATCH 09/10] wrong image filename --- binaryattraction_facebooker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaryattraction_facebooker.rb b/binaryattraction_facebooker.rb index 7e172e8..3691207 100755 --- a/binaryattraction_facebooker.rb +++ b/binaryattraction_facebooker.rb @@ -424,7 +424,7 @@ __END__ %img#ajax_loading{ :alt => 'loading', :src => 'http://static.ak.fbcdn.net/images/upload_progress.gif?1:25923' } %br{ :style => 'clear: both' } %div#ba_content - %img{ :src => 'http://binaryattraction.com/images/binarattraction.png', :style => 'display: block; margin-left: auto; margin-right: auto' } + %img{ :src => 'http://binaryattraction.com/images/binaryattraction.png', :style => 'display: block; margin-left: auto; margin-right: auto' } %h1 What this is all about %blockquote All you young guys are on a binary system. It's either 0 or 1. From c4fc51b07098ec5bb0f5ce2702ff960743c1fcc0 Mon Sep 17 00:00:00 2001 From: Coleman Date: Sun, 23 Nov 2008 16:03:19 -0600 Subject: [PATCH 10/10] that is not the correct address for post-invite redirection --- binaryattraction_facebooker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binaryattraction_facebooker.rb b/binaryattraction_facebooker.rb index 3691207..d7897c9 100755 --- a/binaryattraction_facebooker.rb +++ b/binaryattraction_facebooker.rb @@ -538,5 +538,5 @@ __END__ %td= ba_user.votes.select { |v| v.zero? }.size @@ invite -%fb:request-form{ :type => 'Binary Attraction', :content => "Your friends think you should check out your oneness at ", :action => 'http://apps.binaryattraction.com/binaryattraction', :invite => true, :method => 'POST' } +%fb:request-form{ :type => 'Binary Attraction', :content => "Your friends think you should check out your oneness at ", :action => 'http://apps.facebook.com/binaryattraction', :invite => true, :method => 'POST' } %fb:multi-friend-selector{ :actiontext => "Invite your friends to vote on ones (and not ones)", :showborder => true, :exclude_ids => session[:facebook_session].user.friends_with_this_app.map(&:id).join(","), :bypass => "cancel" }