Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexskr committed Aug 9, 2023
2 parents c4baa22 + dde48c2 commit 5f2fdc9
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 148 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ruby-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
jobs:
test:
strategy:
fail-fast: false
matrix:
backend: ['api', 'api-agraph'] # api runs tests with 4store backend and api-agraph runs with AllegroGraph backend
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
source 'https://rubygems.org'

gem 'activesupport', '~> 3.1'
gem 'activesupport', '~> 3.0'
# see https://github.com/ncbo/ontologies_api/issues/69
gem 'bigdecimal', '1.4.2'
gem 'faraday', '~> 2.0'
gem 'json-schema', '~> 2.0'
gem 'multi_json', '~> 1.0'
gem 'oj', '~> 3.0'
Expand Down
37 changes: 17 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ncbo/goo.git
revision: e8816b06244c26088ef0596ddc0623562a75a284
revision: 59fa167d6e8d2cb55bd0d574d029057f46cbc594
branch: master
specs:
goo (0.0.2)
Expand Down Expand Up @@ -53,7 +53,7 @@ GIT

GIT
remote: https://github.com/ncbo/ontologies_linked_data.git
revision: d858e2e29e5da84c9741b7508efa235919642e46
revision: 0cdb8f84a4d8b19fdcebcaabb2e4968a63809863
branch: master
specs:
ontologies_linked_data (0.0.1)
Expand Down Expand Up @@ -103,9 +103,9 @@ GEM
activesupport (3.2.22.5)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
airbrussh (1.4.1)
airbrussh (1.4.2)
sshkit (>= 1.6.1, != 1.7.0)
backports (3.24.1)
bcrypt (3.1.19)
Expand Down Expand Up @@ -162,16 +162,15 @@ GEM
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-protobuf (3.23.4-aarch64-linux)
google-protobuf (3.23.4-arm64-darwin)
google-protobuf (3.23.4-x86_64-darwin)
google-protobuf (3.23.4-x86_64-linux)
google-protobuf (3.24.0-aarch64-linux)
google-protobuf (3.24.0-x86_64-darwin)
google-protobuf (3.24.0-x86_64-linux)
googleapis-common-protos (1.4.0)
google-protobuf (~> 3.14)
googleapis-common-protos-types (~> 1.2)
grpc (~> 1.27)
googleapis-common-protos-types (1.7.0)
google-protobuf (~> 3.14)
googleapis-common-protos-types (1.8.0)
google-protobuf (~> 3.18)
googleauth (1.7.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
Expand Down Expand Up @@ -213,10 +212,10 @@ GEM
net-smtp
memoist (0.16.2)
method_source (1.0.0)
mime-types (3.4.1)
mime-types (3.5.0)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0218.1)
mini_mime (1.1.2)
mime-types-data (3.2023.0808)
mini_mime (1.1.5)
minitest (4.7.5)
minitest-stub_any_instance (1.0.3)
mlanett-redis-lock (0.2.7)
Expand All @@ -234,10 +233,10 @@ GEM
net-ssh (>= 2.6.5, < 8.0.0)
net-smtp (0.3.3)
net-protocol
net-ssh (7.1.0)
net-ssh (7.2.0)
netrc (0.11.0)
newrelic_rpm (9.3.1)
oj (3.15.0)
oj (3.15.1)
omni_logger (0.1.4)
logger
os (1.1.4)
Expand All @@ -257,7 +256,7 @@ GEM
rack (>= 0.4)
rack-cors (1.0.6)
rack (>= 1.6.0)
rack-mini-profiler (3.1.0)
rack-mini-profiler (3.1.1)
rack (>= 1.2.0)
rack-protection (1.5.5)
rack
Expand All @@ -283,7 +282,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rexml (3.2.6)
rsolr (2.5.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
Expand Down Expand Up @@ -342,13 +341,12 @@ GEM

PLATFORMS
aarch64-linux
arm64-darwin-22
x86_64-darwin-18
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
activesupport (~> 3.1)
activesupport (~> 3.0)
bcrypt_pbkdf (>= 1.0, < 2.0)
bigdecimal (= 1.4.2)
capistrano (~> 3)
Expand All @@ -357,7 +355,6 @@ DEPENDENCIES
capistrano-rbenv
cube-ruby
ed25519 (>= 1.2, < 2.0)
faraday (~> 2.0)
ffi
goo!
haml (~> 5.2.2)
Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
GOO_PATH_DATA = ENV.include?("GOO_PATH_DATA") ? ENV["GOO_PATH_DATA"] : "/data/"
GOO_PATH_QUERY = ENV.include?("GOO_PATH_QUERY") ? ENV["GOO_PATH_QUERY"] : "/sparql/"
GOO_PATH_UPDATE = ENV.include?("GOO_PATH_UPDATE") ? ENV["GOO_PATH_UPDATE"] : "/update/"
GOO_PORT = ENV.include?("GOO_PORT") ? ENV["GOO_PORT"] : 9000
GOO_PORT = ENV.include?("GOO_PORT") ? ENV["GOO_PORT"] : 8080
MGREP_DICTIONARY_FILE = ENV.include?("MGREP_DICTIONARY_FILE") ? ENV["MGREP_DICTIONARY_FILE"] : "./test/data/dictionary.txt"
MGREP_HOST = ENV.include?("MGREP_HOST") ? ENV["MGREP_HOST"] : "localhost"
MGREP_PORT = ENV.include?("MGREP_PORT") ? ENV["MGREP_PORT"] : 55555
Expand Down
8 changes: 6 additions & 2 deletions controllers/ontology_analytics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class OntologyAnalyticsController < ApplicationController
expires 86400, :public
ont = Ontology.find(params["acronym"]).first
error 404, "No ontology exists with the acronym: #{params["acronym"]}" if ont.nil?
analytics = ont.analytics
year = year_param(params)
error 400, "The year you supplied is invalid. Valid years start with 2 and contain 4 digits." if params["year"] && !year
month = month_param(params)
error 400, "The month you supplied is invalid. Valid months are 1-12." if params["month"] && !month
analytics = ont.analytics(year, month)

if params["format"].to_s.downcase.eql?("csv")
tf = Tempfile.new("analytics-#{params['acronym']}")
Expand All @@ -39,7 +43,7 @@ class OntologyAnalyticsController < ApplicationController
years.each do |year|
months = analytics[params["acronym"]][year].keys.sort
months.each do |month|
next if now.year == year && now.month <= month || (year == 2013 && month < 10) # we don't have good data going back past Oct 2013
next if year && month && (now.year == year.to_i && now.month <= month.to_i || year.to_i == 2013 && month.to_i < 10) # we don't have good data going back past Oct 2013
visits = analytics[params["acronym"]][year][month]
month = DateTime.parse("#{year}/#{month}").strftime("%b %Y")
csv << [month, visits]
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ services:
retries: 5

agraph-ut:
image: franzinc/agraph:v7.3.1
#image: franzinc/agraph:v7.3.1
image: ontoportal/agraph:v7.3.1-patch1
platform: linux/amd64
environment:
- AGRAPH_SUPER_USER=test
Expand Down
6 changes: 4 additions & 2 deletions helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ def month_param(params=nil)
if params["month"]
month = params["month"].strip
if %r{(?<month>^(0[1-9]|[1-9]|1[0-2])$)}x === month
month.to_i
return month.to_i.to_s
end
end
nil
end

# validates year for starting with 1 or 2 and containing 4 digits
Expand All @@ -272,9 +273,10 @@ def year_param(params=nil)
if params["year"]
year = params["year"].strip
if %r{(?<year>^([1-2]\d{3})$)}x === year
year.to_i
return year.to_i.to_s
end
end
nil
end

##
Expand Down
Loading

0 comments on commit 5f2fdc9

Please sign in to comment.