sex_it_up 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
 - data/README.rdoc +40 -0
 - data/Rakefile +50 -0
 - data/lib/generators/sex_it_up/sex_it_up_generator.rb +26 -0
 - data/lib/generators/sex_it_up/templates/sex_it_up_migration.rb +22 -0
 - data/lib/sex_it_up.rb +137 -0
 - data/lib/tasks/sex_it_up.rb +10 -0
 - data/spec/factories/Plato_and_Aristotle_in_The_School_of_Athens,_by_italian_Rafael.jpg +0 -0
 - data/spec/factories/sex_it_up_image_factory.rb +7 -0
 - data/spec/helpers/sex_it_up_helper.rb +25 -0
 - data/spec/initializers/paperclip.rb +13 -0
 - data/spec/schema.rb +12 -0
 - data/spec/sex_it_up_spec.rb +31 -0
 - data/spec/spec_helper.rb +45 -0
 - metadata +278 -0
 
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2009 Jim Jones
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 4 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 5 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 6 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 7 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 8 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 9 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 12 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 15 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 16 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 17 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 18 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 19 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 20 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.rdoc
    ADDED
    
    | 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            == Description
         
     | 
| 
      
 2 
     | 
    
         
            +
            Turn your boring demo website and placeholder images into a beautiful display of artwork.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            In your Gemfile, add the following :
         
     | 
| 
      
 5 
     | 
    
         
            +
                gem "sex_it_up", ">= 1.0.0"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Then perform the following from the root of your application directory :
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                bundle install
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Now we need to copy over the needed migration :
         
     | 
| 
      
 12 
     | 
    
         
            +
                rails g sex_it_up
         
     | 
| 
      
 13 
     | 
    
         
            +
                rake db:migrate
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            == Displaying Images
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            If you want to display a random image for the term 'dog', first add the following to your Rakefile :
         
     | 
| 
      
 18 
     | 
    
         
            +
                require 'tasks/sex_it_up'
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Once you have the rake task available, you can issue the following rake command to warm the image cache for a given term :
         
     | 
| 
      
 21 
     | 
    
         
            +
                rake sex_it_up:cache[<Term>]
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                e.g. :
         
     | 
| 
      
 24 
     | 
    
         
            +
                rake sex_it_up:cache["dog"]
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            Once the rake task has completed, change your erb view to call the following helper :
         
     | 
| 
      
 27 
     | 
    
         
            +
                sexy_image('dog', :width => 100, :height => 100)
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            This helper will find a random image for the given term, scale it to the passed in dimensions, and display it.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            == Other Uses
         
     | 
| 
      
 32 
     | 
    
         
            +
            If you wanted to replace your boring default user avatars, you could do the following
         
     | 
| 
      
 33 
     | 
    
         
            +
                user.icon = SexItUp::SexItUpImage.find_all('dog').random.first
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            == Sample Screenshot
         
     | 
| 
      
 36 
     | 
    
         
            +
            http://i.imgur.com/bmHvj.png
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            == Copyright
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            Copyright (c) 2010 Jim Jones. See LICENSE for details.
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundler'
         
     | 
| 
      
 3 
     | 
    
         
            +
            begin
         
     | 
| 
      
 4 
     | 
    
         
            +
              Bundler.setup(:default, :development)
         
     | 
| 
      
 5 
     | 
    
         
            +
            rescue Bundler::BundlerError => e
         
     | 
| 
      
 6 
     | 
    
         
            +
              $stderr.puts e.message
         
     | 
| 
      
 7 
     | 
    
         
            +
              $stderr.puts "Run `bundle install` to install missing gems"
         
     | 
| 
      
 8 
     | 
    
         
            +
              exit e.status_code
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'rake'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            require 'jeweler'
         
     | 
| 
      
 13 
     | 
    
         
            +
            Jeweler::Tasks.new do |gem|
         
     | 
| 
      
 14 
     | 
    
         
            +
            	gem.name = "sex_it_up"
         
     | 
