Skip to content

Commit f19eb1b

Browse files
authored
Merge pull request #2 from ctjacobs/review
Addressing JOSS reviewer comments
2 parents fb6dded + 8d3fd1c commit f19eb1b

File tree

4 files changed

+75
-10
lines changed

4 files changed

+75
-10
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ Both of these dependencies can be installed via `pip` using
1717
sudo pip install -r requirements.txt
1818
```
1919

20+
Alternatively, users can install Git-RDM and its dependencies with [Conda](http://conda.pydata.org/); see the details in the next section.
21+
2022
Note that once PyRDM is installed, you will need to setup Figshare/Zenodo authentication tokens and copy them into the PyRDM configuration file in order to publish your data. See the [PyRDM documentation](https://pyrdm.readthedocs.io/en/latest/getting_started.html) for instructions on how to do this.
2123

2224
## Installing
2325

26+
Git-RDM can either be installed from source, or via Conda packages; see the appropriate sub-section for more details. Once Git-RDM is installed, Git should automatically detect the plugin and recognise the `rdm` command; for example, run `git rdm -h` to list the RDM-related subcommands described in the Usage section below.
27+
28+
### From source
29+
2430
After downloading or cloning this software using
2531

2632
```
@@ -39,7 +45,25 @@ and running
3945
sudo python setup.py install
4046
```
4147

42-
Once Git-RDM is installed, Git should automatically detect the plugin and recognise the `rdm` command; for example, run `git rdm -h` to list the RDM-related subcommands described in the Usage section below.
48+
Alternatively, a local user installation can be achieved using
49+
50+
```
51+
python setup.py install --prefix=/path/to/custom/install/directory
52+
```
53+
54+
and adding `/path/to/custom/install/directory/bin` to the `PATH` environment variable:
55+
56+
```
57+
export PATH=$PATH:/path/to/custom/install/directory/bin
58+
```
59+
60+
### Conda package
61+
62+
Conda users can install the Git-RDM package and its dependencies using
63+
64+
```
65+
conda install -c ctjacobs -c pypi -c auto -c ioos -c conda-forge git-rdm
66+
```
4367

4468
## Usage
4569

@@ -139,6 +163,17 @@ git-rdm INFO: /home/christian/test/test3.png (2016-06-13 @ 00:29:03, revision
139163
git-rdm INFO: /home/christian/test/test2.txt (2016-06-13 @ 00:29:03, revision '1eeccabba810b8c91eef82e692713fdb05ca4a32')
140164
```
141165

166+
To check the raw, unformatted contents of the entire publications database, use the `--raw` flag:
167+
168+
```
169+
~/test $ git rdm ls --raw
170+
git-rdm INFO: Database dump:
171+
git-rdm INFO: id, path, date, time, sha, pid, doi
172+
git-rdm INFO: 13, /home/christian/test/test1.txt, 2016-06-13, 00:29:03.016951, 1eeccabba810b8c91eef82e692713fdb05ca4a32, 3428222, 10.6084/m9.figshare.3428222
173+
git-rdm INFO: 14, /home/christian/test/test3.png, 2016-06-13, 00:29:03.016951, 1eeccabba810b8c91eef82e692713fdb05ca4a32, 3428222, 10.6084/m9.figshare.3428222
174+
git-rdm INFO: 15, /home/christian/test/test2.txt, 2016-06-13, 00:29:03.016951, 1eeccabba810b8c91eef82e692713fdb05ca4a32, 3428222, 10.6084/m9.figshare.3428222
175+
```
176+
142177
### git rdm show
143178

