theoj 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3393fdafdacce02e4613bb5b20b7ebc53f860a560f826ce4fcc695b808658d7
4
- data.tar.gz: 2d3472010e8ad6ecd0c66b9fd68e4c47a176cbc12bd06efa0b5c041a2b21fdbe
3
+ metadata.gz: 86f78e023b1c26cfcd13eea306fcb1ee89a862a300e43e173437655fddcc53b9
4
+ data.tar.gz: 43c48ae2941a5f72076f048a58315f861aedddd1708a5886b437b1858739553d
5
5
  SHA512:
6
- metadata.gz: f52232e14aa6bfd81afd4bc5a79e3ae02e1f439277597acbfee6b31048b58c8b0003816147ea296446cccebcecfd6c7d28009675d9981a50fa0675b4e1da4ec8
7
- data.tar.gz: 6b8d060629fa1652ecd47bda9fc9869b21f4ffa3af8676569a8c7d7e481c572fcf369adcda6213eadc7d9a4594378d9d729af45f38715b96418a6cd9106eb5d5
6
+ metadata.gz: 1cba25b3701a0f52f40317e74df287db75a4f79944183a13bd1ea23567e51b010cdaa2f6d707aaedaa6e5c2ac30119c1dd7eab3f83e0d107a4d048d247e9ee80
7
+ data.tar.gz: 592c523fb973d4f7c57044b451d17038b5a891aa0d534f4081180c4409f5da81ccebd31686c4f98151fbdeea465f61ea2e58df08aa4b1c2770d3af13a71d72d1
data/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
1
  # Changelog
2
2
 
3
- ## 0.0.1 (2021-09-22)
3
+ ## 0.0.3 (2021-10-08)
4
+
5
+ - Added metadata methods to Paper
6
+ - Added to ReviewIssue: editor, reviewers, archive, version
7
+ - New method to read any value from review's issue body
8
+ - Values read from issue boy will be empty if Pending or TBD
9
+ - Added journal config data for OpenJournals: JOSS and JOSE
4
10
 
5
- - Gem created
6
11
 
7
12
  ## 0.0.2 (2021-09-22)
8
13
 
9
14
  - Available objects: Theoj::Journal, Theoj::ReviewIssue and Theoj::Paper
15
+
16
+
17
+ ## 0.0.1 (2021-09-22)
18
+
19
+ - Gem created
20
+
data/lib/theoj/journal.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require_relative "journals_data"
2
+
1
3
  module Theoj
2
4
  class Journal
3
5
  attr_accessor :data
@@ -35,13 +37,7 @@ module Theoj
35
37
  end
36
38
 
37
39
  def default_data
38
- {
39
- doi_prefix: "10.21105",
40
- url: "http://joss.theoj.org",
41
- name: "Journal of Open Source Software",
42
- alias: "joss",
43
- launch_date: "2016-05-05",
44
- }
40
+ Theoj::JOURNALS_DATA[:joss]
45
41
  end
46
42
 
47
43
  def parsed_launch_date
@@ -0,0 +1,23 @@
1
+ module Theoj
2
+ JOURNALS_DATA = {
3
+ joss: {
4
+ doi_prefix: "10.21105",
5
+ url: "https://joss.theoj.org",
6
+ name: "Journal of Open Source Software",
7
+ alias: "joss",
8
+ launch_date: "2016-05-05",
9
+ paper_repository: "openjournals/joss-papers",
10
+ reviews_repository: "openjournals/joss-reviews"
11
+ },
12
+ jose: {
13
+ doi_prefix: "10.21105",
14
+ url: "https://jose.theoj.org",
15
+ name: "Journal of Open Source Education",
16
+ alias: "jose",
17
+ launch_date: "2018-03-07",
18
+ paper_repository: "openjournals/jose-papers",
19
+ reviews_repository: "openjournals/jose-reviews"
20
+ }
21
+ }
22
+ end
23
+
data/lib/theoj/paper.rb CHANGED
@@ -37,18 +37,34 @@ module Theoj
37
37
  paper_path