| 
      
 15 
     | 
    
         
            +
            	gem.summary = %Q{Replace your boring place-holder images with beautiful public domain images of history's greatest artwork and sculptures.}
         
     | 
| 
      
 16 
     | 
    
         
            +
            	gem.description = %Q{SexItUp allows for the easy drop-in of public domain images for site mockups and user avatars.}
         
     | 
| 
      
 17 
     | 
    
         
            +
            	gem.email = "jjones@aantix.com"
         
     | 
| 
      
 18 
     | 
    
         
            +
            	gem.homepage = "http://github.com/aantix/sex_it_up"
         
     | 
| 
      
 19 
     | 
    
         
            +
            	gem.authors = ["Jim Jones"]
         
     | 
| 
      
 20 
     | 
    
         
            +
            	gem.require_path = 'lib'
         
     | 
| 
      
 21 
     | 
    
         
            +
                gem.version = "1.0.0"
         
     | 
| 
      
 22 
     | 
    
         
            +
            	gem.add_development_dependency "paperclip", ">= 2.3.5"
         
     | 
| 
      
 23 
     | 
    
         
            +
            	gem.add_development_dependency "mechanize", ">= 1.0.0"
         
     | 
| 
      
 24 
     | 
    
         
            +
            	gem.add_development_dependency "google-search", ">= 1.0.2"
         
     | 
| 
      
 25 
     | 
    
         
            +
                gem.files = %w(MIT-LICENSE README.textile Rakefile init.rb) + Dir.glob("{generators,lib,spec}/**/*")
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
      
 27 
     | 
    
         
            +
            Jeweler::RubygemsDotOrgTasks.new
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            require 'rspec/core'
         
     | 
| 
      
 30 
     | 
    
         
            +
            require 'rspec/core/rake_task'
         
     | 
| 
      
 31 
     | 
    
         
            +
            RSpec::Core::RakeTask.new(:spec) do |spec|
         
     | 
| 
      
 32 
     | 
    
         
            +
              spec.pattern = FileList['spec/**/*_spec.rb']
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            RSpec::Core::RakeTask.new(:rcov) do |spec|
         
     | 
| 
      
 36 
     | 
    
         
            +
              spec.pattern = 'spec/**/*_spec.rb'
         
     | 
| 
      
 37 
     | 
    
         
            +
              spec.rcov = true
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            task :default => :spec
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            require 'rake/rdoctask'
         
     | 
| 
      
 43 
     | 
    
         
            +
            Rake::RDocTask.new do |rdoc|
         
     | 
| 
      
 44 
     | 
    
         
            +
              version = File.exist?('VERSION') ? File.read('VERSION') : ""
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              rdoc.rdoc_dir = 'rdoc'
         
     | 
| 
      
 47 
     | 
    
         
            +
              rdoc.title = "sex_it_up #{version}"
         
     | 
| 
      
 48 
     | 
    
         
            +
              rdoc.rdoc_files.include('README*')
         
     | 
| 
      
 49 
     | 
    
         
            +
              rdoc.rdoc_files.include('lib/**/*.rb')
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rails/generators'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rails/generators/migration'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class SexItUpGenerator < Rails::Generators::Base
         
     | 
| 
      
 5 
     | 
    
         
            +
              include Rails::Generators::Migration
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              #source_root = File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
         
     | 
| 
      
 8 
     | 
    
         
            +
              def self.source_root
         
     | 
| 
      
 9 
     | 
    
         
            +
                 @source_root ||= File.join(File.dirname(__FILE__), 'templates')
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def generate_migration
         
     | 
| 
      
 13 
     | 
    
         
            +
                migration_template "sex_it_up_migration.rb", "db/migrate/create_sex_it_up_images.rb"
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              protected
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def self.next_migration_number(dirname)
         
     | 
| 
      
 19 
     | 
    
         
            +
                if ActiveRecord::Base.timestamped_migrations
         
     | 
| 
      
 20 
     | 
    
         
            +
                  Time.now.utc.strftime("%Y%m%d%H%M%S")
         
     | 
| 
      
 21 
     | 
    
         
            +
                else
         
     | 
| 
      
 22 
     | 
    
         
            +
                  "%.3d" % (current_migration_number(dirname) + 1)
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'sex_it_up'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class CreateSexItUpImages < ActiveRecord::Migration
         
     | 
| 
      
 4 
     | 
    
         
            +
              def self.up
         
     | 
| 
      
 5 
     | 
    
         
            +
                #load(File.dirname(__FILE__) + '/../../../spec/schema.rb')
         
     | 
| 
      
 6 
     | 
    
         
            +
                create_table "sex_it_up_images" do |t|
         
     | 
| 
      
 7 
     | 
    
         
            +
                  t.string :image_search_term
         
     | 
| 
      
 8 
     | 
    
         
            +
                  t.string :image_original_url
         
     | 
| 
      
 9 
     | 
    
         
            +
                  t.string :image_url
         
     | 
| 
      
 10 
     | 
    
         
            +
                  t.string :image_file_name
         
     | 
| 
      
 11 
     | 
    
         
            +
                  t.string :image_content_type
         
     | 
| 
      
 12 
     | 
    
         
            +
                  t.integer :image_file_size
         
     | 
| 
      
 13 
     | 
    
         
            +
                  t.datetime :image_updated_at
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def self.down
         
     | 
| 
      
 19 
     | 
    
         
            +
                drop_table :sex_it_up_images
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/sex_it_up.rb
    ADDED
    
    | 
         @@ -0,0 +1,137 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'paperclip'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'active_record'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'action_view'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'google-search'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'mechanize'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'open-uri'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            Paperclip.configure
         
     | 
| 
      
 11 
     | 
    
         
            +
            Paperclip::Railtie.insert
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            module SexItUp
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              class SexItUpImage < ActiveRecord::Base
         
     | 
| 
      
 16 
     | 
    
         
            +
                RESULT_LIMIT = 10
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                scope :images_for, lambda {|term|
         
     | 
| 
      
 19 
     | 
    
         
            +
                  where(['image_search_term = ?', term])
         
     | 
| 
      
 20 
     | 
    
         
            +
                }
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                scope :random, lambda {
         
     | 
| 
      
 23 
     | 
    
         
            +
                  max_id  = connection.select_value("select max(id) from #{self.table_name}")
         
     | 
| 
      
 24 
     | 
    
         
            +
                  where("id >= #{rand(max_id)}")
         
     | 
| 
      
 25 
     | 
    
         
            +
                }
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                attr_reader :sizes
         
     | 
| 
      
 28 
     | 
    
         
            +
                has_attached_file :image, :styles => Proc.new { |i| i.instance.attachment_sizes }
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                # Want to give each user a unique avatar?  Assign their profile image to the image returned here.
         
     | 
| 
      
 31 
     | 
    
         
            +
                def self.find_all(term)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  query = "site:commons.wikimedia.org \"is in the public domain\" #{term}"
         
     | 
| 
      
 33 
     | 
    
         
            +
                  cache_search(query, term)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  images_for(term)
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def set_attachment_sizes(sizes = {:thumb => ["100x100"]})
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @sizes = sizes
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def attachment_sizes
         
     | 
| 
      
 42 
     | 
    
         
            +
                  @sizes||={:thumb => ["100x100"]}
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                private
         
     | 
| 
      
 46 
     | 
    
         
            +
                def self.cache_search(query, term)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  num_results = 0
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  Google::Search::Web.new(:query => query).each do |result|
         
     | 
| 
      
 50 
     | 
    
         
            +
                    page        = agent.get(result.uri)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    image       = find_image_link(page)
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                    cache(term, image.href) unless image.nil?
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    num_results+=1
         
     | 
| 
      
 56 
     | 
    
         
            +
                    break if num_results == RESULT_LIMIT
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                def self.find_image_link(page)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  page.links.detect {|link| link.href =~ /http:\/\/upload.wikimedia.org\/wikipedia\/commons\/\w\// }
         
     | 
| 
      
 63 
     | 
    
         
            +
                end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                def self.agent
         
     | 
| 
      
 66 
     | 
    
         
            +
                  @agent||= Mechanize.new
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @agent.max_history = 1
         
     | 
| 
      
 68 
     | 
    
         
            +
                  @agent.user_agent_alias = 'Mac Safari'
         
     | 
| 
      
 69 
     | 
    
         
            +
                  @agent
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                def self.cache(search_term, img_url)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  # No need to re-retrieve file if already done so
         
     | 
| 
      
 74 
     | 
    
         
            +
                  image = find_by_image_original_url(img_url)
         
     | 
| 
      
 75 
     | 
    
         
            +
                  return image unless image.nil?
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  #image = open img_url
         
     | 
| 
      
 78 
     | 
    
         
            +
                  image = open(URI.parse(img_url))
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                  # The original_filename passed in from a file open is unintelligible;
         
     | 
| 
      
 81 
     | 
    
         
            +
                  #   change it to something better. Feels 'dirty' but admittance is the first step.
         
     | 
| 
      
 82 
     | 
    
         
            +
                  def image.original_filename; CGI.unescape(base_uri.path.split('/').last); end
         
     | 
| 
      
 83 
     | 
    
         
            +
                  image.original_filename.blank? ? nil : image
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                  # Any sort of failure on record creation is probably a file format not supported (e.g. .ogg)
         
     | 
| 
      
 86 
     | 
    
         
            +
                  SexItUpImage.create(:image_original_url => img_url,
         
     | 
| 
      
 87 
     | 
    
         
            +
                                      :image_search_term => search_term,
         
     | 
| 
      
 88 
     | 
    
         
            +
                                      :image => image)
         
     | 
| 
      
 89 
     | 
    
         
            +
                end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              module SexItUpHelper
         
     | 
| 
      
 95 
     | 
    
         
            +
                # Pass in a search term (e.g. 'dogs') and the resolution you
         
     | 
| 
      
 96 
     | 
    
         
            +
                #  want the image to be displayed at.
         
     | 
| 
      
 97 
     | 
    
         
            +
                def sexy_image(term, opts = {:width => 100, :height => 100})
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  # The loving is a mess, what happened to all of the feeling?
         
     | 
| 
      
 100 
     | 
    
         
            +
                  # I thought it was for real; babies, rings and fools kneeling
         
     | 
| 
      
 101 
     | 
    
         
            +
                  # And words of pledging trust and lifetimes stretching forever
         
     | 
| 
      
 102 
     | 
    
         
            +
                  # So what went wrong? It was a lie, it crumbled apart
         
     | 
| 
      
 103 
     | 
    
         
            +
                  # Ghost figures of past, present, future haunting the heart
         
     | 
| 
      
 104 
     | 
    
         
            +
                  sexy_image = term.class == SexItUp::SexItUpImage ? term : SexItUpImage.where(['image_search_term = ?', term]).random.first
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                  if sexy_image.nil? || sexy_image.blank?
         
     | 
| 
      
 107 
     | 
    
         
            +
                    # No image object passed in or found; let's go search.
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                    sexy_image = SexItUpImage.find_all(term).random.first
         
     | 
| 
      
 110 
     | 
    
         
            +
                  end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
                  unless sexy_image.nil?
         
     | 
| 
      
 113 
     | 
    
         
            +
                    style           = "#{opts[:width]}x#{opts[:height]}"
         
     | 
| 
      
 114 
     | 
    
         
            +
                    style_sym       = "s_#{style}".to_sym
         
     | 
| 
      
 115 
     | 
    
         
            +
                    style_hash      = {style_sym => [style]}
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
                    sexy_image.set_attachment_sizes(style_hash)
         
     | 
| 
      
 118 
     | 
    
         
            +
                    sexy_image.image.reprocess! unless File.exist?(sexy_image.image.path(style_sym)) # No need for reprocessing if size already exists
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                    tag = "<img"
         
     | 
| 
      
 121 
     | 
    
         
            +
                    tag += " class=\"#{opts[:class]}\"" if opts[:class]
         
     | 
| 
      
 122 
     | 
    
         
            +
                    tag += " src=\"#{sexy_image.image.url(style_sym)}\""
         
     | 
| 
      
 123 
     | 
    
         
            +
                    tag += " alt=\"#{opts[:alt]}\"" if opts[:alt]
         
     | 
| 
      
 124 
     | 
    
         
            +
                    tag += " title=\"#{opts[:title]}\"" if opts[:title]
         
     | 
| 
      
 125 
     | 
    
         
            +
                    tag += " />"
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                    return tag.html_safe
         
     | 
| 
      
 128 
     | 
    
         
            +
                  end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 131 
     | 
    
         
            +
                end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
              end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            end
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
            ActionView::Base.send :include, SexItUp::SexItUpHelper
         
     | 
| 
         Binary file 
     | 
| 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Factory.define :sex_it_up_image, :class => SexItUp::SexItUpImage do |i|
         
     | 
| 
      
 2 
     | 
    
         
            +
              #i.image File.new('spec/factories/Plato_and_Aristotle_in_The_School_of_Athens,_by_italian_Rafael.jpg')
         
     | 
| 
      
 3 
     | 
    
         
            +
              #i.attachment(:image, "spec/factories/Plato_and_Aristotle_in_The_School_of_Athens.jpg", "image/jpeg")
         
     | 
| 
      
 4 
     | 
    
         
            +
              i.image { File.new("#{ROOT_DIR}/spec/factories/Plato_and_Aristotle_in_The_School_of_Athens,_by_italian_Rafael.jpg") }
         
     | 
| 
      
 5 
     | 
    
         
            +
              i.image_original_url 'http://upload.wikimedia.org/wikipedia/commons/f/ff/Plato_and_Aristotle_in_The_School_of_Athens%2C_by_italian_Rafael.jpg'
         
     | 
| 
      
 6 
     | 
    
         
            +
              i.image_search_term 'school'
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ROOT_DIR = `pwd`.strip unless defined? ROOT_DIR
         
     | 
| 
      
 2 
     | 
    
         
            +
            require ROOT_DIR + '/spec/spec_helper'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            describe SexItUp::SexItUpHelper do
         
     | 
| 
      
 5 
     | 
    
         
            +
              include SexItUp::SexItUpHelper
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              before(:all) do
         
     | 
| 
      
 8 
     | 
    
         
            +
                # Start with a clean slate
         
     | 
| 
      
 9 
     | 
    
         
            +
                SexItUp::SexItUpImage.delete_all
         
     | 
| 
      
 10 
     | 
    
         
            +
                @image = Factory.build(:sex_it_up_image)
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              describe "sexy_image" do
         
     | 
| 
      
 14 
     | 
    
         
            +
                it "should source a random image for the search term and size it accordingly" do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  sexy_image('school', {:width => 50, :height => 50}).should =~ /.jpg/i
         
     | 
| 
      
 16 
     | 
    
         
            +
                  sexy_image('school', {:width => 50, :height => 50}).should =~ /s_50x50/
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                it "should generate an image tag for the Rafael.jpg image " do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  sexy_image(@image, {:width => 50, :height => 50}).should =~ /s_50x50\/Plato_and_Aristotle_in_The_School_of_Athens,_by_italian_Rafael.jpg/
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/schema.rb
    ADDED
    
    | 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ActiveRecord::Schema.define :version => 0 do
         
     | 
| 
      
 2 
     | 
    
         
            +
              create_table "sex_it_up_images" do |t|
         
     | 
| 
      
 3 
     | 
    
         
            +
                t.string   :image_search_term
         
     | 
| 
      
 4 
     | 
    
         
            +
                t.string   :image_original_url
         
     | 
| 
      
 5 
     | 
    
         
            +
                t.string   :image_url
         
     | 
| 
      
 6 
     | 
    
         
            +
                t.string   :image_file_name
         
     | 
| 
      
 7 
     | 
    
         
            +
                t.string   :image_content_type
         
     | 
| 
      
 8 
     | 
    
         
            +
                t.integer  :image_file_size
         
     | 
| 
      
 9 
     | 
    
         
            +
                t.datetime :image_updated_at
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
         
     | 
| 
      
 2 
     | 
    
         
            +
            ROOT_DIR = `pwd`.strip unless defined? ROOT_DIR
         
     | 
| 
      
 3 
     | 
    
         
            +
            require ROOT_DIR + '/spec/spec_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe SexItUp::SexItUpImage, '#find_all' do
         
     | 
| 
      
 6 
     | 
    
         
            +
              before(:all) do
         
     | 
| 
      
 7 
     | 
    
         
            +
                # Start with a clean slate
         
     | 
| 
      
 8 
     | 
    
         
            +
                SexItUp::SexItUpImage.delete_all
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              it "shouldn't have any images cached" do
         
     | 
| 
      
 12 
     | 
    
         
            +
                SexItUp::SexItUpImage.all.should have(0).things
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              it "should cache at least one image for the search term 'school'" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                SexItUp::SexItUpImage.find_all('school')
         
     | 
| 
      
 17 
     | 
    
         
            +
                SexItUp::SexItUpImage.all.should have_at_least(1).things
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              it "should find the 'Plato and Aristotle in The School of Athens' image'" do
         
     | 
| 
      
 21 
     | 
    
         
            +
                @image = Factory.build(:sex_it_up_image)
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                url = 'http://upload.wikimedia.org/wikipedia/commons/f/ff/Plato_and_Aristotle_in_The_School_of_Athens%2C_by_italian_Rafael.jpg'
         
     | 
| 
      
 24 
     | 
    
         
            +
                SexItUp::SexItUpImage.find_by_image_original_url(url).image_original_url.should == @image.image_original_url
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              it "should return an empty series of SexItUpImage objects" do
         
     | 
| 
      
 28 
     | 
    
         
            +
                SexItUp::SexItUpImage.find_all('blah123xyz').should == []
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__))
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'rspec'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'sex_it_up'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'factory_girl'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            require 'active_record'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'active_support'
         
     | 
