Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #709 from tobioboye/issue_669_final

Issue 669 final
  • Loading branch information...
commit d1e15e81483cee1354c4db4e2499296217eea2d3 2 parents b78f8d7 + 614c2c8
Oloruntobi Ogunbiyi tobioboye authored
1  Gemfile
View
@@ -12,7 +12,6 @@ source 'http://rubygems.org'
gem "rails"
gem 'exception_notification'
#gem "prototype-rails" Will be needed with Rails3.1
-gem "db_populate"
gem "rubyzip"
gem "ya2yaml"
gem "i18n"
2  Gemfile.lock
View
@@ -39,7 +39,6 @@ GEM
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.4)
daemons (1.1.4)
- db_populate (0.2.6)
dynamic_form (1.1.4)
erubis (2.6.6)
abstract (>= 1.0.0)
@@ -120,7 +119,6 @@ PLATFORMS
ruby
DEPENDENCIES
- db_populate
dynamic_form
exception_notification
faker
1  Rakefile
View
@@ -4,7 +4,6 @@
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rdoc/task'
-require 'db_populate'
# TODO REMOVE THIS FIX WITH RAKE 0.9:0
module ::Markus
0  db/populate/data/deferred-process.jpg → db/data/deferred-process.jpg
View
File renamed without changes
0  db/populate/data/internet.py → db/data/internet.py
View
File renamed without changes
0  db/populate/data/reactors.py → db/data/reactors.py
View
File renamed without changes
0  db/populate/data/service.py → db/data/service.py
View
File renamed without changes
1  db/populate/students.csv → db/data/students.csv
View
@@ -214,3 +214,4 @@ c7arnold,Arnold,Malcolm
g5ligeti,Ligeti,Gyorgy
c8menott,Menotti,Gian Carlo
c6stockh,Stockhausen,Karlheinz
+
6 db/populate/01_admins.rb
View
@@ -1,6 +0,0 @@
-# Standard admin
-Admin.create(:user_name => 'a', :first_name => 'admin', :last_name => 'admin')
-
-# Reid
-Admin.create(:user_name => 'reid', :first_name => 'Karen', :last_name => 'Reid')
-
6 db/populate/02_students.rb
View
@@ -1,6 +0,0 @@
-STUDENT_CSV = 'db/populate/students.csv'
-
-if File.readable?(STUDENT_CSV)
- csv_students = File.new(STUDENT_CSV)
- User.upload_user_list(Student, csv_students, nil)
-end
9 db/populate/03_tas.rb
View
@@ -1,9 +0,0 @@
-Ta.create(:user_name => 'c6conley',
- :first_name => 'Mike',
- :last_name => 'Conley')
-Ta.create(:user_name => 'c6gehwol',
- :first_name => 'Severin',
- :last_name => 'Gehwolf')
-Ta.create(:user_name => 'c9varoqu',
- :first_name => 'Nelle',
- :last_name => 'Varoquaux')
41 db/populate/04_assignments.rb
View
@@ -1,41 +0,0 @@
-# Assignments
-assignment_stat = AssignmentStat.new
-rule = NoLateSubmissionRule.new
-a = Assignment.create(:short_identifier => "A1",
- :description => "Conditionals and Loops",
- :message => "Learn to use conditional statements, and loops.",
- :group_min => 1,
- :group_max => 1,
- :student_form_groups => false,
- :group_name_autogenerated => true,
- :group_name_displayed => false,
- :repository_folder => "A1",
- :due_date => 1.minute.from_now,
- :marking_scheme_type => Assignment::MARKING_SCHEME_TYPE[:rubric],
- :allow_web_submits => true,
- :display_grader_names_to_students => false)
-
-a.submission_rule = rule
-a.assignment_stat = assignment_stat
-a.save
-
-rule = NoLateSubmissionRule.new
-assignment_stat = AssignmentStat.new
-a = Assignment.create(:short_identifier => "A2",
- :description => "Cats and Dogs",
- :message => "Basic exercise in Object Oriented
- Programming. Implement Animal, Cat, and Dog, as
- described in class.",
- :group_min => 2,
- :group_max => 3,
- :student_form_groups => true,
- :group_name_autogenerated => true,
- :group_name_displayed => false,
- :repository_folder => "A2",
- :due_date => 1.month.from_now,
- :marking_scheme_type => Assignment::MARKING_SCHEME_TYPE[:rubric],
- :allow_web_submits => true,
- :display_grader_names_to_students => false)
-a.submission_rule = rule
-a.assignment_stat = assignment_stat
-a.save
20 db/populate/05_groups.rb
View
@@ -1,20 +0,0 @@
-# Let's create groups and groupings !
-
-students = Student.all
-a = Assignment.find_by_short_identifier("A1")
-
-15.times do |time|
- student = students[time]
- group = Group.new
- group.group_name = student.user_name
- group.save
- grouping = Grouping.new
- grouping.group = group
- grouping.assignment = a
- grouping.save
- grouping.invite([student.user_name],
- StudentMembership::STATUSES[:inviter],
- invoked_by_admin=true)
-end
-
-
26 db/populate/06_repos.rb
View
@@ -1,26 +0,0 @@
-# Let's populate students repository with nice data
-
-groups = Group.all
-assignment = Assignment.find_by_short_identifier("A1")
-
-file_dir = File.join(File.dirname(__FILE__), 'data')
-groups.each do |group|
- Dir.foreach(file_dir) do |filename|
- unless File.directory?(File.join(file_dir, filename))
- file_contents = File.open(File.join(file_dir, filename))
- file_contents.rewind
- group.access_repo do |repo|
- txn = repo.get_transaction(group.grouping_for_assignment(
- assignment.id
- ).inviter.user_name)
- path = File.join(assignment.repository_folder,
- filename)
- txn.add(path,
- file_contents.read,
- '')
- repo.commit(txn)
- end
- end
- end
-end
-
23 db/populate/07_criterias.rb
View
@@ -1,23 +0,0 @@
-require 'faker'
-
-8.times do |time|
- rc = RubricCriterion.create(
- :id => time,
- :rubric_criterion_name => Faker::Lorem.sentence(1),
- :assignment_id => 1,
- :position => 1,
- :weight => rand(3) + 1,
- :level_0_name => Faker::Lorem.words(rand(5) + 1).join(" "),
- :level_0_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
- :level_1_name => Faker::Lorem.words(rand(5) + 1).join(" "),
- :level_1_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
- :level_2_name => Faker::Lorem.words(rand(5) + 1).join(" "),
- :level_2_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
- :level_3_name => Faker::Lorem.words(rand(5) + 1).join(" "),
- :level_3_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
- :level_4_name => Faker::Lorem.words(rand(5) + 1).join(" "),
- :level_4_description => Faker::Lorem.sentences(rand(5) + 1).join(" ")
- )
- rc.save
-end
-
23 db/populate/08_annotations.rb
View
@@ -1,23 +0,0 @@
-require 'faker'
-
-5.times do |time|
- ca = AnnotationCategory.new(
- :id => time,
- :assignment_id => 1,
- :annotation_category_name => Faker::Lorem.words(
- rand(3) + 1
- ).join(" ")
- )
- ca.save
-
- (rand(10) + 3).times do |t|
- a = AnnotationText.new(
- :id => t,
- :annotation_category_id => time,
- :content => Faker::Lorem.sentences(rand(3) + 1).join(" ")
- )
- a.save
- end
-end
-
-
152 db/seeds.rb
View
@@ -0,0 +1,152 @@
+# Standard admin
+Admin.create(:user_name => 'a', :first_name => 'admin', :last_name => 'admin')
+
+# Reid
+Admin.create(:user_name => 'reid', :first_name => 'Karen', :last_name => 'Reid')
+
+STUDENT_CSV = 'db/data/students.csv'
+
+if File.readable?(STUDENT_CSV)
+ csv_students = File.new(STUDENT_CSV)
+ User.upload_user_list(Student, csv_students, nil)
+end
+Ta.create(:user_name => 'c6conley',
+ :first_name => 'Mike',
+ :last_name => 'Conley')
+Ta.create(:user_name => 'c6gehwol',
+ :first_name => 'Severin',
+ :last_name => 'Gehwolf')
+Ta.create(:user_name => 'c9varoqu',
+ :first_name => 'Nelle',
+ :last_name => 'Varoquaux')
+# Assignments
+assignment_stat = AssignmentStat.new
+rule = NoLateSubmissionRule.new
+a = Assignment.create(:short_identifier => "A1",
+ :description => "Conditionals and Loops",
+ :message => "Learn to use conditional statements, and loops.",
+ :group_min => 1,
+ :group_max => 1,
+ :student_form_groups => false,
+ :group_name_autogenerated => true,
+ :group_name_displayed => false,
+ :repository_folder => "A1",
+ :due_date => 1.minute.from_now,
+ :marking_scheme_type => Assignment::MARKING_SCHEME_TYPE[:rubric],
+ :allow_web_submits => true,
+ :display_grader_names_to_students => false)
+
+a.submission_rule = rule
+a.assignment_stat = assignment_stat
+a.save
+
+rule = NoLateSubmissionRule.new
+assignment_stat = AssignmentStat.new
+a = Assignment.create(:short_identifier => "A2",
+ :description => "Cats and Dogs",
+ :message => "Basic exercise in Object Oriented
+ Programming. Implement Animal, Cat, and Dog, as
+ described in class.",
+ :group_min => 2,
+ :group_max => 3,
+ :student_form_groups => true,
+ :group_name_autogenerated => true,
+ :group_name_displayed => false,
+ :repository_folder => "A2",
+ :due_date => 1.month.from_now,
+ :marking_scheme_type => Assignment::MARKING_SCHEME_TYPE[:rubric],
+ :allow_web_submits => true,
+ :display_grader_names_to_students => false)
+a.submission_rule = rule
+a.assignment_stat = assignment_stat
+a.save
+# Let's create groups and groupings !
+
+students = Student.all
+a = Assignment.find_by_short_identifier("A1")
+
+15.times do |time|
+ student = students[time]
+ group = Group.new
+ group.group_name = student.user_name
+ group.save
+ grouping = Grouping.new
+ grouping.group = group
+ grouping.assignment = a
+ grouping.save
+ grouping.invite([student.user_name],
+ StudentMembership::STATUSES[:inviter],
+ invoked_by_admin=true)
+end
+
+
+# Let's populate students repository with nice data
+
+groups = Group.all
+assignment = Assignment.find_by_short_identifier("A1")
+
+file_dir = File.join(File.dirname(__FILE__), 'data')
+groups.each do |group|
+ Dir.foreach(file_dir) do |filename|
+ unless File.directory?(File.join(file_dir, filename))
+ file_contents = File.open(File.join(file_dir, filename))
+ file_contents.rewind
+ group.access_repo do |repo|
+ txn = repo.get_transaction(group.grouping_for_assignment(
+ assignment.id
+ ).inviter.user_name)
+ path = File.join(assignment.repository_folder,
+ filename)
+ txn.add(path,
+ file_contents.read,
+ '')
+ repo.commit(txn)
+ end
+ end
+ end
+end
+
+require 'faker'
+
+8.times do |time|
+ rc = RubricCriterion.create(
+ :id => time,
+ :rubric_criterion_name => Faker::Lorem.sentence(1),
+ :assignment_id => 1,
+ :position => 1,
+ :weight => rand(3) + 1,
+ :level_0_name => Faker::Lorem.words(rand(5) + 1).join(" "),
+ :level_0_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
+ :level_1_name => Faker::Lorem.words(rand(5) + 1).join(" "),
+ :level_1_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
+ :level_2_name => Faker::Lorem.words(rand(5) + 1).join(" "),
+ :level_2_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
+ :level_3_name => Faker::Lorem.words(rand(5) + 1).join(" "),
+ :level_3_description => Faker::Lorem.sentences(rand(5) + 1).join(" "),
+ :level_4_name => Faker::Lorem.words(rand(5) + 1).join(" "),
+ :level_4_description => Faker::Lorem.sentences(rand(5) + 1).join(" ")
+ )
+ rc.save
+end
+
+5.times do |time|
+ ca = AnnotationCategory.new(
+ :id => time,
+ :assignment_id => 1,
+ :annotation_category_name => Faker::Lorem.words(
+ rand(3) + 1
+ ).join(" ")
+ )
+ ca.save
+
+ (rand(10) + 3).times do |t|
+ a = AnnotationText.new(
+ :id => t,
+ :annotation_category_id => time,
+ :content => Faker::Lorem.sentences(rand(3) + 1).join(" ")
+ )
+ a.save
+ end
+end
+
+
4 lib/tasks/markus_general.rake
View
@@ -1,6 +1,6 @@
namespace :markus do
- desc "Resets a MarkUs installation. Useful for developers. This is just a rake repos:drop && rake db:reset && rake db:populate"
+ desc "Resets a MarkUs installation. Useful for developers. This is just a rake repos:drop && rake db:reset && rake db:seed"
task(:reset => :environment) do
if ENV['environment'].nil?
::Rails.env = 'development'
@@ -11,7 +11,7 @@ namespace :markus do
Rake::Task['repos:drop'].invoke # drop repositories
Rake::Task['db:reset'].invoke # reset the DB
sleep(2) # need to sleep a little, otherwise the reset doesn't seem to work
- Rake::Task['db:populate'].invoke # repopulate DB
+ Rake::Task['db:seed'].invoke # repopulate DB
puts("Resetting development environment of MarkUs finished!")
end
10 lib/tasks/populate.rake
View
@@ -38,21 +38,21 @@ namespace :markus do
end
desc "Add more student users to the database"
- # this task depends on :environment and :populate
- task(:add_students => [:environment, :"db:populate"]) do
+ # this task depends on :environment and :seed
+ task(:add_students => [:environment, :"db:seed"]) do
puts "Populate database with some additional students"
STUDENT_CSV = File.expand_path(File.join(__FILE__, '..', '..', '..', 'test', 'classlist-csvs', 'new_students.csv'))
if File.readable?(STUDENT_CSV)
csv_students = File.new(STUDENT_CSV)
- User.upload_user_list(Student, csv_students.read)
+ User.upload_user_list(Student, csv_students.read, nil)
else
$stderr.puts "File not found or not readable: #{STUDENT_CSV}"
end
end
desc "Create a setup for usability testing."
- # this task depends on :environment and :populate
- task(:usability_test_setup => [:environment, :"db:populate"]) do
+ # this task depends on :environment and :seed
+ task(:usability_test_setup => [:environment, :"db:seed"]) do
puts "Creating a setup for usability testing"
# modify settings for A1 (solo assignment)
a1 = Assignment.find_by_short_identifier("A1")
4 lib/tasks/results.rake
View
@@ -29,10 +29,10 @@ namespace :load do
a1.save!
# load users
- STUDENT_CSV = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'db', 'populate', 'students.csv'))
+ STUDENT_CSV = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'db', 'data', 'students.csv'))
if File.readable?(STUDENT_CSV)
csv_students = File.new(STUDENT_CSV)
- User.upload_user_list(Student, csv_students.read)
+ User.upload_user_list(Student, csv_students, nil)
end
# create groupings for each student in A1
Please sign in to comment.
Something went wrong with that request. Please try again.