38
38
  end
39
39
 
40
- def self.from_repo(repository_url, branch = "")
41
- Paper.new(repository_url, branch, nil)
40
+ def title
41
+ @paper_metadata["title"]
42
42
  end
43
43
 
44
- def cleanup
45
- FileUtils.rm_rf(local_path) if Dir.exist?(local_path)
44
+ def tags
45
+ @paper_metadata["tags"]
46
+ end
47
+
48
+ def date
49
+ @paper_metadata["date"]
50
+ end
51
+
52
+ def bibliography_path
53
+ @paper_metadata["bibliography"]
46
54
  end
47
55
 
48
56
  def local_path
49
57
  @local_path ||= "tmp/#{SecureRandom.hex}"
50
58
  end
51
59
 
60
+ def cleanup
61
+ FileUtils.rm_rf(local_path) if Dir.exist?(local_path)
62
+ end
63
+
64
+ def self.from_repo(repository_url, branch = "")
65
+ Paper.new(repository_url, branch, nil)
66
+ end
67
+
52
68
  private
53
69
 
54
70
  def find_paper(path)
@@ -16,7 +16,7 @@ module Theoj
16
16
  end
17
17
 
18
18
  def issue_body
19
- issue(repository, issue_id).body
19
+ @issue_body ||= issue(repository, issue_id).body
20
20
  end
21
21
 
22
22
  def paper
@@ -27,10 +27,30 @@ module Theoj
27
27
  @target_repository ||= read_value_from_body("target-repository")
28
28
  end
29
29
 
30
+ def reviewers
31
+ @reviewers ||= read_value_from_body("reviewers").split(",").map{|r| r.strip} - ["Pending", "TBD"]
32
+ end
33
+
34
+ def editor
35
+ @editor ||= read_value_from_body("editor")
36
+ end
37
+
38
+ def archive
39
+ @archive ||= read_value_from_body("archive")
40
+ end
41
+
42
+ def version
43
+ @version ||= read_value_from_body("version")
44
+ end
45
+
30
46
  def paper_branch
31
47
  @paper_branch ||= read_value_from_body("branch")
32
48
  end
33
49
 
50
+ def value_for(value_name)
51
+ read_value_from_body(value_name)
52
+ end
53
+
34
54
  private
35
55
 
36
56
  def read_from_body(start_mark, end_mark)
@@ -38,6 +58,8 @@ module Theoj
38
58
  issue_body.match(/#{start_mark}(.*)#{end_mark}/im) do |m|
39
59
  text = m[1]
40
60
  end
61
+
62
+ text = "" if ["Pending", "TBD"].include?(text.strip)
41
63
  text.strip
42
64
  end
43
65
 
data/lib/theoj/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Theoj
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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: 0.0.2
4
+ version: 0.0.3
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: 2021-09-23 00:00:00.000000000 Z
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -67,6 +67,7 @@ files:
67
67
  - lib/theoj/git.rb
68
68
  - lib/theoj/github.rb
69
69
  - lib/theoj/journal.rb
70
+ - lib/theoj/journals_data.rb
70
71
  - lib/theoj/paper.rb
71
72
  - lib/theoj/review_issue.rb
72
73
  - lib/theoj/version.rb
@@ -75,7 +76,7 @@ licenses:
75
76
  - MIT
76
77
  metadata:
77
78
  bug_tracker_uri: https://github.com/xuanxu/theoj/issues
78
- changelog_uri: https://github.com/xuanxu/theoj/blob/master/CHANGELOG.md
79
+ changelog_uri: https://github.com/xuanxu/theoj/blob/main/CHANGELOG.md
79
80
  documentation_uri: https://www.rubydoc.info/gems/theoj
80
81
  homepage_uri: http://github.com/xuanxu/theoj
81
82
  source_code_uri: http://github.com/xuanxu/theoj