| 
      
 10 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            require 'initializers/paperclip'
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            gem 'sqlite3-ruby'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            DB = '/tmp/sex_it_up.sqlite'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            # Delete the db if exists so we have a clean slate to run against.
         
     | 
| 
      
 19 
     | 
    
         
            +
            File.delete(DB) rescue nil
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            # Delete the paperclip cache directory
         
     | 
| 
      
 22 
     | 
    
         
            +
            FileUtils.rm_rf('public')
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new('/tmp/sex_it_up.log')
         
     | 
| 
      
 25 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => DB)
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ActiveRecord::Schema.define(:version => 1) do
         
     | 
| 
      
 28 
     | 
    
         
            +
              ActiveRecord::Migration.verbose = false
         
     | 
| 
      
 29 
     | 
    
         
            +
              load(File.dirname(__FILE__) + '/schema.rb')
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            # Requires supporting files with custom matchers and macros, etc,
         
     | 
| 
      
 33 
     | 
    
         
            +
            # in ./support/ and its subdirectories.
         
     | 
| 
      
 34 
     | 
    
         
            +
            Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
         
     | 
| 
      
 35 
     | 
    
         
            +
            Dir["#{File.dirname(__FILE__)}/helpers/**/*.rb"].each {|f| require f}
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            # Factories aren't autodiscovered in non-rails environments so have to
         
     | 
