mumukit-platform 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mumukit/platform/bridge.rb +7 -5
- data/lib/mumukit/platform/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 772098b612bcb587487ca542e87d418e9468727c49d6a0aad69f8760b6a50a37
|
4
|
+
data.tar.gz: 316bb67043a39ce9c22dc59623160d752c35b222728dfd6ddab7152a6f533772
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c2f8952e2a98cfc9227d2f736ae68017c3d0b80843894d66ae569a6462383cdd336c1559279ce572c9354e2a2f93e0f8a231fb0aa8357681124b2f8ba6e423f
|
7
|
+
data.tar.gz: 2db1e2f5f4e21ec3e4d6c55cc3dfbb598ca87acd1ae9de6cfd97fcc29d5bb4554c3770025696d5eb789a908440bc7f453d964b40f0c9e25ffa03551d2da9fba8
|
@@ -31,7 +31,7 @@ end
|
|
31
31
|
|
32
32
|
class Mumukit::Bridge::Bibliotheca
|
33
33
|
|
34
|
-
# Import all the contents, using a block that will do the actual
|
34
|
+
# Import all the contents whose slug matches the given regex, using a block that will do the actual
|
35
35
|
# persistence job.
|
36
36
|
#
|
37
37
|
# The block takes:
|
@@ -40,16 +40,18 @@ class Mumukit::Bridge::Bibliotheca
|
|
40
40
|
# * a slug (string)
|
41
41
|
#
|
42
42
|
# Exceptions raised within the block will be ignored
|
43
|
-
def import_contents!(&block)
|
43
|
+
def import_contents!(slug_regex = /.*/, &block)
|
44
44
|
%w(guide topic book).each do |resource_type|
|
45
|
-
import_content!(resource_type) { |slug| block.call(resource_type, slug) }
|
45
|
+
import_content!(resource_type, slug_regex) { |slug| block.call(resource_type, slug) }
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
# Import all the contents of a given type
|
50
|
-
def import_content!(resource_type, &block)
|
49
|
+
# Import all the contents of a given type, that matches a given slug
|
50
|
+
def import_content!(resource_type, slug_regex = /.*/, &block)
|
51
51
|
send(resource_type.to_s.pluralize).each do |resource|
|
52
52
|
slug = resource['slug']
|
53
|
+
return unless slug_regex.matches? slug
|
54
|
+
|
53
55
|
puts "Importing #{resource_type} #{slug}"
|
54
56
|
begin
|
55
57
|
block.call slug
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit-platform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit-nuntius
|