enju_trunk_frbr 1.0.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.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = EnjuTrunkFrbr
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'EnjuTrunkFrbr'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module EnjuTrunkFrbr
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module EnjuTrunkFrbr
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,24 @@
1
+ class Create < ActiveRecord::Base
2
+ belongs_to :work, :class_name => 'Manifestation', :foreign_key => 'work_id'
3
+
4
+ validates_associated :work
5
+ validates_presence_of :patron_id, :work_id
6
+ validates_uniqueness_of :work_id, :scope => :patron_id
7
+
8
+ acts_as_list :scope => :work
9
+ attr_accessible :work_id, :patron_id, :work, :patron
10
+ end
11
+
12
+ # == Schema Information
13
+ #
14
+ # Table name: creates
15
+ #
16
+ # id :integer not null, primary key
17
+ # patron_id :integer not null
18
+ # work_id :integer not null
19
+ # position :integer
20
+ # type :string(255)
21
+ # created_at :datetime
22
+ # updated_at :datetime
23
+ #
24
+
@@ -0,0 +1,42 @@
1
+ class Exemplify < ActiveRecord::Base
2
+ belongs_to :manifestation
3
+ belongs_to :item
4
+
5
+ validates_associated :manifestation, :item
6
+ validates_presence_of :manifestation_id, :item_id
7
+ validates_uniqueness_of :item_id
8
+ after_save :reindex
9
+ after_destroy :reindex
10
+ after_create :create_lending_policy
11
+
12
+ acts_as_list :scope => :manifestation_id
13
+
14
+ def self.per_page
15
+ 10
16
+ end
17
+
18
+ def reindex
19
+ manifestation.try(:index)
20
+ item.try(:index)
21
+ end
22
+
23
+ def create_lending_policy
24
+ UserGroupHasCheckoutType.available_for_item(item).each do |rule|
25
+ LendingPolicy.create!(:item_id => item.id, :user_group_id => rule.user_group_id, :fixed_due_date => rule.fixed_due_date, :loan_period => rule.checkout_period, :renewal => rule.checkout_renewal_limit)
26
+ end
27
+ end
28
+ end
29
+
30
+ # == Schema Information
31
+ #
32
+ # Table name: exemplifies
33
+ #
34
+ # id :integer not null, primary key
35
+ # manifestation_id :integer not null
36
+ # item_id :integer not null
37
+ # type :string(255)
38
+ # position :integer
39
+ # created_at :datetime
40
+ # updated_at :datetime
41
+ #
42
+
@@ -0,0 +1,67 @@
1
+ # -*- encoding: utf-8 -*-
2
+ class Item < ActiveRecord::Base
3
+ scope :recent, where(['items.created_at >= ?', Time.zone.now.months_ago(1)])
4
+ has_one :exemplify
5
+ has_one :manifestation, :through => :exemplify
6
+
7
+ validates :item_identifier, :allow_blank => true, :uniqueness => true, :format => {:with => /\A[0-9A-Za-z_]+\Z/}
8
+ validates :url, :url => true, :allow_blank => true, :length => {:maximum => 255}
9
+ validates_date :acquired_at, :allow_blank => true
10
+
11
+ normalize_attributes :item_identifier
12
+
13
+ attr_accessor :library_id, :manifestation_id, :use_restriction_id
14
+
15
+ def title
16
+ manifestation.try(:original_title)
17
+ end
18
+
19
+ def select_acquired_at
20
+ if self.acquired_at
21
+ return self.acquired_at.strftime("%Y%m")
22
+ else
23
+ return Time.now.strftime("%Y%m")
24
+ end
25
+ end
26
+
27
+ private
28
+ def self.to_format(num)
29
+ num.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,')
30
+ end
31
+
32
+ def self.get_object_method(obj,array)
33
+ _obj = obj.send(array.shift)
34
+ return get_object_method(_obj, array) if array.present?
35
+ return _obj
36
+ end
37
+
38
+ end
39
+
40
+ # == Schema Information
41
+ #
42
+ # Table name: items
43
+ #
44
+ # id :integer not null, primary key
45
+ # call_number :string(255)
46
+ # item_identifier :string(255)
47
+ # circulation_status_id :integer not null
48
+ # checkout_type_id :integer default(1), not null
49
+ # created_at :datetime
50
+ # updated_at :datetime
51
+ # deleted_at :datetime
52
+ # shelf_id :integer default(1), not null
53
+ # include_supplements :boolean default(FALSE), not null
54
+ # checkouts_count :integer default(0), not null
55
+ # owns_count :integer default(0), not null
56
+ # resource_has_subjects_count :integer default(0), not null
57
+ # note :text
58
+ # curl :string(255)
59
+ # price :integer
60
+ # lock_version :integer default(0), not null
61
+ # required_role_id :integer default(1), not null
62
+ # state :string(255)
63
+ # required_score :integer default(0), not null
64
+ # acquired_at :datetime
65
+ # bookstore_id :integer
66
+ #
67
+
@@ -0,0 +1,315 @@
1
+ class Manifestation < ActiveRecord::Base
2
+ scope :periodical_master, where(:periodical_master => true)
3
+ scope :periodical_children, where(:periodical_master => false)
4
+ has_many :creates, :dependent => :destroy, :foreign_key => 'work_id'
5
+ has_many :realizes, :dependent => :destroy, :foreign_key => 'expression_id'
6
+ has_many :produces, :dependent => :destroy, :foreign_key => 'manifestation_id'
7
+ has_many :exemplifies, :foreign_key => 'manifestation_id'
8
+ has_many :items, :through => :exemplifies #, :foreign_key => 'manifestation_id'
9
+ has_many :children, :foreign_key => 'parent_id', :class_name => 'ManifestationRelationship', :dependent => :destroy
10
+ has_many :parents, :foreign_key => 'child_id', :class_name => 'ManifestationRelationship', :dependent => :destroy
11
+ has_many :derived_manifestations, :through => :children, :source => :child
12
+ has_many :original_manifestations, :through => :parents, :source => :parent
13
+ belongs_to :manifestation_relationship_type
14
+
15
+ validates_presence_of :original_title
16
+ validates :isbn, :uniqueness => true, :allow_blank => true, :unless => proc{|manifestation| manifestation.series_statement}
17
+ validates :nbn, :uniqueness => true, :allow_blank => true
18
+ validates :identifier, :uniqueness => true, :allow_blank => true
19
+ validates :access_address, :url => true, :allow_blank => true, :length => {:maximum => 255}
20
+ validate :check_isbn, :check_issn, :check_lccn, :unless => :during_import
21
+
22
+ #validate :check_pub_date
23
+ before_validation :set_wrong_isbn, :check_issn, :check_lccn, :if => :during_import
24
+ before_validation :convert_isbn
25
+ before_create :set_digest
26
+ after_create :clear_cached_numdocs
27
+ before_save :set_date_of_publication, :set_new_serial_number, :set_volume_issue_number
28
+ before_save :delete_attachment?
29
+ normalize_attributes :identifier, :pub_date, :isbn, :issn, :nbn, :lccn, :original_title
30
+ attr_accessible :delete_attachment
31
+ attr_accessor :series_statement_id
32
+ attr_protected :periodical_master
33
+
34
+ def check_pub_date
35
+ logger.info "manifestaion#check pub_date=#{self.pub_date}"
36
+ date = self.pub_date.to_s.gsub(' ', '').dup
37
+ return if date.blank?
38
+
39
+ unless date =~ /^\d+(-\d{0,2}){0,2}$/
40
+ errors.add(:pub_date); return
41
+ end
42
+
43
+ if date =~ /^[0-9]+$/ # => YYYY / YYYYMM / YYYYMMDD
44
+ case date.length
45
+ when 4
46
+ date = "#{date}-01-01"
47
+ when 6
48
+ year = date.slice(0, 4)
49
+ month = date.slice(4, 2)
50
+ date = "#{year}-#{month}-01"
51
+ when 8
52
+ year = date.slice(0, 4)
53
+ month = date.slice(4, 2)
54
+ day = date.slice(6, 2)
55
+ date = "#{year}-#{month}-#{day}"
56
+ else
57
+ errors.add(:pub_date); return
58
+ end
59
+ else
60
+ date_a = date.split(/\D/) #=> ex. YYYY / YYYY-MM / YYYY-MM-DD / YY-MM-DD
61
+ year = date_a[0]
62
+ month = date_a[1]
63
+ day = date_a[2]
64
+ date = "#{year}-01-01" unless month and day
65
+ date = "#{year}-#{month}-01" unless day
66
+ date = "#{year}-#{month}-#{day}" if year and month and day
67
+ end
68
+
69
+ begin
70
+ date = Time.zone.parse(date)
71
+ rescue
72
+ errors.add(:pub_date)
73
+ end
74
+ end
75
+
76
+ def check_isbn
77
+ if isbn.present?
78
+ unless Lisbn.new(isbn).valid?
79
+ errors.add(:isbn)
80
+ end
81
+ end
82
+ end
83
+
84
+ def check_issn
85
+ if issn.present?
86
+ self.issn = Lisbn.new(issn)
87
+ unless StdNum::ISSN.valid?(issn)
88
+ errors.add(:issn)
89
+ end
90
+ end
91
+ end
92
+
93
+ def check_lccn
94
+ if lccn.present?
95
+ unless StdNum::LCCN.valid?(lccn, true)
96
+ errors.add(:lccn)
97
+ end
98
+ end
99
+ end
100
+
101
+ def set_wrong_isbn
102
+ if isbn.present?
103
+ unless Lisbn.new(isbn).valid?
104
+ self.wrong_isbn
105
+ self.isbn = nil
106
+ end
107
+ end
108
+ end
109
+
110
+ def convert_isbn
111
+ num = Lisbn.new(isbn) if isbn
112
+ if num
113
+ if num.length == 10
114
+ self.isbn10 = num
115
+ self.isbn = num.isbn13
116
+ elsif num.length == 13
117
+ self.isbn10 = num.isbn10
118
+ end
119
+ end
120
+ end
121
+
122
+ def set_date_of_publication
123
+ return if pub_date.blank?
124
+ begin
125
+ date = Time.zone.parse("#{pub_date}")
126
+ rescue ArgumentError
127
+ begin
128
+ date = Time.zone.parse("#{pub_date}-01")
129
+ date = date.end_of_month
130
+ rescue ArgumentError
131
+ begin
132
+ date = Time.zone.parse("#{pub_date}-12-01")
133
+ date = date.end_of_month
134
+ rescue ArgumentError
135
+ nil
136
+ end
137
+ end
138
+ end
139
+ self.date_of_publication = date
140
+ end
141
+
142
+ def self.cached_numdocs
143
+ Rails.cache.fetch("manifestation_search_total"){Manifestation.search.total}
144
+ end
145
+
146
+ def clear_cached_numdocs
147
+ Rails.cache.delete("manifestation_search_total")
148
+ end
149
+
150
+ def parent_of_series
151
+ original_manifestations
152
+ end
153
+
154
+ def number_of_pages
155
+ if self.start_page and self.end_page
156
+ if self.start_page.to_s.match(/\D/).nil? and self.end_page.to_s.match(/\D/).nil?
157
+ page = self.end_page.to_i - self.start_page.to_i + 1
158
+ end
159
+ end
160
+ end
161
+
162
+ def titles
163
+ title = []
164
+ title << original_title.to_s.strip
165
+ title << title_transcription.to_s.strip
166
+ title << title_alternative.to_s.strip
167
+ #title << original_title.wakati
168
+ #title << title_transcription.wakati rescue nil
169
+ #title << title_alternative.wakati rescue nil
170
+ title
171
+ end
172
+
173
+ def set_new_serial_number
174
+ self.serial_number = self.serial_number_string.gsub(/\D/, "").to_i if self.serial_number_string rescue nil
175
+ end
176
+
177
+ def set_volume_issue_number
178
+ self.volume_number = (self.volume_number_string.gsub(/\D/, "")).to_i if self.volume_number_string rescue nil
179
+ self.issue_number = self.issue_number_string.gsub(/\D/, "").to_i if self.issue_number_string rescue nil
180
+
181
+ if self.volume_number && self.volume_number.to_s.length > 9
182
+ self.volume_number = nil
183
+ end
184
+ end
185
+
186
+ def title
187
+ titles
188
+ end
189
+
190
+ def hyphenated_isbn
191
+ Lisbn.new(isbn).parts.join("-")
192
+ end
193
+
194
+ def set_digest(options = {:type => 'sha1'})
195
+ if attachment.queued_for_write[:original]
196
+ if File.exists?(attachment.queued_for_write[:original])
197
+ self.file_hash = Digest::SHA1.hexdigest(File.open(attachment.queued_for_write[:original].path, 'rb').read)
198
+ end
199
+ end
200
+ end
201
+
202
+ =begin
203
+ def volume_number
204
+ volume_number_string.gsub(/\D/, ' ').split(" ") if volume_number_string
205
+ end
206
+
207
+ def issue_number
208
+ issue_number_string.gsub(/\D/, ' ').split(" ") if issue_number_string
209
+ end
210
+
211
+ def serial_number
212
+ serial_number_string.gsub(/\D/, ' ').split(" ") if serial_number_string
213
+ end
214
+ =end
215
+
216
+ def self.find_by_isbn(isbn)
217
+ lisbn = Lisbn.new(isbn)
218
+ if lisbn.valid?
219
+ #ISBN_Tools.cleanup!(isbn)
220
+ if isbn.size == 10
221
+ Manifestation.where(:isbn => lisbn.isbn13).first || Manifestation.where(:isbn => lisbn).first
222
+ else
223
+ Manifestation.where(:isbn => lisbn).first || Manifestation.where(:isbn => lisbn.isbn10).first
224
+ end
225
+ end
226
+ end
227
+
228
+ def acquired_at
229
+ items.order(:acquired_at).first.try(:acquired_at)
230
+ end
231
+
232
+ def delete_attachment
233
+ @delete_attachment ||= "0"
234
+ end
235
+
236
+ def delete_attachment=(value)
237
+ @delete_attachment = value
238
+ end
239
+
240
+ private
241
+ def delete_attachment?
242
+ self.attachment.clear if @delete_attachment == "1"
243
+ end
244
+
245
+ end
246
+
247
+ # == Schema Information
248
+ #
249
+ # Table name: manifestations
250
+ #
251
+ # id :integer not null, primary key
252
+ # original_title :text not null
253
+ # title_alternative :text
254
+ # title_transcription :text
255
+ # classification_number :string(255)
256
+ # identifier :string(255)
257
+ # date_of_publication :datetime
258
+ # date_copyrighted :datetime
259
+ # created_at :datetime
260
+ # updated_at :datetime
261
+ # deleted_at :datetime
262
+ # access_address :string(255)
263
+ # language_id :integer default(1), not null
264
+ # carrier_type_id :integer default(1), not null
265
+ # extent_id :integer default(1), not null
266
+ # start_page :integer
267
+ # end_page :integer
268
+ # height :decimal(, )
269
+ # width :decimal(, )
270
+ # depth :decimal(, )
271
+ # isbn :string(255)
272
+ # isbn10 :string(255)
273
+ # wrong_isbn :string(255)
274
+ # nbn :string(255)
275
+ # lccn :string(255)
276
+ # oclc_number :string(255)
277
+ # issn :string(255)
278
+ # price :integer
279
+ # fulltext :text
280
+ # volume_number_string :string(255)
281
+ # issue_number_string :string(255)
282
+ # serial_number_string :string(255)
283
+ # edition :integer
284
+ # note :text
285
+ # produces_count :integer default(0), not null
286
+ # exemplifies_count :integer default(0), not null
287
+ # embodies_count :integer default(0), not null
288
+ # work_has_subjects_count :integer default(0), not null
289
+ # repository_content :boolean default(FALSE), not null
290
+ # lock_version :integer default(0), not null
291
+ # required_role_id :integer default(1), not null
292
+ # state :string(255)
293
+ # required_score :integer default(0), not null
294
+ # frequency_id :integer default(1), not null
295
+ # subscription_master :boolean default(FALSE), not null
296
+ # ipaper_id :integer
297
+ # ipaper_access_key :string(255)
298
+ # attachment_file_name :string(255)
299
+ # attachment_content_type :string(255)
300
+ # attachment_file_size :integer
301
+ # attachment_updated_at :datetime
302
+ # nii_type_id :integer
303
+ # title_alternative_transcription :text
304
+ # description :text
305
+ # abstract :text
306
+ # available_at :datetime
307
+ # valid_until :datetime
308
+ # date_submitted :datetime
309
+ # date_accepted :datetime
310
+ # date_caputured :datetime
311
+ # file_hash :string(255)
312
+ # pub_date :string(255)
313
+ # periodical_master :boolean default(FALSE), not null
314
+ #
315
+
@@ -0,0 +1,36 @@
1
+ class ManifestationRelationship < ActiveRecord::Base
2
+ belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Manifestation'
3
+ belongs_to :child, :foreign_key => 'child_id', :class_name => 'Manifestation'
4
+ belongs_to :manifestation_relationship_type
5
+ validate :check_parent
6
+ validate :check_exist_manifestation
7
+ validates_presence_of :parent_id, :child_id
8
+ acts_as_list :scope => :parent_id
9
+ attr_accessible :parent_id, :child_id, :manifestation_relationship_type_id
10
+
11
+ def check_parent
12
+ if parent_id == child_id
13
+ errors.add(:parent)
14
+ errors.add(:child)
15
+ end
16
+ end
17
+
18
+ def check_exist_manifestation
19
+ parent_manifestation = Manifestation.find(parent_id) rescue errors[:base] << I18n.t('manifestation_relationships.no_parent_id')
20
+ child_manifestation = Manifestation.find(child_id) rescue errors[:base] << I18n.t('manifestation_relationships.no_child_id')
21
+ end
22
+ end
23
+
24
+ # == Schema Information
25
+ #
26
+ # Table name: manifestation_relationships
27
+ #
28
+ # id :integer not null, primary key
29
+ # parent_id :integer
30
+ # child_id :integer
31
+ # manifestation_relationship_type_id :integer
32
+ # created_at :datetime
33
+ # updated_at :datetime
34
+ # position :integer
35
+ #
36
+
@@ -0,0 +1,19 @@
1
+ class ManifestationRelationshipType < ActiveRecord::Base
2
+ include MasterModel
3
+ default_scope :order => 'position'
4
+ has_many :manifestation_relationships
5
+ end
6
+
7
+ # == Schema Information
8
+ #
9
+ # Table name: manifestation_relationship_types
10
+ #
11
+ # id :integer not null, primary key
12
+ # name :string(255) not null
13
+ # display_name :text
14
+ # note :text
15
+ # position :integer
16
+ # created_at :datetime
17
+ # updated_at :datetime
18
+ #
19
+
@@ -0,0 +1,35 @@
1
+ class Produce < ActiveRecord::Base
2
+ belongs_to :patron
3
+ belongs_to :manifestation
4
+ delegate :original_title, :to => :manifestation, :prefix => true
5
+
6
+ validates_associated :patron, :manifestation
7
+ validates_presence_of :patron, :manifestation
8
+ validates_uniqueness_of :manifestation_id, :scope => :patron_id
9
+ after_save :reindex
10
+ after_destroy :reindex
11
+
12
+ acts_as_list :scope => :manifestation
13
+ attr_accessible :patron, :manifestation, :patron_id, :manifestation_id
14
+
15
+ paginates_per 10
16
+
17
+ def reindex
18
+ patron.try(:index)
19
+ manifestation.try(:index)
20
+ end
21
+ end
22
+
23
+ # == Schema Information
24
+ #
25
+ # Table name: produces
26
+ #
27
+ # id :integer not null, primary key
28
+ # patron_id :integer not null
29
+ # manifestation_id :integer not null
30
+ # position :integer
31
+ # type :string(255)
32
+ # created_at :datetime
33
+ # updated_at :datetime
34
+ #
35
+
@@ -0,0 +1,24 @@
1
+ class Realize < ActiveRecord::Base
2
+ belongs_to :expression, :class_name => 'Manifestation', :foreign_key => 'expression_id'
3
+
4
+ validates_associated :expression
5
+ validates_presence_of :patron, :expression
6
+ validates_uniqueness_of :expression_id, :scope => :patron_id
7
+
8
+ acts_as_list :scope => :expression
9
+ attr_accessible :expression, :patron, :expression_id, :patron_id
10
+ end
11
+
12
+ # == Schema Information
13
+ #
14
+ # Table name: realizes
15
+ #
16
+ # id :integer not null, primary key
17
+ # patron_id :integer not null
18
+ # expression_id :integer not null
19
+ # position :integer
20
+ # type :string(255)
21
+ # created_at :datetime
22
+ # updated_at :datetime
23
+ #
24
+
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>EnjuTrunkFrbr</title>
5
+ <%= stylesheet_link_tag "enju_trunk_frbr/application", :media => "all" %>
6
+ <%= javascript_include_tag "enju_trunk_frbr/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ EnjuTrunkFrbr::Engine.routes.draw do
2
+ end
@@ -0,0 +1,5 @@
1
+ module EnjuTrunkFrbr
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace EnjuTrunkFrbr
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module EnjuTrunkFrbr
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "enju_trunk_frbr/engine"
2
+
3
+ module EnjuTrunkFrbr
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :enju_trunk_frbr do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: enju_trunk_frbr
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Emiko TAMIYA
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.2'
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: '3.2'
30
+ - !ruby/object:Gem::Dependency
31
+ name: lisbn
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
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: nori
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ - !ruby/object:Gem::Dependency
63
+ name: sqlite3
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec-rails
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: simplecov
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: FRBR models requierd for EnjuTrunk
111
+ email:
112
+ - tamiya.emiko@miraitsystems.jp
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - app/assets/stylesheets/enju_trunk_frbr/application.css
118
+ - app/assets/javascripts/enju_trunk_frbr/application.js
119
+ - app/controllers/enju_trunk_frbr/application_controller.rb
120
+ - app/helpers/enju_trunk_frbr/application_helper.rb
121
+ - app/views/layouts/enju_trunk_frbr/application.html.erb
122
+ - app/models/exemplify.rb
123
+ - app/models/manifestation.rb
124
+ - app/models/realize.rb
125
+ - app/models/manifestation_relationship_type.rb
126
+ - app/models/create.rb
127
+ - app/models/manifestation_relationship.rb
128
+ - app/models/produce.rb
129
+ - app/models/item.rb
130
+ - config/routes.rb
131
+ - lib/tasks/enju_trunk_frbr_tasks.rake
132
+ - lib/enju_trunk_frbr.rb
133
+ - lib/enju_trunk_frbr/engine.rb
134
+ - lib/enju_trunk_frbr/version.rb
135
+ - MIT-LICENSE
136
+ - Rakefile
137
+ - README.rdoc
138
+ homepage: https://github.com/nakamura-akifumi/enju_trunk
139
+ licenses: []
140
+ post_install_message:
141
+ rdoc_options: []
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ segments:
151
+ - 0
152
+ hash: -4230465122048120083
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ none: false
155
+ requirements:
156
+ - - ! '>='
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ segments:
160
+ - 0
161
+ hash: -4230465122048120083
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 1.8.23
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: FRBR models for EnjuTrunk
168
+ test_files: []