| 
      
 38 
     | 
    
         
            +
            #  explicitly find them.
         
     | 
| 
      
 39 
     | 
    
         
            +
            Factory.find_definitions
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 42 
     | 
    
         
            +
              config.mock_with :rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,278 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: sex_it_up
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 5 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
      
 10 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Jim Jones
         
     | 
| 
      
 13 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 15 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-11-30 00:00:00 -08:00
         
     | 
| 
      
 18 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 19 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 21 
     | 
    
         
            +
              name: activerecord
         
     | 
| 
      
 22 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 23 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 24 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 25 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 27 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 29 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 30 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 31 
     | 
    
         
            +
                    version: 3.0.1
         
     | 
| 
      
 32 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 33 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 34 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 35 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 36 
     | 
    
         
            +
              name: actionpack
         
     | 
| 
      
 37 
     | 
    
         
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 38 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 39 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 40 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 41 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 42 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 43 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 44 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 45 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: 3.0.1
         
     | 
| 
      
 47 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 48 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 49 
     | 
    
         
            +
              version_requirements: *id002
         
     | 
| 
      
 50 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 51 
     | 
    
         
            +
              name: paperclip
         
     | 
| 
      
 52 
     | 
    
         
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 53 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 54 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 55 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 56 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 57 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 58 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 59 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 60 
     | 
    
         
            +
                    - 5
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 2.3.5
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: *id003
         
     | 
