Skip to content

Commit

Permalink
Merge pull request #7 from metanorma/fix-loading-order
Browse files Browse the repository at this point in the history
Fix loading order and make specs runnable
  • Loading branch information
ronaldtse authored Oct 27, 2024
2 parents 76432a4 + a6d258f commit e8cb7f4
Show file tree
Hide file tree
Showing 316 changed files with 251 additions and 5,270 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@

# rspec failure tracking
.rspec_status
Gemfile.lock
.rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
14 changes: 11 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
inherit_from:
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml

# local repo-specific modifications
# ...
Metrics/BlockLength:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/AbcSize:
Enabled: false

AllCops:
TargetRubyVersion: 3.4
TargetRubyVersion: 2.7
SuggestExtensions: false
NewCops: enable
10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ source "https://rubygems.org"
# Specify your gem's dependencies in niso-jats.gemspec
gemspec

gem "equivalent-xml"
gem "pry", "~> 0.12"
gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"
gem "rspec", "~> 3.11"
gem "rubocop", "~> 1.58"
gem "rubocop-performance", "~> 1.21", ">= 1.21.1"
gem "xml-c14n"
1 change: 1 addition & 0 deletions lib/niso-jats.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative "niso/jats"
13 changes: 9 additions & 4 deletions lib/niso/jats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
module Niso
module Jats
class Error < StandardError; end

# Your code goes here...
end
end

require_relative "jats/version"
require_relative "jats/std"
require "zeitwerk"

loader = Zeitwerk::Loader.for_gem
loader.push_dir(__dir__, namespace: Niso)
loader.ignore("#{__dir__}/jats/module_includer.rb")
loader.setup
loader.eager_load

require_relative "jats/module_includer"
4 changes: 0 additions & 4 deletions lib/niso/jats/abbrev.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "def"

module Niso
module Jats
class Abbrev < Lutaml::Model::Serializable
Expand Down
2 changes: 0 additions & 2 deletions lib/niso/jats/abbrev_journal_title.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

module Niso
module Jats
class AbbrevJournalTitle < Lutaml::Model::Serializable
Expand Down
8 changes: 0 additions & 8 deletions lib/niso/jats/abstract.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "label"
require_relative "object_id"
require_relative "paragraph"
require_relative "sec"
require_relative "title"

module Niso
module Jats
class Abstract < Lutaml::Model::Serializable
Expand Down
2 changes: 0 additions & 2 deletions lib/niso/jats/access_date.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

module Niso
module Jats
class AccessDate < Lutaml::Model::Serializable
Expand Down
12 changes: 0 additions & 12 deletions lib/niso/jats/ack.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "abstract"
require_relative "kwd_group"
require_relative "label"
require_relative "object_id"
require_relative "paragraph"
require_relative "ref_list"
require_relative "sec"
require_relative "subj_group"
require_relative "title"

module Niso
module Jats
class Ack < Lutaml::Model::Serializable
Expand Down
37 changes: 0 additions & 37 deletions lib/niso/jats/addr_line.rb
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "abbrev"
require_relative "alternatives"
require_relative "bold"
require_relative "chem_struct"
require_relative "city"
require_relative "country"
require_relative "fax"
require_relative "fixed_case"
require_relative "index_term"
require_relative "index_term_range_end"
require_relative "inline_formula"
require_relative "inline_graphic"
require_relative "inline_media"
require_relative "institution"
require_relative "institution_wrap"
require_relative "italic"
require_relative "milestone_end"
require_relative "milestone_start"
require_relative "monospace"
require_relative "named_content"
require_relative "overline"
require_relative "phone"
require_relative "postal_code"
require_relative "private_char"
require_relative "roman"
require_relative "ruby"
require_relative "sans_serif"
require_relative "sc"
require_relative "state"
require_relative "strike"
require_relative "styled_content"
require_relative "sub"
require_relative "sup"
require_relative "underline"

module Niso
module Jats
class AddrLine < Lutaml::Model::Serializable
Expand Down
15 changes: 0 additions & 15 deletions lib/niso/jats/address.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "addr_line"
require_relative "city"
require_relative "country"
require_relative "email"
require_relative "ext_link"
require_relative "fax"
require_relative "institution"
require_relative "institution_wrap"
require_relative "phone"
require_relative "postal_code"
require_relative "state"
require_relative "uri"

module Niso
module Jats
class Address < Lutaml::Model::Serializable
Expand Down
42 changes: 4 additions & 38 deletions lib/niso/jats/aff.rb
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "addr_line"
require_relative "bold"
require_relative "break"
require_relative "city"
require_relative "country"
require_relative "email"
require_relative "ext_link"
require_relative "fax"
require_relative "fixed_case"
require_relative "fn"
require_relative "inline_supplementary_material"
require_relative "institution"
require_relative "institution_wrap"
require_relative "italic"
require_relative "label"
require_relative "monospace"
require_relative "overline"
require_relative "phone"
require_relative "postal_code"
require_relative "related_article"
require_relative "related_object"
require_relative "roman"
require_relative "ruby"
require_relative "sans_serif"
require_relative "sc"
require_relative "state"
require_relative "strike"
require_relative "sub"
require_relative "sup"
require_relative "target"
require_relative "underline"
require_relative "uri"
require_relative "xref"

