From 1c73d7e92352b8898bfacf93f0217c2a3cda4a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Tue, 10 Oct 2023 10:14:26 +0200 Subject: [PATCH] Change joss_id to journal_id --- app/models/paper.rb | 12 ++++++------ lib/tasks/portico.rake | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/models/paper.rb b/app/models/paper.rb index f26b6ed13..53402b310 100644 --- a/app/models/paper.rb +++ b/app/models/paper.rb @@ -303,10 +303,10 @@ def archive_doi_url end end - # A 5-figure integer used to produce the JOSS DOI - def joss_id + # A 5-figure integer used to produce the Journal DOI + def journal_id if self.is_a_retraction_notice? - return retracted_paper.joss_id + "R" + return retracted_paper.journal_id + "R" else id = "%05d" % review_issue_id return "#{setting(:abbreviation).downcase}.#{id}" @@ -320,7 +320,7 @@ def joss_id # version if no DOI is set. def seo_url if accepted? - "#{Rails.application.settings["url"]}/papers/10.21105/#{joss_id}" + "#{Rails.application.settings["url"]}/papers/10.21105/#{journal_id}" else "#{Rails.application.settings["url"]}/papers/#{to_param}" end @@ -337,7 +337,7 @@ def seo_pdf_url def pdf_url doi_to_file = doi.gsub('/', '.') - "#{Rails.application.settings["papers_html_url"]}/#{joss_id}/#{doi_to_file}.pdf" + "#{Rails.application.settings["papers_html_url"]}/#{journal_id}/#{doi_to_file}.pdf" end # 'reviewers' should be a string (and may be comma-separated) @@ -501,7 +501,7 @@ def status_badge end def status_badge_url - "#{Rails.application.settings["url"]}/papers/10.21105/#{joss_id}/status.svg" + "#{Rails.application.settings["url"]}/papers/10.21105/#{journal_id}/status.svg" end def markdown_code diff --git a/lib/tasks/portico.rake b/lib/tasks/portico.rake index 6bc13a7f2..de027997e 100644 --- a/lib/tasks/portico.rake +++ b/lib/tasks/portico.rake @@ -5,20 +5,20 @@ namespace :portico do task deposit: :environment do Paper.visible.not_archived.each do |paper| Net::SFTP.start(ENV['PORTICO_HOST'], ENV['PORTICO_USERNAME'], password: ENV['PORTICO_PASSWORD']) do |sftp| - if sftp.dir.glob("/", "10.21105.#{paper.joss_id}.zip").any? - puts "Deposit already exists for 10.21105.#{paper.joss_id}" + if sftp.dir.glob("/", "10.21105.#{paper.journal_id}.zip").any? + puts "Deposit already exists for 10.21105.#{paper.journal_id}" else - crossref_file = "https://github.com/#{Rails.application.settings["papers_repo"]}/raw/master/#{paper.joss_id}/10.21105.#{paper.joss_id}.crossref.xml" - pdf_file = "https://github.com/#{Rails.application.settings["papers_repo"]}/raw/master/#{paper.joss_id}/10.21105.#{paper.joss_id}.pdf" + crossref_file = "https://github.com/#{Rails.application.settings["papers_repo"]}/raw/master/#{paper.journal_id}/10.21105.#{paper.journal_id}.crossref.xml" + pdf_file = "https://github.com/#{Rails.application.settings["papers_repo"]}/raw/master/#{paper.journal_id}/10.21105.#{paper.journal_id}.pdf" files_to_download = [crossref_file, pdf_file] # Create folder - `mkdir tmp/10.21105.#{paper.joss_id}` + `mkdir tmp/10.21105.#{paper.journal_id}` # Download the files into this folder files_to_download.each do |file| - `cd tmp/10.21105.#{paper.joss_id} && { curl -L -O #{file} ; cd -; }` + `cd tmp/10.21105.#{paper.journal_id} && { curl -L -O #{file} ; cd -; }` end # Archive the review too... @@ -26,17 +26,17 @@ namespace :portico do archive_review_object['review_issue'] = GITHUB.issue(Rails.application.settings["reviews"], paper.review_issue_id).to_h archive_review_object['review_issue_comments'] = GITHUB.issue_comments(Rails.application.settings["reviews"], paper.review_issue_id).map(&:to_h) - File.open("tmp/10.21105.#{paper.joss_id}/review.json", "w") { |f| + File.open("tmp/10.21105.#{paper.journal_id}/review.json", "w") { |f| f.write(JSON.pretty_generate(archive_review_object)) } # Zip the folder - `zip tmp/10.21105.#{paper.joss_id}.zip tmp/10.21105.#{paper.joss_id}/*` - sftp.upload("tmp/10.21105.#{paper.joss_id}.zip", "10.21105.#{paper.joss_id}.zip") - puts "Uploading deposit for 10.21105.#{paper.joss_id}" + `zip tmp/10.21105.#{paper.journal_id}.zip tmp/10.21105.#{paper.journal_id}/*` + sftp.upload("tmp/10.21105.#{paper.journal_id}.zip", "10.21105.#{paper.journal_id}.zip") + puts "Uploading deposit for 10.21105.#{paper.journal_id}" # Clean up - `rm -rf tmp/10.21105.#{paper.joss_id}*` + `rm -rf tmp/10.21105.#{paper.journal_id}*` # Update the paper paper.update_attribute(:archived, true)