| 
      
 65 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 66 
     | 
    
         
            +
              name: mechanize
         
     | 
| 
      
 67 
     | 
    
         
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 68 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 69 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 70 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 71 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 72 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 73 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 74 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 75 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 76 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
      
 77 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 78 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: *id004
         
     | 
| 
      
 80 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 81 
     | 
    
         
            +
              name: google-search
         
     | 
| 
      
 82 
     | 
    
         
            +
              requirement: &id005 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 83 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 84 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 85 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 86 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 87 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 88 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 89 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 90 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 91 
     | 
    
         
            +
                    version: 1.0.2
         
     | 
| 
      
 92 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 93 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 94 
     | 
    
         
            +
              version_requirements: *id005
         
     | 
| 
      
 95 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 96 
     | 
    
         
            +
              name: factory_girl
         
     | 
| 
      
 97 
     | 
    
         
            +
              requirement: &id006 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 98 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 99 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 100 
     | 
    
         
            +
                - - "="
         
     | 
| 
      
 101 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 102 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 103 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 104 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 105 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 106 
     | 
    
         
            +
                    version: 1.3.2
         
     | 
| 
      
 107 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 108 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 109 
     | 
    
         
            +
              version_requirements: *id006
         
     | 
| 
      
 110 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 111 
     | 
    
         
            +
              name: rspec-rails
         
     | 
| 
      
 112 
     | 
    
         
            +
              requirement: &id007 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 113 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 114 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 115 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 116 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 117 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 118 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 119 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 120 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 121 
     | 
    
         
            +
                    version: 2.1.0
         
     | 
| 
      
 122 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 123 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 124 
     | 
    
         
            +
              version_requirements: *id007
         
     | 
| 
      
 125 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 126 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 127 
     | 
    
         
            +
              requirement: &id008 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 128 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 129 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 130 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 131 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 132 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 133 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 134 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 135 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 136 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
      
 137 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 138 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 139 
     | 
    
         
            +
              version_requirements: *id008
         
     | 
| 
      
 140 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 141 
     | 
    
         
            +
              name: jeweler
         
     | 
| 
      
 142 
     | 
    
         
            +
              requirement: &id009 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 143 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 144 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 145 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 146 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 147 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 148 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 149 
     | 
    
         
            +
                    - 5
         
     | 
| 
      
 150 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 151 
     | 
    
         
            +
                    version: 1.5.1
         
     | 
| 
      
 152 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 153 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 154 
     | 
    
         
            +
              version_requirements: *id009
         
     | 
| 
      
 155 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 156 
     | 
    
         
            +
              name: sqlite3-ruby
         
     | 
| 
      
 157 
     | 
    
         
            +
              requirement: &id010 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 158 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 159 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 160 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 161 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 162 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 163 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 164 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 165 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 166 
     | 
    
         
            +
                    version: 1.3.1
         
     | 
| 
      
 167 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 168 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 169 
     | 
    
         
            +
              version_requirements: *id010
         
     | 
| 
      
 170 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 171 
     | 
    
         
            +
              name: paperclip
         
     | 
| 
      
 172 
     | 
    
         
            +
              requirement: &id011 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 173 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 174 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 175 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 176 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 177 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 178 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 179 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 180 
     | 
    
         
            +
                    - 5
         
     | 
| 
      
 181 
     | 
    
         
            +
                    version: 2.3.5
         
     | 
| 
      
 182 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 183 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 184 
     | 
    
         
            +
              version_requirements: *id011
         
     | 
| 
      
 185 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 186 
     | 
    
         
            +
              name: mechanize
         
     | 
| 
      
 187 
     | 
    
         
            +
              requirement: &id012 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 188 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 189 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 190 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 191 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 192 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 193 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 194 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 195 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 196 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
      
 197 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 198 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 199 
     | 
    
         
            +
              version_requirements: *id012
         
     | 
| 
      
 200 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 201 
     | 
    
         
            +
              name: google-search
         
     | 
| 
      
 202 
     | 
    
         
            +
              requirement: &id013 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 203 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 204 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 205 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 206 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 207 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 208 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 209 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 210 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 211 
     | 
    
         
            +
                    version: 1.0.2
         
     | 
