Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/GeneValidator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.4.10', '2.5', '2.6', '2.7']
ruby-version: ['3.2']

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.10
3.2.2
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 2.4.0
ruby 3.2.2
79 changes: 51 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
PATH
remote: .
specs:
genevalidator (2.1.11)
genevalidator (2.2.0)
bio (~> 1.4)
bio-blastxmlparser (~> 2.0)
genevalidatorapp (~> 2.1.8)
ncbi-blast-dbs (= 0.0.6)
matrix (~> 0.4.2)
net-ftp (~> 0.1.3)
prime (~> 0.1.2)
rack (~> 2.0)
rexml (~> 3.2, >= 3.2.6)
slim (~> 3.0)
statsample (= 2.1.0)
webrick (~> 1.8)

GEM
remote: http://rubygems.org/
specs:
awesome_print (1.9.2)
backports (3.21.0)
backports (3.24.1)
bigdecimal (3.1.6)
bio (1.5.2)
bio-blastxmlparser (2.0.4)
bio-logger
Expand All @@ -24,27 +29,33 @@ GEM
clbustos-rtf (0.4.2)
daru (0.1.6)
backports
date (3.3.4)
dirty-memoize (0.0.4)
distribution (0.8.0)
docile (1.3.1)
docile (1.4.0)
extendmatrix (0.4)
forwardable (1.3.3)
genevalidatorapp (2.1.8)
bio (~> 1.4)
sinatra (~> 2.0)
sinatra-cross_origin (~> 0.3)
slim (~> 3.0)
json (2.1.0)
log4r (1.1.10)
mini_portile2 (2.4.0)
matrix (0.4.2)
mini_portile2 (2.8.5)
minimization (0.2.5)
text-table (~> 1.2)
minitest (5.11.3)
mustermann (1.1.1)
minitest (5.21.2)
mustermann (2.0.2)
ruby2_keywords (~> 0.0.1)
ncbi-blast-dbs (0.0.6)
rake (~> 10.3, >= 10.3.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
net-ftp (0.1.4)
net-protocol
time
net-protocol (0.2.2)
timeout
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
prawn (0.8.4)
prawn-core (>= 0.8.4, < 0.9)
prawn-layout (>= 0.8.4, < 0.9)
Expand All @@ -54,34 +65,42 @@ GEM
prawn-security (0.8.4)
prawn-svg (0.9.1.11)
prawn (>= 0.8.4)
rack (2.2.3)
rack-protection (2.1.0)
prime (0.1.2)
forwardable
singleton
racc (1.7.3)
rack (2.2.8)
rack-protection (2.2.4)
rack
rake (10.5.0)
rake (13.1.0)
reportbuilder (1.4.2)
clbustos-rtf (~> 0.4.0)
prawn (~> 0.8.4)
prawn-svg (~> 0.9.1)
text-table (~> 1.2)
rexml (3.2.6)
rserve-client (0.3.5)
ruby-ole (1.2.12.2)
ruby2_keywords (0.0.4)
ruby2_keywords (0.0.5)
rubyvis (0.6.1)
simplecov (0.16.1)
simplecov (0.22.0)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sinatra (2.1.0)
mustermann (~> 1.0)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (2.2.4)
mustermann (~> 2.0)
rack (~> 2.2)
rack-protection (= 2.1.0)
rack-protection (= 2.2.4)
tilt (~> 2.0)
sinatra-cross_origin (0.4.0)
singleton (0.1.1)
slim (3.0.9)
temple (>= 0.7.6, < 0.9)
tilt (>= 1.3.3, < 2.1)
spreadsheet (1.2.9)
spreadsheet (1.3.1)
bigdecimal
ruby-ole
statsample (2.1.0)
awesome_print (~> 1.6)
Expand All @@ -96,18 +115,22 @@ GEM
spreadsheet (~> 1.1)
temple (0.8.2)
text-table (1.2.4)
tilt (2.0.10)
yard (0.9.16)
tilt (2.0.11)
time (0.3.0)
date
timeout (0.4.1)
webrick (1.8.1)
yard (0.9.34)

PLATFORMS
ruby

DEPENDENCIES
genevalidator!
minitest (~> 5.10)
rake (~> 10.3, >= 10.3.2)
rake (~> 13.0)
simplecov
yard (~> 0.9.11)

BUNDLED WITH
1.17.3
2.5.5
75 changes: 41 additions & 34 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,36 +59,42 @@ require 'bundler/setup'

TMP_DIR = "#{Rake.original_dir}/tmp".freeze
APP_NAME = "#{GEMSPEC.name}-#{GEMSPEC.version}".freeze
PLATFORMS = %w[linux-x86_64 osx].freeze
TRAVELING_RUBY_VERSION = 'traveling-ruby-20210206-2.4.10'.freeze
TRAVELING_RUBYGEMS_VERSION = 'traveling-ruby-gems-20210206-2.4.10'.freeze
NOKOGIRI_VERSION = 'nokogiri-1.10.10'.freeze
PLATFORMS = %w[linux-x86_64 osx-x86_64 osx-arm64].freeze
TR_RUBY_VERSION = '3.2'.freeze
TRAVELING_RUBY_BASE_URL = "https://github.com/YOU54F/traveling-ruby/releases/download/rel-20230803"
TRAVELING_RUBY_VERSION = "traveling-ruby-20230803-3.2.2".freeze
TRAVELING_RUBYGEMS_VERSION = "traveling-ruby-gems-20230803-3.2.2".freeze
NOKOGIRI_VERSION = 'nokogiri-1.15.3'.freeze
MAFFT = {
version: '7.475',
'linux-x86_64': 'https://mafft.cbrc.jp/alignment/software/mafft-7.475-linux.tgz',
osx: 'https://mafft.cbrc.jp/alignment/software/mafft-7.475-mac.zip'
version: '7.490',
'linux-x86_64': 'https://mafft.cbrc.jp/alignment/software/mafft-7.520-linux.tgz',
'osx-x86_64': 'https://mafft.cbrc.jp/alignment/software/mafft-7.490-mac.zip',
'osx-arm64': 'https://mafft.cbrc.jp/alignment/software/mafft-7.490-mac.zip'
}.freeze
BLAST = {
version: '2.11.0+',
'linux-x86_64': 'https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.11.0/ncbi-blast-2.11.0+-x64-linux.tar.gz',
osx: 'https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.11.0/ncbi-blast-2.11.0+-x64-macosx.tar.gz'
version: '2.15.0+',
'linux-x86_64': 'https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.15.0/ncbi-blast-2.15.0+-x64-linux.tar.gz',
'osx-x86_64': 'https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.15.0/ncbi-blast-2.15.0+-x64-macosx.tar.gz',
'osx-arm64': 'https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.15.0/ncbi-blast-2.15.0+-x64-macosx.tar.gz'
}.freeze
JQ = {
version: '1.6',
'linux-x86_64': 'https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64',
osx: 'https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64'
version: '1.7.1',
'linux-x86_64': 'https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-amd64',
'osx-x86_64': 'https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-amd64',
'osx-arm64': 'https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64'
}.freeze
CSVTK = {
version: '0.21.0',
'linux-x86_64': 'https://github.com/shenwei356/csvtk/releases/download/v0.21.0/csvtk_linux_amd64.tar.gz',
osx: 'https://github.com/shenwei356/csvtk/releases/download/v0.21.0/csvtk_darwin_amd64.tar.gz'
version: '0.29.0',
'linux-x86_64': 'https://github.com/shenwei356/csvtk/releases/download/v0.29.0/csvtk_linux_amd64.tar.gz',
'osx-x86_64': 'https://github.com/shenwei356/csvtk/releases/download/v0.29.0/csvtk_darwin_amd64.tar.gz',
'osx-arm64': 'https://github.com/shenwei356/csvtk/releases/download/v0.29.0/csvtk_darwin_arm64.tar.gz'
}.freeze

desc 'Create standalone GeneValidator packages'
task :package do
rm_rf TMP_DIR
mkdir TMP_DIR
task('package:build' => ['package:linux-x86_64', 'package:osx']).invoke
task('package:build' => ['package:linux-x86_64', 'package:osx-x86_64', 'package:osx-arm64']).invoke
rm_rf TMP_DIR
end

Expand All @@ -101,12 +107,12 @@ end
# ## TO RUN with DOCKER
# Start docker, mounting an empty folder called `output`:
#
# `docker run --rm -it -v $PWD/output:/gv ruby:2.4.10 /bin/bash`
# `docker run --rm -it -v $PWD/output:/gv ruby:3.2.2 /bin/bash`
#
# Then inside the shell:
#
# ```
# apt update && apt install unzip && gem install bundler -v 1.17.3
# apt update && apt install unzip && gem install bundler
# cd /gv
# git clone https://github.com/wurmlab/genevalidator
# cd genevalidator
Expand Down Expand Up @@ -202,8 +208,9 @@ namespace :package do

desc 'Install gems to local directory'
task :bundle_install do
if RUBY_VERSION !~ /^2\.4\./
abort "You can only 'bundle install' using Ruby 2.4, because that's " \
puts "Using Ruby #{TR_RUBY_VERSION}"
if RUBY_VERSION !~ /^3\.2\./
abort "You can only 'bundle install' using Ruby #{TR_RUBY_VERSION}, because that's " \
'what Traveling Ruby uses.'
end

Expand All @@ -213,12 +220,12 @@ namespace :package do
end

cd TMP_DIR do
Bundler.with_clean_env do
sh "env BUNDLE_IGNORE_CONFIG=1 BUNDLE_GEMFILE=#{TMP_DIR}/Gemfile" \
Bundler.with_unbundled_env do
sh "env BUNDLE_IGNORE_CONFIG=1 BUNDLE_GEMFILE=#{TMP_DIR}/Gemfile BUNDLE_FORCE_RUBY_PLATFORM=1" \
' bundle install --path vendor --without development test'
end

cd 'vendor/ruby/2.4.0' do
cd "vendor/ruby/#{TR_RUBY_VERSION}.0" do
cd 'gems' do
mkdir APP_NAME
%w[aux lib].each { |d| cp_r "#{Rake.original_dir}/#{d}", APP_NAME }
Expand Down Expand Up @@ -253,9 +260,9 @@ namespace :package do
cd "#{TMP_DIR}/vendor" do
sh 'rm -f */*/cache/*'
sh 'rm -rf ruby/*/extensions'
sh "find ruby/2.4.0/gems -name '*.so' | xargs rm -f"
sh "find ruby/2.4.0/gems -name '*.bundle' | xargs rm -f"
sh "find ruby/2.4.0/gems -name '*.o' | xargs rm -f"
sh "find ruby/#{TR_RUBY_VERSION}.0/gems -name '*.bundle' | xargs rm -f"
sh "find ruby/#{TR_RUBY_VERSION}.0/gems -name '*.so' | xargs rm -f"
sh "find ruby/#{TR_RUBY_VERSION}.0/gems -name '*.o' | xargs rm -f"

# Remove tests
%w[test tests spec features benchmark].each do |dir|
Expand Down Expand Up @@ -284,9 +291,9 @@ namespace :package do
sh "find ruby -name '*.h' | xargs rm -f"
sh "find ruby -name '*.rl' | xargs rm -f"
sh "find ruby -name 'extconf.rb' | xargs rm -f"
sh "find ruby/2.4.0/gems -name '*.o' | xargs rm -f"
sh "find ruby/2.4.0/gems -name '*.so' | xargs rm -f"
sh "find ruby/2.4.0/gems -name '*.bundle' | xargs rm -f"
sh "find ruby/#{TR_RUBY_VERSION}.0/gems -name '*.o' | xargs rm -f"
sh "find ruby/#{TR_RUBY_VERSION}.0/gems -name '*.so' | xargs rm -f"
sh "find ruby/#{TR_RUBY_VERSION}.0/gems -name '*.bundle' | xargs rm -f"

# Remove Java files. They're only used for JRuby support
sh "find ruby -name '*.java' | xargs rm -f"
Expand All @@ -306,12 +313,12 @@ end

def download_runtime(platform)
sh "curl -L --fail -o #{TMP_DIR}/#{TRAVELING_RUBY_VERSION}-#{platform}.tar.gz " \
"https://d6r77u77i8pq3.cloudfront.net/releases/#{TRAVELING_RUBY_VERSION}-#{platform}.tar.gz"
"#{TRAVELING_RUBY_BASE_URL}/#{TRAVELING_RUBY_VERSION}-#{platform}.tar.gz"
end

def download_native_extension(platform, gem_name_and_version)
sh "curl -L --fail -o #{TMP_DIR}/#{TRAVELING_RUBY_VERSION}-#{platform}-#{gem_name_and_version}.tar.gz " \
"https://d6r77u77i8pq3.cloudfront.net/releases/#{TRAVELING_RUBYGEMS_VERSION}-#{platform}/#{gem_name_and_version}.tar.gz"
"#{TRAVELING_RUBY_BASE_URL}/#{TRAVELING_RUBYGEMS_VERSION}-#{platform}-#{gem_name_and_version}.tar.gz"
end

def process_package(url, package_name)
Expand All @@ -335,7 +342,7 @@ def edited_gemspec_content
next if index < 4 # skip first four lines
l = "s.version = '#{GEMSPEC.version}'\n" if l =~ /^\s+s.version/
l = "s.files = ['#{file_list.join("','")}']\n" if l =~ /^\s+s.files/
l = "s.add_dependency 'nokogiri', '1.10.10'\nend" if l =~ /^end/
l = "s.add_dependency 'nokogiri', '#{NOKOGIRI_VERSION.split('-').last}'\nend" if l =~ /^end/
edited_gemspec << l
end
edited_gemspec.join
Expand All @@ -347,7 +354,7 @@ source 'http://rubygems.org'
gem 'bio', '~> 1.4'
gem 'bio-blastxmlparser', '~> 2.0'
gem '#{GEMSPEC.name}', '#{GEMSPEC.version}'
gem 'nokogiri', '1.10.10'
gem 'nokogiri', '#{NOKOGIRI_VERSION.split('-').last}'
gem 'statsample', '2.1.0'
GEMFILE

Expand Down
10 changes: 8 additions & 2 deletions bin/genevalidator
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,15 @@ elsif command == 'serve'
}
elsif command == 'ncbi-blast-dbs'
require 'rake'
load 'ncbi-blast-dbs.rake'

