cirneco 0.6.2 → 0.6.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
  SHA1:
3
- metadata.gz: eaeaad21cf2a466a9c9cd5f263c3023ffbb06d88
4
- data.tar.gz: e8a4c0677b9c1b295b08df6cfba35059c245836f
3
+ metadata.gz: 6b5f9904e8936e7a886b1502b61d63a6046a66ad
4
+ data.tar.gz: 4ad9a39a16a5683f376cc0d53ba1913c62fbe18a
5
5
  SHA512:
6
- metadata.gz: c77a6e9d70d11a4452b7ae5d8167fba20aaeaedfbced8b79008f2b0c4fbe8d1e77095b20198b51b25c756a0a01478cd90a5a607b147415ba8876d48940f42fdd
7
- data.tar.gz: 8e995c12b58effd10dea51965c8d2874f1bf925cb4ccf95d033f646b424ccc99ebdb6001522847ce991c70316a6d2d18604ecec4849b7d74b7983340678db5fb
6
+ metadata.gz: 4dcf18fab90ab424a399d84f7fffa3913c2edf564485720a3cce0e74eb3dd134ede1519be8375e68c344d9454bdb79135f2ff783f4acb64a617ef8ba1b6133b7
7
+ data.tar.gz: f56f7cbe7433c420eb931a80e7c644b1ebe3326c7c3706d9ca93b1d9644e5a0eec41651aca2cf36adc0483beee8f7f7904aca3d8113c3047e8b17cf7071d45e9
data/.env.example CHANGED
@@ -1,3 +1,11 @@
1
1
  MDS_USERNAME=USER.USER
2
2
  MDS_PASSWORD=opensesame
3
- PREFIX=10.5555
3
+ SANDBOX=1
4
+ PREFIX=10.23725
5
+
6
+ SITE_URL=https://blog.datacite.org/
7
+ SITE_TITLE=DataCite Blog
8
+ SITE_SITEPATH=spec/fixtures/site.yml
9
+ SITE_AUTHORPATH=spec/fixtures/authors.yml
10
+ SITE_CSLPATH=spec/fixtures/apa.csl
11
+ SITE_REFERENCESPATH=spec/fixtures/references.yaml
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirneco (0.6.2)
4
+ cirneco (0.6.3)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  base32-crockford-checksum (~> 0.2.2)
7
7
  bergamasco (~> 0.2)
@@ -127,4 +127,4 @@ DEPENDENCIES
127
127
  webmock (~> 1.22, >= 1.22.3)
128
128
 
129
129
  BUNDLED WITH
130
- 1.12.5
130
+ 1.13.6
data/README.md CHANGED
@@ -39,19 +39,9 @@ gem install cirneco
39
39
 
40
40
  Configure ENV variables `MDS_USERNAME`, `MDS_PASSWORD` and `PREFIX`, e.g. by storing them in file `.env` (see `.env.xample`) in same directory you run the command.
41
41
 
42
- ## Commands
42
+ ## DataCite MDS API Commands
43
43
 
