Browse files

adding a task to find missing images

  • Loading branch information...
1 parent 38a57ec commit f8d40faeffb7b0a479a77e76b238e17127369b29 @tenderlove committed Mar 27, 2011
Showing with 56 additions and 35 deletions.
  1. +2 −2 Gemfile
  2. +33 −33 Gemfile.lock
  3. +1 −0 config/environment.rb
  4. +20 −0 lib/tasks/import.rake
View
4 Gemfile
@@ -1,11 +1,11 @@
source 'http://rubygems.org'
-gem 'rails', '3.0.4.rc1'
+gem 'rails', '3.0.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
-gem 'sqlite3-ruby', :require => 'sqlite3'
+gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
View
66 Gemfile.lock
@@ -2,38 +2,38 @@ GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
- actionmailer (3.0.3)
- actionpack (= 3.0.3)
- mail (~> 2.2.9)
- actionpack (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
+ actionmailer (3.0.5)
+ actionpack (= 3.0.5)
+ mail (~> 2.2.15)
+ actionpack (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4)
rack (~> 1.2.1)
rack-mount (~> 0.6.13)
- rack-test (~> 0.5.6)
+ rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
- activemodel (3.0.3)
- activesupport (= 3.0.3)
+ activemodel (3.0.5)
+ activesupport (= 3.0.5)
builder (~> 2.1.2)
i18n (~> 0.4)
- activerecord (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
+ activerecord (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
- activeresource (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- activesupport (3.0.3)
- arel (2.0.6)
+ activeresource (3.0.5)
+ activemodel (= 3.0.5)
+ activesupport (= 3.0.5)
+ activesupport (3.0.5)
+ arel (2.0.8)
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
i18n (0.5.0)
- mail (2.2.13)
+ mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -43,31 +43,31 @@ GEM
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
- rack-test (0.5.6)
+ rack-test (0.5.7)
rack (>= 1.0)
- rails (3.0.3)
- actionmailer (= 3.0.3)
- actionpack (= 3.0.3)
- activerecord (= 3.0.3)
- activeresource (= 3.0.3)
- activesupport (= 3.0.3)
+ rails (3.0.5)
+ actionmailer (= 3.0.5)
+ actionpack (= 3.0.5)
+ activerecord (= 3.0.5)
+ activeresource (= 3.0.5)
+ activesupport (= 3.0.5)
bundler (~> 1.0)
- railties (= 3.0.3)
- railties (3.0.3)
- actionpack (= 3.0.3)
- activesupport (= 3.0.3)
+ railties (= 3.0.5)
+ railties (3.0.5)
+ actionpack (= 3.0.5)
+ activesupport (= 3.0.5)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
- sqlite3-ruby (1.3.2)
+ sqlite3 (1.3.3)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
- tzinfo (0.3.23)
+ tzinfo (0.3.24)
PLATFORMS
ruby
DEPENDENCIES
- rails (= 3.0.3)
- sqlite3-ruby
+ rails (= 3.0.5)
+ sqlite3
View
1 config/environment.rb
@@ -1,5 +1,6 @@
# Load the rails application
require File.expand_path('../application', __FILE__)
+ENV['RAILS_ASSET_ID'] = ''
# Initialize the rails application
Rubycommitters::Application.initialize!
View
20 lib/tasks/import.rake
@@ -4,3 +4,23 @@ desc "import the list of ruby committers"
task :import => 'db:migrate' do
Account.import open('http://svn.coderepos.org/share/lang/ruby/ruby-committers/ruby-committers.yml')
end
+
+desc "missing images"
+namespace :images do
+ task :missing => 'environment' do
+ usernames = Portrait.find(:all, :include => :account).map(&:account).map(&:username).uniq
+
+ photodir = File.join Rails.root, 'public', 'images', 'people', 'photos'
+ missing = Dir.chdir(photodir) do
+ usernames - Dir['*'].map { |x|
+ File.basename(File.basename(x, '.jpg'), '.png')
+ }
+ end
+
+ Account.find_all_by_username(missing).each do |account|
+ account.portraits.each do |portrait|
+ p account.username => portrait.url
+ end
+ end
+ end
+end

0 comments on commit f8d40fa

Please sign in to comment.