Skip to content

Commit

Permalink
Merge pull request #160 from ncbo/develop
Browse files Browse the repository at this point in the history
Develop to master merge, release v5.32.0
alexskr authored Sep 25, 2024
2 parents 02bcf36 + 8d8f576 commit cef6801
Showing 7 changed files with 96 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build docker-compose
run: docker-compose --profile 4store build #profile flag is set in order to build all containers in this step
run: docker compose --profile 4store build #profile flag is set in order to build all containers in this step
- name: Run unit tests
# unit tests are run inside a container
# http://docs.codecov.io/docs/testing-with-docker
run: |
ci_env=`bash <(curl -s https://codecov.io/env)`
docker-compose run $ci_env -e CI --rm ${{ matrix.backend }} bundle exec rake test TESTOPTS='-v'
docker compose run $ci_env -e CI --rm ${{ matrix.backend }} bundle exec rake test TESTOPTS='-v'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.8
3.0.6
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION
ARG RUBY_VERSION=3.0
ARG DISTRO_NAME=bullseye

FROM ruby:$RUBY_VERSION-$DISTRO_NAME
@@ -14,10 +14,7 @@ COPY Gemfile* /srv/ontoportal/ontologies_api/

WORKDIR /srv/ontoportal/ontologies_api

# set rubygem and bundler to the last version supported by ruby 2.7
# remove version after ruby v3 upgrade
RUN gem update --system '3.4.22'
RUN gem install bundler -v 2.4.22
RUN gem update --system
RUN gem install bundler
ENV BUNDLE_PATH=/srv/ontoportal/bundle
RUN bundle install
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ gem 'oj', '~> 3.0'
gem 'parseconfig'
gem 'rack'
gem 'rake', '~> 10.0'
gem 'rexml' # Investigate why unicorn fails to start under ruby 3 without adding rexml gem to the Gemfile
gem 'sinatra', '~> 1.0'
gem 'sinatra-advanced-routes'
gem 'sinatra-contrib', '~> 1.0'
@@ -77,4 +78,5 @@ group :test do
gem 'simplecov', require: false
gem 'simplecov-cobertura' # for codecov.io
gem 'webmock', '~> 3.19.1'
gem 'webrick'
end
129 changes: 63 additions & 66 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_annotator.git
revision: 7531e10ad55ac66e925c099d7fc05a5a3ceae67e
revision: 2fb892f92f66b876b9793944124f72821f3b3eb8
branch: develop
specs:
ncbo_annotator (0.0.1)
@@ -27,7 +27,7 @@ GIT

