grom 0.4.0 → 0.5.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 +4 -4
- data/.ruby-version +1 -1
- data/gocd/web1live.yaml +30 -0
- data/lib/grom/builder.rb +24 -4
- data/lib/grom/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '00868d0d8687f9e5b228550499afda1340b32ddc'
|
4
|
+
data.tar.gz: 5e0c5da043501b4a19311dccef4aa9352690255b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddfeacff71067896dbca7393697ea3305ecee0fb92f7826f213fd5f03d4e9dc8e24504248b18ac7466369539c9220a473cebe85388f47bb4fa8664e97b1ac229
|
7
|
+
data.tar.gz: b9890c67a74e83d6026c73b56d6ca4c157e77d3bfc09c9546b3ee6a5b834cab11202c1a7baf6f3c9bbafc55d928c828878e7d9884624c4089350a93615f66132
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.1
|
data/gocd/web1live.yaml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
pipelines:
|
2
|
+
GEM-grom:
|
3
|
+
group: Dependencies
|
4
|
+
label_template: "${COUNT}"
|
5
|
+
materials:
|
6
|
+
GEM-grom-git:
|
7
|
+
git: https://github.com/ukparliament/grom.git
|
8
|
+
branch: master
|
9
|
+
auto_update: true
|
10
|
+
stages:
|
11
|
+
- deploy:
|
12
|
+
approval: manual
|
13
|
+
jobs:
|
14
|
+
deploy:
|
15
|
+
tasks:
|
16
|
+
- exec:
|
17
|
+
run_if: passed
|
18
|
+
command: make
|
19
|
+
arguments:
|
20
|
+
- checkout_to_release
|
21
|
+
- exec:
|
22
|
+
run_if: passed
|
23
|
+
command: make
|
24
|
+
arguments:
|
25
|
+
- deploy_to_release
|
26
|
+
|
27
|
+
environments:
|
28
|
+
Web.LIVE:
|
29
|
+
pipelines:
|
30
|
+
- GEM-grom
|
data/lib/grom/builder.rb
CHANGED
@@ -46,14 +46,34 @@ module Grom
|
|
46
46
|
@reader.edges_by_subject.each do |subject, predicates|
|
47
47
|
predicates.each do |predicate, object_uris|
|
48
48
|
current_node = @objects_by_subject[subject]
|
49
|
+
next if current_node.nil?
|
49
50
|
|
50
51
|
object_uris.each do |object_uri|
|
51
52
|
predicate_name_symbol = "@#{predicate}".to_sym
|
52
|
-
object_array = current_node.instance_variable_get(predicate_name_symbol)
|
53
|
-
object_array = [] if object_array.is_a?(String) || object_array.all? { |object| object.is_a?(String) }
|
54
|
-
object_array << @objects_by_subject[object_uri]
|
55
53
|
|
56
|
-
|
54
|
+
# Get the current value (if there is one)
|
55
|
+
current_value = current_node.instance_variable_get(predicate_name_symbol)
|
56
|
+
|
57
|
+
object = current_value
|
58
|
+
|
59
|
+
# If we have stored a string, and there are objects to link, create an empty array
|
60
|
+
current_value_is_string = current_value.is_a?(String)
|
61
|
+
object_is_array_of_strings = object.all? { |entry| entry.is_a?(String) } if object.is_a?(Array)
|
62
|
+
object_by_uri = @objects_by_subject[object_uri]
|
63
|
+
|
64
|
+
object = [] if (current_value_is_string || object_is_array_of_strings) && object_by_uri
|
65
|
+
|
66
|
+
# If the above is correct, and we have an array
|
67
|
+
if object.is_a?(Array)
|
68
|
+
# Insert the current value (only if this is a new array (prevents possible duplication),
|
69
|
+
# the current value is a string, and there are no linked objects to insert)
|
70
|
+
object << current_value if object.empty? && current_value_is_string && object_by_uri.nil?
|
71
|
+
|
72
|
+
# Insert linked objects, if there are any
|
73
|
+
object << object_by_uri if object_by_uri
|
74
|
+
end
|
75
|
+
|
76
|
+
current_node.instance_variable_set(predicate_name_symbol, object)
|
57
77
|
end
|
58
78
|
end
|
59
79
|
end
|
data/lib/grom/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rebecca Appleyard
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-09-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rdf
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- bin/console
|
148
148
|
- bin/setup
|
149
149
|
- docs/logo.svg
|
150
|
+
- gocd/web1live.yaml
|
150
151
|
- grom.gemspec
|
151
152
|
- lib/grom.rb
|
152
153
|
- lib/grom/builder.rb
|