Sha256: 1da0e8251eb128894bdf0658e789788d8e6d75ac86ab016407be931183d7481d

Contents?: true

Size: 1.43 KB

Versions: 25

Compression:

Stored size: 1.43 KB

Contents

namespace :db do
  namespace :populate do
    desc "Create populate data with client sites"
    task create: 'create:site_clients'

    namespace :create do
      desc "Add client sites populate data"
      task site_clients: :read_environment do
        puts 'Site Client population (Dummy and 9 clients more)'

        start = Time.now

        # Create dummy site
        aid = Actor.find_by_slug('demo').id

        s = Site::Client.create! name: 'Dummy',
                                 description: "Social Stream's spec/dummy application",
                                 url: 'http://localhost:3000',
                                 callback_url: 'http://localhost:3000/users/auth/socialstream/callback',
                                 author_id: aid
        
        s.update_attributes! secret: "f9974ce87c455544f61cc960b58cf833eb039875ef27029449408857879a1e87283c86558e46fa431d37a3c5590ba92612c51dfd0872ccff35cbecf3910eaa02"

        9.times do
          domain = Forgery::Internet.domain_name 
          Site::Client.create! name: Forgery::Name.company_name,
                               description: Forgery::LoremIpsum.sentence(random: true),
                               url: "https://#{ domain }",
                               callback_url: "https://#{ domain }/callback",
                               author: User.all[rand(User.all.size)]
        end

        puts "   -> #{ (Time.now - start).round(4) }s"
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
social_stream-2.2.2 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.2.2 lib/tasks/db/populate.rake
social_stream-2.2.1 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.2.1 lib/tasks/db/populate.rake
social_stream-2.2.0 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.2.0 lib/tasks/db/populate.rake
social_stream-2.1.1 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.1.1 lib/tasks/db/populate.rake
social_stream-2.1.0 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.1.0 lib/tasks/db/populate.rake
social_stream-2.0.4 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.0.3 lib/tasks/db/populate.rake
social_stream-2.0.3 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.0.2 lib/tasks/db/populate.rake
social_stream-2.0.2 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.0.1 lib/tasks/db/populate.rake
social_stream-2.0.1 oauth2_server/lib/tasks/db/populate.rake
social_stream-2.0.0 oauth2_server/lib/tasks/db/populate.rake
social_stream-oauth2_server-2.0.0 lib/tasks/db/populate.rake
social_stream-2.0.0.beta3 oauth2_server/lib/tasks/db/populate.rake