Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 68 lines (52 sloc) 1.823 kB
99da426 @zk Initial commit after nuking history (pws and keys in history).
authored
1 # Add your own tasks in files placed in lib/tasks ending in .rake,
2 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
4 require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
6 require 'rake'
7 require 'rake/testtask'
8 require 'rake/rdoctask'
9
10 require 'tasks/rails'
11
67ebc78 @zk [#40] Added rake task for anonymizing the users table.
authored
12 require 'digest/sha1'
13
55da58f @zk Switched to including rcov tasks only if env != production
authored
14 puts ENV['RAILS_ENV']
99da426 @zk Initial commit after nuking history (pws and keys in history).
authored
15
67ebc78 @zk [#40] Added rake task for anonymizing the users table.
authored
16
17 def sha1(s)
18 Digest::SHA1.hexdigest(s) if s
19 end
20
55da58f @zk Switched to including rcov tasks only if env != production
authored
21 if ENV['RAILS_ENV'] != 'production'
22
23 require 'rcov/rcovtask'
24
25 namespace :test do
99da426 @zk Initial commit after nuking history (pws and keys in history).
authored
26 namespace :coverage do
55da58f @zk Switched to including rcov tasks only if env != production
authored
27 desc "Delete aggregate coverage data."
28 task(:clean) { rm_f "coverage.data" }
29 end
30 desc 'Aggregate code coverage for unit, functional and integration tests'
31 task :coverage => "test:coverage:clean"
32 %w[unit functional integration].each do |target|
33 namespace :coverage do
34 Rcov::RcovTask.new(target) do |t|
35 t.libs << "test"
36 t.test_files = FileList["test/#{target}/*_test.rb"]
37 t.output_dir = "test/coverage/#{target}"
38 t.verbose = true
39 t.rcov_opts << '--rails --aggregate coverage.data --exclude "gems,cc_quick_ref\.rb"'
40 end
41 end
42 task :coverage => "test:coverage:#{target}"
99da426 @zk Initial commit after nuking history (pws and keys in history).
authored
43 end
44 end
67ebc78 @zk [#40] Added rake task for anonymizing the users table.
authored
45
46 desc "Anonymize user table."
47 namespace :db do
48 task :clean => :environment do
49
50 # Need to do this with reflection
51 User.find_each do |u|
52 u.login = sha1 u.login
53 u.email = "#{sha1(u.email)}@clojuredocs.org"
54 u.crypted_password = sha1 u.crypted_password
55 u.password_salt = sha1 u.password_salt
56 u.persistence_token = sha1 u.persistence_token
57 u.current_login_ip = sha1 u.current_login_ip
58 u.last_login_ip = sha1 u.last_login_ip
59 u.openid_identifier = nil
60 u.save(false)
61 end
62
63 end
64 end
65
99da426 @zk Initial commit after nuking history (pws and keys in history).
authored
66 end
67ebc78 @zk [#40] Added rake task for anonymizing the users table.
authored
67
Something went wrong with that request. Please try again.