44
- The commands map to the commands available in the [DataCite MDS API](https://mds.datacite.org/static/apidoc), and two additional commands allow the generation and check of random DOIs.
45
-
46
- Generate a random DOI in the format `xxxx-xxxy` where `y` is the checksum
47
- ```
48
- cirneco doi generate
49
- ```
50
-
51
- Check DOI for valid checksum
52
- ```
53
- cirneco doi check 10.5555/1234
54
- ```
44
+ The commands map to the commands available in the [DataCite MDS API](https://mds.datacite.org/static/apidoc).
55
45
 
56
46
  Return all DOIs registered for the data center
57
47
  ```
@@ -88,6 +78,40 @@ Post media information from file `1234.txt` in same directory
88
78
  cirneco media post 1234.xml
89
79
  ```
90
80
 
81
+ ## Utility Commands
82
+ Commands to generate and check random DOIs, and for registering DOIs using
83
+ markdown files with metadata in YAML frontmatter
84
+
85
+ Generate a random DOI in the format `xxxx-xxxy` where `y` is the checksum
86
+ ```
87
+ cirneco doi generate
88
+ ```
89
+
90
+ Check DOI for valid checksum
91
+ ```
92
+ cirneco doi check 10.5555/1234
93
+ ```
94
+
95
+ Mint a DOI with metadata from a markdown file with YAML frontmatter
96
+ ```
97
+ cirneco doi mint /source/posts/cool-dois.html.md
98
+ ```
99
+
100
+ Mint DOIs with metadata for all markdown files in a folder
101
+ ```
102
+ cirneco doi mint /source/posts
103
+ ```
104
+
105
+ Hide DOI metadata for a markdown file with YAML frontmatter
106
+ ```
107
+ cirneco doi hide /source/posts/cool-dois.html.md
108
+ ```
109
+
110
+ Hide DOIs with metadata for all markdown files in a folder
111
+ ```
112
+ cirneco doi hide /source/posts
113
+ ```
114
+
91
115
  ## Development
92
116
 
93
117
  We use rspec for unit testing:
data/lib/cirneco/doi.rb CHANGED
@@ -49,6 +49,8 @@ module Cirneco
49
49
  end
50
50
 
51
51
  desc "mint DOCUMENTS", "mint documents"
52
+ method_option :csl, :default => ENV['SITE_CSLPATH']
53
+ method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
52
54
  method_option :username, :default => ENV['MDS_USERNAME']
53
55
  method_option :password, :default => ENV['MDS_PASSWORD']
54
56
  method_option :prefix, :default => ENV['PREFIX']
@@ -65,6 +67,8 @@ module Cirneco
65
67
  end
66
68
 
67
69
  desc "hide DOCUMENTS", "hide documents"
70
+ method_option :csl, :default => ENV['SITE_CSLPATH']
71
+ method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
68
72
  method_option :username, :default => ENV['MDS_USERNAME']
69
73
  method_option :password, :default => ENV['MDS_PASSWORD']
70
74
  method_option :sandbox, :default => ENV['SANDBOX']
data/lib/cirneco/utils.rb CHANGED
@@ -100,7 +100,7 @@ module Cirneco
100
100
  references = referencespath.present? ? Bergamasco::Markdown.read_yaml(referencespath) : {}
101
101
 
102
102
  # required metadata
103
- prefix = options[:prefix] || site_options["prefix"] || ENV['SITE_PREFIX']
103
+ prefix = options[:prefix] || site_options["prefix"] || ENV['PREFIX']
104
104
  metadata["doi"] ||= encode_doi(prefix, options)
105
105
 
106
106
  site_url = site_options["site_url"] || ENV['SITE_URL']
@@ -1,3 +1,3 @@
1
1
  module Cirneco
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
data/spec/utils_spec.rb CHANGED
@@ -81,7 +81,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
81
81
  it 'should generate metadata for work' do
82
82
  filepath = fixture_path + 'cool-dois.html.md'
83
83
  number = 123
84
- metadata = subject.generate_metadata_for_work(filepath, number: number, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.bib')
84
+ metadata = subject.generate_metadata_for_work(filepath, number: number, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml')
85
85
  expect(metadata["url"]).to eq("https://blog.datacite.org/cool-dois/")
86
86
  expect(metadata["creators"]).to eq([{:given_name=>"Martin", :family_name=>"Fenner", :orcid=>"0000-0003-1419-2405"}])
87
87
  expect(metadata["descriptions"]).to eq([{:value=>"In 1998 Tim Berners-Lee coined the term cool URIs (1998), that is URIs that don’t change. We know that URLs referenced in the scholarly literature are often not cool, leading to link rot (Klein et al., 2014) and making it hard or impossible to find the referenced resource.",:description_type=>"Abstract"}])
@@ -96,7 +96,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
96
96
  it 'should register_work_for_metadata' do
97
97
  filepath = fixture_path + 'cool-dois.html.md'
98
98
  number = 123
99
- metadata = subject.generate_metadata_for_work(filepath, number: number, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.bib')
99
+ metadata = subject.generate_metadata_for_work(filepath, number: number, csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml')
100
100
  work = subject.register_work_for_metadata(metadata)
101
101
  expect(work.validation_errors).to be_empty
102
102
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirneco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner