Sha256: 45f3e4d7ea596205a08623c867d6e96e1ff1496cf27e5da9f33f2b03cf04db8e

Contents?: true

Size: 765 Bytes

Versions: 24

Compression:

Stored size: 765 Bytes

Contents

namespace :db do
  namespace :populate do

    desc "Create populate data with documents"
    task :create => 'create:documents'

    namespace :create do
      desc "Add documents to populate data"
      task :documents => :read_environment do
        SS_DOCS_PATH=Gem::Specification.find_by_name('social_stream-documents').full_gem_path
        doc_files = Forgery::Extensions::Array.new(Dir.glob(File.join(SS_DOCS_PATH, 'lib', 'samples', "*")))

        SocialStream::Population::ActivityObject.new Document do |d|
          d.file  = File.open(doc_files.random, "r")
          d.title = Forgery::LoremIpsum.words(rand(4), :random => true)
          d.description = Forgery::LoremIpsum.sentences(rand(4), :random => true)
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
social_stream-2.0.0.beta2 documents/lib/tasks/db/populate.rake
social_stream-documents-2.0.0.beta2 lib/tasks/db/populate.rake
social_stream-2.0.0.beta1 documents/lib/tasks/db/populate.rake
social_stream-documents-2.0.0.beta1 lib/tasks/db/populate.rake