mumukit-platform 2.2.0 → 2.3.0

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: 193f279831a954c01d410cdfe09a787d0a16370a1e8444e099d26356fc5836e0
4
- data.tar.gz: 4fcb30e02bcd73b43473788188a0d05400cd0887e2d23c926b6b0d9a2e73844f
3
+ metadata.gz: 772098b612bcb587487ca542e87d418e9468727c49d6a0aad69f8760b6a50a37
4
+ data.tar.gz: 316bb67043a39ce9c22dc59623160d752c35b222728dfd6ddab7152a6f533772
5
5
  SHA512:
6
- metadata.gz: 0d906fdfe5e62892264a7b905909287d62d24faa78b45532241f2bfb1329fd70cc0733910a1e20b6562fd9efbc693578771d751edea6d1de9ece1fbe10ecfac3
7
- data.tar.gz: ca42ab8e0c2aff1bbf178dee8d7f82dd9989a58a850d884b88de4dce10d6baae4245251734885d5d0c9f861198f74ea850ea4ae1c109b1946f5d459183ce8762
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
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Platform
3
- VERSION = '2.2.0'
3
+ VERSION = '2.3.0'
4
4
  end
5
5
  end
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.2.0
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-12 00:00:00.000000000 Z
11
+ date: 2018-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit-nuntius