GIT
remote: https://github.com/ncbo/ncbo_cron.git
revision: 1fbfc8f7f3ca62de35912ec09f23cac72fea1550
revision: 3bb491139267efc37d3b752888824ca3dd976e85
branch: develop
specs:
ncbo_cron (0.0.1)
@@ -56,7 +56,7 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: 013a322440b4cfd899908d15ff605799acf8e6ef
revision: c30887ee907acd39500cae6c12f45edb06fe0802
branch: develop
specs:
ontologies_linked_data (0.0.1)
@@ -108,85 +108,83 @@ 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)
ast (2.4.2)
backports (3.25.0)
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-arm64-darwin)
bcrypt_pbkdf (1.1.1-x86_64-darwin)
bigdecimal (1.4.2)
builder (3.3.0)
capistrano (3.19.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.1.0)
capistrano-bundler (2.1.1)
capistrano (~> 3.1)
capistrano-locally (0.3.0)
capistrano (~> 3.0)
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
coderay (1.1.3)
concurrent-ruby (1.3.3)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crack (1.0.0)
bigdecimal
rexml
cube-ruby (0.0.3)
dante (0.2.0)
date (3.3.4)
docile (1.4.0)
docile (1.4.1)
domain_name (0.6.20240107)
ed25519 (1.3.0)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.0.2)
faraday-net_http (3.3.0)
net-http
faraday-retry (2.2.1)
faraday (~> 2.0)
ffi (1.17.0-aarch64-linux-gnu)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
gapic-common (0.21.1)
gapic-common (0.22.0)
faraday (>= 1.9, < 3.a)
faraday-retry (>= 1.0, < 3.a)
google-protobuf (~> 3.18)
googleapis-common-protos (>= 1.4.0, < 2.a)
googleapis-common-protos-types (>= 1.11.0, < 2.a)
googleauth (~> 1.9)
grpc (~> 1.59)
google-protobuf (>= 3.25, < 5.a)
googleapis-common-protos (~> 1.6)
googleapis-common-protos-types (~> 1.15)
googleauth (~> 1.11)
grpc (~> 1.65)
get_process_mem (0.2.7)
ffi (~> 1.0)
google-analytics-data (0.6.0)
google-analytics-data (0.6.1)
google-analytics-data-v1beta (>= 0.11, < 2.a)
google-cloud-core (~> 1.6)
google-analytics-data-v1beta (0.12.0)
google-analytics-data-v1beta (0.13.1)
gapic-common (>= 0.21.1, < 2.a)
google-cloud-errors (~> 1.0)
google-cloud-core (1.7.0)
google-cloud-core (1.7.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.1)
google-cloud-env (2.2.0)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.4.0)
google-protobuf (3.25.3-aarch64-linux)
google-protobuf (3.25.3-arm64-darwin)
google-protobuf (3.25.3-x86_64-darwin)
google-protobuf (3.25.3-x86_64-linux)
google-protobuf (3.25.5-aarch64-linux)
google-protobuf (3.25.5-arm64-darwin)
google-protobuf (3.25.5-x86_64-linux)
googleapis-common-protos (1.6.0)
google-protobuf (>= 3.18, < 5.a)
googleapis-common-protos-types (~> 1.7)
grpc (~> 1.41)
googleapis-common-protos-types (1.15.0)
googleapis-common-protos-types (1.16.0)
google-protobuf (>= 3.18, < 5.a)
googleauth (1.11.0)
faraday (>= 1.0, < 3.a)
@@ -195,37 +193,34 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
grpc (1.64.0-aarch64-linux)
google-protobuf (~> 3.25)
googleapis-common-protos-types (~> 1.0)
grpc (1.64.0-arm64-darwin)
google-protobuf (~> 3.25)
grpc (1.66.0-aarch64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.64.0-x86_64-darwin)
google-protobuf (~> 3.25)
grpc (1.66.0-arm64-darwin)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.64.0-x86_64-linux)
google-protobuf (~> 3.25)
grpc (1.66.0-x86_64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
haml (5.2.2)
temple (>= 0.8.0)
tilt
hashdiff (1.1.0)
hashdiff (1.1.1)
http-accept (1.7.0)
http-cookie (1.0.6)
http-cookie (1.0.7)
domain_name (~> 0.5)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
json (2.7.2)
json-schema (2.8.1)
addressable (>= 2.4)
json_pure (2.7.2)
jwt (2.8.2)
jwt (2.9.0)
base64
kgio (2.11.4)
language_server-protocol (3.17.0.3)
libxml-ruby (5.0.3)
logger (1.6.0)
logger (1.6.1)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.8.1)
@@ -236,15 +231,17 @@ GEM
method_source (1.1.0)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0702)
mime-types-data (3.2024.0903)
mini_mime (1.1.5)
minitest (4.7.5)
minitest-stub_any_instance (1.0.3)
mlanett-redis-lock (0.2.7)
redis
multi_json (1.15.0)
net-http (0.4.1)
uri
net-http-persistent (2.9.4)
net-imap (0.4.14)
net-imap (0.4.16)
date
net-protocol
net-pop (0.1.2)
@@ -259,23 +256,24 @@ GEM
net-protocol
net-ssh (7.2.3)
netrc (0.11.0)
newrelic_rpm (9.11.0)
newrelic_rpm (9.13.0)
oj (3.16.1)
omni_logger (0.1.4)
logger
os (1.1.4)
parallel (1.25.1)
ostruct (0.6.0)
parallel (1.26.3)
parseconfig (1.1.2)
parser (3.3.3.0)
parser (3.3.5.0)
ast (~> 2.4.1)
racc
pony (1.13.1)
mail (>= 2.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.1.1)
racc (1.8.0)
public_suffix (6.0.1)
racc (1.8.1)
rack (1.6.13)
rack-accept (0.4.5)
rack (>= 0.4)
@@ -298,14 +296,14 @@ GEM
rdf (1.0.8)
addressable (>= 2.2)
redcarpet (3.6.0)
redis (5.2.0)
redis (5.3.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
redis-rack-cache (2.2.1)
rack-cache (>= 1.10, < 2)
redis-store (>= 1.6, < 2)
redis-store (1.10.0)
redis-store (1.11.0)
redis (>= 4, < 6)
regexp_parser (2.9.2)
request_store (1.7.0)
@@ -315,27 +313,24 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.3.1)
strscan
rexml (3.3.7)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
rubocop (1.64.1)
rubocop (1.66.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
rubocop-ast (1.32.3)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
ruby-xxHash (0.4.0.2)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rufus-scheduler (2.0.24)
tzinfo (>= 0.3.22)
@@ -351,7 +346,7 @@ GEM
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
sinatra (1.4.8)
rack (~> 1.5)
@@ -366,37 +361,37 @@ GEM
rack-test
sinatra (~> 1.4.0)
tilt (>= 1.3, < 3)
sshkit (1.23.0)
sshkit (1.23.1)
base64
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
strscan (3.1.0)
ostruct
systemu (2.6.5)
temple (0.10.3)
tilt (2.4.0)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-worker-killer (0.4.5)
get_process_mem (~> 0)
unicorn (>= 4, < 7)
uri (0.13.1)
uuid (2.3.9)
macaddr (~> 1.0)
webmock (3.19.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)

PLATFORMS
aarch64-linux
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-23
x86_64-linux

DEPENDENCIES
@@ -437,6 +432,7 @@ DEPENDENCIES
redis
redis-rack-cache (~> 2.0)
redis-store (~> 1.10)
rexml
rubocop
shotgun!
simplecov
@@ -448,6 +444,7 @@ DEPENDENCIES
unicorn
unicorn-worker-killer
webmock (~> 3.19.1)
webrick

BUNDLED WITH
2.4.22
2.5.19
24 changes: 24 additions & 0 deletions controllers/slices_controller.rb
Original file line number Diff line number Diff line change
@@ -40,6 +40,30 @@ class SlicesController < ApplicationController
end
halt 204
end


# Check to make sure each group has a corresponding slice (and ontologies match)
get '/synchronize_groups' do
error 403, "Access denied" unless current_user && current_user.admin?

groups = LinkedData::Models::Group.where.include(LinkedData::Models::Group.attributes(:all)).all
groups.each do |g|
slice = LinkedData::Models::Slice.find(g.acronym.downcase.gsub(" ", "_")).include(LinkedData::Models::Slice.attributes(:all)).first
if slice
slice.ontologies = g.ontologies
slice.save if slice.valid?
else
slice = LinkedData::Models::Slice.new({
acronym: g.acronym.downcase.gsub(" ", "_"),
name: g.name,
description: g.description,
ontologies: g.ontologies
})
slice.save rescue reply "Error creating slice: " + slice.errors.to_s
end
end
reply LinkedData::Models::Slice.where.include(LinkedData::Models::Slice.attributes(:all)).all
end

private

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@ x-app: &app
build:
context: .
args:
RUBY_VERSION: '2.7'
RUBY_VERSION: '3.0'
# Increase the version number in the image tag every time Dockerfile or its arguments is changed
image: ontologies_api:0.0.4
image: ontologies_api:0.0.5
environment: &env
BUNDLE_PATH: /srv/ontoportal/bundle
# default bundle config resolves to /usr/local/bundle/config inside of the container

0 comments on commit cef6801

Please sign in to comment.