moodle2cc 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +69 -16
- data/lib/moodle2cc/canvas/assignment.rb +2 -12
- data/lib/moodle2cc/canvas/web_content.rb +5 -0
- data/lib/moodle2cc/canvas/wiki.rb +1 -0
- data/lib/moodle2cc/cc/assignment.rb +22 -27
- data/lib/moodle2cc/cc/cc_helper.rb +3 -0
- data/lib/moodle2cc/cc/converter.rb +1 -1
- data/lib/moodle2cc/cc/templates/assignment.html.erb +7 -3
- data/lib/moodle2cc/cc/web_content.rb +3 -2
- data/lib/moodle2cc/cc/wiki.rb +3 -2
- data/lib/moodle2cc/moodle/grade_item.rb +3 -0
- data/lib/moodle2cc/version.rb +1 -1
- data/test/unit/canvas/converter_test.rb +1 -1
- data/test/unit/cc/assignment_test.rb +9 -4
- data/test/unit/cc/web_content_test.rb +3 -3
- data/test/unit/cc/wiki_test.rb +17 -17
- metadata +4 -6
- data/lib/moodle2cc/canvas/.converter.rb.swo +0 -0
- data/lib/moodle2cc/canvas/.wiki.rb.swo +0 -0
data/README.md
CHANGED
@@ -7,35 +7,32 @@ Moodle information: http://moodle.org/
|
|
7
7
|
|
8
8
|
Common Cartridge information: http://www.imsglobal.org/cc/index.html
|
9
9
|
|
10
|
-
|
10
|
+
Use the [Github Issues](https://github.com/instructure/moodle2cc/issues?state=open)
|
11
|
+
for feature requests and bug reports.
|
11
12
|
|
12
|
-
|
13
|
+
## Installation/Usage
|
14
|
+
|
15
|
+
### Command line
|
13
16
|
Install RubyGems on your system, see http://rubygems.org/ for instructions.
|
14
17
|
Once RubyGems is installed you can install this gem:
|
15
18
|
|
16
19
|
$ gem install moodle2cc
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
Add this line to your application's Gemfile:
|
21
|
+
Convert a moodle .zip into Common Cartridge format
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
And then execute:
|
23
|
+
$ moodle2cc migrate <path-to-moodle-backup> <path-to-cc-export-directory>
|
25
24
|
|
26
|
-
|
25
|
+
Or into a Canvas-enhanced Common Cartridge format
|
27
26
|
|
28
|
-
|
27
|
+
$ moodle2cc migrate --format=canvas <path-to-moodle-backup> <path-to-cc-export-directory>
|
29
28
|
|
30
|
-
###
|
29
|
+
### In a Ruby application
|
31
30
|
|
32
|
-
|
33
|
-
$ moodle2cc migrate <path-to-moodle-backup> <path-to-cc-export-directory>
|
31
|
+
Add this line to your application's Gemfile and run `bundle`:
|
34
32
|
|
35
|
-
|
36
|
-
$ moodle2cc migrate --format=canvas <path-to-moodle-backup> <path-to-cc-export-directory>
|
33
|
+
gem 'moodle2cc'
|
37
34
|
|
38
|
-
|
35
|
+
Require the library in your project and use the migrator:
|
39
36
|
|
40
37
|
```ruby
|
41
38
|
require 'moodle2cc'
|
@@ -43,6 +40,62 @@ migrator = Moodle2CC::Migrator.new moodle_zip_path, destination_bath
|
|
43
40
|
migrator.migrate
|
44
41
|
```
|
45
42
|
|
43
|
+
## Caveats
|
44
|
+
|
45
|
+
Common Cartridge (CC) does not support all of the concepts in a Moodle course.
|
46
|
+
CC has no concepts such as assignments or wiki pages, so these things have to
|
47
|
+
fit into Common Cartridge as best they can. Here are some of the decisions we
|
48
|
+
made about these things:
|
49
|
+
|
50
|
+
<table>
|
51
|
+
<tr>
|
52
|
+
<th>Moodle</th>
|
53
|
+
<th>Common Cartridge</th>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td>Course Files</td>
|
57
|
+
<td>All files are in the `web_resources` folder, links to files in HTML are
|
58
|
+
referenced relative to that directory with the token `$IMS_CC_FILEBASE$`.</td>
|
59
|
+
</tr>
|
60
|
+
<tr>
|
61
|
+
<td>Assignments</td>
|
62
|
+
<td>HTML pages in an `assignments` subfolder in `web_resources`. The description
|
63
|
+
of the assignment is the body of the page and stuff like points possible are
|
64
|
+
in meta fields.</td>
|
65
|
+
</tr>
|
66
|
+
<tr>
|
67
|
+
<td>Wiki Pages</td>
|
68
|
+
<td>HTML pages in a `pages` subfolder in `web_resources`.</td>
|
69
|
+
</tr>
|
70
|
+
<tr>
|
71
|
+
<td>Discussion Topics</td>
|
72
|
+
<td>The titles and bodies of topics are intact in the conversion.</td>
|
73
|
+
</tr>
|
74
|
+
<tr>
|
75
|
+
<td>Grade Items</td>
|
76
|
+
<td>If the grade item is attached to an assignment its data will be in the
|
77
|
+
meta data of the assignment's HTML page. Otherwise it isn't currently converted.</td>
|
78
|
+
</tr>
|
79
|
+
<tr>
|
80
|
+
<td>Assessments (quizzes)</td>
|
81
|
+
<td>TODO - Coming soon! Only the CC-supported question types will be converted
|
82
|
+
to QTI as documented <a href="http://www.imsglobal.org/cc/ccv1p1/imscc_profilev1p1-Implementation.html#_Toc285616469">here</a> </td>
|
83
|
+
</tr>
|
84
|
+
<tr>
|
85
|
+
<td>Question Categories</td>
|
86
|
+
<td>TODO - Coming soon! Common Cartridge only supports having a single question bank, so all banks
|
87
|
+
will be combined into one. <a href="http://www.imsglobal.org/cc/ccv1p1/imscc_profilev1p1-Implementation.html#_Toc285616457">CC Question Bank Docs</a> </td>
|
88
|
+
</tr>
|
89
|
+
</table>
|
90
|
+
|
91
|
+
## Todo
|
92
|
+
|
93
|
+
* Support exporting to CC 1.2
|
94
|
+
* Quiz conversion
|
95
|
+
* Question Category conversion
|
96
|
+
* LTI configurations?
|
97
|
+
* Convert more Moodle features as requested
|
98
|
+
|
46
99
|
## Contributing
|
47
100
|
|
48
101
|
Run the tests:
|
@@ -10,6 +10,8 @@ module Moodle2CC::Canvas
|
|
10
10
|
|
11
11
|
def initialize(mod, position=0)
|
12
12
|
super
|
13
|
+
@rel_path = "#{identifier}/#{file_slug(@title)}.html"
|
14
|
+
@resource_type = LOR
|
13
15
|
@body = convert_file_path_tokens(mod.description)
|
14
16
|
@points_possible = mod.grade_item ? mod.grade_item.grade_max : mod.grade
|
15
17
|
@grading_type = 'points'
|
@@ -60,18 +62,6 @@ module Moodle2CC::Canvas
|
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
63
|
-
def create_resource_node(resources_node)
|
64
|
-
href = "#{identifier}/#{file_slug(@title)}.html"
|
65
|
-
resources_node.resource(
|
66
|
-
:href => href,
|
67
|
-
:type => LOR,
|
68
|
-
:identifier => identifier
|
69
|
-
) do |resource_node|
|
70
|
-
resource_node.file(:href => href)
|
71
|
-
resource_node.file(:href => File.join(identifier, ASSIGNMENT_SETTINGS))
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
65
|
def create_resource_sub_nodes(resource_node)
|
76
66
|
resource_node.file(:href => File.join(identifier, ASSIGNMENT_SETTINGS))
|
77
67
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Moodle2CC::Canvas
|
2
2
|
class WebContent < Moodle2CC::CC::WebContent
|
3
3
|
include Resource
|
4
|
+
|
5
|
+
def initialize(mod)
|
6
|
+
super
|
7
|
+
@rel_path = File.join(WIKI_FOLDER, "#{file_slug(@title)}.html")
|
8
|
+
end
|
4
9
|
|
5
10
|
def create_module_meta_item_elements(item_node)
|
6
11
|
item_node.content_type 'WikiPage'
|
@@ -3,46 +3,41 @@ module Moodle2CC::CC
|
|
3
3
|
include CCHelper
|
4
4
|
include Resource
|
5
5
|
|
6
|
-
|
7
|
-
attr_accessor :body
|
6
|
+
attr_accessor :body, :meta_fields
|
8
7
|
|
9
8
|
def initialize(mod, position=0)
|
10
9
|
super
|
11
10
|
@body = convert_file_path_tokens(mod.description)
|
11
|
+
@meta_fields = build_meta_fields(mod)
|
12
|
+
@rel_path = File.join(CC_ASSIGNMENT_FOLDER, "#{file_slug(@title)}.html")
|
13
|
+
@resource_type = nil
|
12
14
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
when 'uploadsingle'
|
26
|
-
'online_upload'
|
27
|
-
else
|
28
|
-
'none'
|
15
|
+
|
16
|
+
# Common Cartridge doesn't have anywhere to put assignment meta data like this
|
17
|
+
# So add them as HTML meta fields in the HTML file
|
18
|
+
def build_meta_fields(mod)
|
19
|
+
fields = {}
|
20
|
+
%w{mod_type assignment_type}.each do |key|
|
21
|
+
fields[key] = mod.send(key) if mod.respond_to?(key)
|
22
|
+
end
|
23
|
+
if mod.grade_item
|
24
|
+
Moodle2CC::Moodle::GradeItem::PROPERTIES.each do |key|
|
25
|
+
fields[key] = mod.grade_item.send(key) if mod.grade_item.respond_to?(key)
|
29
26
|
end
|
30
|
-
elsif mod.mod_type == 'workshop'
|
31
|
-
submission_types = ['online_text_entry']
|
32
|
-
submission_types.unshift('online_upload') if mod.number_of_attachments > 0
|
33
|
-
submission_types.join(',')
|
34
27
|
end
|
28
|
+
|
29
|
+
fields
|
35
30
|
end
|
36
31
|
|
37
32
|
def create_resource_node(resources_node)
|
38
|
-
href = "#{identifier}/#{file_slug(@title)}.html"
|
39
33
|
resources_node.resource(
|
40
|
-
:href =>
|
41
|
-
:type =>
|
34
|
+
:href => @rel_path,
|
35
|
+
:type => @resource_type || WEBCONTENT,
|
42
36
|
:identifier => identifier
|
43
37
|
) do |resource_node|
|
44
|
-
resource_node.file(:href =>
|
38
|
+
resource_node.file(:href => @rel_path)
|
45
39
|
create_resource_sub_nodes(resource_node)
|
40
|
+
# todo if CC 1.2 add assignment meta tag
|
46
41
|
end
|
47
42
|
end
|
48
43
|
|
@@ -55,7 +50,7 @@ module Moodle2CC::CC
|
|
55
50
|
|
56
51
|
def create_html(export_dir)
|
57
52
|
template = File.expand_path('../templates/assignment.html.erb', __FILE__)
|
58
|
-
path = File.join(export_dir,
|
53
|
+
path = File.join(export_dir, @rel_path)
|
59
54
|
FileUtils.mkdir_p(File.dirname(path))
|
60
55
|
File.open(path, 'w') do |file|
|
61
56
|
erb = ERB.new(File.read(template))
|
@@ -70,6 +70,9 @@ module CCHelper
|
|
70
70
|
WEB_RESOURCES_FOLDER = 'web_resources'
|
71
71
|
WIKI_FOLDER = 'wiki_content'
|
72
72
|
MEDIA_OBJECTS_FOLDER = 'media_objects'
|
73
|
+
|
74
|
+
CC_ASSIGNMENT_FOLDER = File.join(WEB_RESOURCES_FOLDER, "assignments")
|
75
|
+
CC_WIKI_FOLDER = File.join(WEB_RESOURCES_FOLDER, "pages")
|
73
76
|
|
74
77
|
def create_key(object, prepend="")
|
75
78
|
CCHelper.create_key(object, prepend)
|
@@ -129,7 +129,7 @@ module Moodle2CC::CC
|
|
129
129
|
|
130
130
|
def create_web_resources
|
131
131
|
web_resources_folder = File.join(@export_dir, WEB_RESOURCES_FOLDER)
|
132
|
-
FileUtils.
|
132
|
+
FileUtils.mkdir_p(web_resources_folder)
|
133
133
|
@moodle_backup.copy_files_to(web_resources_folder)
|
134
134
|
end
|
135
135
|
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
4
|
-
|
3
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
4
|
+
<% if meta_fields
|
5
|
+
meta_fields.each_pair do |key, val|%>
|
6
|
+
<meta name="<%= key %>" content="<%= val %>" /> <% end %>
|
7
|
+
<% end %>
|
8
|
+
<title>Assignment: <%= title %></title>
|
5
9
|
</head>
|
6
10
|
<body>
|
7
|
-
|
11
|
+
<%= body %>
|
8
12
|
</body>
|
9
13
|
</html>
|
@@ -7,13 +7,14 @@ module Moodle2CC::CC
|
|
7
7
|
|
8
8
|
def initialize(mod)
|
9
9
|
super
|
10
|
+
@rel_path = File.join(CC_WIKI_FOLDER, "#{file_slug(@title)}.html")
|
10
11
|
body = mod.alltext
|
11
12
|
body = mod.content || '' if body.nil? || body.length == 0
|
12
13
|
@body = convert_file_path_tokens(body)
|
13
14
|
end
|
14
15
|
|
15
16
|
def create_resource_node(resources_node)
|
16
|
-
href =
|
17
|
+
href = @rel_path
|
17
18
|
resources_node.resource(
|
18
19
|
:type => WEBCONTENT,
|
19
20
|
:identifier => identifier,
|
@@ -29,7 +30,7 @@ module Moodle2CC::CC
|
|
29
30
|
|
30
31
|
def create_html(export_dir)
|
31
32
|
template = File.expand_path('../templates/wiki_content.html.erb', __FILE__)
|
32
|
-
path = File.join(export_dir,
|
33
|
+
path = File.join(export_dir, @rel_path)
|
33
34
|
FileUtils.mkdir_p(File.dirname(path))
|
34
35
|
File.open(path, 'w') do |file|
|
35
36
|
erb = ERB.new(File.read(template))
|
data/lib/moodle2cc/cc/wiki.rb
CHANGED
@@ -7,6 +7,7 @@ module Moodle2CC::CC
|
|
7
7
|
|
8
8
|
def initialize(mod)
|
9
9
|
super
|
10
|
+
@href_template ||= "#{CC_WIKI_FOLDER}/%s.html"
|
10
11
|
page_versions = mod.pages.inject({}) do |result, page|
|
11
12
|
version = result[page.page_name]
|
12
13
|
result[page.page_name] = page.version if version.nil? || page.version > version
|
@@ -18,14 +19,14 @@ module Moodle2CC::CC
|
|
18
19
|
title_slug = file_slug(@title)
|
19
20
|
body = page.content
|
20
21
|
slug = [title_slug, file_slug(page.page_name)].join('-')
|
21
|
-
href =
|
22
|
+
href = @href_template % slug
|
22
23
|
Moodle2CC::OpenStruct.new(:title => page.page_name, :body => body, :href => href, :identifier => create_key(href))
|
23
24
|
end
|
24
25
|
end.compact
|
25
26
|
|
26
27
|
if @pages.empty?
|
27
28
|
slug = file_slug(@title)
|
28
|
-
href =
|
29
|
+
href = @href_template % slug
|
29
30
|
@pages = [Moodle2CC::OpenStruct.new(:title => @title, :body => mod.summary, :href => href, :identifier => create_key(href))]
|
30
31
|
end
|
31
32
|
|
data/lib/moodle2cc/version.rb
CHANGED
@@ -47,21 +47,26 @@ class TestUnitCCAssignment < MiniTest::Unit::TestCase
|
|
47
47
|
|
48
48
|
resource = xml.xpath('resource').first
|
49
49
|
assert resource
|
50
|
-
assert_equal '
|
51
|
-
assert_equal '
|
50
|
+
assert_equal 'webcontent', resource.attributes['type'].value
|
51
|
+
assert_equal 'web_resources/assignments/create-a-rails-site.html', resource.attributes['href'].value
|
52
52
|
assert_equal 'i6b162484accdf6081cea43b39219d129', resource.attributes['identifier'].value
|
53
53
|
|
54
|
-
file = resource.xpath('file[@href="
|
54
|
+
file = resource.xpath('file[@href="web_resources/assignments/create-a-rails-site.html"]').first
|
55
55
|
assert file
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_it_creates_assignment_html
|
59
59
|
tmp_dir = File.expand_path('../../../tmp', __FILE__)
|
60
60
|
@assignment.create_html(tmp_dir)
|
61
|
-
html = Nokogiri::HTML(File.read(File.join(tmp_dir,
|
61
|
+
html = Nokogiri::HTML(File.read(File.join(tmp_dir, Moodle2CC::CC::CCHelper::CC_ASSIGNMENT_FOLDER, 'create-a-rails-site.html')))
|
62
62
|
|
63
63
|
assert html
|
64
64
|
assert_equal 'Assignment: Create a Rails site', html.search('title').text
|
65
65
|
assert_equal '<h1>Hello World</h1>', html.search('body').inner_html.strip
|
66
|
+
assert_equal 'assignment', html.at_css('meta[name=mod_type]')['content']
|
67
|
+
assert_equal 'offline', html.at_css('meta[name=assignment_type]')['content']
|
68
|
+
assert_equal '1.0', html.at_css('meta[name=grade_min]')['content']
|
69
|
+
assert_equal '150.0', html.at_css('meta[name=grade_max]')['content']
|
70
|
+
assert_equal '2', html.at_css('meta[name=grade_type]')['content']
|
66
71
|
end
|
67
72
|
end
|
@@ -52,9 +52,9 @@ class TestUnitCCWebContent < MiniTest::Unit::TestCase
|
|
52
52
|
assert resource
|
53
53
|
assert_equal 'webcontent', resource.attributes['type'].value
|
54
54
|
assert_equal 'i6447ff05ab6e342a42302007a6e3bcb4', resource.attributes['identifier'].value
|
55
|
-
assert_equal '
|
55
|
+
assert_equal Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/instructor-resources.html', resource.attributes['href'].value
|
56
56
|
|
57
|
-
file = resource.xpath(
|
57
|
+
file = resource.xpath(%{file[@href="#{Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER}/instructor-resources.html"]}).first
|
58
58
|
assert file
|
59
59
|
end
|
60
60
|
|
@@ -66,7 +66,7 @@ class TestUnitCCWebContent < MiniTest::Unit::TestCase
|
|
66
66
|
tmp_dir = File.expand_path('../../../tmp', __FILE__)
|
67
67
|
web_content = Moodle2CC::CC::WebContent.new @mod
|
68
68
|
web_content.create_html(tmp_dir)
|
69
|
-
html = Nokogiri::HTML(File.read(File.join(tmp_dir,
|
69
|
+
html = Nokogiri::HTML(File.read(File.join(tmp_dir, Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER, 'instructor-resources.html')))
|
70
70
|
|
71
71
|
assert html
|
72
72
|
assert_equal 'i6447ff05ab6e342a42302007a6e3bcb4', html.search('head meta[name="identifier"]').first.attributes['content'].value
|
data/test/unit/cc/wiki_test.rb
CHANGED
@@ -43,13 +43,13 @@ class TestUnitCCWiki < MiniTest::Unit::TestCase
|
|
43
43
|
|
44
44
|
assert_equal 'My Wiki', wiki.pages[0].title
|
45
45
|
assert_equal 'Second version', wiki.pages[0].body
|
46
|
-
assert_equal '
|
47
|
-
assert_equal '
|
46
|
+
assert_equal Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki-my-wiki.html', wiki.pages[0].href
|
47
|
+
assert_equal 'i2eb0de275c9d8430f49bbf4cdf96286c', wiki.pages[0].identifier
|
48
48
|
|
49
49
|
assert_equal 'New Page', wiki.pages[1].title
|
50
50
|
assert_equal 'This is a link to [My Wiki]', wiki.pages[1].body
|
51
|
-
assert_equal '
|
52
|
-
assert_equal '
|
51
|
+
assert_equal Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki-new-page.html', wiki.pages[1].href
|
52
|
+
assert_equal 'i2eb0de275c9d8430f49bbf4cdf96286c', wiki.pages[0].identifier
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_it_converts_summary_to_page_if_no_pages_exist
|
@@ -62,8 +62,8 @@ class TestUnitCCWiki < MiniTest::Unit::TestCase
|
|
62
62
|
|
63
63
|
assert_equal 'My wiki', wiki.pages[0].title
|
64
64
|
assert_equal 'This is the summary', wiki.pages[0].body
|
65
|
-
assert_equal '
|
66
|
-
assert_equal '
|
65
|
+
assert_equal Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki.html', wiki.pages[0].href
|
66
|
+
assert_equal 'ib1bfc2398c654e88470adb5a882f83e5', wiki.pages[0].identifier
|
67
67
|
end
|
68
68
|
|
69
69
|
def test_it_has_a_root_page_for_defined_pages
|
@@ -89,7 +89,7 @@ class TestUnitCCWiki < MiniTest::Unit::TestCase
|
|
89
89
|
@mod.pages = []
|
90
90
|
|
91
91
|
wiki = Moodle2CC::CC::Wiki.new @mod
|
92
|
-
assert_equal '
|
92
|
+
assert_equal 'ib1bfc2398c654e88470adb5a882f83e5', wiki.identifier
|
93
93
|
end
|
94
94
|
|
95
95
|
def test_it_creates_resource_in_imsmanifest
|
@@ -103,19 +103,19 @@ class TestUnitCCWiki < MiniTest::Unit::TestCase
|
|
103
103
|
resource = xml.root.xpath('resource[1]').first
|
104
104
|
assert resource
|
105
105
|
assert_equal 'webcontent', resource.attributes['type'].value
|
106
|
-
assert_equal '
|
107
|
-
assert_equal '
|
106
|
+
assert_equal Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki-link.html', resource.attributes['href'].value
|
107
|
+
assert_equal 'ie8b2c8b5a9156a6994b13abae6b18da6', resource.attributes['identifier'].value
|
108
108
|
|
109
|
-
file = resource.xpath(
|
109
|
+
file = resource.xpath(%{file[@href="#{Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER}/my-wiki-link.html"]}).first
|
110
110
|
assert file
|
111
111
|
|
112
112
|
resource = xml.root.xpath('resource[2]').first
|
113
113
|
assert resource
|
114
114
|
assert_equal 'webcontent', resource.attributes['type'].value
|
115
|
-
assert_equal '
|
116
|
-
assert_equal '
|
115
|
+
assert_equal Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki-my-wiki.html', resource.attributes['href'].value
|
116
|
+
assert_equal 'i2eb0de275c9d8430f49bbf4cdf96286c', resource.attributes['identifier'].value
|
117
117
|
|
118
|
-
file = resource.xpath(
|
118
|
+
file = resource.xpath(%{file[@href="#{Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER}/my-wiki-my-wiki.html"]}).first
|
119
119
|
assert file
|
120
120
|
end
|
121
121
|
|
@@ -124,15 +124,15 @@ class TestUnitCCWiki < MiniTest::Unit::TestCase
|
|
124
124
|
tmp_dir = File.expand_path('../../../tmp', __FILE__)
|
125
125
|
wiki.create_html(tmp_dir)
|
126
126
|
|
127
|
-
html = Nokogiri::HTML(File.read(File.join(tmp_dir, '
|
127
|
+
html = Nokogiri::HTML(File.read(File.join(tmp_dir, Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki-my-wiki.html')))
|
128
128
|
assert html
|
129
|
-
assert_equal '
|
129
|
+
assert_equal 'i2eb0de275c9d8430f49bbf4cdf96286c', html.search('meta[name="identifier"]').first.attributes['content'].value
|
130
130
|
assert_equal 'My Wiki', html.search('title').text
|
131
131
|
assert_equal 'Hello [link]', html.search('body').inner_html.strip
|
132
132
|
|
133
|
-
html = Nokogiri::HTML(File.read(File.join(tmp_dir, '
|
133
|
+
html = Nokogiri::HTML(File.read(File.join(tmp_dir, Moodle2CC::CC::CCHelper::CC_WIKI_FOLDER + '/my-wiki-link.html')))
|
134
134
|
assert html
|
135
|
-
assert_equal '
|
135
|
+
assert_equal 'ie8b2c8b5a9156a6994b13abae6b18da6', html.search('meta[name="identifier"]').first.attributes['content'].value
|
136
136
|
assert_equal 'link', html.search('title').text
|
137
137
|
assert_equal 'This is a linked page', html.search('body').inner_html.strip
|
138
138
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moodle2cc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Christopher Durtschi
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-08-
|
20
|
+
date: 2012-08-21 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rubyzip
|
@@ -193,8 +193,6 @@ files:
|
|
193
193
|
- Rakefile
|
194
194
|
- bin/moodle2cc
|
195
195
|
- lib/moodle2cc.rb
|
196
|
-
- lib/moodle2cc/canvas/.converter.rb.swo
|
197
|
-
- lib/moodle2cc/canvas/.wiki.rb.swo
|
198
196
|
- lib/moodle2cc/canvas/assessment.rb
|
199
197
|
- lib/moodle2cc/canvas/assignment.rb
|
200
198
|
- lib/moodle2cc/canvas/converter.rb
|
Binary file
|
Binary file
|