scorm-package 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6c845da6facaddb39a95ceda211bc5f65916e26bcadd79df356fb34b5d1bc8f
4
- data.tar.gz: 8ec19304fc472e74a9c21058a2e2e579ab5f2be5dd2a68a5e8dfed0edaf7e6b1
3
+ metadata.gz: 20b4caf4d6bd72f57a84d0295ff11f8fe86666aff390c43a829fc83e925fd4a5
4
+ data.tar.gz: 8f10c0537986f9c24302eb6c090bc8f06dd80bf779e36636011859296edccad1
5
5
  SHA512:
6
- metadata.gz: ac99c8c52027ceed7dc9c8180883ec82d45d0bd4926a07e04e85fbc15c7169e0bbff194ce0c42e19afe8dbe7da2619acc30b8cecd387f0146bc2a792056738d1
7
- data.tar.gz: 978bf31fcd77485a62b7a7dcb73be8f94e405a51229d20b7117b7bb81c3975cf2626c40d40ef200cd868098038596c5aa4af789b8212ee639c22e60eac51f6ea
6
+ metadata.gz: bb7a1266827460e65a76d6598e391faec81944b02b842d6204b373b0961ee7e48233bdc9ea30c7aa2bee8d1b2dcdf9ee7d7081c72d0fe60a9a99c6c5b572c131
7
+ data.tar.gz: 697d823c18d060036f5791078184441ac92f93cc5c40a1dd3db05096388c705c087a68a3f7be468694c2789ab9342e70d3dfe3b9dda33bc93e26b89cc38e04f1
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ### [0.1.1](https://www.github.com/openvitae-tech/scorm-package/compare/v0.1.0...v0.1.1) (2025-02-10)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * test auto version upgrade ([fea7dd4](https://www.github.com/openvitae-tech/scorm-package/commit/fea7dd4c0a756179251f112032fe258d3278cf19))
9
+
10
+ ## 0.3.1 (2025-02-10)
11
+
12
+ ### Features
13
+
14
+ - Release 0.3.1 ([3b42b6c](https://www.github.com/openvitae-tech/scorm-package/commit/3b42b6ce908929776a69de67c159dc0a67388645))
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Scorm Packaging gem
2
2
 
3
- ## Local development with Host Application
3
+ ## Local development with the Host Application
4
4
 
5
5
  ### Installation
6
6
 
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScormPackage
4
+ class BaseCourse
5
+ ABSTRACT_METHODS = %i[title description course_modules].freeze
6
+
7
+ def initialize
8
+ raise "Cannot initialize an abstract BaseCourse class" if instance_of?(BaseCourse)
9
+
10
+ missing_methods = ABSTRACT_METHODS.reject { |method| respond_to?(method) }
11
+ return if missing_methods.empty?
12
+
13
+ raise NotImplementedError, "#{self.class} must implement methods: #{missing_methods.join(", ")}"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScormPackage
4
+ class BaseCourseModule
5
+ ABSTRACT_METHODS = %i[title lessons].freeze
6
+
7
+ def initialize
8
+ raise "Cannot initialize an abstract BaseCourseModule class" if instance_of?(BaseCourseModule)
9
+
10
+ missing_methods = ABSTRACT_METHODS.reject { |method| respond_to?(method) }
11
+ return if missing_methods.empty?
12
+
13
+ raise NotImplementedError, "#{self.class} must implement methods: #{missing_methods.join(", ")}"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScormPackage
4
+ class BaseLesson
5
+ ABSTRACT_METHODS = %i[title videos].freeze
6
+
7
+ def initialize
8
+ raise "Cannot initialize an abstract BaseLesson class" if instance_of?(BaseLesson)
9
+
10
+ missing_methods = ABSTRACT_METHODS.reject { |method| respond_to?(method) }
11
+ return if missing_methods.empty?
12
+
13
+ raise NotImplementedError, "#{self.class} must implement methods: #{missing_methods.join(", ")}"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ScormPackage
4
+ class BaseVideo
5
+ ABSTRACT_METHODS = %i[id language video_url].freeze
6
+
7
+ def initialize
8
+ raise "Cannot initialize an abstract BaseVideo class" if instance_of?(BaseVideo)
9
+
10
+ missing_methods = ABSTRACT_METHODS.reject { |method| respond_to?(method) }
11
+ return if missing_methods.empty?
12
+
13
+ raise NotImplementedError, "#{self.class} must implement methods: #{missing_methods.join(", ")}"
14
+ end
15
+ end
16
+ end
@@ -4,7 +4,7 @@ require_relative "create_zip"
4
4
 
5
5
  module ScormPackage
6
6
  module Packaging
7
- class Generate
7
+ class Generator
8
8
  attr_reader :course, :scorm_token
9
9
 
10
10
  def initialize(course, scorm_token)
@@ -12,7 +12,7 @@ module ScormPackage
12
12
  @scorm_token = scorm_token
13
13
  end
14
14
 
15
- def process
15
+ def generate
16
16
  manifest = generate_manifest
17
17
  lessons_html = generate_lesson_contents
18
18
  ScormPackage::Packaging::CreateZip.new(manifest, lessons_html).process
@@ -84,6 +84,18 @@ module ScormPackage
84
84
  end.join
85
85
  end
86
86
 
87
+ def generate_lesson_contents
88
+ lessons_hash = {}
89
+
90
+ course.course_modules.each_with_index do |mod, mod_index|
91
+ mod.lessons.each_with_index do |lesson, lesson_index|
92
+ lesson_path = "content/module#{mod_index + 1}/lesson#{lesson_index + 1}.html"
93
+ lessons_hash[lesson_path] = generate_lesson_html(lesson)
94
+ end
95
+ end
96
+ lessons_hash
97
+ end
98
+
87
99
  def generate_lesson_html(lesson)
88
100
  <<~HTML
89
101
  <!DOCTYPE html>
@@ -101,9 +113,9 @@ module ScormPackage
101
113
  <body>
102
114
  <p>Lesson: #{lesson.title}</p>
103
115
  <ul>#{lesson.videos.map do |video|
104
- "<li>Language: #{video[:language]}<br>" \
105
- "<div id=\"loader-#{video[:id]}\" class=\"loader\">Loading...</div>" \
106
- "<iframe id=\"custom-iframe-#{video[:id]}\" data-video-url=\"#{video[:video_url]}\"></iframe></li>"
116
+ "<li>Language: #{video.language}<br>" \
117
+ "<div id=\"loader-#{video.id}\" class=\"loader\">Loading...</div>" \
118
+ "<iframe id=\"custom-iframe-#{video.id}\" data-video-url=\"#{video.video_url}\"></iframe></li>"
107
119
  end.join}</ul>
108
120
  <script>
109
121
  const loadIframe = async (iframe) => {
@@ -126,18 +138,6 @@ module ScormPackage
126
138
  </html>
127
139
  HTML
128
140
  end
129
-
130
- def generate_lesson_contents
131
- lessons_hash = {}
132
-
133
- course.course_modules.each_with_index do |mod, mod_index|
134
- mod.lessons.each_with_index do |lesson, lesson_index|
135
- lesson_path = "content/module#{mod_index + 1}/lesson#{lesson_index + 1}.html"
136
- lessons_hash[lesson_path] = generate_lesson_html(lesson)
137
- end
138
- end
139
- lessons_hash
140
- end
141
141
  end
142
142
  end
143
143
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ScormPackage
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/scorm_package.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "scorm_package/version"
4
- require_relative "scorm_package/abstract_course"
5
- require_relative "scorm_package/abstract_course_module"
6
- require_relative "scorm_package/abstract_lesson"
7
- require_relative "scorm_package/packaging/generate"
4
+ require_relative "scorm_package/base_course"
5
+ require_relative "scorm_package/base_course_module"
6
+ require_relative "scorm_package/base_lesson"
7
+ require_relative "scorm_package/base_video"
8
+ require_relative "scorm_package/packaging/generator"
8
9
 
9
10
  module ScormPackage
10
11
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scorm-package
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Sojan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-29 00:00:00.000000000 Z
11
+ date: 2025-02-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -19,20 +19,22 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ".rspec"
21
21
  - ".rubocop.yml"
22
+ - CHANGELOG.md
22
23
  - LICENSE.txt
23
24
  - README.md
24
25
  - Rakefile
25
26
  - lib/scorm_package.rb
26
- - lib/scorm_package/abstract_course.rb
27
- - lib/scorm_package/abstract_course_module.rb
28
- - lib/scorm_package/abstract_lesson.rb
27
+ - lib/scorm_package/base_course.rb
28
+ - lib/scorm_package/base_course_module.rb
29
+ - lib/scorm_package/base_lesson.rb
30
+ - lib/scorm_package/base_video.rb
29
31
  - lib/scorm_package/packaging/common/adlcp_rootv1p2.xsd
30
32
  - lib/scorm_package/packaging/common/ims_xml.xsd
31
33
  - lib/scorm_package/packaging/common/imscp_rootv1p1p2.xsd
32
34
  - lib/scorm_package/packaging/common/imsmd_rootv1p2p1.xsd
33
35
  - lib/scorm_package/packaging/common/scormfunctions.js
34
36
  - lib/scorm_package/packaging/create_zip.rb
35
- - lib/scorm_package/packaging/generate.rb
37
+ - lib/scorm_package/packaging/generator.rb
36
38
  - lib/scorm_package/version.rb
37
39
  - sig/scorm_package.rbs
38
40
  homepage: https://github.com/openvitae-tech/scorm-package
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ScormPackage
4
- class AbstractCourse
5
- def initialize
6
- raise "Cannot initialize an abstract Course class"
7
- end
8
-
9
- def title
10
- raise NotImplementedError, "#{self.class} must implement abstract method 'title'"
11
- end
12
-
13
- def description
14
- raise NotImplementedError, "#{self.class} must implement abstract method 'description'"
15
- end
16
-
17
- def course_modules
18
- raise NotImplementedError, "#{self.class} must implement abstract method 'course_modules'"
19
- end
20
- end
21
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ScormPackage
4
- class AbstractCourseModule
5
- def initialize
6
- raise "Cannot initialize an abstract CourseModule class"
7
- end
8
-
9
- def title
10
- raise NotImplementedError, "#{self.class} must implement abstract method 'title'"
11
- end
12
-
13
- def lessons
14
- raise NotImplementedError, "#{self.class} must implement abstract method 'lessons'"
15
- end
16
- end
17
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ScormPackage
4
- class AbstractLesson
5
- def initialize
6
- raise "Cannot initialize an abstract Lesson class"
7
- end
8
-
9
- def title
10
- raise NotImplementedError, "#{self.class} must implement abstract method 'title'"
11
- end
12
-
13
- def videos
14
- raise NotImplementedError, "#{self.class} must implement abstract method 'videos'"
15
- end
16
- end
17
- end