mumuki-domain 7.0.2 → 7.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/content.rb +3 -3
- data/app/models/exercise.rb +5 -4
- data/app/models/guide.rb +4 -10
- data/lib/mumuki/domain.rb +1 -1
- data/lib/mumuki/domain/extensions.rb +1 -0
- data/lib/mumuki/domain/extensions/hash.rb +5 -0
- data/lib/mumuki/domain/seed.rb +10 -6
- data/lib/mumuki/domain/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 110d08769d6933a1f24050a84a55cfbd52635f6f51c6a0bd0c100b5278048bac
|
4
|
+
data.tar.gz: 72080c8736a0b180bf1a00b1299a357ab49b889084cdac6038967d32e44f750f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78522ae785959966a37a4ccb091253a0652cbd0da35108a11cbdb1d2a9ae7f4af6750d32749aa429d736d5057ad6233045119cc0ac7a2f19c1480b3fbd8df0f8
|
7
|
+
data.tar.gz: 89d0b2c8e21b779d1ffb46c6623cb7e91e7abd8a1b57c711d33043ef9748a0b1b8cf29c844f5414c88b479ce3e4b6a075617fa0c20c11c552a55b0fbd57ef4fa
|
data/app/models/content.rb
CHANGED
@@ -8,11 +8,11 @@ class Content < ApplicationRecord
|
|
8
8
|
include WithUsages
|
9
9
|
include WithName
|
10
10
|
|
11
|
-
def to_resource_h
|
12
|
-
to_expanded_resource_h.compact
|
11
|
+
def to_resource_h(*args)
|
12
|
+
to_expanded_resource_h(*args).compact
|
13
13
|
end
|
14
14
|
|
15
|
-
def to_expanded_resource_h
|
15
|
+
def to_expanded_resource_h(*)
|
16
16
|
as_json(only: [:name, :slug, :description, :locale]).symbolize_keys
|
17
17
|
end
|
18
18
|
|
data/app/models/exercise.rb
CHANGED
@@ -115,13 +115,13 @@ class Exercise < ApplicationRecord
|
|
115
115
|
choice_values.index(value)
|
116
116
|
end
|
117
117
|
|
118
|
-
def to_resource_h
|
119
|
-
to_expanded_resource_h.compact
|
118
|
+
def to_resource_h(*args)
|
119
|
+
to_expanded_resource_h(*args).compact
|
120
120
|
end
|
121
121
|
|
122
122
|
# Keep this list up to date with
|
123
|
-
# Mumuki::Domain::Store::ExerciseSchema
|
124
|
-
def to_expanded_resource_h
|
123
|
+
# Mumuki::Domain::Store::Github::ExerciseSchema
|
124
|
+
def to_expanded_resource_h(options={})
|
125
125
|
language_resource_h = language.to_embedded_resource_h if language != guide.language
|
126
126
|
as_json(only: BASIC_RESOURCE_FIELDS)
|
127
127
|
.merge(id: bibliotheca_id, language: language_resource_h, type: type.underscore)
|
@@ -130,6 +130,7 @@ class Exercise < ApplicationRecord
|
|
130
130
|
.merge(settings: self[:settings])
|
131
131
|
.merge(RANDOMIZED_FIELDS.map { |it| [it, self[it]] }.to_h)
|
132
132
|
.symbolize_keys
|
133
|
+
.tap { |it| it.markdownify!(:hint, :corollary, :description, :teacher_info) if options[:markdownified] }
|
133
134
|
end
|
134
135
|
|
135
136
|
def reset!
|
data/app/models/guide.rb
CHANGED
@@ -93,23 +93,17 @@ class Guide < Content
|
|
93
93
|
|
94
94
|
# Keep this list up to date with
|
95
95
|
# Mumuki::Domain::Store::Github::GuideSchema
|
96
|
-
def to_expanded_resource_h
|
96
|
+
def to_expanded_resource_h(options={})
|
97
97
|
as_json(only: BASIC_RESOURCE_FIELDS)
|
98
98
|
.symbolize_keys
|
99
99
|
.merge(super)
|
100
|
-
.merge(exercises: exercises.map(
|
100
|
+
.merge(exercises: exercises.map { |it| it.to_resource_h(options) })
|
101
101
|
.merge(language: language.to_embedded_resource_h)
|
102
|
+
.tap { |it| it.markdownify!(:corollary, :description, :teacher_info) if options[:markdownified] }
|
102
103
|
end
|
103
104
|
|
104
105
|
def to_markdownified_resource_h
|
105
|
-
to_resource_h
|
106
|
-
%i(corollary description teacher_info).each do |it|
|
107
|
-
guide[it] = Mumukit::ContentType::Markdown.to_html(guide[it])
|
108
|
-
end
|
109
|
-
%i(hint corollary description teacher_info).each do |it|
|
110
|
-
guide[:exercises].each { |exercise| exercise[it] = Mumukit::ContentType::Markdown.to_html(exercise[it]) }
|
111
|
-
end
|
112
|
-
end
|
106
|
+
to_resource_h(markdownified: true)
|
113
107
|
end
|
114
108
|
|
115
109
|
def as_lesson_of(topic)
|
data/lib/mumuki/domain.rb
CHANGED
@@ -50,7 +50,7 @@ end
|
|
50
50
|
|
51
51
|
Mumukit::Sync::Store::Github.configure do |config|
|
52
52
|
config.guide_schema = Mumuki::Domain::Store::Github::GuideSchema
|
53
|
-
config.exercise_schema = Mumuki::Domain::Store::
|
53
|
+
config.exercise_schema = Mumuki::Domain::Store::Github::ExerciseSchema
|
54
54
|
end
|
55
55
|
|
56
56
|
Mulang::Inspection.register_extension! Mumukit::Inspection::Css
|
data/lib/mumuki/domain/seed.rb
CHANGED
@@ -15,15 +15,19 @@ module Mumuki::Domain::Seed
|
|
15
15
|
flbulgarelli
|
16
16
|
)
|
17
17
|
|
18
|
+
def self.contents_syncer
|
19
|
+
Mumukit::Sync::Syncer.new(Mumuki::Domain::Store::Bibliotheca.new(Mumukit::Platform.bibliotheca_bridge))
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.languages_syncer
|
23
|
+
Mumukit::Sync::Syncer.new(Mumuki::Domain::Store::Thesaurus.new(Mumukit::Platform.thesaurus_bridge))
|
24
|
+
end
|
25
|
+
|
18
26
|
def self.import_main_contents!
|
19
|
-
|
20
|
-
Mumuki::Domain::Store::Bibliotheca.new(
|
21
|
-
Mumukit::Platform.bibliotheca_bridge)).import_all! /^#{MAIN_CONTENT_ORGANIZATIONS.join('|')}\/.*$/i
|
27
|
+
self.contents_syncer.import_all! /^#{MAIN_CONTENT_ORGANIZATIONS.join('|')}\/.*$/i
|
22
28
|
end
|
23
29
|
|
24
30
|
def self.import_languages!
|
25
|
-
|
26
|
-
Mumuki::Domain::Store::Thesaurus.new(
|
27
|
-
Mumukit::Platform.thesaurus_bridge)).import_all!
|
31
|
+
self.languages_syncer.import_all!
|
28
32
|
end
|
29
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-domain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mumukit-bridge
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -600,6 +600,7 @@ files:
|
|
600
600
|
- lib/mumuki/domain/exceptions/unauthorized_error.rb
|
601
601
|
- lib/mumuki/domain/extensions.rb
|
602
602
|
- lib/mumuki/domain/extensions/array.rb
|
603
|
+
- lib/mumuki/domain/extensions/hash.rb
|
603
604
|
- lib/mumuki/domain/extensions/module.rb
|
604
605
|
- lib/mumuki/domain/extensions/string.rb
|
605
606
|
- lib/mumuki/domain/factories.rb
|