geolexica-server 0.0.1.pre.beta.pre.32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8361c5a39bae869d9c8983ea30621417cd4119c3b3ca4e6330ce58af407e6d7a
4
+ data.tar.gz: 8a997a1d670649b7f65b440ab095d603219edeb7540d56a87a1df8d589f1f19a
5
+ SHA512:
6
+ metadata.gz: '04395338ba83b2ebf09e697247dc23372c40e3bd6f666b257756cbf870a60a8681e02869e51e1571235374982f901e45a96cea30599923db41a8f1b806125bac'
7
+ data.tar.gz: 7da8a18d04ce08c9843d1e0200acf2be42028ce2663e55b482f74a66d537c1ba5fe3790fc8703245da02c4ce079829b1cb617a622132e70d124faf40ca445dbf
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # (c) Copyright 2020 Ribose Inc.
2
+ #
3
+
4
+ source "https://rubygems.org"
5
+
6
+ gemspec
data/README.adoc ADDED
@@ -0,0 +1,102 @@
1
+ = ISO/TC 211 Geolexica Terminology Database
2
+
3
+ image:https://github.com/ISO-TC211/geolexica.org/workflows/build/badge.svg["Build Status", link="https://github.com/ISO-TC211/geolexica.org/actions?workflow=build"]
4
+
5
+ image:https://github.com/ISO-TC211/geolexica.org/workflows/deploy-master/badge.svg["Build Status", link="https://github.com/ISO-TC211/geolexica.org/actions?workflow=deploy-master"]
6
+
7
+ image:https://github.com/ISO-TC211/geolexica.org/workflows/deploy-staging/badge.svg["Build Status", link="https://github.com/ISO-TC211/geolexica.org/actions?workflow=deploy-staging"]
8
+
9
+
10
+ == Introduction
11
+
12
+ Geolexica is the site name of the online version of the ISO/TC 211 Multi Lingual Glossary of Terms.
13
+
14
+ This repository contains the source of the https://www.geolexica.org site.
15
+
16
+ The site is managed by the ISO/TC 211 TMG together with Ribose.
17
+
18
+ NOTE: This repository is only meant for internal consumption!
19
+
20
+
21
+ == How to add/remove entries or suggest changes?
22
+
23
+ For change suggestions, contact ISO/TC 211 TMG.
24
+
25
+ This terminology database is managed by the ISO/TC 211 TMG, and it only considers
26
+ requests from within ISO/TC 211. The database is not directly community-managed or community-sourced.
27
+
28
+
29
+ == ISO/TC 211 MLGT component overview
30
+
31
+ Components involved in ISO/TC 211 MLGT solution:
32
+
33
+ . Geolexica.org: **this repository**.
34
+ Renders Geolexica database into HTML, JSON-LD and other Web-friendly formats.
35
+
36
+ . Geolexica database:
37
+ see https://github.com/geolexica/geolexica-database[geolexica/geolexica-database].
38
+ Hosts all concept data in YAML;
39
+ bundles facilities for converting authoritative spreadsheet data into YAML.
40
+ Candidate to become authoritative source, contingent upon factual usage of Glossarist by TMG.
41
+
42
+ . Manually managed XLST spreadsheets (1.0 workflow):
43
+ see https://github.com/ISO-TC211/mlgt-data[ISO-TC211/mlgt-data].
44
+ Currently the authoritative source in 1.0 workflow.
45
+ Will be phased out in favor of Geolexica database in 2.0.
46
+
47
+ . Glossarist desktop application (2.0 workflow):
48
+ see https://github.com/geolexica/geolexica-desktop[geolexica/geolexica-desktop].
49
+ Will be used to manage the Geolexica database in 2.0 workflow.
50
+
51
+
52
+ === Change lifecycle (1.0, current)
53
+
54
+ . Requested changes are directed to ISO/TC 211 TMG.
55
+
56
+ . When a change is approved, TMG publishes a new version of ISO/TC 211 "`Multi-Lingual Glossary of Terms`".
57
+
58
+ . TMG uploads the new MLGT version to mlgt-data repository.
59
+
60
+ . From the updated mlgt-data, a new snapshot of the database is created in geolexica-database repository.
61
+
62
+ . After new snapshot of the database is committed to geolexica-database,
63
+ ISO/TC 211’s Geolexica.org is deployed with the latest database version.
64
+
65
+
66
+ === Change lifecycle (2.0, near future)
67
+
68
+ . Requested changes are directed to ISO/TC 211 TMG.
69
+
70
+ . Adding, updating, approving concepts & terms in ISO/TC 211 Geolexica database
71
+ is done by TMG using the desktop application under development.
72
+
73
+ . As changes are made, new versions of Geolexica database are created,
74
+ and ISO/TC 211’s Geolexica.org is deployed with the latest database version.
75
+
76
+
77
+ == Internal operations
78
+
79
+ NOTE: These steps are only intended for the internal operator of the site!
80
+
81
+
82
+ === Building the site
83
+
84
+ . Ensure geolexica-database submodule is up-to-date.
85
+
86
+ . Run ``make _site``
87
+
88
+
89
+ === Deployment
90
+
91
+ Please push all changes to the `staging` branch, and changes will be automatically deployed and reflected on the staging site.
92
+
93
+ If your changes are to be made public to the production site, please contact Ribose.
94
+
95
+
96
+ === Rendering of HTML
97
+
98
+ Jekyll is used to render YAML into HTML.
99
+
100
+ NOTE: Since Jekyll Collections have this flaw where YAML files can't be directly
101
+ rendered, a hack is implemented in the Makefile `_concepts` target,
102
+ so that every YAML file is converted into AsciiDoc by padding `---` at the end.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/exe/geolexica ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "mercenary"
5
+ require "pry"
6
+ require_relative "../lib/geolexica_server"
7
+
8
+ Mercenary.program(:geolexica) do |p|
9
+ p.version GeolexicaServer::VERSION
10
+ p.syntax "geolexica <subcommand> [options]"
11
+
12
+ p.option "source", "-s", "--source [DIR]", "Source directory (defaults to ./)"
13
+ p.option "destination", "-d", "--destination [DIR]", "Destination directory (defaults to ./_site)"
14
+
15
+ Jekyll::Commands::Serve.init_with_program(p)
16
+ Jekyll::Commands::Build.init_with_program(p)
17
+
18
+ p.command(:generate_metadata) do |c|
19
+ c.syntax "generate-metadata [options]"
20
+ c.description "Creates a file containing metadata related to current repo"
21
+
22
+ c.action do |_args, options|
23
+ GeolexicaServer::Generator::Metadata.generate(options)
24
+ end
25
+ end
26
+
27
+ p.command(:generate_bibliography) do |c|
28
+ c.syntax "generate-bibliography [options]"
29
+ c.description "Creates a directory containing bibliography based on bibliography.yaml file"
30
+
31
+ c.action do |_args, options|
32
+ GeolexicaServer::Generator::Bibliography.generate(options)
33
+ end
34
+ end
35
+
36
+ p.action do |args, _options|
37
+ puts(p) if args.empty?
38
+ end
39
+ end
@@ -0,0 +1,49 @@
1
+ # (c) Copyright 2020 Ribose Inc.
2
+ #
3
+
4
+ require_relative "lib/geolexica_server/version"
5
+
6
+ all_files_in_git = Dir.chdir(__dir__) { `git ls-files -z`.split("\x0") }
7
+
8
+ ribose_url = "https://open.ribose.com/"
9
+ github_url = "https://github.com/geolexica/geolexica-server"
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = "geolexica-server"
13
+ spec.version = GeolexicaServer::VERSION
14
+ spec.authors = ["Ribose Inc."]
15
+ spec.email = ["open.source@ribose.com"]
16
+
17
+ spec.summary = "Server for Geolexica sites"
18
+ spec.homepage = ribose_url
19
+ spec.license = "MIT"
20
+
21
+ spec.metadata = {
22
+ "bug_tracker_uri" => "#{github_url}/issues",
23
+ "homepage_uri" => ribose_url,
24
+ "source_code_uri" => github_url
25
+ }
26
+
27
+ spec.files = all_files_in_git.reject do |f|
28
+ [
29
+ f.match(%r{^(test|spec|features|.github)/}),
30
+ f.match(%r{^\.})
31
+ ].any?
32
+ end
33
+
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_dependency "jekyll-geolexica"
39
+ spec.add_dependency "mercenary"
40
+ spec.add_dependency "relaton"
41
+
42
+ # Zeitwerk::Loader#push_dir supports :namespace argument from v. 2.4.
43
+ spec.add_runtime_dependency "zeitwerk", "~> 2.4"
44
+
45
+ spec.add_development_dependency "bundler", "~> 2.1"
46
+ spec.add_development_dependency "pry"
47
+ spec.add_development_dependency "rake", ">= 10"
48
+ spec.add_development_dependency "rspec", "~> 3.9"
49
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
4
+
5
+ module GeolexicaServer
6
+ module Generator
7
+ # Base class for generators in GeolexicaServer
8
+ class Base
9
+ def self.generate(*args)
10
+ new(*args).generate
11
+ end
12
+
13
+ def initialize(options = {})
14
+ config_file_path =
15
+ options["config_file_path"] ||
16
+ GeolexicaServer::DEFAULT_CONFIG_FILE_PATH
17
+
18
+ @config = YAML.load_file(config_file_path)
19
+
20
+ unless @config["geolexica"] && @config["geolexica"]["glossary_path"]
21
+ raise StandardError,
22
+ "geolexica.glossary_path is missing in config file."
23
+ end
24
+
25
+ @glossary_path = @config["geolexica"]["glossary_path"]
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "relaton"
4
+
5
+ module GeolexicaServer
6
+ module Generator
7
+ # Class for generating bibliography of the glossary
8
+ class Bibliography < Base
9
+ def initialize(options)
10
+ super
11
+
12
+ @input_file = "#{@glossary_path}/bibliography.yaml"
13
+ @output_dir = "bibliography"
14
+
15
+ @bibliography_map = YAML.load_file(@input_file)
16
+ @db = Relaton::Db.new(nil, nil)
17
+ end
18
+
19
+ def generate
20
+ Dir.mkdir(@output_dir) unless File.directory?(@output_dir)
21
+
22
+ @bibliography_map.each do |name, identifier|
23
+ bib =
24
+ @db.fetch(identifier["reference"]) ||
25
+ user_defined_bib(identifier)
26
+
27
+ file_path = "#{@output_dir}/#{name}.yaml"
28
+ File.write(file_path, bib.to_yaml)
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def user_defined_bib(identifier)
35
+ {
36
+ "user_defined" => true,
37
+ "reference" => identifier["reference"],
38
+ "link" => identifier["link"],
39
+ }.compact
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GeolexicaServer
4
+ module Generator
5
+ # Class for generating metadata of the glossary
6
+ class Metadata < Base
7
+ def initialize(options)
8
+ super
9
+
10
+ @concepts_dir = "#{@glossary_path}/concepts/*.yaml"
11
+ @output_file_name = "metadata.yaml"
12
+ end
13
+
14
+ def generate
15
+ terms = extract_terms
16
+
17
+ File.open(@output_file_name, "w") do |file|
18
+ file.write(metadata(terms).to_yaml)
19
+ end
20
+
21
+ puts "Done."
22
+ end
23
+
24
+ private
25
+
26
+ def extract_terms
27
+ terms = []
28
+
29
+ Dir[@concepts_dir].map do |yaml_file|
30
+ terms << YAML.safe_load(IO.read(yaml_file))
31
+ puts "Processing #{yaml_file}"
32
+ end
33
+
34
+ terms
35
+ end
36
+
37
+ def metadata(terms)
38
+ {
39
+ "concept_count" => terms.length,
40
+ "term_count" => terms.sum { |t| t.keys.length - 2 },
41
+ "version" => "20220530",
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GeolexicaServer
4
+ module Generator
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # (c) Copyright 2020 Ribose Inc.
2
+ #
3
+
4
+ module GeolexicaServer
5
+ VERSION = "0.0.1-beta-32".freeze
6
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require "zeitwerk"
5
+
6
+ loader = Zeitwerk::Loader.for_gem
7
+ loader.setup
8
+
9
+ module GeolexicaServer
10
+ # Loads Rake tasks which are provided in this gem.
11
+ #
12
+ # In order to load these tasks, following lines should be added to given
13
+ # site's Rakefile:
14
+ #
15
+ # require "geolexica_server"
16
+ # GeolexicaServer.load_tasks
17
+ def self.load_tasks
18
+ tasks_path = File.expand_path("../tasks", __dir__)
19
+ Rake.add_rakelib(tasks_path)
20
+ end
21
+
22
+ DEFAULT_CONFIG_FILE_PATH = "./_config.yaml"
23
+ end
@@ -0,0 +1,44 @@
1
+ # (c) Copyright 2020 Ribose Inc.
2
+ #
3
+
4
+ namespace :geolexica do
5
+
6
+ desc "Deploy site to S3"
7
+ task :s3_deploy do
8
+ s3sync_patterns_and_options = {
9
+ "*.html" => ["--content-type", "text/html; charset=utf-8"],
10
+ "*.json" => ["--content-type", "application/json; charset=utf-8"],
11
+ "*.jsonld" => ["--content-type", "application/ld+json; charset=utf-8"],
12
+ "*.tbx.xml" => ["--content-type", "application/xml; charset=utf-8"],
13
+ "*.ttl" => ["--content-type", "text/turtle; charset=utf-8"],
14
+ "*.yaml" => ["--content-type", "text/yaml; charset=utf-8"],
15
+ }
16
+
17
+ s3sync_patterns_and_options.each_pair do |pattern, options|
18
+ s3_sync "--exclude", "*", "--include", pattern, *options
19
+ end
20
+
21
+ # Remaining files
22
+ remaining_patterns = s3sync_patterns_and_options.keys
23
+ s3_sync "--include", "*", *remaining_patterns.flat_map { |k| ["--exclude", k] }
24
+
25
+ aws "configure", "set", "preview.cloudfront", "true"
26
+
27
+ aws "cloudfront", "create-invalidation",
28
+ "--distribution-id", ENV["CLOUDFRONT_DISTRIBUTION_ID"],
29
+ "--paths", "/*"
30
+ end
31
+
32
+ def s3_sync(*args)
33
+ source = "_site"
34
+ target = "s3://#{ENV["S3_BUCKET_NAME"]}"
35
+ common_options = ["--region", ENV["AWS_REGION"], "--delete", "--no-progress"]
36
+
37
+ aws "s3", "sync", source, target, *common_options, *args
38
+ end
39
+
40
+ def aws(*args)
41
+ system "aws", *args, exception: true
42
+ end
43
+
44
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: geolexica-server
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.pre.beta.pre.32
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-09-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll-geolexica
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mercenary
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: relaton
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: zeitwerk
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.4'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.9'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.9'
125
+ description:
126
+ email:
127
+ - open.source@ribose.com
128
+ executables:
129
+ - geolexica
130
+ extensions: []
131
+ extra_rdoc_files: []
132
+ files:
133
+ - Gemfile
134
+ - README.adoc
135
+ - Rakefile
136
+ - exe/geolexica
137
+ - geolexica-server.gemspec
138
+ - lib/geolexica_server.rb
139
+ - lib/geolexica_server/generator.rb
140
+ - lib/geolexica_server/generator/base.rb
141
+ - lib/geolexica_server/generator/bibliography.rb
142
+ - lib/geolexica_server/generator/metadata.rb
143
+ - lib/geolexica_server/version.rb
144
+ - lib/tasks/deploy.rake
145
+ homepage: https://open.ribose.com/
146
+ licenses:
147
+ - MIT
148
+ metadata:
149
+ bug_tracker_uri: https://github.com/geolexica/geolexica-server/issues
150
+ homepage_uri: https://open.ribose.com/
151
+ source_code_uri: https://github.com/geolexica/geolexica-server
152
+ post_install_message:
153
+ rdoc_options: []
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">"
164
+ - !ruby/object:Gem::Version
165
+ version: 1.3.1
166
+ requirements: []
167
+ rubygems_version: 3.3.7
168
+ signing_key:
169
+ specification_version: 4
170
+ summary: Server for Geolexica sites
171
+ test_files: []