144179
The full publication record maintained by the data repository service can be shown using `git rdm show`. It expects two arguments: the name of the hosting service (`figshare` or `zenodo`) and the publication ID. For example, for the publication whose Figshare publication ID is 3428222 (and DOI is `10.6084/m9.figshare.3428222`), the (truncated) output is:
@@ -177,6 +212,12 @@ git-rdm INFO: {
177212
## License
178213
This software is released under the MIT license. See the file called `LICENSE` for more information.
179214

215+
## Citing
216+
217+
If you use Git-RDM during the course of your research, please consider citing the following paper:
218+
219+
* C. T. Jacobs, A. Avdis (Under Review). Git-RDM: A research data management plugin for the Git version control system. *Journal of Open Source Software*.
220+
180221
## Contact
181222
Please send any questions or comments about Git-RDM via email to [Christian Jacobs](http://christianjacobs.uk) at <[email protected]>.
182223

codemeta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
"keywords": "research data management, git, version control, digital curation, data, publishing, figshare, zenodo",
1414
"license": "MIT",
1515
"title": "Git-RDM",
16-
"version": "v1.0.0"
17-
}
16+
"version": "v1.0.1"
17+
}

git-rdm

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,38 @@ class GitRDM:
172172

173173
return
174174

175-
def ls(self, path=None, by_doi=True):
175+
def ls(self, path=None, by_doi=True, raw=False):
176176
""" List all published files, and files to be published. If a file has multiple DOIs associated with it then they are all listed together.
177177
178178
:arg path: The relative/absolute path to the file to be listed.
179179
:arg bool by_doi: List the files by DOI first (i.e. each DOI will be listed at the top level, with names of the files associated with that DOI underneath).
180+
:arg bool raw: Print out the entire SQL database table without any formatting.
180181
"""
181-
182-
self.db_connect()
183-
182+
183+
self.db_connect()
184+
185+
# Raw database dump of all the rows
186+
if raw:
187+
_LOG.info("Database dump:")
188+
189+
query = "SELECT * FROM %s" % PUBLICATIONS_TABLE
190+
191+
with self.connection:
192+
c = self.connection.cursor()
193+
c.execute(query)
194+
result = c.fetchall()
195+
if len(result) > 0:
196+
# Column names
197+
names = list(map(lambda x: x[0], c.description))
198+
_LOG.info(", ".join(names))
199+
200+
# Rows
201+
for r in result:
202+
values = [str(r[name]) for name in names]
203+
_LOG.info(", ".join(values))
204+
205+
return
206+
184207
# If a path is provided, then specify all the publications/DOIs associated with that path.
185208
if path:
186209
path = os.path.abspath(path) # Get the absolute path
@@ -194,7 +217,7 @@ class GitRDM:
194217
for r in result:
195218
_LOG.info("\t" + str(r["doi"]) + " (" + str(r["date"]) + " @ " + str(r["time"]).split(".")[0] + ", revision '%s')" % r["sha"])
196219
return
197-
220+
198221
# List all published files.
199222
if by_doi:
200223
query = "SELECT * FROM %s WHERE doi IS NOT NULL ORDER BY doi" % PUBLICATIONS_TABLE
@@ -483,6 +506,7 @@ if(__name__ == "__main__"):
483506
ls_parser = subparsers.add_parser("ls", help="List the published files, and files staged for publishing.")
484507
ls_parser.add_argument("--path", required=False, help="The path to the file to list.", action="store", type=str, default=None)
485508
ls_parser.add_argument("--by-doi", help="Group files by DOI.", action="store_true", default=False, dest="by_doi")
509+
ls_parser.add_argument("--raw", help="Print out the entire SQL database table without any formatting.", action="store_true", default=False, dest="raw")
486510

487511
# 'git rdm publish'
488512
publish_parser = subparsers.add_parser("publish", help="Publish the files in the publishing staging area.")
@@ -511,7 +535,7 @@ if(__name__ == "__main__"):
511535
elif args.subcommand == "rm":
512536
rdm.rm(args.path)
513537
elif args.subcommand == "ls":
514-
rdm.ls(path=args.path, by_doi=args.by_doi)
538+
rdm.ls(path=args.path, by_doi=args.by_doi, raw=args.raw)
515539
elif args.subcommand == "publish":
516540
rdm.publish(service=args.service, pid=args.pid)
517541
elif args.subcommand == "show":

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from distutils.core import setup
2929

3030
setup(name='git-rdm',
31-
version='1.0',
31+
version='1.0.1',
3232
description='Git-RDM is a research data management plugin for the Git version control system.',
3333
author='Christian T. Jacobs, Alexandros Avdis',
3434
author_email='[email protected]',

0 commit comments

Comments
 (0)