From 4a86632cf33ae4753a451c20ea675af885d0c513 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 20:47:21 -0700 Subject: [PATCH 01/11] show default user photos for requests --- app/views/aspects/manage.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/aspects/manage.html.haml b/app/views/aspects/manage.html.haml index 640c545ca..54cb3eee8 100644 --- a/app/views/aspects/manage.html.haml +++ b/app/views/aspects/manage.html.haml @@ -29,7 +29,7 @@ %ul - for request in @remote_requests %li.requested_person{:id => request.person.id, :request_id => request.id} - = image_tag(request.person.profile.image_url(:thumb_small)) unless request.person.profile.image_url.nil? + = person_image_tag(request.person) .name = request.person.real_name %h1 From 509c16d9537fdf35534a825ecf4adc23366b5f5f Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 21:10:10 -0700 Subject: [PATCH 02/11] debugging js --- public/javascripts/aspect-edit.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index b21a9dd9f..ecc67225f 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -44,7 +44,14 @@ $(function() { $.ajax({ type: "DELETE", url: "/requests/" + ui.draggable[0].getAttribute('request_id') , - data: {"accept" : true , "aspect_id" : $(this)[0].id } + data: {"accept" : true , "aspect_id" : $(this)[0].id }, + success: function(data){ + var old_request_count = $(".new_requests").html().match(/\d+/); + + alert( old_request_count ); + + $(".new_requests").html().replace(/\d+/,old_request_count-1); + } }); }else { From aaaa10b7e4af072c3c1c92735930851b58774e33 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 21:12:56 -0700 Subject: [PATCH 03/11] more testing --- public/javascripts/aspect-edit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index ecc67225f..1600f89ba 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -49,8 +49,8 @@ $(function() { var old_request_count = $(".new_requests").html().match(/\d+/); alert( old_request_count ); - - $(".new_requests").html().replace(/\d+/,old_request_count-1); + $(".new_requests").html( + $(".new_requests").html().replace(/\d+/,old_request_count-1)); } }); From 6c2c3d9157356d85f61fc189bf3cb29f0522430f Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 21:16:16 -0700 Subject: [PATCH 04/11] working? --- public/javascripts/aspect-edit.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 1600f89ba..32c404327 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -48,9 +48,14 @@ $(function() { success: function(data){ var old_request_count = $(".new_requests").html().match(/\d+/); - alert( old_request_count ); - $(".new_requests").html( - $(".new_requests").html().replace(/\d+/,old_request_count-1)); + if( old_request_count == 1 ) { + $(".new_requests").html( + $(".new_requests").html().replace(/ \(\d+\)/,''); + + } else { + $(".new_requests").html( + $(".new_requests").html().replace(/\d+/,old_request_count-1)); + } } }); From 55f00eb955e71edbaa5c363dd933a6468c263a75 Mon Sep 17 00:00:00 2001 From: maxwell Date: Tue, 14 Sep 2010 21:16:47 -0700 Subject: [PATCH 05/11] MS two dumb readme sudo changes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b9f1eafb3..772bf7504 100644 --- a/README.md +++ b/README.md @@ -91,12 +91,12 @@ On **Ubuntu**, run the following: sudo ruby setup.rb sudo ln -s /usr/bin/gem1.8 /usr/bin/gem -On **Mac OS X**, RubyGems comes preinstalled; however, you might need to update it for use with the latest Bundler. To update RubyGems, run `gem update --system`. +On **Mac OS X**, RubyGems comes preinstalled; however, you might need to update it for use with the latest Bundler. To update RubyGems, run `sudo gem update --system`. ### Bundler -After RubyGems is updated, simply run `gem install bundler` to get Bundler. +After RubyGems is updated, simply run `sudo gem install bundler` to get Bundler. ## Getting Diaspora From 12e15ba3a1e40ff28ee76e1aa931873ca6a37f12 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 21:17:27 -0700 Subject: [PATCH 06/11] forgot a paren --- public/javascripts/aspect-edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 32c404327..1aa7b5a89 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -50,7 +50,7 @@ $(function() { if( old_request_count == 1 ) { $(".new_requests").html( - $(".new_requests").html().replace(/ \(\d+\)/,''); + $(".new_requests").html().replace(/ \(\d+\)/,'')); } else { $(".new_requests").html( From b77260af6b4e240304ce4e0d39c176768b785404 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Tue, 14 Sep 2010 21:24:57 -0700 Subject: [PATCH 07/11] Decrement request counter on request action --- public/javascripts/aspect-edit.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/public/javascripts/aspect-edit.js b/public/javascripts/aspect-edit.js index 1aa7b5a89..15562780c 100644 --- a/public/javascripts/aspect-edit.js +++ b/public/javascripts/aspect-edit.js @@ -28,6 +28,20 @@ $('#move_friends_link').live( 'click', function(){ }); +function decrementRequestsCounter(){ + var old_request_count = $(".new_requests").html().match(/\d+/); + + if( old_request_count == 1 ) { + $(".new_requests").html( + $(".new_requests").html().replace(/ \(\d+\)/,'')); + + } else { + $(".new_requests").html( + $(".new_requests").html().replace(/\d+/,old_request_count-1)); + } + +} + $(function() { $("ul .person").draggable({ revert: true @@ -46,16 +60,7 @@ $(function() { url: "/requests/" + ui.draggable[0].getAttribute('request_id') , data: {"accept" : true , "aspect_id" : $(this)[0].id }, success: function(data){ - var old_request_count = $(".new_requests").html().match(/\d+/); - - if( old_request_count == 1 ) { - $(".new_requests").html( - $(".new_requests").html().replace(/ \(\d+\)/,'')); - - } else { - $(".new_requests").html( - $(".new_requests").html().replace(/\d+/,old_request_count-1)); - } + decrementRequestsCounter(); } }); @@ -84,7 +89,7 @@ $(function() { type: "DELETE", url: "/requests/" + ui.draggable[0].getAttribute('request_id') }); - alert("Removed Request, proably want an undo countdown.") + decrementRequestsCounter(); $(ui.draggable[0]).fadeOut('slow') }else{ $.ajax({ From 1d9403968417495e0ef0616a1c0fd81594e650f4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 14 Sep 2010 22:28:13 -0700 Subject: [PATCH 09/11] put in deploy configs --- config/deploy.rb | 164 +++++++++++++++++++++++++++++++++++++++ config/deploy_config.yml | 85 ++++++++++++++++++++ 2 files changed, 249 insertions(+) create mode 100644 config/deploy.rb create mode 100644 config/deploy_config.yml diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 000000000..f0bf1e5c2 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,164 @@ +# Copyright 2010 Diaspora Inc. +# +# This file is part of Diaspora. +# +# Diaspora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Diaspora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Diaspora. If not, see . +# + + + +config = YAML.load_file(File.dirname(__FILE__) + '/deploy_config.yml') +all = config['cross_server'] + +set :backers, config['servers']['backer'] +set :application, "diaspora" +set :deploy_to, all['deploy_to'] +#set :runner, "diasporaroot" +#set :current_dir, "" +# Source code +set :scm, :git +set :user, all['user'] +#set :user, ARGV[0] +set :password, all['password'] +set :scm_verbose, true +set :repository, all['repo'] +set :branch, all['branch'] +set :repository_cache, "remote_cache" +set :deploy_via, :checkout +#ssh_options[:forward_agent] = true +#set :ssh_options, { :forward_agent => true } +# +set :rails_env, ENV['rails_env'] || ENV['RAILS_ENV'] || all['default_env'] + +role :tom, "tom.joindiaspora.com" +backers.each{ |backer| + role :backer, "#{backer['username']}.joindiaspora.com", :number => backer['number'] +} + +#role :ci, "ci.joindiaspora.com" +# If you are using Passenger mod_rails uncomment this: +# if you're still using the script/reapear helper you will need +# these http://github.com/rails/irs_process_scripts + +# Start Nginx +after "deploy:cold" do + run("nginx stop") + run("killall nginx") + #run("nginx") +end + +namespace :deploy do + task :symlink_images do + run "mkdir -p #{shared_path}/uploads" + run "ln -s -f #{shared_path}/uploads #{current_path}/public/uploads" + end + + task :symlink_bundle do + run "mkdir -p #{shared_path}/bundle" + run "ln -s -f #{shared_path}/bundle #{current_path}/vendor/bundle" + end + + task :start do + start_mongo + start_thin + end + + task :start_mongo do + run("mkdir -p -v #{current_path}/log/db/ ") + run("mkdir -p -v #{shared_path}/db/") + run("mongod --fork --logpath #{current_path}/log/db/mongolog.txt --dbpath #{shared_path}/db/ " ) + end + + task :start_thin do + run("mkdir -p -v #{current_path}/log/thin/ ") + run("cd #{current_path} && bundle exec thin start -C config/thin.yml") + end + + task :stop do + stop_thin + run("killall -s 2 mongod || true") + end + + task :stop_thin do + run("killall -s 2 ruby || true") + #run("cd #{current_path} && bundle exec thin stop -C config/thin.yml || true") + end + + task :restart, :roles => :app, :except => { :no_release => true } do + stop + start + end + + task :bundle_gems do + run "cd #{current_path} && bundle install" + end + + task :reinstall_old_bundler do + #run ("rm #{current_path}/Gemfile.lock || true") + run 'gem list | cut -d" " -f1 | xargs gem uninstall -aIx || true ' + run "gem install bundler -v 0.9.26 || true" + end + + task :update_bundler do + run 'gem install bundler' + end + + + task :migrate do + end + end + +namespace :cloud do + task :reboot do + run('reboot') + end + + task :clear_bundle do + + run('cd && rm -r -f .bundle') + end +end +namespace :db do + + task :purge, :roles => [:tom, :backer] do + run "cd #{current_path} && bundle exec rake db:purge --trace RAILS_ENV=#{rails_env}" + end + + task :tom_seed, :roles => :tom do + run "cd #{current_path} && bundle exec rake db:seed:tom --trace RAILS_ENV=#{rails_env}" + run "curl -silent -u tom@tom.joindiaspora.com:evankorth http://tom.joindiaspora.com/zombiefriends" + backers.each do |backer| + run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/zombiefriendaccept" + #run "curl -silent -u #{backer['username']}@#{backer['username']}.joindiaspora.com:#{backer['username']}#{backer['pin']} http://#{backer['username']}.joindiaspora.com/set_profile_photo" + end + + end + + task :backer_seed, :roles => :backer do + (0..10).each { |n| + run "curl -silent http://localhost/set_backer_number?number=#{n}", :only => {:number => n} + } + run "cd #{current_path} && bundle exec rake db:seed:backer --trace RAILS_ENV=#{rails_env}" + end + + task :reset do + purge + backer_seed + tom_seed + end + + +end + +after "deploy:symlink", "deploy:symlink_images", "deploy:symlink_bundle" diff --git a/config/deploy_config.yml b/config/deploy_config.yml new file mode 100644 index 000000000..98763d0da --- /dev/null +++ b/config/deploy_config.yml @@ -0,0 +1,85 @@ +# Copyright 2010 Diaspora Inc. +# +# This file is part of Diaspora. +# +# Diaspora is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Diaspora is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Diaspora. If not, see . +# + + + +cross_server: + deploy_to: '/usr/local/app/diaspora' + user: 'root' + repo: 'git@github.com:diaspora/diaspora.git' + branch: 'master' + default_env: 'development' +servers: + tom: + - url: 'tom.joindiaspora.com' + backer: + - username: 'washington' + given_name: 'George' + family_name: 'Washington' + number: 0 + pin: 5072 + - username: 'adams' + given_name: 'John' + family_name: 'Adams' + number: 1 + pin: 3742 + - username: 'jefferson' + given_name: 'Thomas' + family_name: 'Jefferson' + number: 2 + pin: 7782 + - username: 'madison' + given_name: 'James' + family_name: 'Madison' + number: 3 + pin: 2691 + - username: 'monroe' + given_name: 'James' + family_name: 'Monroe' + number: 4 + pin: 6133 + - username: 'quincyadams' + given_name: 'John Quincy' + family_name: 'Adams' + number: 5 + pin: 7558 + - username: 'jackson' + given_name: 'Andrew' + family_name: 'Jackson' + number: 6 + pin: 8670 + - username: 'buren' + given_name: 'Martin' + family_name: 'Van Buren' + number: 7 + pin: 1559 + - username: 'harrison' + given_name: 'William Henry' + family_name: 'Harrison' + number: 8 + pin: 5404 + - username: 'tyler' + given_name: 'John' + family_name: 'Tyler' + number: 9 + pin: 6431 + - username: 'polk' + given_name: 'James K.' + family_name: 'Polk' + number: 10 + pin: 1957 From 1d04c89b48d58de40b52be4ee8c829ef7ba35f40 Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Wed, 15 Sep 2010 00:39:48 -0700 Subject: [PATCH 10/11] header tweak --- public/stylesheets/application.css | 18 ++++++++++-------- public/stylesheets/sass/application.sass | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index dc43acdfa..fb34cdc83 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -85,9 +85,9 @@ header { margin: -2em; margin-bottom: 2em; color: black; - background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(black), to(#333333)); - background: -moz-linear-gradient(19% 75% 90deg, #333333, black); - background-color: #222222; + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#666666), to(#222222)); + background: -moz-linear-gradient(19% 75% 90deg, #222222, #666666); + background-color: #666666; padding: 0; padding-top: 5px; border-bottom: 1px solid #cccccc; } @@ -120,7 +120,7 @@ header { header #aspect_header { z-index: 5; background-color: #eeeeee; - border-top: 1px solid #555555; + border-top: 1px solid white; padding: 20px 0; } header #aspect_header h1 { margin-bottom: 0; @@ -469,15 +469,17 @@ h1.big_text { padding-bottom: 2px; color: #999999; } #aspect_nav ul > li a:hover { - background-color: #555555; + background-color: #4e4e4e; color: #cccccc; } #aspect_nav ul > li.selected a { - padding-top: 5px; - padding-bottom: 3px; + text-shadow: 0 2px 0 white; + padding-top: 4px; + padding-bottom: 4px; line-height: 18px; font-weight: bold; background-color: #eeeeee; - border-bottom: 1px solid #eeeeee; + border: 1px solid white; + border-bottom: none; color: black; } #aspect_nav ul > li.selected a:hover { background-color: #efefef; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 45413512f..a96b19507 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -112,10 +112,10 @@ header :margin -2em :bottom 2em :color #000 - :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#000000), to(#333333)) - :background -moz-linear-gradient(19% 75% 90deg, #333333, #000000) + :background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#666), to(#222)) + :background -moz-linear-gradient(19% 75% 90deg, #222, #666) :background - :color #222 + :color #666 :padding 0 :top 5px :border @@ -164,7 +164,7 @@ header :background :color #eee :border - :top 1px solid #555 + :top 1px solid #fff :padding 20px 0 h1 @@ -633,21 +633,22 @@ h1.big_text &:hover :background - :color #555 + :color #4e4e4e :color #ccc &.selected a + :text-shadow 0 2px 0 #fff :padding - :top 5px - :bottom 3px + :top 4px + :bottom 4px :line :height 18px :font :weight bold :background :color #eee - :border - :bottom 1px solid #eee + :border 1px solid #fff + :bottom none :color #000 &:hover :background From 6dff249c733c81af9165b6f436047bd33ce88f68 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 15 Sep 2010 09:43:59 -0700 Subject: [PATCH 11/11] Check for the presence of a password in the deploy config --- config/deploy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy.rb b/config/deploy.rb index f0bf1e5c2..0394af864 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -30,7 +30,7 @@ set :deploy_to, all['deploy_to'] set :scm, :git set :user, all['user'] #set :user, ARGV[0] -set :password, all['password'] +set :password, all['password'] if all['password'] set :scm_verbose, true set :repository, all['repo'] set :branch, all['branch']