Top Level Namespace

Defined Under Namespace

Modules: AuthToken, Exceptions, Senkyoshi

Constant Summary collapse

SOURCE_DIR =

CHANGED THESE TO CHANGE THE FOLDER LOCATIONS

"sources".freeze
OUTPUT_DIR =
"canvas".freeze
UPLOAD_DIR =
"uploaded".freeze
SOURCE_NAME =

Don’t change these, these are just getting the last of the folder name for the script below to use

SOURCE_DIR.split("/").last
OUTPUT_NAME =
OUTPUT_DIR.split("/").last
UPLOAD_NAME =
UPLOAD_DIR.split("/").last
SOURCE_FILES =
Rake::FileList.new("#{SOURCE_DIR}/*.zip")
CONVERTED_FILES =
Rake::FileList.new("#{OUTPUT_DIR}/*.imscc")
QTI_TYPE =
{
  "Test" => "Assessment",
  "Survey" => "Survey",
  "Pool" => "QuestionBank",
}.freeze

Instance Method Summary collapse

Instance Method Details

#log_file(name) ⇒ Object



52
53
54
55
# File 'lib/senkyoshi/tasks.rb', line 52

def log_file(name)
  sh "touch #{name}"
  sh "date >> #{name}"
end

#make_directories(name, upload_dir) ⇒ Object



47
48
49
50
# File 'lib/senkyoshi/tasks.rb', line 47

def make_directories(name, upload_dir)
  mkdir_p name.pathmap("%d")
  mkdir_p upload_dir
end

#source_for_imscc(imscc_file) ⇒ Object



33
34
35
36
37
38
# File 'lib/senkyoshi/tasks.rb', line 33

def source_for_imscc(imscc_file)
  SOURCE_FILES.detect do |f|
    path = imscc_file.pathmap("%{^#{OUTPUT_DIR}/,#{SOURCE_DIR}/}X")
    f.ext("") == path
  end
end

#source_for_upload_log(upload_log) ⇒ Object



40
41
42
43
44
45
# File 'lib/senkyoshi/tasks.rb', line 40

def source_for_upload_log(upload_log)
  CONVERTED_FILES.detect do |f|
    path = upload_log.pathmap("%{^#{UPLOAD_DIR}/,#{OUTPUT_DIR}/}X")
    f.ext("") == path
  end
end