| 
      
 212 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 213 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 214 
     | 
    
         
            +
              version_requirements: *id013
         
     | 
| 
      
 215 
     | 
    
         
            +
            description: SexItUp allows for the easy drop-in of public domain images for site mockups and user avatars.
         
     | 
| 
      
 216 
     | 
    
         
            +
            email: jjones@aantix.com
         
     | 
| 
      
 217 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
      
 219 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 222 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 223 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 224 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 225 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 226 
     | 
    
         
            +
            - lib/generators/sex_it_up/sex_it_up_generator.rb
         
     | 
| 
      
 227 
     | 
    
         
            +
            - lib/generators/sex_it_up/templates/sex_it_up_migration.rb
         
     | 
| 
      
 228 
     | 
    
         
            +
            - lib/sex_it_up.rb
         
     | 
| 
      
 229 
     | 
    
         
            +
            - lib/tasks/sex_it_up.rb
         
     | 
| 
      
 230 
     | 
    
         
            +
            - spec/factories/Plato_and_Aristotle_in_The_School_of_Athens,_by_italian_Rafael.jpg
         
     | 
| 
      
 231 
     | 
    
         
            +
            - spec/factories/sex_it_up_image_factory.rb
         
     | 
| 
      
 232 
     | 
    
         
            +
            - spec/helpers/sex_it_up_helper.rb
         
     | 
| 
      
 233 
     | 
    
         
            +
            - spec/initializers/paperclip.rb
         
     | 
| 
      
 234 
     | 
    
         
            +
            - spec/schema.rb
         
     | 
| 
      
 235 
     | 
    
         
            +
            - spec/sex_it_up_spec.rb
         
     | 
| 
      
 236 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 237 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 238 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 239 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 240 
     | 
    
         
            +
            homepage: http://github.com/aantix/sex_it_up
         
     | 
| 
      
 241 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 244 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
      
 246 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 247 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 248 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 249 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 250 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 251 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 252 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 253 
     | 
    
         
            +
                  hash: -267357419563257916
         
     | 
| 
      
 254 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 255 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 256 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 257 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 258 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 259 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 260 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 261 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 262 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 263 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 264 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 265 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 268 
     | 
    
         
            +
            rubygems_version: 1.3.7
         
     | 
| 
      
 269 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 270 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 271 
     | 
    
         
            +
            summary: Replace your boring place-holder images with beautiful public domain images of history's greatest artwork and sculptures.
         
     | 
| 
      
 272 
     | 
    
         
            +
            test_files: 
         
     | 
| 
      
 273 
     | 
    
         
            +
            - spec/factories/sex_it_up_image_factory.rb
         
     | 
| 
      
 274 
     | 
    
         
            +
            - spec/helpers/sex_it_up_helper.rb
         
     | 
| 
      
 275 
     | 
    
         
            +
            - spec/initializers/paperclip.rb
         
     | 
| 
      
 276 
     | 
    
         
            +
            - spec/schema.rb
         
     | 
| 
      
 277 
     | 
    
         
            +
            - spec/sex_it_up_spec.rb
         
     | 
| 
      
 278 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |