Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 95 lines (81 sloc) 3.062 kB
91e6499 @danielgrippi MS DG update copyright
danielgrippi authored
1 # Copyright (c) 2010-2011, Diaspora Inc. This file is
1fd3aea Add or later to license notice
Raphael authored
2 # licensed under the Affero General Public License version 3 or later. See
aa3ebe3 License notices replaced
Raphael authored
3 # the COPYRIGHT file.
4c15b1a added license to every single goddamn file. also, put one in the roo…
Daniel Vincent Grippi authored
4
bb97aa9 @danielgrippi DG IZ; rake db:seed, rake db:delete
danielgrippi authored
5 namespace :db do
58f757b profile_spec is passing with mysql... baby steps.
Mike Sofaer, Raphael Sofaer & Sarah Mei authored
6 desc "rebuild and prepare test db"
254860b @maxwell SM MS; Read email sent to diaspora-dev for more information about this
maxwell authored
7 task :rebuild do
8 Rake::Task['db:drop'].invoke
9 Rake::Task['db:drop_integration'].invoke
10 Rake::Task['db:create'].invoke
11 Rake::Task['db:migrate'].invoke
12 puts "seeding users, this will take awhile"
13 `rake db:seed` #ghetto hax as we have active record garbage in our models
14 puts "seeded!"
15 Rake::Task['db:test:prepare'].invoke
16 end
58f757b profile_spec is passing with mysql... baby steps.
Mike Sofaer, Raphael Sofaer & Sarah Mei authored
17
38289b1 Multi-server integration tests are now possible
Raphael Sofaer authored
18 namespace :integration do
19 # desc 'Check for pending migrations and load the integration schema'
20 task :prepare => :environment do
21 abcs = ActiveRecord::Base.configurations
22 envs = abcs.keys.select{ |k| k.include?("integration") }
54e8040 @maxwell basic federation profile testing stuff
maxwell authored
23 puts envs.inspect
49117cc @Raven24 make federation logger db creation faster by not migrating but using …
Raven24 authored
24 envs.each_with_index do |env, i|
25 Rails.env = env
26 Rake::Task.tasks.each{ |task| task.reenable }
27
28 print "\n\n## preparing database for #{env}... "
29 puts (i == 0) ? "(go get yourself a coffee)" : "(time for another coffee)"
30
31 # do drop, schema:load_if_ruby, structure:load_if_sql, seed
32 Rake::Task['db:drop'].invoke
33 Rake::Task['db:setup'].invoke
34
35 puts "db #{ActiveRecord::Base.connection.current_database} done"
38289b1 Multi-server integration tests are now possible
Raphael Sofaer authored
36 end
37 end
38 end
39
bb97aa9 @danielgrippi DG IZ; rake db:seed, rake db:delete
danielgrippi authored
40 desc 'Delete the collections in the current RAILS_ENV database'
585906d @danielgrippi DG IZ; db rake tasks ouput text; delete is now purge
danielgrippi authored
41 task :purge do
0b39359 @sarahmei Standardize how we're requiring config/environment
sarahmei authored
42 require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
585906d @danielgrippi DG IZ; db rake tasks ouput text; delete is now purge
danielgrippi authored
43
fbd1195 @danielgrippi DG IZ; rake task for backer, can now pass in arguments [backer_num, p…
danielgrippi authored
44 puts "Purging the database for #{Rails.env}..."
585906d @danielgrippi DG IZ; db rake tasks ouput text; delete is now purge
danielgrippi authored
45
9d7611f addedthe controllers and the views for the message and the conversati…
zhitomirskiyi authored
46 Rake::Task['db:rebuild'].invoke
cd875d0 RS, DG; DB purge now deletes tmp folder
Raphael authored
47
48 puts 'Deleting tmp folder...'
ee7005a @danielgrippi db:purge now deletes everything in uploads folder
danielgrippi authored
49 `rm -rf #{File.dirname(__FILE__)}/../../public/uploads/*`
bb97aa9 @danielgrippi DG IZ; rake db:seed, rake db:delete
danielgrippi authored
50 end
6d84eb2 @danielgrippi DG IZ; added rake db:reset, which aliases a delete and seed to the db
danielgrippi authored
51
52 desc 'Purge and seed the current RAILS_ENV database using information from db/seeds.rb'
53 task :reset do
fbd1195 @danielgrippi DG IZ; rake task for backer, can now pass in arguments [backer_num, p…
danielgrippi authored
54 puts "Resetting the database for #{Rails.env}".upcase
585906d @danielgrippi DG IZ; db rake tasks ouput text; delete is now purge
danielgrippi authored
55 Rake::Task['db:purge'].invoke
9d7611f addedthe controllers and the views for the message and the conversati…
zhitomirskiyi authored
56 Rake::Task['db:seed'].invoke
585906d @danielgrippi DG IZ; db rake tasks ouput text; delete is now purge
danielgrippi authored
57 puts "Success!"
6d84eb2 @danielgrippi DG IZ; added rake db:reset, which aliases a delete and seed to the db
danielgrippi authored
58 end
874ea58 @maxwell new rake spec for dev database (different default user than tom, friends
maxwell authored
59
70be713 Drop the integration databases in rebuild
Raphael Sofaer authored
60 task :drop_integration do
61 ActiveRecord::Base.configurations.keys.select{ |k|
62 k.include?("integration")
63 }.each{ |k|
17774d8 Getting repost back to almost green.
Raphael Sofaer authored
64 drop_database ActiveRecord::Base.configurations[k] rescue Mysql2::Error
70be713 Drop the integration databases in rebuild
Raphael Sofaer authored
65 }
66 end
67
1e8f10f @maxwell MS rake task to fix broken local people.... let me test it first on a…
maxwell authored
68 task :fix_diaspora_handle do
69 puts "fixing the people in this seed"
0b39359 @sarahmei Standardize how we're requiring config/environment
sarahmei authored
70 require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
494f765 fix_diaspora_handle rake task
Raphael authored
71 Person.where(:url => 'example.org').all.each{|person|
dea0912 Do a more specific query in the fix rake task
Raphael authored
72 if person.owner
1f67cc2 @sarahmei Replace APP_CONFIG with lib/app_config.rb so that it's testable.
sarahmei authored
73 person.url = AppConfig[:pod_url]
1e8f10f @maxwell MS rake task to fix broken local people.... let me test it first on a…
maxwell authored
74 person.diaspora_handle = person.owner.diaspora_handle
6ffc03a @Dorian Big clean up: delete trailing whitespace
Dorian authored
75 person.save
1e8f10f @maxwell MS rake task to fix broken local people.... let me test it first on a…
maxwell authored
76 end
494f765 fix_diaspora_handle rake task
Raphael authored
77 }
1e8f10f @maxwell MS rake task to fix broken local people.... let me test it first on a…
maxwell authored
78 puts "everything should be peachy"
79 end
904143d rake task to move the private key
ilya authored
80
81 task :move_private_key do
0b39359 @sarahmei Standardize how we're requiring config/environment
sarahmei authored
82 require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
904143d rake task to move the private key
ilya authored
83 User.all.each do |user|
c8f864a Finish fixing move_private_key
Raphael authored
84 if user.serialized_private_key.nil?
85 user.serialized_private_key = user.person.serialized_key
904143d rake task to move the private key
ilya authored
86 user.save
87 person = user.person
88 person.serialized_key = nil
c8f864a Finish fixing move_private_key
Raphael authored
89 person.serialized_public_key = user.encryption_key.public_key.to_s
904143d rake task to move the private key
ilya authored
90 person.save
91 end
92 end
93 end
bb97aa9 @danielgrippi DG IZ; rake db:seed, rake db:delete
danielgrippi authored
94 end
Something went wrong with that request. Please try again.