mods_display 0.9.1 → 1.0.0.alpha2
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/.rubocop.yml +2 -1
- data/.rubocop_todo.yml +433 -35
- data/README.md +0 -95
- data/app/components/mods_display/field_component.html.erb +13 -0
- data/app/components/mods_display/field_component.rb +27 -0
- data/app/components/mods_display/list_field_component.html.erb +11 -0
- data/app/components/mods_display/list_field_component.rb +10 -0
- data/app/components/mods_display/record_component.html.erb +5 -0
- data/app/components/mods_display/record_component.rb +39 -0
- data/app/helpers/mods_display/record_helper.rb +106 -0
- data/app/models/mods_display/record.rb +26 -0
- data/config/locales/en.yml +1 -1
- data/config.ru +9 -0
- data/lib/mods_display/engine.rb +13 -0
- data/lib/mods_display/fields/access_condition.rb +4 -0
- data/lib/mods_display/fields/contents.rb +14 -15
- data/lib/mods_display/fields/field.rb +13 -149
- data/lib/mods_display/fields/genre.rb +4 -0
- data/lib/mods_display/fields/imprint.rb +52 -3
- data/lib/mods_display/fields/location.rb +1 -1
- data/lib/mods_display/fields/name.rb +11 -20
- data/lib/mods_display/fields/nested_related_item.rb +7 -18
- data/lib/mods_display/fields/note.rb +4 -0
- data/lib/mods_display/fields/related_item.rb +4 -0
- data/lib/mods_display/fields/resource_type.rb +1 -1
- data/lib/mods_display/fields/sub_title.rb +3 -3
- data/lib/mods_display/fields/subject.rb +13 -39
- data/lib/mods_display/fields/title.rb +43 -32
- data/lib/mods_display/fields/values.rb +4 -4
- data/lib/mods_display/html.rb +55 -106
- data/lib/mods_display/version.rb +1 -1
- data/lib/mods_display.rb +2 -17
- data/mods_display.gemspec +15 -9
- metadata +45 -105
- data/.github/workflows/ruby.yml +0 -24
- data/.gitignore +0 -21
- data/lib/mods_display/configuration/access_condition.rb +0 -21
- data/lib/mods_display/configuration/base.rb +0 -34
- data/lib/mods_display/configuration/genre.rb +0 -9
- data/lib/mods_display/configuration/imprint.rb +0 -13
- data/lib/mods_display/configuration/name.rb +0 -9
- data/lib/mods_display/configuration/note.rb +0 -9
- data/lib/mods_display/configuration/related_item.rb +0 -9
- data/lib/mods_display/configuration/subject.rb +0 -13
- data/lib/mods_display/configuration/title.rb +0 -9
- data/lib/mods_display/configuration.rb +0 -93
- data/lib/mods_display/controller_extension.rb +0 -32
- data/lib/mods_display/helpers/record_helper.rb +0 -131
- data/lib/mods_display/model_extension.rb +0 -22
- data/lib/mods_display/railtie.rb +0 -10
- data/spec/configuration/access_condition_spec.rb +0 -10
- data/spec/configuration/base_spec.rb +0 -39
- data/spec/fake_app.rb +0 -18
- data/spec/fields/abstract_spec.rb +0 -39
- data/spec/fields/access_condition_spec.rb +0 -107
- data/spec/fields/audience_spec.rb +0 -24
- data/spec/fields/cartographics_spec.rb +0 -38
- data/spec/fields/collection_spec.rb +0 -77
- data/spec/fields/contact_spec.rb +0 -23
- data/spec/fields/contents_spec.rb +0 -39
- data/spec/fields/description_spec.rb +0 -55
- data/spec/fields/extent_spec.rb +0 -31
- data/spec/fields/form_spec.rb +0 -49
- data/spec/fields/genre_spec.rb +0 -34
- data/spec/fields/geo_spec.rb +0 -40
- data/spec/fields/identifier_spec.rb +0 -61
- data/spec/fields/imprint_spec.rb +0 -289
- data/spec/fields/language_spec.rb +0 -51
- data/spec/fields/location_spec.rb +0 -81
- data/spec/fields/name_spec.rb +0 -166
- data/spec/fields/nested_related_item_spec.rb +0 -89
- data/spec/fields/note_spec.rb +0 -72
- data/spec/fields/related_item_spec.rb +0 -72
- data/spec/fields/resource_type_spec.rb +0 -34
- data/spec/fields/sub_title_spec.rb +0 -20
- data/spec/fields/subject_spec.rb +0 -113
- data/spec/fields/title_spec.rb +0 -74
- data/spec/fixtures/access_condition_fixtures.rb +0 -58
- data/spec/fixtures/cartographics_fixtures.rb +0 -52
- data/spec/fixtures/imprint_fixtures.rb +0 -349
- data/spec/fixtures/name_fixtures.rb +0 -398
- data/spec/fixtures/nested_realted_items_fixtures.rb +0 -64
- data/spec/fixtures/related_item_fixtures.rb +0 -107
- data/spec/fixtures/subjects_fixtures.rb +0 -115
- data/spec/fixtures/title_fixtures.rb +0 -101
- data/spec/helpers/record_helper_spec.rb +0 -241
- data/spec/integration/configuration_spec.rb +0 -57
- data/spec/integration/html_spec.rb +0 -87
- data/spec/integration/installation_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -46
- data/spec/test_fr.yml +0 -3
@@ -18,30 +18,19 @@ module ModsDisplay
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def to_html
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
output << "<dt#{label_class} #{sanitized_field_title(field.label)}>#{field.label}</dt>"
|
28
|
-
output << "<dd#{value_class}>"
|
29
|
-
output << '<ul class="mods_display_nested_related_items">'
|
30
|
-
output << field.values.map do |val|
|
31
|
-
"<li class='mods_display_nested_related_item open'>#{link_urls_and_email(val.to_s)}</li>"
|
32
|
-
end.join
|
33
|
-
output << '</ul>'
|
34
|
-
output << '</dd>'
|
35
|
-
end
|
36
|
-
output
|
37
|
-
end
|
21
|
+
def to_html(view_context = ApplicationController.renderer)
|
22
|
+
helpers = view_context.respond_to?(:simple_format) ? view_context : ApplicationController.new.view_context
|
23
|
+
|
24
|
+
component = ModsDisplay::FieldComponent.with_collection(fields, value_transformer: ->(value) { helpers.link_urls_and_email(value.to_s) })
|
25
|
+
|
26
|
+
view_context.render component
|
38
27
|
end
|
39
28
|
|
40
29
|
private
|
41
30
|
|
42
31
|
def related_item_mods_object(value)
|
43
32
|
mods = ::Stanford::Mods::Record.new.tap { |r| r.from_str("<mods>#{value.children.to_xml}</mods>", false) }
|
44
|
-
related_item = ModsDisplay::HTML.new(
|
33
|
+
related_item = ModsDisplay::HTML.new(mods)
|
45
34
|
|
46
35
|
ModsDisplay::Values.new(
|
47
36
|
label: related_item_label(value),
|
@@ -2,7 +2,7 @@ module ModsDisplay
|
|
2
2
|
class ResourceType < Field
|
3
3
|
def fields
|
4
4
|
return_fields = @values.map do |value|
|
5
|
-
ModsDisplay::Values.new(label: displayLabel(value) || label, values: [value.text.strip
|
5
|
+
ModsDisplay::Values.new(label: displayLabel(value) || label, values: [value.text.strip])
|
6
6
|
end
|
7
7
|
collapse_fields(return_fields)
|
8
8
|
end
|
@@ -27,44 +27,14 @@ module ModsDisplay
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# Would really like to clean this up, but it works and is tested for now.
|
30
|
-
def to_html
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
buffer = []
|
39
|
-
sub_parts = []
|
40
|
-
subjects.each do |val|
|
41
|
-
if val.is_a?(ModsDisplay::Name::Person)
|
42
|
-
buffer << val.name
|
43
|
-
else
|
44
|
-
buffer << val
|
45
|
-
end
|
46
|
-
if @config.link && @config.hierarchical_link
|
47
|
-
if val.is_a?(ModsDisplay::Name::Person)
|
48
|
-
sub_parts << link_to_value(val.name, buffer.join(' '))
|
49
|
-
else
|
50
|
-
sub_parts << link_to_value(val, buffer.join(' '))
|
51
|
-
end
|
52
|
-
elsif @config.link
|
53
|
-
if val.is_a?(ModsDisplay::Name::Person)
|
54
|
-
sub_parts << link_to_value(val.name)
|
55
|
-
else
|
56
|
-
sub_parts << link_to_value(val.to_s)
|
57
|
-
end
|
58
|
-
else
|
59
|
-
sub_parts << val.to_s
|
60
|
-
end
|
61
|
-
end
|
62
|
-
subs << sub_parts.join(@config.delimiter)
|
63
|
-
end
|
64
|
-
output << subs.join('<br/>')
|
65
|
-
output << '</dd>'
|
66
|
-
end
|
67
|
-
output
|
30
|
+
def to_html(view_context = ApplicationController.renderer)
|
31
|
+
component = ModsDisplay::FieldComponent.with_collection(
|
32
|
+
fields,
|
33
|
+
delimiter: '<br />'.html_safe,
|
34
|
+
value_transformer: ->(value) { value.join(' > ') }
|
35
|
+
)
|
36
|
+
|
37
|
+
view_context.render component
|
68
38
|
end
|
69
39
|
|
70
40
|
def process_hierarchicalGeographic(element)
|
@@ -72,13 +42,17 @@ module ModsDisplay
|
|
72
42
|
end
|
73
43
|
|
74
44
|
def process_name(element)
|
75
|
-
name = ModsDisplay::Name.new([element]
|
45
|
+
name = ModsDisplay::Name.new([element]).fields.first
|
76
46
|
|
77
47
|
name.values.first if name
|
78
48
|
end
|
79
49
|
|
80
50
|
private
|
81
51
|
|
52
|
+
def delimiter
|
53
|
+
' > '
|
54
|
+
end
|
55
|
+
|
82
56
|
def values_from_subjects(element)
|
83
57
|
return_values = []
|
84
58
|
selected_subjects(element).each do |child|
|
@@ -4,31 +4,10 @@ module ModsDisplay
|
|
4
4
|
return_values = []
|
5
5
|
if @values
|
6
6
|
@values.each do |value|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
)
|
12
|
-
else
|
13
|
-
nonSort = nil
|
14
|
-
title = nil
|
15
|
-
subTitle = nil
|
16
|
-
nonSort = value.nonSort.text.strip unless value.nonSort.text.strip.empty?
|
17
|
-
title = value.title.text.strip unless value.title.text.strip.empty?
|
18
|
-
subTitle = value.subTitle.text unless value.subTitle.text.strip.empty?
|
19
|
-
preSubTitle = [nonSort, title].compact.join(' ')
|
20
|
-
preSubTitle = nil if preSubTitle.strip.empty?
|
21
|
-
preParts = compact_and_join_with_delimiter([preSubTitle, subTitle], ' : ')
|
22
|
-
preParts = nil if preParts.strip.empty?
|
23
|
-
parts = value.children.select do |child|
|
24
|
-
%w(partName partNumber).include?(child.name)
|
25
|
-
end.map(&:text).compact.join(parts_delimiter(value))
|
26
|
-
parts = nil if parts.strip.empty?
|
27
|
-
return_values << ModsDisplay::Values.new(
|
28
|
-
label: displayLabel(value) || title_label(value),
|
29
|
-
values: [compact_and_join_with_delimiter([preParts, parts], '. ')]
|
30
|
-
)
|
31
|
-
end
|
7
|
+
return_values << ModsDisplay::Values.new(
|
8
|
+
label: displayLabel(value) || title_label(value),
|
9
|
+
values: [assemble_title(value)]
|
10
|
+
)
|
32
11
|
end
|
33
12
|
end
|
34
13
|
collapse_fields(return_values)
|
@@ -36,14 +15,46 @@ module ModsDisplay
|
|
36
15
|
|
37
16
|
private
|
38
17
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
18
|
+
def delimiter
|
19
|
+
'<br />'
|
20
|
+
end
|
21
|
+
|
22
|
+
def assemble_title(element)
|
23
|
+
return displayForm(element) if displayForm(element)
|
24
|
+
|
25
|
+
title = ''
|
26
|
+
previous_element = nil
|
27
|
+
|
28
|
+
element.children.select { |value| title_parts.include? value.name }.each do |value|
|
29
|
+
str = value.text.strip
|
30
|
+
next if str.empty?
|
31
|
+
|
32
|
+
delimiter = case
|
33
|
+
when title.empty?, title.end_with?(' ')
|
34
|
+
nil
|
35
|
+
when title.end_with?('.', ',', ':', ';')
|
36
|
+
' '
|
37
|
+
when value.name == 'subTitle'
|
38
|
+
' : '
|
39
|
+
when value.name == 'partName' && previous_element.name == 'partNumber'
|
40
|
+
', '
|
41
|
+
when value.name == 'partNumber', value.name == 'partName'
|
42
|
+
'. '
|
43
|
+
else
|
44
|
+
' '
|
45
|
+
end
|
46
|
+
|
47
|
+
title += delimiter if delimiter
|
48
|
+
title += str
|
49
|
+
|
50
|
+
previous_element = value
|
45
51
|
end
|
46
|
-
|
52
|
+
|
53
|
+
title
|
54
|
+
end
|
55
|
+
|
56
|
+
def title_parts
|
57
|
+
%w[nonSort title subTitle partName partNumber]
|
47
58
|
end
|
48
59
|
|
49
60
|
def title_label(element)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module ModsDisplay
|
2
2
|
class Values
|
3
3
|
attr_accessor :label, :values
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
|
5
|
+
def initialize(label: nil, values: [])
|
6
|
+
@label = label
|
7
|
+
@values = values
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
data/lib/mods_display/html.rb
CHANGED
@@ -1,136 +1,85 @@
|
|
1
1
|
module ModsDisplay
|
2
2
|
class HTML
|
3
|
-
|
4
|
-
|
3
|
+
MODS_DISPLAY_FIELD_MAPPING = {
|
4
|
+
title: :title_info,
|
5
|
+
subTitle: :title_info,
|
6
|
+
name: :plain_name,
|
7
|
+
resourceType: :typeOfResource,
|
8
|
+
genre: :genre,
|
9
|
+
form: :physical_description,
|
10
|
+
extent: :physical_description,
|
11
|
+
geo: :extension,
|
12
|
+
imprint: :origin_info,
|
13
|
+
language: :language,
|
14
|
+
description: :physical_description,
|
15
|
+
cartographics: :subject,
|
16
|
+
abstract: :abstract,
|
17
|
+
contents: :tableOfContents,
|
18
|
+
audience: :targetAudience,
|
19
|
+
note: :note,
|
20
|
+
contact: :note,
|
21
|
+
collection: :related_item,
|
22
|
+
nestedRelatedItem: :related_item,
|
23
|
+
relatedItem: :related_item,
|
24
|
+
subject: :subject,
|
25
|
+
identifier: :identifier,
|
26
|
+
location: :location,
|
27
|
+
accessCondition: :accessCondition
|
28
|
+
}.freeze
|
29
|
+
|
30
|
+
def initialize(xml)
|
5
31
|
@stanford_mods = xml
|
6
32
|
@xml = xml.mods_ng_xml
|
7
|
-
@klass = klass
|
8
33
|
end
|
9
34
|
|
10
35
|
def title
|
11
|
-
unless mods_field(
|
12
|
-
return mods_field(
|
36
|
+
unless mods_field(:title).fields.empty?
|
37
|
+
return mods_field(:title).fields.first.values
|
13
38
|
end
|
14
39
|
''
|
15
40
|
end
|
16
41
|
|
42
|
+
def render_in(view_context)
|
43
|
+
body(view_context)
|
44
|
+
end
|
45
|
+
|
17
46
|
# Need to figure out how to get the 1st title out of the list.
|
18
47
|
# Maybe have a separate class that will omit the first tite natively
|
19
48
|
# and replace the first key in the the fields list with that.
|
20
|
-
def body
|
21
|
-
|
22
|
-
body_fields = mods_display_fields.dup
|
23
|
-
body_fields[0] = :subTitle
|
24
|
-
body_fields.each do |field_key|
|
25
|
-
field = mods_field(@xml, field_key)
|
26
|
-
output << field.to_html unless field.nil? || field.to_html.nil?
|
27
|
-
end
|
28
|
-
output << '</dl>'
|
49
|
+
def body(view_context = ApplicationController.renderer)
|
50
|
+
view_context.render ModsDisplay::RecordComponent.new(record: self)
|
29
51
|
end
|
30
52
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
output << field.to_html unless field.nil? || field.to_html.nil?
|
36
|
-
end
|
37
|
-
output << '</dl>'
|
53
|
+
# @deprecated
|
54
|
+
def to_html(view_context = ApplicationController.renderer)
|
55
|
+
fields = [:title] + ModsDisplay::RecordComponent::DEFAULT_FIELDS - [:subTitle]
|
56
|
+
view_context.render ModsDisplay::RecordComponent.new(record: self, fields: fields)
|
38
57
|
end
|
39
58
|
|
40
|
-
|
41
|
-
if
|
42
|
-
to_html.send(method_name, *args, &block)
|
43
|
-
elsif method_name == :subTitle || mods_display_fields.include?(method_name)
|
44
|
-
field = mods_field(@xml, method_name)
|
45
|
-
return field if (args.dig(0, :raw))
|
46
|
-
field.fields
|
47
|
-
else
|
48
|
-
super
|
49
|
-
end
|
50
|
-
end
|
59
|
+
MODS_DISPLAY_FIELD_MAPPING.each do |key, _value|
|
60
|
+
next if key == :title
|
51
61
|
|
52
|
-
|
62
|
+
define_method(key) do |raw: false|
|
63
|
+
field = mods_field(key)
|
64
|
+
next field if raw
|
53
65
|
|
54
|
-
|
55
|
-
if xml.respond_to?(mods_display_field_mapping[field_key])
|
56
|
-
field = xml.send(mods_display_field_mapping[field_key])
|
57
|
-
ModsDisplay.const_get(
|
58
|
-
"#{field_key.slice(0, 1).upcase}#{field_key.slice(1..-1)}"
|
59
|
-
).new(field, field_config(field_key), @klass)
|
60
|
-
elsif @stanford_mods.respond_to?(field_key)
|
61
|
-
ModsDisplay.const_get(
|
62
|
-
"#{field_key.slice(0, 1).upcase}#{field_key.slice(1..-1)}"
|
63
|
-
).new(@stanford_mods, field_config(field_key), @klass)
|
66
|
+
field.fields
|
64
67
|
end
|
65
68
|
end
|
66
69
|
|
67
|
-
def
|
68
|
-
@
|
69
|
-
rescue
|
70
|
-
ModsDisplay::Configuration::Base.new
|
71
|
-
end
|
70
|
+
def mods_field(key)
|
71
|
+
raise ArgumentError unless MODS_DISPLAY_FIELD_MAPPING[key] && @xml.respond_to?(MODS_DISPLAY_FIELD_MAPPING[key])
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
:name,
|
76
|
-
:language,
|
77
|
-
:imprint,
|
78
|
-
:resourceType,
|
79
|
-
:genre,
|
80
|
-
:form,
|
81
|
-
:extent,
|
82
|
-
:geo,
|
83
|
-
:description,
|
84
|
-
:cartographics,
|
85
|
-
:abstract,
|
86
|
-
:contents,
|
87
|
-
:audience,
|
88
|
-
:note,
|
89
|
-
:contact,
|
90
|
-
:collection,
|
91
|
-
:nestedRelatedItem,
|
92
|
-
:relatedItem,
|
93
|
-
:subject,
|
94
|
-
:identifier,
|
95
|
-
:location,
|
96
|
-
:accessCondition
|
97
|
-
]
|
73
|
+
field = @xml.public_send(MODS_DISPLAY_FIELD_MAPPING[key])
|
74
|
+
mods_field_class(key).new(field)
|
98
75
|
end
|
99
76
|
|
100
|
-
|
101
|
-
{ title: :title_info,
|
102
|
-
subTitle: :title_info,
|
103
|
-
name: :plain_name,
|
104
|
-
resourceType: :typeOfResource,
|
105
|
-
genre: :genre,
|
106
|
-
form: :physical_description,
|
107
|
-
extent: :physical_description,
|
108
|
-
geo: :extension,
|
109
|
-
imprint: :origin_info,
|
110
|
-
language: :language,
|
111
|
-
description: :physical_description,
|
112
|
-
cartographics: :subject,
|
113
|
-
abstract: :abstract,
|
114
|
-
contents: :tableOfContents,
|
115
|
-
audience: :targetAudience,
|
116
|
-
note: :note,
|
117
|
-
contact: :note,
|
118
|
-
collection: :related_item,
|
119
|
-
nestedRelatedItem: :related_item,
|
120
|
-
relatedItem: :related_item,
|
121
|
-
subject: :subject,
|
122
|
-
identifier: :identifier,
|
123
|
-
location: :location,
|
124
|
-
accessCondition: :accessCondition }
|
125
|
-
end
|
77
|
+
private
|
126
78
|
|
127
|
-
def
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
accessCondition: :access_condition,
|
132
|
-
nestedRelatedItem: :nested_related_item
|
133
|
-
}
|
79
|
+
def mods_field_class(key)
|
80
|
+
ModsDisplay.const_get(
|
81
|
+
"#{key.slice(0, 1).upcase}#{key.slice(1..-1)}"
|
82
|
+
)
|
134
83
|
end
|
135
84
|
end
|
136
85
|
end
|
data/lib/mods_display/version.rb
CHANGED
data/lib/mods_display.rb
CHANGED
@@ -1,20 +1,8 @@
|
|
1
1
|
require 'mods_display/version'
|
2
|
-
require 'mods_display/controller_extension'
|
3
2
|
require 'mods_display/html'
|
4
|
-
require 'mods_display/model_extension'
|
5
3
|
require 'mods_display/country_codes'
|
6
4
|
require 'mods_display/relator_codes'
|
7
5
|
require 'mods_display/related_item_concerns'
|
8
|
-
require 'mods_display/configuration'
|
9
|
-
require 'mods_display/configuration/base'
|
10
|
-
require 'mods_display/configuration/access_condition'
|
11
|
-
require 'mods_display/configuration/imprint'
|
12
|
-
require 'mods_display/configuration/genre'
|
13
|
-
require 'mods_display/configuration/name'
|
14
|
-
require 'mods_display/configuration/note'
|
15
|
-
require 'mods_display/configuration/related_item'
|
16
|
-
require 'mods_display/configuration/subject'
|
17
|
-
require 'mods_display/configuration/title'
|
18
6
|
require 'mods_display/fields/field'
|
19
7
|
require 'mods_display/fields/abstract'
|
20
8
|
require 'mods_display/fields/access_condition'
|
@@ -38,8 +26,8 @@ require 'mods_display/fields/note'
|
|
38
26
|
require 'mods_display/fields/related_item'
|
39
27
|
require 'mods_display/fields/resource_type'
|
40
28
|
require 'mods_display/fields/subject'
|
41
|
-
require 'mods_display/fields/sub_title'
|
42
29
|
require 'mods_display/fields/title'
|
30
|
+
require 'mods_display/fields/sub_title'
|
43
31
|
require 'mods_display/fields/values'
|
44
32
|
|
45
33
|
require 'stanford-mods'
|
@@ -50,13 +38,10 @@ I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
|
50
38
|
I18n.load_path += Dir["#{File.expand_path('../..', __FILE__)}/config/locales/*.yml"]
|
51
39
|
I18n.backend.load_translations
|
52
40
|
|
53
|
-
# load Rails/Railtie
|
54
41
|
begin
|
55
42
|
require 'rails'
|
56
43
|
rescue LoadError
|
57
44
|
#do nothing
|
58
45
|
end
|
59
46
|
|
60
|
-
if defined?
|
61
|
-
require 'mods_display/railtie'
|
62
|
-
end
|
47
|
+
require 'mods_display/engine' if defined?(Rails)
|
data/mods_display.gemspec
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'mods_display/version'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "lib/mods_display/version"
|
5
3
|
|
6
4
|
Gem::Specification.new do |gem|
|
7
5
|
gem.name = 'mods_display'
|
@@ -12,13 +10,20 @@ Gem::Specification.new do |gem|
|
|
12
10
|
gem.summary = 'The MODS Display gem allows implementers to configure a customized display of MODS metadata. This display implements the specifications defined at Stanford for how to display MODS.'
|
13
11
|
gem.homepage = 'https://github.com/sul-dlss/mods_display'
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
gem.
|
18
|
-
|
13
|
+
# Specify which files should be added to the gem when it is released.
|
14
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
15
|
+
gem.files = Dir.chdir(File.expand_path(__dir__)) do
|
16
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
gem.bindir = "exe"
|
21
|
+
gem.executables = gem.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
22
|
+
gem.require_paths = ["lib"]
|
19
23
|
|
20
24
|
gem.add_dependency 'stanford-mods', '~> 2.1'
|
21
25
|
gem.add_dependency 'i18n'
|
26
|
+
gem.add_dependency 'view_component'
|
22
27
|
|
23
28
|
gem.add_development_dependency 'rake'
|
24
29
|
gem.add_development_dependency 'rspec', '~> 3.0'
|
@@ -26,5 +31,6 @@ Gem::Specification.new do |gem|
|
|
26
31
|
gem.add_development_dependency 'rubocop'
|
27
32
|
gem.add_development_dependency 'capybara'
|
28
33
|
gem.add_development_dependency 'byebug'
|
29
|
-
gem.add_development_dependency 'rails', '~> 6.0'
|
34
|
+
gem.add_development_dependency 'rails', ENV['RAILS_VERSION'] || '~> 6.0'
|
35
|
+
gem.add_development_dependency 'combustion', '~> 1.3'
|
30
36
|
end
|