Rake.application.init 'ncbi-blast-dbs'
if ARGV.include? "http"
load "genevalidator/ncbi-blast-dbs/http-ncbi-blast-dbs.rake"
Rake.application.init 'http-ncbi-blast-dbs'
else
load "genevalidator/ncbi-blast-dbs/ncbi-blast-dbs.rake"
Rake.application.init 'ncbi-blast-dbs'
end

Rake.application.load_imports
Rake.application.top_level

Expand Down
8 changes: 6 additions & 2 deletions genevalidator.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.2.0'

s.add_development_dependency 'minitest', '~> 5.10'
s.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
s.add_development_dependency 'rake', '~> 13.0'
s.add_development_dependency 'yard', '~> 0.9.11'

s.add_dependency 'bio', '~> 1.4'
s.add_dependency 'bio-blastxmlparser', '~> 2.0'
s.add_dependency 'genevalidatorapp', '~> 2.1.8'
s.add_dependency 'ncbi-blast-dbs', '0.0.6'
s.add_dependency 'matrix', '~> 0.4.2' # required by statsample
s.add_dependency 'net-ftp', '~> 0.1.3' # required by ncbi-blast-dbs
s.add_dependency 'prime', '~> 0.1.2' # required by distribution (statsample)
s.add_dependency 'rack', '~> 2.0'
s.add_dependency 'slim', '~>3.0'
s.add_dependency 'statsample', '2.1.0'
s.add_dependency 'rexml', '~> 3.2', '>= 3.2.6' # required by prawn (statsample)
s.add_dependency 'webrick', '~> 1.8'

s.files = `git ls-files -z`.split("\x0")
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
Expand Down
6 changes: 6 additions & 0 deletions lib/genevalidator/ext/file.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Needed for Prawn (from Statsample)
class File
class << self
alias_method :exists?, :exist? unless respond_to?(:exists?)
end
end
Loading