active_fedora-noid 0.1.0 → 0.2.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/.gitignore +4 -1
- data/CONTRIBUTING.md +113 -0
- data/Gemfile +4 -0
- data/LICENSE +15 -202
- data/README.md +131 -2
- data/active_fedora-noid.gemspec +4 -4
- data/lib/active_fedora/noid/version.rb +1 -1
- data/spec/spec_helper.rb +3 -17
- data/spec/unit/config_spec.rb +0 -1
- data/spec/unit/noid_spec.rb +0 -1
- data/spec/unit/service_spec.rb +0 -1
- data/spec/unit/synchronized_minter_spec.rb +0 -1
- metadata +16 -18
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/Gemfile.lock +0 -190
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83ec9c5f0edbe298c0b6fa8371eef1ec7af1651a
|
4
|
+
data.tar.gz: ef4f8031eaf4e0bab414882c4e46e49e67dd7841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f935884a4bb63bc70d10d54fc5ff56c7fde95740954c69af86d717887439427565243518ce2918b65999315ddd0d873ff0db0f325a593398fa79f04d6c4e39
|
7
|
+
data.tar.gz: 03fc4dcfc8c764a650e1f5d03e4769fa88e4fd2ffaa177d3f781bd9d89ab10d3b9fe0e5668a8db2a5ed6bd8b43690494f7d9e689b3ebcbde4e1cb158f8ef625e
|
data/.gitignore
CHANGED
@@ -20,7 +20,10 @@ config/secrets.yml
|
|
20
20
|
/vendor/bundle
|
21
21
|
|
22
22
|
# these should all be checked in to normalise the environment:
|
23
|
-
|
23
|
+
Gemfile.lock
|
24
|
+
.ruby-gemset
|
25
|
+
.ruby-version
|
26
|
+
pkg
|
24
27
|
|
25
28
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
26
29
|
.rvmrc
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# How to Contribute
|
2
|
+
|
3
|
+
We want your help to make Project Hydra great.
|
4
|
+
There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
|
5
|
+
|
6
|
+
## Hydra Project Intellectual Property Licensing and Ownership
|
7
|
+
|
8
|
+
All code contributors must have an Individual Contributor License Agreement (iCLA) on file with the Hydra Project Steering Group.
|
9
|
+
If the contributor works for an institution, the institution must have a Corporate Contributor License Agreement (cCLA) on file.
|
10
|
+
|
11
|
+
https://wiki.duraspace.org/display/hydra/Hydra+Project+Intellectual+Property+Licensing+and+Ownership
|
12
|
+
|
13
|
+
You should also add yourself to the `CONTRIBUTORS.md` file in the root of the project.
|
14
|
+
|
15
|
+
## Contribution Tasks
|
16
|
+
|
17
|
+
* Reporting Issues
|
18
|
+
* Making Changes
|
19
|
+
* Submitting Changes
|
20
|
+
* Merging Changes
|
21
|
+
|
22
|
+
### Reporting Issues
|
23
|
+
|
24
|
+
* Make sure you have a [GitHub account](https://github.com/signup/free)
|
25
|
+
* Submit a [Github issue](./issues) by:
|
26
|
+
* Clearly describing the issue
|
27
|
+
* Provide a descriptive summary
|
28
|
+
* Explain the expected behavior
|
29
|
+
* Explain the actual behavior
|
30
|
+
* Provide steps to reproduce the actual behavior
|
31
|
+
|
32
|
+
### Making Changes
|
33
|
+
|
34
|
+
* Fork the repository on GitHub
|
35
|
+
* Create a topic branch from where you want to base your work.
|
36
|
+
* This is usually the master branch.
|
37
|
+
* To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
|
38
|
+
* Then checkout the new branch with `git checkout fix/master/my_contribution`.
|
39
|
+
* Please avoid working directly on the `master` branch.
|
40
|
+
* You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
|
41
|
+
* Make commits of logical units.
|
42
|
+
* Your commit should include a high level description of your work in HISTORY.textile
|
43
|
+
* Check for unnecessary whitespace with `git diff --check` before committing.
|
44
|
+
* Make sure your commit messages are [well formed](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
45
|
+
* If you created an issue, you can close it by including "Closes #issue" in your commit message. See [Github's blog post for more details](https://github.com/blog/1386-closing-issues-via-commit-messages)
|
46
|
+
|
47
|
+
```
|
48
|
+
Present tense short summary (50 characters or less)
|
49
|
+
|
50
|
+
More detailed description, if necessary. It should be wrapped to 72
|
51
|
+
characters. Try to be as descriptive as you can, even if you think that
|
52
|
+
the commit content is obvious, it may not be obvious to others. You
|
53
|
+
should add such description also if it's already present in bug tracker,
|
54
|
+
it should not be necessary to visit a webpage to check the history.
|
55
|
+
|
56
|
+
Include Closes #<issue-number> when relavent.
|
57
|
+
|
58
|
+
Description can have multiple paragraphs and you can use code examples
|
59
|
+
inside, just indent it with 4 spaces:
|
60
|
+
|
61
|
+
class PostsController
|
62
|
+
def index
|
63
|
+
respond_with Post.limit(10)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
You can also add bullet points:
|
68
|
+
|
69
|
+
- you can use dashes or asterisks
|
70
|
+
|
71
|
+
- also, try to indent next line of a point for readability, if it's too
|
72
|
+
long to fit in 72 characters
|
73
|
+
```
|
74
|
+
|
75
|
+
* Make sure you have added the necessary tests for your changes.
|
76
|
+
* Run _all_ the tests to assure nothing else was accidentally broken.
|
77
|
+
* When you are ready to submit a pull request
|
78
|
+
|
79
|
+
### Submitting Changes
|
80
|
+
|
81
|
+
[Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
|
82
|
+
|
83
|
+
* Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
|
84
|
+
* Make sure your branch is up to date with its parent branch (i.e. master)
|
85
|
+
* `git checkout master`
|
86
|
+
* `git pull --rebase`
|
87
|
+
* `git checkout <your-branch>`
|
88
|
+
* `git rebase master`
|
89
|
+
* It is likely a good idea to run your tests again.
|
90
|
+
* Squash the commits for your branch into one commit
|
91
|
+
* `git rebase --interactive HEAD~<number-of-commits>` ([See Github help](https://help.github.com/articles/interactive-rebase))
|
92
|
+
* To determine the number of commits on your branch: `git log master..<your-branch> --oneline | wc -l`
|
93
|
+
* Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
|
94
|
+
* Push your changes to a topic branch in your fork of the repository.
|
95
|
+
* Submit a pull request from your fork to the project.
|
96
|
+
|
97
|
+
### Merging Changes
|
98
|
+
|
99
|
+
* It is considered "poor from" to merge your own request.
|
100
|
+
* Please take the time to review the changes and get a sense of what is being changed. Things to consider:
|
101
|
+
* Does the commit message explain what is going on?
|
102
|
+
* Does the code changes have tests? _Not all changes need new tests, some changes are refactorings_
|
103
|
+
* Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
|
104
|
+
* Did the Travis tests complete successfully?
|
105
|
+
* If you are uncertain, bring other contributors into the conversation by creating a comment that includes their @username.
|
106
|
+
* If you like the pull request, but want others to chime in, create a +1 comment and tag a user.
|
107
|
+
|
108
|
+
# Additional Resources
|
109
|
+
|
110
|
+
* [General GitHub documentation](http://help.github.com/)
|
111
|
+
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
|
112
|
+
* [Pro Git](http://git-scm.com/book) is both a free and excellent book about Git.
|
113
|
+
* [A Git Config for Contributing](http://ndlib.github.io/practices/my-typical-per-project-git-config/)
|
data/Gemfile
CHANGED
data/LICENSE
CHANGED
@@ -1,202 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright {yyyy} {name of copyright owner}
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
202
|
-
|
1
|
+
##########################################################################
|
2
|
+
# Copyright 2015 Penn State University
|
3
|
+
# Additional copyright may be held by others, as reflected in the commit log
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
data/README.md
CHANGED
@@ -1,2 +1,131 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
[](http://badge.fury.io/rb/active_fedora-noid)
|
2
|
+
[](./LICENSE)
|
3
|
+
[](./CONTRIBUTING.md)
|
4
|
+
[](http://rubydoc.info/gems/active_fedora-noid)
|
5
|
+
[](https://travis-ci.org/projecthydra-labs/active_fedora-noid)
|
6
|
+
[](https://gemnasium.com/projecthydra-labs/active_fedora-noid)
|
7
|
+
[](https://coveralls.io/r/projecthydra-labs/active_fedora-noid?branch=master)
|
8
|
+
|
9
|
+
# ActiveFedora::Noid
|
10
|
+
|
11
|
+
Override your ActiveFedora-based applications with opaque [Noid](https://wiki.ucop.edu/display/Curation/NOID)-based identifiers.
|
12
|
+
|
13
|
+
**This gem depends only upon ActiveFedora, not on Hydra or HydraHead**
|
14
|
+
|
15
|
+
# Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
gem 'active_fedora-noid'
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle install
|
24
|
+
|
25
|
+
Or install it yourself via:
|
26
|
+
|
27
|
+
$ gem install active_fedora-noid
|
28
|
+
|
29
|
+
# Usage
|
30
|
+
|
31
|
+
## Minting and validating identifiers
|
32
|
+
|
33
|
+
Mint a new Noid:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
noid_service = ActiveFedora::Noid::Service.new
|
37
|
+
noid = noid_service.mint
|
38
|
+
```
|
39
|
+
|
40
|
+
This creates a Noid with the default identifier template, which you can override (see below). Now that you have a service object with a template, you can also use it to validate identifier to see if they conform to the template:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
noid_service.valid? 'xyz123foobar'
|
44
|
+
> false
|
45
|
+
```
|
46
|
+
|
47
|
+
## ActiveFedora integration
|
48
|
+
|
49
|
+
To get ActiveFedora to automatically call your Noid service whenever a new ActiveFedora object is saved, create a method on your model called `assign_id` and have it talk to your Noid service, e.g.:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
# app/models/my_object.rb
|
53
|
+
require 'active_fedora/noid'
|
54
|
+
|
55
|
+
class MyObject < ActiveFedora::Base
|
56
|
+
# ...
|
57
|
+
|
58
|
+
def assign_id
|
59
|
+
noid_service.mint
|
60
|
+
end
|
61
|
+
|
62
|
+
# ...
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def noid_service
|
67
|
+
@noid_service ||= ActiveFedora::Noid::Service.new
|
68
|
+
end
|
69
|
+
end
|
70
|
+
```
|
71
|
+
|
72
|
+
## Overriding default behavior
|
73
|
+
|
74
|
+
The default minter creates a Noid and dumps it to a statefile in the /tmp directory. You can override the location or name of this statefile as follows:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
require 'active_fedora/noid'
|
78
|
+
|
79
|
+
ActiveFedora::Noid.configure do |config|
|
80
|
+
config.statefile = '/var/foo/bar'
|
81
|
+
end
|
82
|
+
```
|
83
|
+
|
84
|
+
To override the default identifier pattern -- a nine-character string consisting of two alphanumeric digits, two numeric digits, two alphanumeric digits, two numeric digits, and a check digit -- put the following code in e.g. `config/initializers/active_fedora-noid.rb`:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
require 'active_fedora/noid'
|
88
|
+
|
89
|
+
ActiveFedora::Noid.configure do |config|
|
90
|
+
config.template = '.ddddd'
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
94
|
+
For more information about the format of Noid patterns, see pages 8-10 of the [Noid documentation](https://wiki.ucop.edu/download/attachments/16744482/noid.pdf).
|
95
|
+
|
96
|
+
If you don't want your minter's state to be persisted, you may also pass in your own minter. First write up a minter class that looks like the following:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
class MyMinter
|
100
|
+
def initialize(*args)
|
101
|
+
# do something if you need initialization
|
102
|
+
end
|
103
|
+
|
104
|
+
def mint
|
105
|
+
# spit out an identifier
|
106
|
+
end
|
107
|
+
|
108
|
+
def valid?(identifier)
|
109
|
+
# return true/false if you care about ids conforming to templates
|
110
|
+
end
|
111
|
+
end
|
112
|
+
```
|
113
|
+
|
114
|
+
Then inject an instance of your minter into ActiveFedora::Noid::Service:
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
noid_service = ActiveFedora::Noid::Service.new(MyMinter.new)
|
118
|
+
```
|
119
|
+
|
120
|
+
And the service will delegate minting and validating to an instance of your customized minter class.
|
121
|
+
|
122
|
+
# Help
|
123
|
+
|
124
|
+
If you have questions or need help, please email [the Hydra community tech list](mailto:hydra-tech@googlegroups.com) or stop by [the Hydra community IRC channel](irc://irc.freenode.net/projecthydra).
|
125
|
+
|
126
|
+
# Acknowledgments
|
127
|
+
|
128
|
+
This software has been developed by and is brought to you by the Hydra community. Learn more at the
|
129
|
+
[Project Hydra website](http://projecthydra.org)
|
130
|
+
|
131
|
+

|
data/active_fedora-noid.gemspec
CHANGED
@@ -10,17 +10,17 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["leftwing@alumni.rutgers.edu"]
|
11
11
|
spec.summary = %q{Noid identifier services for ActiveFedora-based applications}
|
12
12
|
spec.description = %q{Noid identifier services for ActiveFedora-based applications.}
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/projecthydra-labs/active_fedora-noid"
|
14
14
|
spec.license = "Apache2"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.test_files = spec.files.grep(%r{^spec/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency 'active-fedora'
|
21
|
-
spec.add_dependency 'noid'
|
20
|
+
spec.add_dependency 'active-fedora', '~> 9.0'
|
21
|
+
spec.add_dependency 'noid', '~> 0.7'
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency 'rspec'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
26
26
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
-
# files.
|
6
|
-
#
|
7
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
-
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
-
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
-
# a separate helper file that requires the additional dependencies and performs
|
12
|
-
# the additional setup, and require it from the spec files that actually need
|
13
|
-
# it.
|
14
|
-
#
|
15
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
-
# users commonly want.
|
17
|
-
#
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
18
4
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
5
|
RSpec.configure do |config|
|
20
6
|
# rspec-expectations config goes here. You can use an alternate
|
data/spec/unit/config_spec.rb
CHANGED
data/spec/unit/noid_spec.rb
CHANGED
data/spec/unit/service_spec.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_fedora-noid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael J. Giarlo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active-fedora
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '9.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: '0'
|
26
|
+
version: '9.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: noid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.7'
|
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: '0'
|
40
|
+
version: '0.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.2'
|
76
76
|
type: :development
|
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: '
|
82
|
+
version: '3.2'
|
83
83
|
description: Noid identifier services for ActiveFedora-based applications.
|
84
84
|
email:
|
85
85
|
- leftwing@alumni.rutgers.edu
|
@@ -88,11 +88,9 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
|
-
- ".ruby-gemset"
|
92
|
-
- ".ruby-version"
|
93
91
|
- ".travis.yml"
|
92
|
+
- CONTRIBUTING.md
|
94
93
|
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
94
|
- LICENSE
|
97
95
|
- README.md
|
98
96
|
- Rakefile
|
@@ -107,7 +105,7 @@ files:
|
|
107
105
|
- spec/unit/noid_spec.rb
|
108
106
|
- spec/unit/service_spec.rb
|
109
107
|
- spec/unit/synchronized_minter_spec.rb
|
110
|
-
homepage: https://github.com/
|
108
|
+
homepage: https://github.com/projecthydra-labs/active_fedora-noid
|
111
109
|
licenses:
|
112
110
|
- Apache2
|
113
111
|
metadata: {}
|
data/.ruby-gemset
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
afnoid
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1
|
data/Gemfile.lock
DELETED
@@ -1,190 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
active_fedora-noid (0.0.1)
|
5
|
-
active-fedora
|
6
|
-
noid
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
active-fedora (9.0.1)
|
12
|
-
active-triples (~> 0.6.0)
|
13
|
-
activesupport (>= 4.1.0)
|
14
|
-
deprecation
|
15
|
-
ldp (~> 0.2.1)
|
16
|
-
linkeddata
|
17
|
-
nom-xml (>= 0.5.1)
|
18
|
-
om (~> 3.1)
|
19
|
-
rdf-ldp
|
20
|
-
rdf-rdfxml (~> 1.1.0)
|
21
|
-
rsolr (~> 1.0.10)
|
22
|
-
active-triples (0.6.1)
|
23
|
-
activemodel (>= 3.0.0)
|
24
|
-
activesupport (>= 3.0.0)
|
25
|
-
deprecation (~> 0.1)
|
26
|
-
linkeddata (~> 1.1)
|
27
|
-
rdf (~> 1.1)
|
28
|
-
activemodel (4.2.0)
|
29
|
-
activesupport (= 4.2.0)
|
30
|
-
builder (~> 3.1)
|
31
|
-
activesupport (4.2.0)
|
32
|
-
i18n (~> 0.7)
|
33
|
-
json (~> 1.7, >= 1.7.7)
|
34
|
-
minitest (~> 5.1)
|
35
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
36
|
-
tzinfo (~> 1.1)
|
37
|
-
builder (3.2.2)
|
38
|
-
daemons (1.1.9)
|
39
|
-
deprecation (0.1.0)
|
40
|
-
activesupport
|
41
|
-
diff-lcs (1.2.5)
|
42
|
-
ebnf (0.3.6)
|
43
|
-
haml (~> 4.0)
|
44
|
-
rdf (~> 1.1)
|
45
|
-
sxp (~> 0.1, >= 0.1.3)
|
46
|
-
equivalent-xml (0.5.1)
|
47
|
-
nokogiri (>= 1.4.3)
|
48
|
-
faraday (0.9.1)
|
49
|
-
multipart-post (>= 1.2, < 3)
|
50
|
-
haml (4.0.6)
|
51
|
-
tilt
|
52
|
-
htmlentities (4.3.3)
|
53
|
-
http_logger (0.5.1)
|
54
|
-
i18n (0.7.0)
|
55
|
-
json (1.8.2)
|
56
|
-
json-ld (1.1.7)
|
57
|
-
rdf (~> 1.1, >= 1.1.4)
|
58
|
-
ldp (0.2.2)
|
59
|
-
faraday
|
60
|
-
http_logger
|
61
|
-
linkeddata (>= 1.1)
|
62
|
-
slop
|
63
|
-
link_header (0.0.8)
|
64
|
-
linkeddata (1.1.2)
|
65
|
-
equivalent-xml (~> 0.4)
|
66
|
-
json-ld (~> 1.1, >= 1.1.7)
|
67
|
-
nokogiri (~> 1.6)
|
68
|
-
rdf (~> 1.1, >= 1.1.7)
|
69
|
-
rdf-aggregate-repo (~> 1.1)
|
70
|
-
rdf-isomorphic (~> 1.1)
|
71
|
-
rdf-json (~> 1.1)
|
72
|
-
rdf-microdata (~> 2.0)
|
73
|
-
rdf-n3 (~> 1.1)
|
74
|
-
rdf-rdfa (~> 1.1, >= 1.1.5)
|
75
|
-
rdf-rdfxml (~> 1.1, >= 1.1.3)
|
76
|
-
rdf-reasoner (~> 0.2, >= 0.2.1)
|
77
|
-
rdf-trig (~> 1.1, >= 1.1.3)
|
78
|
-
rdf-trix (~> 1.1)
|
79
|
-
rdf-turtle (~> 1.1, >= 1.1.5)
|
80
|
-
sparql (~> 1.1, >= 1.1.4)
|
81
|
-
sparql-client (~> 1.1, >= 1.1.3)
|
82
|
-
mini_portile (0.6.2)
|
83
|
-
minitest (5.5.1)
|
84
|
-
multipart-post (2.0.0)
|
85
|
-
net-http-persistent (2.9.4)
|
86
|
-
noid (0.7.1)
|
87
|
-
nokogiri (1.6.6.2)
|
88
|
-
mini_portile (~> 0.6.0)
|
89
|
-
nom-xml (0.5.2)
|
90
|
-
activesupport (>= 3.2.18)
|
91
|
-
i18n
|
92
|
-
nokogiri
|
93
|
-
om (3.1.0)
|
94
|
-
activemodel
|
95
|
-
activesupport
|
96
|
-
nokogiri (>= 1.4.2)
|
97
|
-
solrizer (~> 3.3)
|
98
|
-
rake (10.4.2)
|
99
|
-
rdf (1.1.8)
|
100
|
-
link_header (~> 0.0, >= 0.0.8)
|
101
|
-
rdf-aggregate-repo (1.1.0)
|
102
|
-
rdf (>= 1.1)
|
103
|
-
rdf-isomorphic (1.1.0)
|
104
|
-
rdf (>= 1.1)
|
105
|
-
rdf-json (1.1.1)
|
106
|
-
rdf (~> 1.1)
|
107
|
-
rdf-ldp (0.0.4)
|
108
|
-
rdf
|
109
|
-
rdf-microdata (2.0)
|
110
|
-
htmlentities (~> 4.3)
|
111
|
-
nokogiri (~> 1.6)
|
112
|
-
rdf (~> 1.1)
|
113
|
-
rdf-xsd (~> 1.1)
|
114
|
-
rdf-n3 (1.1.2)
|
115
|
-
rdf (~> 1.1, >= 1.1.5)
|
116
|
-
rdf-rdfa (1.1.5)
|
117
|
-
haml (~> 4.0)
|
118
|
-
htmlentities (~> 4.3)
|
119
|
-
rdf (~> 1.1, >= 1.1.6)
|
120
|
-
rdf-aggregate-repo
|
121
|
-
rdf-xsd (~> 1.1)
|
122
|
-
rdf-rdfxml (1.1.3)
|
123
|
-
htmlentities (~> 4.3)
|
124
|
-
rdf (~> 1.1, >= 1.1.6)
|
125
|
-
rdf-rdfa (~> 1.1, >= 1.1.4.1)
|
126
|
-
rdf-xsd (~> 1.1)
|
127
|
-
rdf-reasoner (0.2.1)
|
128
|
-
rdf (~> 1.1, >= 1.1.4.2)
|
129
|
-
rdf-turtle (~> 1.1)
|
130
|
-
rdf-xsd (~> 1.1)
|
131
|
-
rdf-trig (1.1.3.1)
|
132
|
-
ebnf (~> 0.3, >= 0.3.5)
|
133
|
-
rdf (~> 1.1, >= 1.1.2.1)
|
134
|
-
rdf-turtle (~> 1.1, >= 1.1.3)
|
135
|
-
rdf-trix (1.1.0)
|
136
|
-
rdf (>= 1.1)
|
137
|
-
rdf-turtle (1.1.5)
|
138
|
-
ebnf (~> 0.3, >= 0.3.6)
|
139
|
-
rdf (~> 1.1, >= 1.1.4)
|
140
|
-
rdf-xsd (1.1.2)
|
141
|
-
rdf (~> 1.1)
|
142
|
-
rsolr (1.0.10)
|
143
|
-
builder (>= 2.1.2)
|
144
|
-
rspec (3.2.0)
|
145
|
-
rspec-core (~> 3.2.0)
|
146
|
-
rspec-expectations (~> 3.2.0)
|
147
|
-
rspec-mocks (~> 3.2.0)
|
148
|
-
rspec-core (3.2.0)
|
149
|
-
rspec-support (~> 3.2.0)
|
150
|
-
rspec-expectations (3.2.0)
|
151
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
152
|
-
rspec-support (~> 3.2.0)
|
153
|
-
rspec-mocks (3.2.0)
|
154
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
155
|
-
rspec-support (~> 3.2.0)
|
156
|
-
rspec-support (3.2.1)
|
157
|
-
slop (4.0.0)
|
158
|
-
solrizer (3.3.0)
|
159
|
-
activesupport
|
160
|
-
daemons
|
161
|
-
nokogiri
|
162
|
-
stomp
|
163
|
-
xml-simple
|
164
|
-
sparql (1.1.4)
|
165
|
-
builder (~> 3.0)
|
166
|
-
ebnf (~> 0.3, >= 0.3.5)
|
167
|
-
rdf (~> 1.1, >= 1.1.4)
|
168
|
-
rdf-aggregate-repo (~> 1.1, >= 1.1.0)
|
169
|
-
rdf-xsd (~> 1.1)
|
170
|
-
sparql-client (~> 1.1)
|
171
|
-
sxp (~> 0.1)
|
172
|
-
sparql-client (1.1.3.1)
|
173
|
-
net-http-persistent (~> 2.9)
|
174
|
-
rdf (~> 1.1)
|
175
|
-
stomp (1.3.4)
|
176
|
-
sxp (0.1.5)
|
177
|
-
thread_safe (0.3.4)
|
178
|
-
tilt (2.0.1)
|
179
|
-
tzinfo (1.2.2)
|
180
|
-
thread_safe (~> 0.1)
|
181
|
-
xml-simple (1.1.4)
|
182
|
-
|
183
|
-
PLATFORMS
|
184
|
-
ruby
|
185
|
-
|
186
|
-
DEPENDENCIES
|
187
|
-
active_fedora-noid!
|
188
|
-
bundler (~> 1.7)
|
189
|
-
rake (~> 10.0)
|
190
|
-
rspec
|