lib/verdict/tasks.rake in verdict-0.2.0 vs lib/verdict/tasks.rake in verdict-0.2.1
- old
+ new
@@ -3,24 +3,24 @@
raise "Provide #{key} as environment variable" if value.blank?
value
end
namespace :experiments do
-
+
desc "List all defined experiments"
task :list => 'environment' do
- length = Experiments.repository.keys.map(&:length).max
- Experiments.repository.each do |_, experiment|
+ length = Verdict.repository.keys.map(&:length).max
+ Verdict.repository.each do |_, experiment|
print "#{experiment.handle.ljust(length)} | "
print "Groups: #{experiment.groups.values.map(&:to_s).join(', ')}"
puts
end
end
desc "Looks up the assignment for a given experiment and subject"
task :lookup_assignment => 'environment' do
- experiment = Experiments[require_env('experiment')] or raise "Experiment not found"
+ experiment = Verdict[require_env('experiment')] or raise "Experiment not found"
subject_identifier = require_env('subject')
assignment = experiment.lookup_assignment_for_identifier(subject_identifier)
if assignment.nil?
puts "Subject #{ENV['subject']} is not assigned to experiment #{experiment.handle} yet."
elsif assignment.qualified?
@@ -30,30 +30,30 @@
end
end
desc "Manually assign a subject to a given group in an experiment"
task :assign_manually => 'environment' do
- experiment = Experiments[require_env('experiment')] or raise "Experiment not found"
+ experiment = Verdict[require_env('experiment')] or raise "Experiment not found"
group = experiment.group(require_env('group')) or raise "Group not found"
assignment = experiment.subject_assignment(require_env('subject'), group, false)
experiment.store_assignment(assignment)
end
desc "Disqualify a subject from an experiment"
task :disqualify => 'environment' do
- experiment = Experiments[require_env('experiment')] or raise "Experiment not found"
+ experiment = Verdict[require_env('experiment')] or raise "Experiment not found"
assignment = experiment.subject_assignment(require_env('subject'), nil, false)
experiment.store_assignment(assignment)
end
desc "Removes the assignment for a subject so it will be reassigned to the experiment."
task :remove_assignment => 'environment' do
- experiment = Experiments[require_env('experiment')] or raise "Experiment not found"
+ experiment = Verdict[require_env('experiment')] or raise "Experiment not found"
experiment.remove_subject_identifier(require_env('subject'))
end
desc "Runs the cleanup tasks for an experiment"
task :wrapup => 'environment' do
- experiment = Experiments[require_env('experiment')] or raise "Experiment not found"
+ experiment = Verdict[require_env('experiment')] or raise "Experiment not found"
experiment.wrapup
end
end