module Niso
module Jats
class Aff < Lutaml::Model::Serializable
Expand All @@ -57,7 +21,8 @@ class Aff < Lutaml::Model::Serializable
attribute :email, Email, collection: true
attribute :ext_link, ExtLink, collection: true
attribute :uri, Uri, collection: true
attribute :inline_supplementary_material, InlineSupplementaryMaterial, collection: true
attribute :inline_supplementary_material, InlineSupplementaryMaterial,
collection: true
attribute :related_article, RelatedArticle, collection: true
attribute :related_object, RelatedObject, collection: true
attribute :break, Break, collection: true
Expand Down Expand Up @@ -100,7 +65,8 @@ class Aff < Lutaml::Model::Serializable
map_element "email", to: :email
map_element "ext-link", to: :ext_link
map_element "uri", to: :uri
map_element "inline-supplementary-material", to: :inline_supplementary_material
map_element "inline-supplementary-material",
to: :inline_supplementary_material
map_element "related-article", to: :related_article
map_element "related-object", to: :related_object
map_element "break", to: :break
Expand Down
4 changes: 0 additions & 4 deletions lib/niso/jats/aff_alternatives.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "aff"

module Niso
module Jats
class AffAlternatives < Lutaml::Model::Serializable
Expand Down
2 changes: 0 additions & 2 deletions lib/niso/jats/alt_text.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

module Niso
module Jats
class AltText < Lutaml::Model::Serializable
Expand Down
44 changes: 2 additions & 42 deletions lib/niso/jats/alt_title.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "abbrev"
require_relative "alternatives"
require_relative "bold"
require_relative "break"
require_relative "chem_struct"
require_relative "email"
require_relative "ext_link"
require_relative "fixed_case"
require_relative "fn"
require_relative "index_term"
require_relative "index_term_range_end"
require_relative "inline_formula"
require_relative "inline_graphic"
require_relative "inline_media"
require_relative "inline_supplementary_material"
require_relative "italic"
require_relative "milestone_end"
require_relative "milestone_start"
require_relative "monospace"
require_relative "named_content"
require_relative "overline"
require_relative "private_char"
require_relative "related_article"
require_relative "related_object"
require_relative "roman"
require_relative "ruby"
require_relative "sans_serif"
require_relative "sc"
require_relative "strike"
require_relative "styled_content"
require_relative "sub"
require_relative "sup"
require_relative "target"
require_relative "tex_math"
require_relative "underline"
require_relative "uri"
require_relative "xref"

module Niso
module Jats
class AltTitle < Lutaml::Model::Serializable
Expand All @@ -48,7 +8,6 @@ class AltTitle < Lutaml::Model::Serializable
attribute :id, :string
attribute :specific_use, :string
attribute :lang, :string
include BasicText
attribute :break, Break, collection: true

xml do
Expand All @@ -62,7 +21,8 @@ class AltTitle < Lutaml::Model::Serializable
map_element "email", to: :email
map_element "ext-link", to: :ext_link
map_element "uri", to: :uri
map_element "inline-supplementary-material", to: :inline_supplementary_material
map_element "inline-supplementary-material",
to: :inline_supplementary_material
map_element "related-article", to: :related_article
map_element "related-object", to: :related_object
map_element "bold", to: :bold
Expand Down
24 changes: 4 additions & 20 deletions lib/niso/jats/alternatives.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

require_relative "array"
require_relative "chem_struct"
require_relative "code"
require_relative "graphic"
require_relative "inline_graphic"
require_relative "inline_media"
require_relative "inline_supplementary_material"
require_relative "media"
require_relative "object_id"
require_relative "preformat"
require_relative "private_char"
require_relative "supplementary_material"
require_relative "table"
require_relative "tex_math"
require_relative "textual_form"

module Niso
module Jats
class Alternatives < Lutaml::Model::Serializable
Expand All @@ -29,7 +11,8 @@ class Alternatives < Lutaml::Model::Serializable
attribute :graphic, Graphic, collection: true
attribute :inline_graphic, InlineGraphic, collection: true
attribute :inline_media, InlineMedia, collection: true
attribute :inline_supplementary_material, InlineSupplementaryMaterial, collection: true
attribute :inline_supplementary_material, InlineSupplementaryMaterial,
collection: true
attribute :media, Media, collection: true
attribute :preformat, Preformat, collection: true
attribute :private_char, PrivateChar, collection: true
Expand All @@ -50,7 +33,8 @@ class Alternatives < Lutaml::Model::Serializable
map_element "graphic", to: :graphic
map_element "inline-graphic", to: :inline_graphic
map_element "inline-media", to: :inline_media
map_element "inline-supplementary-material", to: :inline_supplementary_material
map_element "inline-supplementary-material",
to: :inline_supplementary_material
map_element "media", to: :media
map_element "preformat", to: :preformat
map_element "private-char", to: :private_char
Expand Down
7 changes: 0 additions & 7 deletions lib/niso/jats/annotation.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# frozen_string_literal: true

require "lutaml/model"

# require_relative "paragraph"

module Niso
module Jats
class P < Lutaml::Model::Serializable
end

class Annotation < Lutaml::Model::Serializable
attribute :content_type, :string
attribute :id, :string
Expand Down
2 changes: 0 additions & 2 deletions lib/niso/jats/anonymous.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "lutaml/model"

module Niso
module Jats
class Anonymous < Lutaml::Model::Serializable
Expand Down
Loading

0 comments on commit e8cb7f4

Please sign in to comment.