roboneuro 0.1.1
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 +7 -0
- data/.DS_Store +0 -0
- data/.env-example +12 -0
- data/.env.test +8 -0
- data/.github/workflows/docker-image.yml +63 -0
- data/.github/workflows/tests.yml +28 -0
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +135 -0
- data/LICENSE +21 -0
- data/README.md +190 -0
- data/Rakefile +13 -0
- data/bin/whedon +131 -0
- data/fixtures/latex_paper/paper.tex +0 -0
- data/fixtures/paper/10.21105.jcon.00017.crossref.xml +88 -0
- data/fixtures/paper/crossref-metadata.yaml +34 -0
- data/fixtures/paper/paper-bib.md +27 -0
- data/fixtures/paper/paper-single-author.md +24 -0
- data/fixtures/paper/paper-with-harder-names.md +27 -0
- data/fixtures/paper/paper-with-missing-affiliations.md +21 -0
- data/fixtures/paper/paper.bib +65 -0
- data/fixtures/paper/paper.html +14 -0
- data/fixtures/paper/paper.md +27 -0
- data/fixtures/paper/paper.pdf +0 -0
- data/fixtures/paper/paper.xml +28 -0
- data/fixtures/paper/paper_with_missing_title.md +26 -0
- data/fixtures/review_body.txt +48 -0
- data/fixtures/test_paper/nested/paper.bib +0 -0
- data/fixtures/test_paper/nested/paper.md +0 -0
- data/fixtures/test_paper/paper.bib +0 -0
- data/fixtures/test_paper/paper.md +0 -0
- data/fixtures/vcr_cassettes/joss-lookup.yml +58 -0
- data/fixtures/vcr_cassettes/review.yml +237 -0
- data/fixtures/vcr_cassettes/reviews.yml +270 -0
- data/lib/whedon/auditor.rb +39 -0
- data/lib/whedon/author.rb +81 -0
- data/lib/whedon/bibtex_parser.rb +103 -0
- data/lib/whedon/compilers.rb +379 -0
- data/lib/whedon/github.rb +12 -0
- data/lib/whedon/orcid_validator.rb +83 -0
- data/lib/whedon/processor.rb +178 -0
- data/lib/whedon/review.rb +25 -0
- data/lib/whedon/reviews.rb +29 -0
- data/lib/whedon/version.rb +3 -0
- data/lib/whedon.rb +387 -0
- data/paperdraft.Dockerfile +48 -0
- data/pkg/roboneuro-0.1.0.gem +0 -0
- data/resources/.DS_Store +0 -0
- data/resources/NeuroLibre/.DS_Store +0 -0
- data/resources/NeuroLibre/aas-logo.png +0 -0
- data/resources/NeuroLibre/apa.csl +1919 -0
- data/resources/NeuroLibre/defaults.yaml +14 -0
- data/resources/NeuroLibre/latex.template +541 -0
- data/resources/NeuroLibre/logo.png +0 -0
- data/resources/NeuroLibre/logo_link.png +0 -0
- data/resources/apa.csl +1919 -0
- data/resources/crossref.template +89 -0
- data/resources/docker-defaults.yaml +42 -0
- data/resources/docker-entrypoint.sh +37 -0
- data/resources/jats.csl +204 -0
- data/resources/jats.template +105 -0
- data/resources/jose/apa.csl +1919 -0
- data/resources/jose/defaults.yaml +14 -0
- data/resources/jose/latex.template +486 -0
- data/resources/jose/logo.png +0 -0
- data/resources/joss/aas-logo.png +0 -0
- data/resources/joss/apa.csl +1919 -0
- data/resources/joss/defaults.yaml +14 -0
- data/resources/joss/latex.template +525 -0
- data/resources/joss/logo.png +0 -0
- data/resources/latex.template +485 -0
- data/resources/time.lua +8 -0
- data/roboneuro.gemspec +39 -0
- data/spec/auditor_spec.rb +22 -0
- data/spec/author_spec.rb +17 -0
- data/spec/bibtex_spec.rb +31 -0
- data/spec/orcid_validator_spec.rb +33 -0
- data/spec/processor_spec.rb +66 -0
- data/spec/review_spec.rb +12 -0
- data/spec/reviews_spec.rb +18 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/whedon_spec.rb +93 -0
- metadata +386 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3facccb4e09f68c233c0a386b6c9d35262ca140316c182026928c090a5a13e86
|
4
|
+
data.tar.gz: '00588aa4a555273fcb1bf62a78f0237167ab6c9d0e16d9b1c7ddeb4ee41eabb4'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 88571deda0ffdccffd7a65a0756a9446b3ad1b52bcf397a53156062173d8a707ae03d2950d8e1ca78120487c752ac56084e44074fc47544bd91e1c58f22fef20
|
7
|
+
data.tar.gz: b543ab1f0436e2625cce9553bef99a549bb8b622d5639aee6225c0f87328a047f05266e5561dab649f061b7f2305c2bb1ee2f31147eaeca3d036929baa624342
|
data/.DS_Store
ADDED
Binary file
|
data/.env-example
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
GH_TOKEN=xxxxxxxxxxxxxxxxxxxx
|
2
|
+
WHEDON_SECRET=xxxxxxxxxxxxxxxxxxxx
|
3
|
+
DOI_PREFIX = "10.xxxxx"
|
4
|
+
PAPER_REPOSITORY = "joss-papers-example"
|
5
|
+
REVIEW_REPOSITORY = "openjournals/joss-reviews-example"
|
6
|
+
JOURNAL_URL = "http://example.theoj.org"
|
7
|
+
JOURNAL_NAME = "Journal of Open Source Examples"
|
8
|
+
JOURNAL_ALIAS = 'jose'
|
9
|
+
JOURNAL_LAUNCH_DATE = '2016-05-05'
|
10
|
+
CROSSREF_USERNAME="xxxxxxxxxxxxxxxxxxxx"
|
11
|
+
CROSSREF_PASSWORD="xxxxxxxxxxxxxxxxxxxx"
|
12
|
+
JOURNAL_ISSN="xxxxxxxxxxxxxx"
|
data/.env.test
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
GH_TOKEN=FOO
|
2
|
+
DOI_PREFIX = "10.21105"
|
3
|
+
PAPER_REPOSITORY = "openjournals/joss-papers-testing"
|
4
|
+
REVIEW_REPOSITORY = "openjournals/joss-reviews"
|
5
|
+
JOURNAL_URL = "http://joss.theoj.org"
|
6
|
+
JOURNAL_NAME = "Journal of Open Source Software"
|
7
|
+
JOURNAL_ALIAS = "joss"
|
8
|
+
JOURNAL_LAUNCH_DATE = "2016-05-05"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
name: Build Images
|
2
|
+
|
3
|
+
on:
|
4
|
+
# Build and publish when pushed to master
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
8
|
+
# Build, but don't push on pull requests
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
env:
|
12
|
+
IMAGE_NAME: agahkarakuzu/paperdraft
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
# Build images and store them as tar archive
|
16
|
+
build:
|
17
|
+
name: Build
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
steps:
|
20
|
+
- name: Checkout
|
21
|
+
uses: actions/checkout@v2
|
22
|
+
|
23
|
+
- name: Build image
|
24
|
+
run: |
|
25
|
+
docker build \
|
26
|
+
--tag $IMAGE_NAME \
|
27
|
+
-f paperdraft.Dockerfile \
|
28
|
+
.
|
29
|
+
|
30
|
+
- name: Save images to archive
|
31
|
+
run: docker save $IMAGE_NAME > image.tar
|
32
|
+
|
33
|
+
- name: Upload archive
|
34
|
+
uses: actions/upload-artifact@v1
|
35
|
+
with:
|
36
|
+
name: paperdraft
|
37
|
+
path: image.tar
|
38
|
+
|
39
|
+
# Push image to GitHub Packages.
|
40
|
+
push:
|
41
|
+
name: Push
|
42
|
+
runs-on: ubuntu-latest
|
43
|
+
if: github.event_name == 'push'
|
44
|
+
needs:
|
45
|
+
- build
|
46
|
+
|
47
|
+
steps:
|
48
|
+
- name: Download stored images
|
49
|
+
uses: actions/download-artifact@v1
|
50
|
+
with:
|
51
|
+
name: paperdraft
|
52
|
+
|
53
|
+
- name: Load images
|
54
|
+
run: |
|
55
|
+
docker load --input paperdraft/image.tar
|
56
|
+
|
57
|
+
- name: Log into registry
|
58
|
+
run: >-
|
59
|
+
echo "${{ secrets.DOCKER_HUB_TOKEN }}" |
|
60
|
+
docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
|
61
|
+
|
62
|
+
- name: Push core image
|
63
|
+
run: docker push $IMAGE_NAME
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
continue-on-error: ${{ matrix.failure-allowed }}
|
8
|
+
strategy:
|
9
|
+
matrix:
|
10
|
+
ruby-version: ['2.6.3', '3.0.2']
|
11
|
+
failure-allowed: [false]
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Install Pandoc
|
15
|
+
run: |
|
16
|
+
curl -L https://github.com/jgm/pandoc/releases/download/2.9.1.1/pandoc-2.9.1.1-1-amd64.deb > pandoc.deb
|
17
|
+
dpkg -x pandoc.deb .
|
18
|
+
echo "pandoc downloaded and unpacked"
|
19
|
+
echo "$PWD/usr/bin" >> $GITHUB_PATH
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true
|
25
|
+
- name: Run specs
|
26
|
+
run: |
|
27
|
+
bundle exec ruby -v
|
28
|
+
bundle exec rake spec
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
roboneuro (0.1.1)
|
5
|
+
bibtex-ruby (~> 6.0.0)
|
6
|
+
dotenv
|
7
|
+
github-linguist (~> 5.3)
|
8
|
+
latex-decode
|
9
|
+
octokit (~> 4.20)
|
10
|
+
openjournals-nameable
|
11
|
+
redcarpet (~> 3.3)
|
12
|
+
rest-client (>= 1.8)
|
13
|
+
thor (~> 0.19)
|
14
|
+
tilt
|
15
|
+
unicode (~> 0.4.4)
|
16
|
+
|
17
|
+
GEM
|
18
|
+
remote: https://rubygems.org/
|
19
|
+
specs:
|
20
|
+
addressable (2.7.0)
|
21
|
+
public_suffix (>= 2.0.2, < 5.0)
|
22
|
+
bibtex-ruby (6.0.0)
|
23
|
+
latex-decode (~> 0.0)
|
24
|
+
charlock_holmes (0.7.7)
|
25
|
+
coderay (1.1.3)
|
26
|
+
crack (0.4.5)
|
27
|
+
rexml
|
28
|
+
diff-lcs (1.4.4)
|
29
|
+
domain_name (0.5.20190701)
|
30
|
+
unf (>= 0.0.5, < 1.0.0)
|
31
|
+
dotenv (2.7.6)
|
32
|
+
escape_utils (1.1.1)
|
33
|
+
faraday (1.10.0)
|
34
|
+
faraday-em_http (~> 1.0)
|
35
|
+
faraday-em_synchrony (~> 1.0)
|
36
|
+
faraday-excon (~> 1.1)
|
37
|
+
faraday-httpclient (~> 1.0)
|
38
|
+
faraday-multipart (~> 1.0)
|
39
|
+
faraday-net_http (~> 1.0)
|
40
|
+
faraday-net_http_persistent (~> 1.0)
|
41
|
+
faraday-patron (~> 1.0)
|
42
|
+
faraday-rack (~> 1.0)
|
43
|
+
faraday-retry (~> 1.0)
|
44
|
+
ruby2_keywords (>= 0.0.4)
|
45
|
+
faraday-em_http (1.0.0)
|
46
|
+
faraday-em_synchrony (1.0.0)
|
47
|
+
faraday-excon (1.1.0)
|
48
|
+
faraday-httpclient (1.0.1)
|
49
|
+
faraday-multipart (1.0.3)
|
50
|
+
multipart-post (>= 1.2, < 3)
|
51
|
+
faraday-net_http (1.0.1)
|
52
|
+
faraday-net_http_persistent (1.2.0)
|
53
|
+
faraday-patron (1.0.0)
|
54
|
+
faraday-rack (1.0.0)
|
55
|
+
faraday-retry (1.0.3)
|
56
|
+
github-linguist (5.3.3)
|
57
|
+
charlock_holmes (~> 0.7.5)
|
58
|
+
escape_utils (~> 1.1.0)
|
59
|
+
mime-types (>= 1.19)
|
60
|
+
rugged (>= 0.25.1)
|
61
|
+
hashdiff (1.0.1)
|
62
|
+
http-accept (1.7.0)
|
63
|
+
http-cookie (1.0.4)
|
64
|
+
domain_name (~> 0.5)
|
65
|
+
latex-decode (0.3.2)
|
66
|
+
method_source (1.0.0)
|
67
|
+
mime-types (3.4.1)
|
68
|
+
mime-types-data (~> 3.2015)
|
69
|
+
mime-types-data (3.2022.0105)
|
70
|
+
mini_portile2 (2.4.0)
|
71
|
+
multipart-post (2.1.1)
|
72
|
+
netrc (0.11.0)
|
73
|
+
nokogiri (1.10.8)
|
74
|
+
mini_portile2 (~> 2.4.0)
|
75
|
+
octokit (4.22.0)
|
76
|
+
faraday (>= 0.9)
|
77
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
78
|
+
openjournals-nameable (1.1.7)
|
79
|
+
pry (0.13.1)
|
80
|
+
coderay (~> 1.1)
|
81
|
+
method_source (~> 1.0)
|
82
|
+
public_suffix (4.0.6)
|
83
|
+
rake (10.5.0)
|
84
|
+
redcarpet (3.5.1)
|
85
|
+
rest-client (2.1.0)
|
86
|
+
http-accept (>= 1.7.0, < 2.0)
|
87
|
+
http-cookie (>= 1.0.2, < 2.0)
|
88
|
+
mime-types (>= 1.16, < 4.0)
|
89
|
+
netrc (~> 0.8)
|
90
|
+
rexml (3.2.4)
|
91
|
+
rspec (3.10.0)
|
92
|
+
rspec-core (~> 3.10.0)
|
93
|
+
rspec-expectations (~> 3.10.0)
|
94
|
+
rspec-mocks (~> 3.10.0)
|
95
|
+
rspec-core (3.10.1)
|
96
|
+
rspec-support (~> 3.10.0)
|
97
|
+
rspec-expectations (3.10.1)
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
+
rspec-support (~> 3.10.0)
|
100
|
+
rspec-mocks (3.10.2)
|
101
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
+
rspec-support (~> 3.10.0)
|
103
|
+
rspec-support (3.10.2)
|
104
|
+
ruby2_keywords (0.0.5)
|
105
|
+
rugged (1.4.2)
|
106
|
+
sawyer (0.8.2)
|
107
|
+
addressable (>= 2.3.5)
|
108
|
+
faraday (> 0.8, < 2.0)
|
109
|
+
thor (0.20.3)
|
110
|
+
tilt (2.0.10)
|
111
|
+
unf (0.1.4)
|
112
|
+
unf_ext
|
113
|
+
unf_ext (0.0.8.1)
|
114
|
+
unicode (0.4.4.4)
|
115
|
+
vcr (6.0.0)
|
116
|
+
webmock (3.11.2)
|
117
|
+
addressable (>= 2.3.6)
|
118
|
+
crack (>= 0.3.2)
|
119
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
120
|
+
|
121
|
+
PLATFORMS
|
122
|
+
ruby
|
123
|
+
|
124
|
+
DEPENDENCIES
|
125
|
+
bundler
|
126
|
+
nokogiri (= 1.10.8)
|
127
|
+
pry (~> 0.10)
|
128
|
+
rake (~> 10.0)
|
129
|
+
roboneuro!
|
130
|
+
rspec (~> 3.3)
|
131
|
+
vcr (~> 6.0)
|
132
|
+
webmock (~> 3.11.2)
|
133
|
+
|
134
|
+
BUNDLED WITH
|
135
|
+
2.2.17
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Open Journals
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
# What is Whedon?
|
2
|
+
|
3
|
+
Whedon is a collection of command-line utilities to manage JOSS submissions. Whedon is used by the [Whedon-API bot](https://github.com/openjournals/whedon-api) to interact with authors and reviewers during the review process on https://github.com/openjournals/joss-reviews
|
4
|
+
|
5
|
+
## Setup
|
6
|
+
|
7
|
+
Whedon uses [`dotenv`](https://github.com/bkeepers/dotenv) to manage local configuration. Take a look at `.env-example` (which needs renaming to `.env` to be picked up).
|
8
|
+
|
9
|
+
Whedon requires a local installation of Pandoc 2 and Pandoc-Citeproc as well as a LaTeX (ideally [TeXLive](https://www.tug.org/texlive/)) installation. See [Pandoc's install instruction](http://pandoc.org/installing.html) for details.
|
10
|
+
|
11
|
+
## Is it green?
|
12
|
+
|
13
|
+
Hopefully...
|
14
|
+
|
15
|
+
[](https://github.com/openjournals/whedon/actions/workflows/tests.yml)
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Depending on how Ruby is installed on your system there might slightly different steps be necessary. Note that Whedon is only tested for reasonably modern versions of Ruby (i.e. > 2.1) [Bundler](http://bundler.io/) is used to install dependencies.
|
20
|
+
|
21
|
+
On macOS and with a Homebrew installed Ruby Bundler should be installable with
|
22
|
+
|
23
|
+
```
|
24
|
+
gem install bundler
|
25
|
+
```
|
26
|
+
|
27
|
+
On other Linux distros this might be a separate package or already installed.
|
28
|
+
|
29
|
+
After cloning the `whedon` repository with
|
30
|
+
|
31
|
+
```
|
32
|
+
git clone https://github.com/openjournals/whedon.git
|
33
|
+
```
|
34
|
+
|
35
|
+
from within the `whedon` directory run the following command:
|
36
|
+
|
37
|
+
```
|
38
|
+
bundle install
|
39
|
+
```
|
40
|
+
|
41
|
+
or
|
42
|
+
|
43
|
+
```
|
44
|
+
bundle install --path vendor/bundle
|
45
|
+
```
|
46
|
+
|
47
|
+
Next, it's necessary to create a `.env` file based on the example
|
48
|
+
[`.env.test`](https://github.com/openjournals/whedon/blob/master/.env.test).
|
49
|
+
|
50
|
+
The `GH_TOKEN` can be created following the instructions from GitHub's
|
51
|
+
[help pages](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
|
52
|
+
|
53
|
+
Once you have edited the `.env` file you can run the commands described below.
|
54
|
+
It might be necessary to prefix the `whedon` command with `bundle exec` or
|
55
|
+
give the full path to the executable, e.g. `./bin/whedon`.
|
56
|
+
|
57
|
+
## Usage
|
58
|
+
|
59
|
+
There are two main ways to use `Whedon`, 1) via the command-line utility or 2) using the Ruby API. If you want to see how the command line is implemented, take a look at the [executable](https://github.com/openjournals/whedon/blob/master/bin/whedon).
|
60
|
+
|
61
|
+
### Currently implemented functionality
|
62
|
+
|
63
|
+
List available commands:
|
64
|
+
|
65
|
+
```
|
66
|
+
$ bundle exec whedon # or just 'whedon' depending on whether you have built and installed the RubyGem locally
|
67
|
+
|
68
|
+
Commands:
|
69
|
+
whedon compile # Compile the paper and XML metadata
|
70
|
+
whedon deposit # Deposit the metadata with the JOSS application and Crossref
|
71
|
+
whedon download # Download the repo
|
72
|
+
whedon help [COMMAND] # Describe available commands or one specific command
|
73
|
+
whedon open # Open browser for review
|
74
|
+
whedon prepare # Just prepare the PDF
|
75
|
+
whedon reviews # Lists open reviews
|
76
|
+
whedon verify # Check the key values in the review issue
|
77
|
+
```
|
78
|
+
|
79
|
+
**whedon reviews**
|
80
|
+
|
81
|
+
List all open reviews in the GitHub review repository:
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
$ whedon reviews
|
85
|
+
|
86
|
+
# Ruby API equivalent
|
87
|
+
>> require 'whedon'
|
88
|
+
>> Whedon::Paper.list
|
89
|
+
```
|
90
|
+
|
91
|
+
**whedon verify**
|
92
|
+
|
93
|
+
Verify the review issue body has key fields present:
|
94
|
+
|
95
|
+
```ruby
|
96
|
+
$ whedon verify {id}
|
97
|
+
|
98
|
+
# Ruby API equivalent
|
99
|
+
>> require 'whedon'
|
100
|
+
>> Whedon::Paper.new(issue_id).audit
|
101
|
+
```
|
102
|
+
|
103
|
+
**whedon open**
|
104
|
+
|
105
|
+
Open the browser at the review issue page
|
106
|
+
|
107
|
+
```
|
108
|
+
$ whedon open {id}
|
109
|
+
```
|
110
|
+
|
111
|
+
**whedon download**
|
112
|
+
|
113
|
+
Download locally the repository linked to in the review issue (note this tries to do a simple `git clone` of the repository address which will fail for non-git repositories).
|
114
|
+
|
115
|
+
```ruby
|
116
|
+
$ whedon download {id}
|
117
|
+
|
118
|
+
# Ruby API equivalent
|
119
|
+
>> require 'whedon'
|
120
|
+
>> Whedon::Paper.new(issue_id).download
|
121
|
+
```
|
122
|
+
|
123
|
+
**whedon prepare**
|
124
|
+
|
125
|
+
Compile a downloaded paper locally to a PDF.
|
126
|
+
|
127
|
+
This is the command that the `Whedon-API` bot uses to generate a preview of the paper PDF for sharing with reviewers and editors.
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
$ whedon prepare {id}
|
131
|
+
|
132
|
+
# Ruby API equivalent
|
133
|
+
>> require 'whedon'
|
134
|
+
>> review = Whedon::Review.new(issue_id)
|
135
|
+
>> processor = Whedon::Processor.new(issue_id, review.issue_body)
|
136
|
+
>> processor.set_paper(path_to_paper.md_file)
|
137
|
+
>> processor.generate_pdf
|
138
|
+
```
|
139
|
+
|
140
|
+
Under the hood, the `prepare` method does the following:
|
141
|
+
|
142
|
+
- Looks for the paper.md
|
143
|
+
- If more than one paper.md is found, asks the user to pick the correct one
|
144
|
+
- Compiles the markdown to a custom PDF: `pandoc -o paper.pdf -V geometry:margin=1in --filter pandoc-citeproc paper.md --template latex.template`. See the actual [command here](https://github.com/openjournals/whedon/blob/25f9a1307a83b6b89080d6d934a3621f6a244035/lib/whedon/processor.rb#L101-L122).
|
145
|
+
- Returns the filesystem location of the compiled PDF for inspection
|
146
|
+
|
147
|
+
|
148
|
+
**whedon compile**
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
$ whedon compile {id}
|
152
|
+
|
153
|
+
# Ruby API equivalent
|
154
|
+
>> require 'whedon'
|
155
|
+
>> review = Whedon::Review.new(issue_id)
|
156
|
+
>> processor = Whedon::Processor.new(issue_id, review.issue_body)
|
157
|
+
>> processor.set_paper(path_to_paper.md_file)
|
158
|
+
>> processor.compile
|
159
|
+
```
|
160
|
+
|
161
|
+
Under the hood, the `compile` method does the following:
|
162
|
+
|
163
|
+
- Looks for the paper.md
|
164
|
+
- If more than one paper.md is found, asks the user to pick the correct one
|
165
|
+
- Compiles the markdown to [four different outputs](https://github.com/openjournals/whedon/blob/25f9a1307a83b6b89080d6d934a3621f6a244035/lib/whedon/processor.rb#L82-L87):
|
166
|
+
- [The JOSS PDF](https://github.com/openjournals/whedon/blob/25f9a1307a83b6b89080d6d934a3621f6a244035/lib/whedon/processor.rb#L101-L122)
|
167
|
+
- A (currently un-used) [custom XML output](https://github.com/openjournals/whedon/blob/25f9a1307a83b6b89080d6d934a3621f6a244035/lib/whedon/processor.rb#L149-L167)
|
168
|
+
- An [HTML representation](https://github.com/openjournals/whedon/blob/25f9a1307a83b6b89080d6d934a3621f6a244035/lib/whedon/processor.rb#L169-L206) of the paper (deprecated)
|
169
|
+
- The [Crossref deposit metadata](https://github.com/openjournals/whedon/blob/25f9a1307a83b6b89080d6d934a3621f6a244035/lib/whedon/processor.rb#L208-L247)
|
170
|
+
- Returns the filesystem location of the compiled PDF for inspection
|
171
|
+
|
172
|
+
### Functionality under development
|
173
|
+
|
174
|
+
Accept a paper into JOSS. This method currently returns the necessary metadata for the JOSS application (i.e. fields that need updating in the [JOSS database](https://github.com/openjournals/joss/blob/ce7722c2ec6d1ff306b13f465887e9747c76b3b1/db/schema.rb#L35-L55)) once a paper is accepted.
|
175
|
+
|
176
|
+
In the future, this method should:
|
177
|
+
|
178
|
+
- Update the database fields automatically on the JOSS application.
|
179
|
+
- Deposit the Crossref XML to the Crossref API
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
$ whedon deposit {id}
|
183
|
+
|
184
|
+
# Ruby API equivalent
|
185
|
+
>> require 'whedon'
|
186
|
+
>> review = Whedon::Review.new(issue_id)
|
187
|
+
>> processor = Whedon::Processor.new(issue_id, review.issue_body)
|
188
|
+
>> processor.set_paper(path_to_paper.md_file)
|
189
|
+
>> processor.deposit
|
190
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
require 'dotenv'
|
5
|
+
Dotenv.load(".env.test")
|
6
|
+
|
7
|
+
require_relative './lib/whedon'
|
8
|
+
|
9
|
+
desc "Run specs"
|
10
|
+
RSpec::Core::RakeTask.new do |t|
|
11
|
+
t.pattern = 'spec/**/*_spec.rb'
|
12
|
+
t.rspec_opts = ["--order", "rand", "--color"]
|
13
|
+
end
|
data/bin/whedon
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require_relative "../lib/whedon"
|
3
|
+
require 'thor'
|
4
|
+
|
5
|
+
class WhedonCli < Thor
|
6
|
+
desc "reviews", "Lists open reviews"
|
7
|
+
def reviews
|
8
|
+
Whedon::Paper.list
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "tags", "List tags for a paper"
|
12
|
+
def tags(issue_id)
|
13
|
+
review = Whedon::Review.new(issue_id)
|
14
|
+
processor = Whedon::Processor.new(issue_id, review.issue_body)
|
15
|
+
|
16
|
+
paper_paths = processor.find_paper_paths
|
17
|
+
tags = Whedon::Paper.new(issue_id, paper_paths.first).tags
|
18
|
+
|
19
|
+
if tags
|
20
|
+
puts tags.join(',')
|
21
|
+
else
|
22
|
+
puts ""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "open", "Open browser for review"
|
27
|
+
def open(issue_id)
|
28
|
+
`open https://github.com/#{ENV['REVIEW_REPOSITORY']}/issues/#{issue_id}`
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "verify", "Check the key values in the review issue"
|
32
|
+
def verify(issue_id)
|
33
|
+
Whedon::Paper.new(issue_id).audit
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "download", "Download the repo"
|
37
|
+
def download(issue_id, custom_path=nil, paper_path=nil)
|
38
|
+
Whedon::Paper.new(issue_id, custom_path, paper_path).download
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "prepare", "Just prepare the PDF (optional second argument of custom git branch, optional third argument for custom path)"
|
42
|
+
def prepare(issue_id, custom_path=nil, custom_branch=nil)
|
43
|
+
review = Whedon::Review.new(issue_id)
|
44
|
+
processor = Whedon::Processor.new(issue_id, review.issue_body, custom_path)
|
45
|
+
processor.archive_doi = 'PENDING'
|
46
|
+
|
47
|
+
# Optionally set the path to work in
|
48
|
+
path = custom_path ? custom_path : "tmp/#{issue_id}"
|
49
|
+
|
50
|
+
# Need to checkout the new branch before looking for the paper.
|
51
|
+
`cd #{path} && git checkout #{custom_branch} --quiet` if custom_branch
|
52
|
+
|
53
|
+
paper_paths = processor.find_paper_paths(path)
|
54
|
+
|
55
|
+
if paper_paths.empty?
|
56
|
+
abort("Can't find any papers to compile :-(")
|
57
|
+
elsif paper_paths.size == 1
|
58
|
+
processor.set_paper(paper_paths.first)
|
59
|
+
processor.generate_pdf(custom_branch)
|
60
|
+
else
|
61
|
+
puts "Looks like we found more than one possible paper:"
|
62
|
+
paper_paths.each_with_index { |path, index| puts "#{index+1}. #{path}"}
|
63
|
+
selected_paper = ask("Pick which paper you want:")
|
64
|
+
paper_path = paper_paths[selected_paper.to_i - 1]
|
65
|
+
puts "Setting paper_path to #{paper_paths}"
|
66
|
+
processor.set_paper(paper_path)
|
67
|
+
processor.generate_pdf(custom_branch)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
desc "compile", "Compile the paper and XML metadata"
|
72
|
+
def compile(issue_id, custom_path=nil, custom_branch=nil)
|
73
|
+
review = Whedon::Review.new(issue_id)
|
74
|
+
processor = Whedon::Processor.new(issue_id, review.issue_body, custom_path)
|
75
|
+
|
76
|
+
# Optionally set the path to work in
|
77
|
+
path = custom_path ? custom_path : "tmp/#{issue_id}"
|
78
|
+
|
79
|
+
# Need to checkout the new branch before looking for the paper.
|
80
|
+
`cd #{path} && git checkout #{custom_branch} --quiet` if custom_branch
|
81
|
+
|
82
|
+
paper_paths = processor.find_paper_paths(path)
|
83
|
+
|
84
|
+
if paper_paths.empty?
|
85
|
+
abort("Can't find any papers to compile :-(")
|
86
|
+
elsif paper_paths.size == 1
|
87
|
+
processor.set_paper(paper_paths.first)
|
88
|
+
processor.compile
|
89
|
+
else
|
90
|
+
puts "Looks like we found more than one possible paper:"
|
91
|
+
paper_paths.each_with_index { |path, index| puts "#{index+1}. #{path}"}
|
92
|
+
selected_paper = ask("Pick which paper you want:")
|
93
|
+
paper_path = paper_paths[selected_paper.to_i - 1]
|
94
|
+
puts "Setting paper_path to #{paper_paths}"
|
95
|
+
processor.set_paper(paper_path)
|
96
|
+
processor.compile
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
desc "deposit", "Deposit the metadata with the JOSS application and Crossref"
|
101
|
+
def deposit(issue_id, custom_path=nil, custom_branch=nil)
|
102
|
+
review = Whedon::Review.new(issue_id)
|
103
|
+
processor = Whedon::Processor.new(issue_id, review.issue_body, custom_path)
|
104
|
+
|
105
|
+
# Optionally set the path to work in
|
106
|
+
path = custom_path ? custom_path : "tmp/#{issue_id}"
|
107
|
+
|
108
|
+
# Need to checkout the new branch before looking for the paper.
|
109
|
+
`cd #{path} && git checkout #{custom_branch} --quiet` if custom_branch
|
110
|
+
|
111
|
+
paper_paths = processor.find_paper_paths(path)
|
112
|
+
|
113
|
+
if paper_paths.empty?
|
114
|
+
abort("Can't find any papers to process :-(")
|
115
|
+
elsif paper_paths.size == 1
|
116
|
+
puts "Setting paper_path to #{paper_paths.first}"
|
117
|
+
processor.set_paper(paper_paths.first)
|
118
|
+
processor.deposit
|
119
|
+
else
|
120
|
+
puts "Looks like we found more than one possible paper:"
|
121
|
+
paper_paths.each_with_index { |path, index| puts "#{index+1}. #{path}"}
|
122
|
+
selected_paper = ask("Pick which paper you want:")
|
123
|
+
paper_path = paper_paths[selected_paper.to_i - 1]
|
124
|
+
puts "Setting paper_path to #{paper_paths}"
|
125
|
+
processor.set_paper(paper_path)
|
126
|
+
processor.deposit
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
WhedonCli.start
|
File without changes
|