summon-refworks 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +9 -0
- data/lib/summon/RT.yaml +163 -0
- data/lib/summon/mappings.rb +78 -0
- data/lib/summon/refworks.rb +72 -0
- data/lib/summon/refworks/version.rb +5 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/summon/.rbx/c0/c09f9c2f95e2fad53664b38f979c18e2786d8f58 +241 -0
- data/spec/summon/refworks_spec.rb +29 -0
- data/summon-refworks.gemspec +22 -0
- metadata +110 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Charles Lowell
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Summon::Refworks
|
2
|
+
|
3
|
+
This provides an extension to the summon gem to convert summon documents
|
4
|
+
to [refworks tagged format][1]
|
5
|
+
|
6
|
+
It does this by implementing a single `to_refworks` method, which returns
|
7
|
+
a hash containing refworks tags as keys corresponding to field values.
|
8
|
+
|
9
|
+
### Basic Usage
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'summon/refworks'
|
13
|
+
document = summon.search('shakespeare').first
|
14
|
+
document.to_refworks #=> {:RT => ['Play'], :T1 => ['Romeo and Juliet'], ...}
|
15
|
+
```
|
16
|
+
|
17
|
+
### Advanced Usage
|
18
|
+
|
19
|
+
If you want to override the default mappings, you can do so by passing
|
20
|
+
in a hash of options to the `to_refworks` method where the keys are the
|
21
|
+
refworks tag names, and the values are either a value, a symbol or a proc
|
22
|
+
|
23
|
+
|
24
|
+
## Mappings
|
25
|
+
|
26
|
+
Content type mappings can be found in `lib/summon/refworks/RT.yaml`
|
27
|
+
|
28
|
+
Other field mappings are found in `lib/summon/refworks/mappings.rb`
|
29
|
+
|
30
|
+
## Installation
|
31
|
+
|
32
|
+
summon-refworks requires ruby > 1.9.2
|
33
|
+
|
34
|
+
Gemfile
|
35
|
+
|
36
|
+
gem 'summon-refworks'
|
37
|
+
|
38
|
+
standalone
|
39
|
+
|
40
|
+
gem install summon-refworks
|
41
|
+
|
42
|
+
[1]: http://www.refworks.com/rwathens/help/RefWorks_Tagged_Format.htm
|
data/Rakefile
ADDED
data/lib/summon/RT.yaml
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# This file is a mapping of Summon content types to
|
2
|
+
# corresponding Refworks 'reference types'. If a
|
3
|
+
# mapping is not found, or is left blank, then
|
4
|
+
# the 'Generic reference type will be used.
|
5
|
+
# see http://www.refworks.com/rwathens/help/RefWorks_Tagged_Format.htm
|
6
|
+
# for a complete listing of reference types.
|
7
|
+
|
8
|
+
# "newspaper article" => "Newspaper Article",
|
9
|
+
# "journal article" => "Journal Article",
|
10
|
+
# "dissertation" => 'Dissertation/Thesis',
|
11
|
+
# "book" => "Book, Whole",
|
12
|
+
# "patent" => "Patent",
|
13
|
+
# "conference proceeding" => "Conference Proceedings",
|
14
|
+
# "report" => "Report",
|
15
|
+
# "ebook" => "Book, Whole",
|
16
|
+
# "book chapter" => "Book, Section",
|
17
|
+
# "journal" => "Journal, Electronic",
|
18
|
+
# "ejournal" => "Journal, Electronic",
|
19
|
+
# "map" => "Map",
|
20
|
+
# "music score" => "Music Score",
|
21
|
+
# "video recording" => 'Video/DVD',
|
22
|
+
# "computer file" => "Computer Program",
|
23
|
+
# "photograph" => "Artwork",
|
24
|
+
# "audio recording" => "Sound Recording",
|
25
|
+
# "image" => "Artwork",
|
26
|
+
# "poster" => "Artwork",
|
27
|
+
# "paper" => "Report",
|
28
|
+
# "government document" => "Report",
|
29
|
+
# "manuscript" => "Book, Whole",
|
30
|
+
# "musical score" => "Music Score",
|
31
|
+
# "trade publication article" => "Journal, Electronic",
|
32
|
+
# "trade publication" => "Journal, Electronic",
|
33
|
+
# "magazine" => "Journal, Electronic"
|
34
|
+
|
35
|
+
|
36
|
+
Album:
|
37
|
+
Architectural Drawing:
|
38
|
+
Archival Material:
|
39
|
+
Art: Artwork
|
40
|
+
Artifact:
|
41
|
+
Atlas:
|
42
|
+
Audio Recording: Sound Recording
|
43
|
+
Audio Tape:
|
44
|
+
Blueprints:
|
45
|
+
Book: Book, Whole
|
46
|
+
Book Chapter: Book, Section
|
47
|
+
Book Review:
|
48
|
+
Case:
|
49
|
+
Catalog:
|
50
|
+
Ceremonial Object:
|
51
|
+
Citation:
|
52
|
+
Clothing:
|
53
|
+
Compact Disc:
|
54
|
+
Computer File: Computer Program
|
55
|
+
Course Reading:
|
56
|
+
Conference Proceeding: Conference Proceedings
|
57
|
+
Data Set:
|
58
|
+
Database:
|
59
|
+
Dissertation: Dissertation/Thesis
|
60
|
+
Drawing:
|
61
|
+
DVD: Video/ DVD
|
62
|
+
eBook: Book, Whole
|
63
|
+
eJournal: Journal, Electronic
|
64
|
+
Electronic Resource:
|
65
|
+
Equipment:
|
66
|
+
Exam:
|
67
|
+
Film:
|
68
|
+
Film Script:
|
69
|
+
Filmstrip:
|
70
|
+
Finding Aid:
|
71
|
+
Furnishing:
|
72
|
+
Globe:
|
73
|
+
Government Document: Report
|
74
|
+
Graphic Arts:
|
75
|
+
Houseware:
|
76
|
+
Ignored:
|
77
|
+
Image: Artwork
|
78
|
+
Implements:
|
79
|
+
Interactive Media:
|
80
|
+
Journal: Journal, Electronic
|
81
|
+
Journal Article: Journal Article
|
82
|
+
Kit:
|
83
|
+
Library Holding:
|
84
|
+
Magazine: Journal, Electronic
|
85
|
+
Magazine Article:
|
86
|
+
Manuscript: Book, Whole
|
87
|
+
Map: Map
|
88
|
+
Market Research:
|
89
|
+
Microfilm:
|
90
|
+
Microform:
|
91
|
+
Model:
|
92
|
+
Music Manuscript:
|
93
|
+
Music Score: Music Score
|
94
|
+
Music Recording:
|
95
|
+
Musical Instrument:
|
96
|
+
Newsletter:
|
97
|
+
Newspaper:
|
98
|
+
Newspaper Article: Newspaper Article
|
99
|
+
Painting:
|
100
|
+
Pamphlet:
|
101
|
+
Paper: Report
|
102
|
+
Patent: Patent
|
103
|
+
Personal Article:
|
104
|
+
Personal Narrative:
|
105
|
+
Photograph: Artwork
|
106
|
+
Poem:
|
107
|
+
Postcard:
|
108
|
+
Poster: Artwork
|
109
|
+
Play:
|
110
|
+
Presentation:
|
111
|
+
Publication:
|
112
|
+
Publication Article:
|
113
|
+
Realia:
|
114
|
+
Reference:
|
115
|
+
Report: Report
|
116
|
+
Research Guide:
|
117
|
+
Sheet Music:
|
118
|
+
Slide:
|
119
|
+
Special Collection:
|
120
|
+
Spoken Word Recording:
|
121
|
+
Standard:
|
122
|
+
Streaming Audio:
|
123
|
+
Streaming Video:
|
124
|
+
Technical Report:
|
125
|
+
Tool:
|
126
|
+
Trade Publication: Journal, Electronic
|
127
|
+
Trade Publication Article: Journal, Electronic
|
128
|
+
Transcript:
|
129
|
+
Unknown:
|
130
|
+
Video Recording: Video/DVD
|
131
|
+
Web Resource:
|
132
|
+
Archival Material/Manuscripts:
|
133
|
+
Audio-visual:
|
134
|
+
CD/DVD:
|
135
|
+
Digital Collection:
|
136
|
+
Learning Object:
|
137
|
+
Library Research Guide:
|
138
|
+
Online Archival Material:
|
139
|
+
Online Audio Recording:
|
140
|
+
Online Dissertation:
|
141
|
+
Online Image:
|
142
|
+
Online Map:
|
143
|
+
Online Music Score: Music Score
|
144
|
+
Online Video Recording:
|
145
|
+
Performance:
|
146
|
+
Research Publication:
|
147
|
+
Streaming Audio:
|
148
|
+
Streaming Video:
|
149
|
+
Student Thesis:
|
150
|
+
Article:
|
151
|
+
Serial:
|
152
|
+
Video Cassette:
|
153
|
+
Video DVD:
|
154
|
+
Music CD:
|
155
|
+
Music LP:
|
156
|
+
Music:
|
157
|
+
Audio Book on Cassette:
|
158
|
+
Audio Book on CD:
|
159
|
+
Sound Recording:
|
160
|
+
Maps and Atlases:
|
161
|
+
Software:
|
162
|
+
Text:
|
163
|
+
Mixed:
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#These are the mappings from which
|
2
|
+
#refworks will draw its tags. On the left is the refworks tag
|
3
|
+
#on the right an expression which will yield that value given
|
4
|
+
#a summon document.
|
5
|
+
|
6
|
+
#This is an exhaustive list of refworks fields according to:
|
7
|
+
#http://www.refworks.com/rwathens/help/RefWorks_Tagged_Format.htm
|
8
|
+
#so some mappings are inevitably going to be blank.
|
9
|
+
|
10
|
+
{
|
11
|
+
RT: ->() { content_type_to_reference_type }, #Reference Type
|
12
|
+
SR: blank, #Source Type (field is either Print(0) or Electronic(1) )
|
13
|
+
ID: blank, #Reference Identifier
|
14
|
+
A1: ->() { authors.map(&:name) + corporate_authors.map(&:name) }, #Primary Authors
|
15
|
+
T1: ->() { subtitle ? "#{title}: #{subtitle}" : title}, #Primary Title
|
16
|
+
JF: ->() { publication_title }, #Periodical Full
|
17
|
+
JO: blank, #Periodical Abbrev
|
18
|
+
YR: ->() { publication_date.year.to_s }, #Publication Year
|
19
|
+
FD: blank, #Publication Data, Free Form
|
20
|
+
VO: ->() { volume }, #Volume
|
21
|
+
IS: ->() { issue }, #Issue
|
22
|
+
SP: ->() { start_page }, #Start Page
|
23
|
+
OP: ->() { end_page }, #Other Pages
|
24
|
+
K1: ->() { subject_terms.tag_per_value }, #Keyword
|
25
|
+
AB: ->() { abstract }, #Abstract
|
26
|
+
NO: ->() { isi_cited_references_count ? uri : url }, #Notes
|
27
|
+
A2: blank, #Secondary Authors
|
28
|
+
T2: blank, #Secondary Title
|
29
|
+
ED: blank, #Edition
|
30
|
+
PB: ->() { publisher }, #Publisher
|
31
|
+
PP: ->() { publication_place }, #Place of Publication
|
32
|
+
A3: blank, #Tertiary Authors
|
33
|
+
A4: blank, #Quaternary Authors
|
34
|
+
A5: blank, #Quinary Authors
|
35
|
+
T3: blank, #Tertiary Title
|
36
|
+
SN: ->() { issns.empty? ? isbns : issns }, #ISSN/ISBN
|
37
|
+
AV: blank, #Availability
|
38
|
+
AD: blank, #Author Address
|
39
|
+
AN: blank, #Accession Number
|
40
|
+
LA: ->() { languages }, #Language
|
41
|
+
CL: blank, #Classification
|
42
|
+
SF: blank, #Subfile/Database
|
43
|
+
OT: blank, #Original Foreign Title
|
44
|
+
LK: blank, #Links
|
45
|
+
DO: ->() { doi }, #Digital Object Identifier
|
46
|
+
CN: blank, #Call Number
|
47
|
+
DB: blank, #Database
|
48
|
+
DS: blank, #Data Source
|
49
|
+
IP: blank, #Identifying Phrase
|
50
|
+
RD: blank, #Retrieved Date
|
51
|
+
ST: blank, #Shortened Title
|
52
|
+
U1: blank, #User 1
|
53
|
+
U2: blank, #User 2
|
54
|
+
U3: blank, #User 3
|
55
|
+
U4: blank, #User 4
|
56
|
+
U5: ->() { [thumbnail_small, thumbnail_medium, thumbnail_large] if thumbnail_large}, #User 5
|
57
|
+
U6: ->() { open_url }, #User 6
|
58
|
+
U7: ->() { content_type }, #User 7
|
59
|
+
U8: blank, #User 8
|
60
|
+
U9: blank, #User 9
|
61
|
+
U10: blank, #User 10
|
62
|
+
U11: blank, #User 11
|
63
|
+
U12: blank, #User 12
|
64
|
+
U13: blank, #User 13
|
65
|
+
U14: blank, #User 14
|
66
|
+
U15: blank, #User 15
|
67
|
+
UL: ->() { link }, #URL
|
68
|
+
SL: blank, #Sponsoring Library
|
69
|
+
LL: blank, #Sponsoring Library Location
|
70
|
+
CR: blank, #Cited References
|
71
|
+
WT: blank, #Website Title
|
72
|
+
A6: blank, #Website editors
|
73
|
+
WV: blank, #Website version
|
74
|
+
WP: blank, #Date of Electronic Publication
|
75
|
+
OL: blank, #Output Language (see codes for specific languages below)
|
76
|
+
PMID: blank, #PMID
|
77
|
+
PMCID: blank, #PMCID
|
78
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'summon'
|
3
|
+
require "summon/refworks/version"
|
4
|
+
module Summon
|
5
|
+
module Refworks
|
6
|
+
def to_refworks(options = {})
|
7
|
+
Builder.build self, options
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_refworks_text(options = {})
|
11
|
+
buffer = StringIO.new
|
12
|
+
to_refworks(options).each do |key, values|
|
13
|
+
values.each do |value|
|
14
|
+
buffer.puts "#{key} #{value}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
buffer.string
|
18
|
+
end
|
19
|
+
|
20
|
+
module Builder
|
21
|
+
define_method(:blank) {''}
|
22
|
+
|
23
|
+
def self.build(document, options)
|
24
|
+
document.extend self
|
25
|
+
document.to_refworks_tagged_format options
|
26
|
+
end
|
27
|
+
|
28
|
+
def refworks_tags
|
29
|
+
filename = File.expand_path("../mappings.rb", __FILE__)
|
30
|
+
eval(File.read(filename), binding, filename, 1)
|
31
|
+
end
|
32
|
+
|
33
|
+
def refworks_normal(value)
|
34
|
+
if value.kind_of?(Array)
|
35
|
+
value.tag_per_value? ? value : [value.join(', ')]
|
36
|
+
else
|
37
|
+
[value]
|
38
|
+
end.compact
|
39
|
+
end
|
40
|
+
|
41
|
+
def content_type_to_reference_type
|
42
|
+
mapping = YAML.load(File.read File.expand_path("../RT.yaml", __FILE__))
|
43
|
+
mapping[content_type] || 'Generic'
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_refworks_tagged_format(options)
|
47
|
+
{}.tap do |tags|
|
48
|
+
refworks_tags.merge(options).each do |tag, mapping|
|
49
|
+
tags[tag] = refworks_normal case mapping
|
50
|
+
when Symbol then send(mapping)
|
51
|
+
when Proc then mapping.call()
|
52
|
+
else mapping; end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
class Document
|
59
|
+
include Refworks
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class ::Array
|
64
|
+
def tag_per_value
|
65
|
+
self.tap do
|
66
|
+
@tag_per_value = true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
def tag_per_value?
|
70
|
+
@tag_per_value
|
71
|
+
end
|
72
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
!RBIX
|
2
|
+
2074804382012766664
|
3
|
+
18
|
4
|
+
M
|
5
|
+
1
|
6
|
+
n
|
7
|
+
n
|
8
|
+
x
|
9
|
+
10
|
10
|
+
__script__
|
11
|
+
i
|
12
|
+
24
|
13
|
+
5
|
14
|
+
7
|
15
|
+
0
|
16
|
+
64
|
17
|
+
47
|
18
|
+
49
|
19
|
+
1
|
20
|
+
1
|
21
|
+
15
|
22
|
+
5
|
23
|
+
45
|
24
|
+
2
|
25
|
+
3
|
26
|
+
43
|
27
|
+
4
|
28
|
+
56
|
29
|
+
5
|
30
|
+
47
|
31
|
+
50
|
32
|
+
6
|
33
|
+
1
|
34
|
+
15
|
35
|
+
2
|
36
|
+
11
|
37
|
+
I
|
38
|
+
3
|
39
|
+
I
|
40
|
+
0
|
41
|
+
I
|
42
|
+
0
|
43
|
+
I
|
44
|
+
0
|
45
|
+
I
|
46
|
+
0
|
47
|
+
n
|
48
|
+
p
|
49
|
+
7
|
50
|
+
s
|
51
|
+
E
|
52
|
+
0
|
53
|
+
|
54
|
+
11
|
55
|
+
spec_helper
|
56
|
+
x
|
57
|
+
7
|
58
|
+
require
|
59
|
+
x
|
60
|
+
6
|
61
|
+
Summon
|
62
|
+
n
|
63
|
+
x
|
64
|
+
8
|
65
|
+
Refworks
|
66
|
+
M
|
67
|
+
1
|
68
|
+
p
|
69
|
+
2
|
70
|
+
x
|
71
|
+
9
|
72
|
+
for_block
|
73
|
+
t
|
74
|
+
n
|
75
|
+
x
|
76
|
+
9
|
77
|
+
__block__
|
78
|
+
i
|
79
|
+
11
|
80
|
+
5
|
81
|
+
7
|
82
|
+
0
|
83
|
+
64
|
84
|
+
56
|
85
|
+
1
|
86
|
+
47
|
87
|
+
50
|
88
|
+
2
|
89
|
+
1
|
90
|
+
11
|
91
|
+
I
|
92
|
+
4
|
93
|
+
I
|
94
|
+
0
|
95
|
+
I
|
96
|
+
0
|
97
|
+
I
|
98
|
+
0
|
99
|
+
I
|
100
|
+
0
|
101
|
+
I
|
102
|
+
-2
|
103
|
+
p
|
104
|
+
3
|
105
|
+
s
|
106
|
+
E
|
107
|
+
0
|
108
|
+
|
109
|
+
23
|
110
|
+
extends summon document
|
111
|
+
M
|
112
|
+
1
|
113
|
+
p
|
114
|
+
2
|
115
|
+
x
|
116
|
+
9
|
117
|
+
for_block
|
118
|
+
t
|
119
|
+
n
|
120
|
+
x
|
121
|
+
9
|
122
|
+
__block__
|
123
|
+
i
|
124
|
+
32
|
125
|
+
45
|
126
|
+
0
|
127
|
+
1
|
128
|
+
43
|
129
|
+
2
|
130
|
+
13
|
131
|
+
71
|
132
|
+
3
|
133
|
+
47
|
134
|
+
9
|
135
|
+
23
|
136
|
+
47
|
137
|
+
49
|
138
|
+
4
|
139
|
+
0
|
140
|
+
13
|
141
|
+
47
|
142
|
+
49
|
143
|
+
5
|
144
|
+
0
|
145
|
+
15
|
146
|
+
8
|
147
|
+
26
|
148
|
+
49
|
149
|
+
3
|
150
|
+
0
|
151
|
+
49
|
152
|
+
6
|
153
|
+
0
|
154
|
+
19
|
155
|
+
0
|
156
|
+
11
|
157
|
+
I
|
158
|
+
4
|
159
|
+
I
|
160
|
+
1
|
161
|
+
I
|
162
|
+
0
|
163
|
+
I
|
164
|
+
0
|
165
|
+
I
|
166
|
+
0
|
167
|
+
I
|
168
|
+
-2
|
169
|
+
p
|
170
|
+
7
|
171
|
+
x
|
172
|
+
6
|
173
|
+
Summon
|
174
|
+
n
|
175
|
+
x
|
176
|
+
6
|
177
|
+
Canned
|
178
|
+
x
|
179
|
+
3
|
180
|
+
new
|
181
|
+
x
|
182
|
+
8
|
183
|
+
allocate
|
184
|
+
x
|
185
|
+
10
|
186
|
+
initialize
|
187
|
+
x
|
188
|
+
6
|
189
|
+
search
|
190
|
+
p
|
191
|
+
3
|
192
|
+
I
|
193
|
+
0
|
194
|
+
I
|
195
|
+
5
|
196
|
+
I
|
197
|
+
20
|
198
|
+
x
|
199
|
+
75
|
200
|
+
/Users/cowboyd/Projects/Sersol/summon-refworks/spec/summon/refworks_spec.rb
|
201
|
+
p
|
202
|
+
1
|
203
|
+
x
|
204
|
+
8
|
205
|
+
document
|
206
|
+
x
|
207
|
+
2
|
208
|
+
it
|
209
|
+
p
|
210
|
+
3
|
211
|
+
I
|
212
|
+
0
|
213
|
+
I
|
214
|
+
4
|
215
|
+
I
|
216
|
+
b
|
217
|
+
x
|
218
|
+
75
|
219
|
+
/Users/cowboyd/Projects/Sersol/summon-refworks/spec/summon/refworks_spec.rb
|
220
|
+
p
|
221
|
+
0
|
222
|
+
x
|
223
|
+
8
|
224
|
+
describe
|
225
|
+
p
|
226
|
+
5
|
227
|
+
I
|
228
|
+
0
|
229
|
+
I
|
230
|
+
1
|
231
|
+
I
|
232
|
+
9
|
233
|
+
I
|
234
|
+
3
|
235
|
+
I
|
236
|
+
18
|
237
|
+
x
|
238
|
+
75
|
239
|
+
/Users/cowboyd/Projects/Sersol/summon-refworks/spec/summon/refworks_spec.rb
|
240
|
+
p
|
241
|
+
0
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Summon::Refworks do
|
4
|
+
before do
|
5
|
+
@search = Summon::Service.new(:transport => Summon::Transport::Canned.new).search
|
6
|
+
@doc = @search.documents.first
|
7
|
+
end
|
8
|
+
it "extends summon document" do
|
9
|
+
@doc.to_refworks.should include(:RT => ["Newspaper Article"])
|
10
|
+
end
|
11
|
+
it "uses the 'Generic' for RT if no mapping is present" do
|
12
|
+
@doc.stub(:content_type) {"Opaque"}
|
13
|
+
@doc.to_refworks[:RT].should eql ['Generic']
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "controlling how multiple values are concatenated" do
|
17
|
+
before do
|
18
|
+
@doc.stub(:multi_value) {[1,2,3]}
|
19
|
+
end
|
20
|
+
|
21
|
+
it "joins multiple values with ', ' by default" do
|
22
|
+
@doc.to_refworks(:multi_value => lambda {@doc.multi_value})[:multi_value].should eql ["1, 2, 3"]
|
23
|
+
end
|
24
|
+
|
25
|
+
it "accepts the option to preseve multiple values per field" do
|
26
|
+
@doc.to_refworks(:multi_value => lambda {@doc.multi_value.tag_per_value})[:multi_value].should eql [1,2,3]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/summon/refworks/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Serials Solutions, Inc."]
|
6
|
+
gem.email = ["summon@serialssolutions.com"]
|
7
|
+
gem.description = %q{convert summon documents to refworks tagged format}
|
8
|
+
gem.summary = %q{Summon has a schema, so does Refworks. this handy tool lets you go from one to the other}
|
9
|
+
gem.homepage = "https://github.com/summon/summon-refworks.rb"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "summon-refworks"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Summon::Refworks::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'summon', '~> 2.0.0'
|
19
|
+
|
20
|
+
gem.add_development_dependency 'rake'
|
21
|
+
gem.add_development_dependency 'rspec'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: summon-refworks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Serials Solutions, Inc.
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: summon
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.0.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: convert summon documents to refworks tagged format
|
63
|
+
email:
|
64
|
+
- summon@serialssolutions.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- lib/summon/RT.yaml
|
75
|
+
- lib/summon/mappings.rb
|
76
|
+
- lib/summon/refworks.rb
|
77
|
+
- lib/summon/refworks/version.rb
|
78
|
+
- spec/spec_helper.rb
|
79
|
+
- spec/summon/.rbx/c0/c09f9c2f95e2fad53664b38f979c18e2786d8f58
|
80
|
+
- spec/summon/refworks_spec.rb
|
81
|
+
- summon-refworks.gemspec
|
82
|
+
homepage: https://github.com/summon/summon-refworks.rb
|
83
|
+
licenses: []
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
requirements: []
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.8.24
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: Summon has a schema, so does Refworks. this handy tool lets you go from one
|
106
|
+
to the other
|
107
|
+
test_files:
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/summon/.rbx/c0/c09f9c2f95e2fad53664b38f979c18e2786d8f58
|
110
|
+
- spec/summon/refworks_spec.rb
|