Skip to content

Commit

Permalink
Merge branch 'feature/add-portal-config-endpoint' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Sep 4, 2024
2 parents 2ffbd55 + fc6635f commit c111f51
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem 'json-ld'


# Rack middleware
gem 'ffi'
gem 'ffi', '~> 1.16.3'
gem 'rack-accept', '~> 0.4'
gem 'rack-attack', '~> 6.6.1', require: 'rack/attack'
gem 'rack-cache', '~> 1.13.0'
Expand Down Expand Up @@ -51,7 +51,7 @@ gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branc
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'development'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'feature/add-portal-config-model'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand Down
33 changes: 16 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 9605eb44c4271c60bedda0520e85d8c3fa2513ac
branch: development
revision: d893c08a2c2f11c743fad520873b7f98b0805240
branch: feature/add-portal-config-model
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand Down Expand Up @@ -108,12 +108,13 @@ GEM
multi_json (~> 1.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airbrussh (1.5.2)
airbrussh (1.5.3)
sshkit (>= 1.6.1, != 1.7.0)
backports (3.25.0)
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-x86_64-darwin)
bigdecimal (1.4.2)
builder (3.3.0)
capistrano (3.19.1)
Expand Down Expand Up @@ -164,7 +165,7 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.17.0)
ffi (1.16.3)
gapic-common (0.21.1)
faraday (>= 1.9, < 3.a)
faraday-retry (>= 1.0, < 3.a)
Expand All @@ -178,7 +179,7 @@ GEM
google-analytics-data (0.6.1)
google-analytics-data-v1beta (>= 0.11, < 2.a)
google-cloud-core (~> 1.6)
google-analytics-data-v1beta (0.13.0)
google-analytics-data-v1beta (0.13.1)
gapic-common (>= 0.21.1, < 2.a)
google-cloud-errors (~> 1.0)
google-apis-analytics_v3 (0.16.0)
Expand Down Expand Up @@ -211,11 +212,11 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.65.2-x86_64-linux)
grpc (1.65.2-x86_64-darwin)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.62.0-x86_64-linux)
google-protobuf (~> 3.25)
grpc (1.65.2-x86_64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
haml (5.2.2)
temple (>= 0.8.0)
Expand All @@ -239,7 +240,7 @@ GEM
kgio (2.11.4)
libxml-ruby (5.0.3)
link_header (0.0.8)
logger (1.6.0)
logger (1.6.1)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.8.1)
Expand All @@ -250,7 +251,7 @@ GEM
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0820)
mime-types-data (3.2024.0903)
mini_mime (1.1.5)
minitest (4.7.5)
minitest-stub_any_instance (1.0.3)
Expand All @@ -261,7 +262,7 @@ GEM
mutex_m (0.2.0)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.14)
net-imap (0.4.15)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -276,7 +277,7 @@ GEM
net-protocol
net-ssh (7.2.3)
netrc (0.11.0)
newrelic_rpm (9.12.0)
newrelic_rpm (9.13.0)
oj (3.16.1)
omni_logger (0.1.4)
logger
Expand Down Expand Up @@ -344,8 +345,7 @@ GEM
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
retriable (3.1.2)
rexml (3.3.6)
strscan
rexml (3.3.7)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand Down Expand Up @@ -386,7 +386,6 @@ GEM
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
strscan (3.1.0)
systemu (2.6.5)
temple (0.10.3)
tilt (2.4.0)
Expand Down Expand Up @@ -423,7 +422,7 @@ DEPENDENCIES
cube-ruby
ed25519 (>= 1.2, < 2.0)
faraday (~> 1.9)
ffi
ffi (~> 1.16.3)
goo!
haml (~> 5.2.2)
json-ld
Expand Down Expand Up @@ -467,4 +466,4 @@ DEPENDENCIES
webmock (~> 3.19.1)

BUNDLED WITH
2.4.22
2.3.23
31 changes: 31 additions & 0 deletions config/environments/config.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,37 @@ LinkedData.config do |config|
link: 'https://www.googleapis.com/oauth2/v3/userinfo'
}
}
config.ui_name = 'Bioportal'
config.title = 'NCBO BioPortal'
config.description = "The world's most comprehensive repository of biomedical ontologies "
config.color = '#234979'
config.logo = ''
config.fundedBy = [
{
img_src: 'https://identity.stanford.edu/wp-content/uploads/sites/3/2020/07/block-s-right.png',
url: 'https://www.stanford.edu',

},
{
img_src: 'https://ontoportal.org/images/logo.png',
url: 'https://ontoportal.org/',
}
]
config.federated_portals = {
'agroportal' => {
api: 'http://data.agroportal.lirmm.fr',
ui: 'http://agroportal.lirmm.fr',
apikey: '1cfae05f-9e67-486f-820b-b393dec5764b',
color: '#1e2251'
},
'bioportal' => {
api: 'http://data.bioontology.org',
ui: 'http://bioportal.bioontology.org',
apikey: '4a5011ea-75fa-4be6-8e89-f45c8c84844e',
color: '#234979'
},

}
end

Annotator.config do |config|
Expand Down
18 changes: 13 additions & 5 deletions controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class HomeController < ApplicationController

CLASS_MAP = {
Property: "LinkedData::Models::ObjectProperty"
Property: "LinkedData::Models::ObjectProperty"
}

namespace "/" do
Expand All @@ -28,14 +28,22 @@ class HomeController < ApplicationController
next if route.length < 3 || route.split("/").length > 2
route_no_slash = route.gsub("/", "")
context[route_no_slash] = route_to_class_map[route].type_uri.to_s if route_to_class_map[route] && route_to_class_map[route].respond_to?(:type_uri)
routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix+route_no_slash
routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix + route_no_slash
end
routes_hash["@context"] = context
reply ({links: routes_hash})

config = LinkedData::Models::PortalConfig.current_portal_config

federated_portals = config.federated_portals
federated_portals. transform_values! { |v| v.delete(:apikey) ; v }
config.init_federated_portals_settings(federated_portals)

config.class.link_to *routes_hash.map { |key, url| LinkedData::Hypermedia::Link.new(key, url, context[key]) }

reply config
end

get "documentation" do
@metadata_all = metadata_all.sort {|a,b| a[0].name <=> b[0].name}
@metadata_all = metadata_all.sort { |a, b| a[0].name <=> b[0].name }
haml "documentation/documentation".to_sym, :layout => "documentation/layout".to_sym
end

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ services:
- "9393:9393"
volumes:
# bundle volume for hosting gems installed by bundle; it speeds up gem install in local development
- app_api:/srv/ontoportal/ontologies_api
- .:/srv/ontoportal/ontologies_api
- repository:/srv/ontoportal/data/repository

ncbo_cron:
Expand Down

0 comments on commit c111f51

Please sign in to comment.