moodle2cc 0.2.44 → 0.2.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moodle2cc/canvas_cc/assessment_writer.rb +3 -3
- data/lib/moodle2cc/canvas_cc/question_bank_writer.rb +2 -2
- data/lib/moodle2cc/migrator.rb +4 -4
- data/lib/moodle2cc/moodle2/parsers/file_parser.rb +2 -2
- data/lib/moodle2cc/moodle2/parsers/forum_parser.rb +2 -2
- data/lib/moodle2cc/moodle2/parsers/question_category_parser.rb +1 -1
- data/lib/moodle2cc/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 939e7d8dd8334a8cf1582e1e00fc06c49155d2d5e7da6dab985250d0ea866f39
|
4
|
+
data.tar.gz: 2996e02a9626488b09f05be63f0ed0b4bdaed241472650814bb60ed8b7b65acf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f42977ae253921b0ee2251b88b0a9eec71c9ae9ab485b65ccdda1706c797be6ada640a3f34c66248f9482125fa92ce085c8e5a231e38e753f2249a8b587a9ea4
|
7
|
+
data.tar.gz: 18e5c56f7d8bf6e80032b06147e57fc22c927a0cb565b1d088fed3cc315886013db0e9deff9dfb929ea93354802682dabe98e316f512085aa3543692ff4e18e2
|
@@ -37,7 +37,7 @@ module Moodle2CC::CanvasCC
|
|
37
37
|
end.to_xml
|
38
38
|
|
39
39
|
file_path = File.join(@work_dir, assessment.meta_file_path)
|
40
|
-
FileUtils.mkdir_p(File.dirname(file_path)) unless File.
|
40
|
+
FileUtils.mkdir_p(File.dirname(file_path)) unless File.exist?(File.dirname(file_path))
|
41
41
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
42
42
|
end
|
43
43
|
|
@@ -75,8 +75,8 @@ module Moodle2CC::CanvasCC
|
|
75
75
|
end.to_xml
|
76
76
|
|
77
77
|
file_path = File.join(@work_dir, assessment.qti_file_path)
|
78
|
-
FileUtils.mkdir_p(File.dirname(file_path)) unless File.
|
78
|
+
FileUtils.mkdir_p(File.dirname(file_path)) unless File.exist?(File.dirname(file_path))
|
79
79
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
80
80
|
end
|
81
81
|
end
|
82
|
-
end
|
82
|
+
end
|
@@ -37,8 +37,8 @@ module Moodle2CC::CanvasCC
|
|
37
37
|
end.to_xml
|
38
38
|
|
39
39
|
file_path = File.join(@work_dir, bank_resource.href)
|
40
|
-
FileUtils.mkdir_p(File.dirname(file_path)) unless File.
|
40
|
+
FileUtils.mkdir_p(File.dirname(file_path)) unless File.exist?(File.dirname(file_path))
|
41
41
|
File.open(file_path, 'w') { |f| f.write(xml) }
|
42
42
|
end
|
43
43
|
end
|
44
|
-
end
|
44
|
+
end
|
data/lib/moodle2cc/migrator.rb
CHANGED
@@ -13,7 +13,7 @@ module Moodle2CC
|
|
13
13
|
@destination = destination
|
14
14
|
@format = options['format'] || 'cc'
|
15
15
|
Moodle2CC::Logger.logger = options['logger'] || ::Logger.new(STDOUT)
|
16
|
-
raise(Moodle2CC::Error, "'#{@source}' does not exist") unless File.
|
16
|
+
raise(Moodle2CC::Error, "'#{@source}' does not exist") unless File.exist?(@source)
|
17
17
|
raise(Moodle2CC::Error, "'#{@destination}' is not a directory") unless File.directory?(@destination)
|
18
18
|
raise(Moodle2CC::Error, "'#{@format}' is not a valid format. Please use 'cc' or 'canvas'.") unless ['cc', 'canvas'].include?(@format)
|
19
19
|
@converter_class = @format == 'cc' ? Moodle2CC::CC::Converter : Moodle2CC::Canvas::Converter
|
@@ -51,9 +51,9 @@ module Moodle2CC
|
|
51
51
|
|
52
52
|
def moodle_version
|
53
53
|
if File.directory?(@source)
|
54
|
-
if File.
|
54
|
+
if File.exist?(File.join(@source, 'moodle_backup.xml'))
|
55
55
|
MOODLE_2
|
56
|
-
elsif File.
|
56
|
+
elsif File.exist?(File.join(@source, 'moodle.xml'))
|
57
57
|
MOODLE_1_9
|
58
58
|
end
|
59
59
|
else
|
@@ -68,4 +68,4 @@ module Moodle2CC
|
|
68
68
|
end
|
69
69
|
|
70
70
|
end
|
71
|
-
end
|
71
|
+
end
|
@@ -39,7 +39,7 @@ module Moodle2CC::Moodle2::Parsers
|
|
39
39
|
file.repository_id = parse_text(node, 'repositoryid')
|
40
40
|
file.reference = parse_text(node, 'reference')
|
41
41
|
file.file_location = File.join(@work_dir, FILES_DIR, file.content_hash[0..1], file.content_hash)
|
42
|
-
if file.file_size > 0 && File.
|
42
|
+
if file.file_size > 0 && File.exist?(file.file_location)
|
43
43
|
files << file
|
44
44
|
else
|
45
45
|
missing_files << file
|
@@ -49,4 +49,4 @@ module Moodle2CC::Moodle2::Parsers
|
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
@@ -47,7 +47,7 @@ module Moodle2CC::Moodle2::Parsers
|
|
47
47
|
forum.completion_posts = parse_text(forum_xml, "/activity/#{module_name}/completionposts")
|
48
48
|
end
|
49
49
|
grade_file = File.join(activity_dir, "grades.xml")
|
50
|
-
if File.
|
50
|
+
if File.exist?(grade_file)
|
51
51
|
File.open(grade_file) do |f|
|
52
52
|
grade_xml = Nokogiri::XML(f)
|
53
53
|
if node = grade_xml.at_xpath("activity_gradebook/grade_items/grade_item/grademax")
|
@@ -60,4 +60,4 @@ module Moodle2CC::Moodle2::Parsers
|
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
@@ -32,7 +32,7 @@ module Moodle2CC::Moodle2
|
|
32
32
|
category.parent = parse_text(node, "parent")
|
33
33
|
category.sort_order = parse_text(node, "sortorder")
|
34
34
|
|
35
|
-
category.questions += node.search("questions/question").filter_map { |question_node| question_parser(question_node) }
|
35
|
+
category.questions += node.search("./questions/question").filter_map { |question_node| question_parser(question_node) }
|
36
36
|
category.questions += node.search("question_bank_entries/question_bank_entry").map do |question_bank_entry|
|
37
37
|
question_bank_entry.search("question_version/question_versions").map do |question_versions|
|
38
38
|
question_versions.search("questions/question").map do |question_node|
|
data/lib/moodle2cc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moodle2cc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Durtschi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubyzip
|
@@ -424,7 +424,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
424
424
|
- !ruby/object:Gem::Version
|
425
425
|
version: '0'
|
426
426
|
requirements: []
|
427
|
-
rubygems_version: 3.
|
427
|
+
rubygems_version: 3.5.3
|
428
428
|
signing_key:
|
429
429
|
specification_version: 4
|
430
430
|
summary: Migrates Moodle backup ZIP to IMS Common Cartridge package
|