theoj 1.3.4 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/theoj/author.rb +13 -1
- data/lib/theoj/journal.rb +9 -0
- data/lib/theoj/journals_data.rb +12 -0
- data/lib/theoj/paper.rb +1 -0
- data/lib/theoj/submission.rb +95 -54
- data/lib/theoj/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e40a25606ae1f2aaadf5e1459e1d9711b4c2650faa57cea6132a35d5c20cb8a
|
4
|
+
data.tar.gz: f84ded3ac7b898a5fe25cd469d6c559ad6aa57a38c293fc948cfa01604c0de89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140741757c989ae514fad023fffd967b5f7ad90a7c94b800aa9c8aa7aeb9af9eccfdf4ce111fa35f2f916e83a1baff945e87a49c74f226fd76eb5739535a58ed
|
7
|
+
data.tar.gz: e8ab0f0e2dbd6da6a81ef08b824cb7accaaa8dd9e9b378dbd72671528a774deb5f72c48465412c2d74ad1367ed680f21da852280f56dd991996692ae6b66b738
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.4.0 (2022-08-01)
|
4
|
+
|
5
|
+
- Added method to Journal to get year/volume/issue information for any date
|
6
|
+
- Submission metadata now takes into account published paper status
|
7
|
+
|
8
|
+
## 1.3.6 (2022-07-11)
|
9
|
+
|
10
|
+
- Improve parsing os author names
|
11
|
+
|
12
|
+
## 1.3.5 (2022-07-01)
|
13
|
+
|
14
|
+
- Added configuration for JuliaCon
|
15
|
+
|
3
16
|
## 1.3.4 (2022-05-29)
|
4
17
|
|
5
18
|
- Use Faraday v2 (updated Octokit and other dependencies)
|
data/lib/theoj/author.rb
CHANGED
@@ -45,7 +45,19 @@ module Theoj
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def parse_name(author_name)
|
48
|
-
|
48
|
+
if author_name.is_a? Hash
|
49
|
+
g = author_name["given-names"] || author_name["given"] || author_name["first"] || author_name["firstname"]
|
50
|
+
m = author_name["dropping-particle"]
|
51
|
+
s = author_name["surname"] || author_name["family"]
|
52
|
+
|
53
|
+
g = strip_footnotes(g) unless g.nil?
|
54
|
+
s = strip_footnotes(s) unless s.nil?
|
55
|
+
|
56
|
+
@parsed_name = m.nil? ? Nameable::Latin.new(g, s) : Nameable::Latin.new(g, m, s)
|
57
|
+
else
|
58
|
+
@parsed_name = Nameable::Latin.new.parse(strip_footnotes(author_name))
|
59
|
+
end
|
60
|
+
|
49
61
|
@name = @parsed_name.to_nameable
|
50
62
|
end
|
51
63
|
|
data/lib/theoj/journal.rb
CHANGED
@@ -42,6 +42,15 @@ module Theoj
|
|
42
42
|
reviews_url
|
43
43
|
end
|
44
44
|
|
45
|
+
def year_volume_issue_for_date(d)
|
46
|
+
d = Date.parse(d) if d.is_a? String
|
47
|
+
year = d.year
|
48
|
+
volume = year - (launch_year - 1)
|
49
|
+
issue = (1 + ((year * 12 + d.month) - (launch_year * 12 + launch_month)))
|
50
|
+
|
51
|
+
[year, volume, issue]
|
52
|
+
end
|
53
|
+
|
45
54
|
private
|
46
55
|
|
47
56
|
def set_data(custom_data)
|
data/lib/theoj/journals_data.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "date"
|
2
|
+
|
1
3
|
module Theoj
|
2
4
|
JOURNALS_DATA = {
|
3
5
|
joss: {
|
@@ -20,6 +22,16 @@ module Theoj
|
|
20
22
|
reviews_repository: "openjournals/jose-reviews",
|
21
23
|
deposit_url: "https://joss.theoj.org/papers/api_deposit"
|
22
24
|
},
|
25
|
+
jcon: {
|
26
|
+
doi_prefix: "10.21105",
|
27
|
+
url: "https://proceedings.juliacon.org/",
|
28
|
+
name: "The Proceedings of the JuliaCon Conferences",
|
29
|
+
alias: "jcon",
|
30
|
+
launch_date: "2019-07-21",
|
31
|
+
papers_repository: "JuliaCon/juliacon-proceedings-papers",
|
32
|
+
reviews_repository: "JuliaCon/juliacon-proceedings-reviews",
|
33
|
+
deposit_url: "https://proceedings.juliacon.org/papers/api_deposit"
|
34
|
+
},
|
23
35
|
test_journal: {
|
24
36
|
doi_prefix: "10.21105",
|
25
37
|
url: "https://test.joss.theoj.org/",
|
data/lib/theoj/paper.rb
CHANGED
@@ -121,6 +121,7 @@ module Theoj
|
|
121
121
|
|
122
122
|
# Loop through the authors block and build up the affiliation
|
123
123
|
authors_metadata.each do |author|
|
124
|
+
author['name'] = author.dup if author['name'].nil?
|
124
125
|
affiliation_index = author['affiliation']
|
125
126
|
failure "Author (#{author['name']}) is missing affiliation" if affiliation_index.nil?
|
126
127
|
begin
|
data/lib/theoj/submission.rb
CHANGED
@@ -20,58 +20,105 @@ module Theoj
|
|
20
20
|
# Create the payload to use to post for depositing with Open Journals
|
21
21
|
def deposit_payload
|
22
22
|
{
|
23
|
-
id:
|
23
|
+
id: metadata_info[:review_issue_id],
|
24
24
|
metadata: Base64.encode64(metadata_payload),
|
25
|
-
doi:
|
26
|
-
archive_doi:
|
25
|
+
doi: metadata_info[:doi],
|
26
|
+
archive_doi: metadata_info[:archive_doi],
|
27
27
|
citation_string: citation_string,
|
28
|
-
title:
|
28
|
+
title: metadata_info[:title]
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
32
|
# Create a metadata json payload
|
33
33
|
def metadata_payload
|
34
|
-
|
34
|
+
{
|
35
35
|
paper: {
|
36
|
-
title:
|
37
|
-
tags:
|
38
|
-
languages:
|
39
|
-
authors:
|
40
|
-
doi:
|
41
|
-
archive_doi:
|
42
|
-
repository_address:
|
43
|
-
editor:
|
44
|
-
reviewers:
|
45
|
-
volume:
|
46
|
-
issue:
|
47
|
-
year:
|
48
|
-
page:
|
36
|
+
title: metadata_info[:title],
|
37
|
+
tags: metadata_info[:tags],
|
38
|
+
languages: metadata_info[:languages],
|
39
|
+
authors: metadata_info[:authors],
|
40
|
+
doi: metadata_info[:doi],
|
41
|
+
archive_doi: metadata_info[:archive_doi],
|
42
|
+
repository_address: metadata_info[:software_repository_url],
|
43
|
+
editor: metadata_info[:review_editor],
|
44
|
+
reviewers: metadata_info[:reviewers].collect(&:strip),
|
45
|
+
volume: metadata_info[:volume],
|
46
|
+
issue: metadata_info[:issue],
|
47
|
+
year: metadata_info[:year],
|
48
|
+
page: metadata_info[:page]
|
49
49
|
}
|
50
|
-
}
|
51
|
-
|
52
|
-
metadata.to_json
|
50
|
+
}.to_json
|
53
51
|
end
|
54
52
|
|
55
53
|
# Create metadata used to generate PDF/JATS outputs
|
56
54
|
def article_metadata
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
55
|
+
{
|
56
|
+
title: metadata_info[:title],
|
57
|
+
tags: metadata_info[:tags],
|
58
|
+
authors: metadata_info[:authors],
|
59
|
+
doi: metadata_info[:doi],
|
60
|
+
software_repository_url: metadata_info[:software_repository_url],
|
61
|
+
reviewers: metadata_info[:reviewers].collect{|r| user_login(r)},
|
62
|
+
volume: metadata_info[:volume],
|
63
|
+
issue: metadata_info[:issue],
|
64
|
+
year: metadata_info[:year],
|
65
|
+
page: metadata_info[:page],
|
66
|
+
journal_alias: metadata_info[:journal_alias],
|
67
|
+
software_review_url: metadata_info[:software_review_url],
|
68
|
+
archive_doi: metadata_info[:archive_doi],
|
69
|
+
citation_string: metadata_info[:citation_string],
|
70
|
+
editor: metadata_info[:editor],
|
71
|
+
submitted_at: metadata_info[:submitted_at],
|
72
|
+
published_at: metadata_info[:published_at]
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
def metadata_info
|
77
|
+
@metadata_info ||= all_metadata
|
78
|
+
end
|
79
|
+
|
80
|
+
def deposit!(secret)
|
81
|
+
parameters = deposit_payload.merge(secret: secret)
|
82
|
+
Faraday.post(journal.data[:deposit_url], parameters.to_json, {"Content-Type" => "application/json"})
|
83
|
+
end
|
84
|
+
|
85
|
+
def citation_string
|
86
|
+
metadata_info[:citation_string]
|
87
|
+
end
|
88
|
+
|
89
|
+
def paper_id
|
90
|
+
journal.paper_id_from_issue(review_issue.issue_id)
|
91
|
+
end
|
92
|
+
|
93
|
+
def paper_doi
|
94
|
+
journal.paper_doi_for_id(paper_id)
|
95
|
+
end
|
73
96
|
|
74
|
-
|
97
|
+
def all_metadata
|
98
|
+
metadata = {
|
99
|
+
title: paper.title,
|
100
|
+
tags: paper.tags,
|
101
|
+
languages: paper.languages,
|
102
|
+
authors: paper.authors.collect { |a| a.to_h },
|
103
|
+
doi: paper_doi,
|
104
|
+
software_repository_url: review_issue.target_repository,
|
105
|
+
review_issue_id: review_issue.issue_id,
|
106
|
+
review_editor: review_issue.editor,
|
107
|
+
reviewers: review_issue.reviewers,
|
108
|
+
volume: journal.current_volume,
|
109
|
+
issue: journal.current_issue,
|
110
|
+
year: journal.current_year,
|
111
|
+
page: review_issue.issue_id,
|
112
|
+
journal_alias: journal.alias,
|
113
|
+
journal_name: journal.name,
|
114
|
+
software_review_url: journal.reviews_repository_url(review_issue.issue_id),
|
115
|
+
archive_doi: review_issue.archive,
|
116
|
+
citation_author: paper.citation_author
|
117
|
+
}
|
118
|
+
|
119
|
+
metadata.merge!(editor_info, dates_info)
|
120
|
+
metadata[:citation_string] = build_citation_string(metadata)
|
121
|
+
metadata
|
75
122
|
end
|
76
123
|
|
77
124
|
def editor_info
|
@@ -106,30 +153,24 @@ module Theoj
|
|
106
153
|
dates_info[:submitted_at] = format_date(info[:submitted]) if info[:submitted]
|
107
154
|
dates_info[:published_at] = format_date(info[:accepted]) if info[:accepted]
|
108
155
|
end
|
156
|
+
|
157
|
+
if dates_info[:published_at]
|
158
|
+
yvi = journal.year_volume_issue_for_date(Date.parse(dates_info[:published_at]))
|
159
|
+
dates_info[:year] = yvi[0]
|
160
|
+
dates_info[:volume] = yvi[1]
|
161
|
+
dates_info[:issue] = yvi[2]
|
162
|
+
end
|
109
163
|
end
|
110
164
|
|
111
165
|
dates_info
|
112
166
|
end
|
113
167
|
|
114
|
-
|
115
|
-
parameters = deposit_payload.merge(secret: secret)
|
116
|
-
Faraday.post(journal.data[:deposit_url], parameters.to_json, {"Content-Type" => "application/json"})
|
117
|
-
end
|
118
|
-
|
119
|
-
def citation_string
|
120
|
-
paper_year = Time.now.strftime('%Y')
|
121
|
-
"#{paper.citation_author}, (#{paper_year}). #{paper.title}. #{journal.name}, #{journal.current_volume}(#{journal.current_issue}), #{review_issue.issue_id}, https://doi.org/#{paper_doi}"
|
122
|
-
end
|
123
|
-
|
124
|
-
def paper_id
|
125
|
-
journal.paper_id_from_issue(review_issue.issue_id)
|
126
|
-
end
|
168
|
+
private
|
127
169
|
|
128
|
-
def
|
129
|
-
|
170
|
+
def build_citation_string(metadata)
|
171
|
+
"#{metadata[:citation_author]}, (#{metadata[:year]}). #{metadata[:title]}. #{metadata[:journal_name]}, #{metadata[:volume]}(#{metadata[:issue]}), #{metadata[:review_issue_id]}, https://doi.org/#{metadata[:doi]}"
|
130
172
|
end
|
131
173
|
|
132
|
-
private
|
133
174
|
def format_date(date_string)
|
134
175
|
Date.parse(date_string.to_s).strftime("%Y-%m-%d")
|
135
176
|
rescue Date::Error
|
data/lib/theoj/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: theoj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juanjo Bazán
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.4.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: openjournals-nameable
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.5.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.5.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|