exlibris-aleph 0.0.2 → 0.1.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/README.rdoc CHANGED
@@ -1,3 +1,56 @@
1
1
  = Exlibris::Aleph
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ Exlibris::Primo offers a set of libraries for interacting with the ExLibris Aleph ILS.
4
+
5
+ == Exlibris::Aleph::Patron
6
+ Exlibris::Aleph::Patron provides access to the Aleph Patron REST API.
7
+
8
+ === Example of Exlibris::Aleph::Patron in action
9
+ patron =
10
+ Exlibris::Aleph::Patron.
11
+ new("S0M31D", "http://aleph.institution.edu")
12
+ patron.address # Returns HTTParty::Response of patron's address
13
+ patron.loans # Returns HTTParty::Response patron's loan
14
+ patron.renew_loans # Renews all loans
15
+ patron.renew_loans("ADM5000000001") # Renews loan of item 00000001 in ADM50
16
+ patron.place_hold("ADM50", "SBLIB", "00000001", "00000001", {:pickup_location => "SBLIB"}) # Places hold on the specified item for pickup at SBLIB
17
+
18
+ == Exlibris::Aleph::Record
19
+ Provides access to the Aleph Record REST API.
20
+
21
+ === Example of Exlibris::Aleph::Record in action
22
+ record =
23
+ Exlibris::Aleph::Record.
24
+ new("ADM50", "00000001", "http://aleph.institution.edu")
25
+ record.bib # Returns HTTParty::Response of record's bibliographic metadata
26
+ record.holdings # Returns HTTParty::Response of record's holdings
27
+ record.items # Returns HTTParty::Response of record's items
28
+
29
+ == Exlibris::Aleph::TabHelper
30
+ Exlibris::Aleph::TabHelper provides a way to access the various tab settings for patrons, patron_permissions, items, item_permission (both by item status and by item processing status), collections and pickup locations. It also provides convenience methods for common tasks like getting the pickup location for a given combination of item status, item process status and borrower status or getting an item's web text.
31
+
32
+ === Example of Exlibris::Aleph::TabHelper in action
33
+ # Placed this in an initializer.
34
+ Exlibris::Aleph::TabHelper.init("/mnt/aleph_tab", ["ADM50", "ADM50"])
35
+
36
+ # Rake task to refresh the config yml files
37
+ rake exlibris:aleph:refresh
38
+
39
+ # Get an instance of TabHelper
40
+ helper = Exlibris::Aleph::TabHelper.instance
41
+ helper.sub_library_text("SBLIB") # Returns display text for the give code
42
+ helper.sub_library_adm("SBLIB") # Returns ADM for the give code
43
+ helper.item_pickup_locations({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :bor_status => "51"}) # Returns the pickup locations for the given parameters
44
+ helper.collection_text({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :collection_code => "MAIN"}) # Returns the collection display text for the give parameters
45
+ helper.item_web_text({:adm_library_code => "ADM50", :item_process_status => "Item Process Status"}) # Returns the web text for the given parameters
46
+ helper.item_web_text({:adm_library_code => "ADM50", :sub_library_code => "SBLIB", :item_process_status_code => "DP"}) # Returns the web text for the given parameters
47
+
48
+ == Exlibris::Aleph::BorAuth
49
+ Exlibris::Aleph::BorAuth provides access to the BorAuth Aleph XService.
50
+
51
+ === Example of Exlibris::Aleph::BorAuth in action
52
+ bor_auth =
53
+ Exlibris::Aleph::BorAuth.
54
+ new("http://aleph.institution.edu", "ADM50", "SBLIB", "N", "S0M31D", "V3R1F1C@T10N")
55
+ permissions = bor_auth.permissions # Return a Hash of permissions based on the Exlibris::Aleph::BorAuth instance
56
+
@@ -2,8 +2,12 @@ module Exlibris
2
2
  module Aleph
3
3
  require 'open-uri'
4
4
  require 'nokogiri'
5
+ # ==Overview
6
+ # Exlibris::Aleph::BorAuth provides access to the BorAuth Aleph XService.
5
7
  class BorAuth
6
8
  attr_reader :response, :error, :session_id
9
+
10
+ # Creates an instance of Exlibris::Aleph::BorAuth based on the input parameters.
7
11
  def initialize(aleph_url, library, sub_library, translate, bor_id, bor_verification)
8
12
  url = "#{aleph_url}/X?"
9
13
  url += "op=bor-auth&library=#{library}&"
@@ -13,7 +17,8 @@ module Exlibris
13
17
  @session_id = @response.at("//session-id").inner_text unless @response.at("//session-id").nil?
14
18
  @error = @response.at("//error").inner_text unless @response.at("//error").nil?
15
19
  end
16
-
20
+
21
+ # Returns a Hash of permissions for the Aleph sub library passed into the constructor.
17
22
  def permissions
18
23
  rv = {}
19
24
  return rv unless @response and self.error.nil?
@@ -1,8 +1,11 @@
1
1
  module Exlibris
2
2
  module Aleph
3
+ # ==Overview
4
+ # Provides access to the Aleph Patron REST API.
3
5
  class Patron < Rest
4
- attr_accessor :patron_id
5
-
6
+ attr_reader :patron_id
7
+
8
+ # Creates an instance of Exlibris::Aleph::Patron for the given :patron_id
6
9
  def initialize(patron_id, uri)
7
10
  @patron_id = patron_id
8
11
  raise "Initialization error in #{self.class}. Missing patron id." if @patron_id.nil?
@@ -11,7 +14,8 @@ module Exlibris
11
14
  end
12
15
 
13
16
  # Place a hold on the specificed item.
14
- # Raises errors if
17
+ # Raises an error if there was a problem placing the hold.
18
+ # Returns a HTTParty::Response.
15
19
  def place_hold(adm_library, bib_library, bib_id, item_id, params)
16
20
  pickup_location = params[:pickup_location]
17
21
  raise "Error in place hold. Missing pickup location." if pickup_location.nil?
@@ -40,29 +44,38 @@ module Exlibris
40
44
  return @response
41
45
  end
42
46
 
43
- def get_address()
47
+ # Call the patronInformation/address Aleph Patron REST API
48
+ # Returns a HTTParty::Response.
49
+ def address()
44
50
  @response = self.class.get(self.uri+ "/patronInformation/address")
45
51
  return nil unless error.nil?
46
52
  return @response
47
53
  end
48
54
 
55
+ # Call the circulationActions/loans Aleph Patron REST API
56
+ # Returns a HTTParty::Response.
49
57
  def loans()
50
58
  @response = self.class.get(@uri+ "/circulationActions/loans?view=full")
51
59
  raise "Error getting loans through Aleph REST APIs. #{error}" unless error.nil?
52
60
  return @response
53
61
  end
54
62
 
63
+ # Renew the specified item.
64
+ # Will renew all if item not specified.
65
+ # Returns a HTTParty::Response.
55
66
  def renew_loans(item_id="")
56
- # Will renew all if specific item not specified
57
67
  @response = self.class.post(@uri+ "/circulationActions/loans/#{item_id}")
58
68
  raise "Error renewing loan(s) through Aleph REST APIs. #{error}" unless error.nil?
59
69
  return @response
60
70
  end
61
-
71
+
72
+ # Returns the note associated with the request.
62
73
  def note
63
74
  return (not @response.first.last.kind_of?(Hash) or @response.first.last["create_hold"].nil?) ? "" : ": #{@response.first.last["create_hold"]["note"]}" if @response.instance_of?(Hash)
64
75
  end
65
-
76
+
77
+ # Returns the error associated with the request.
78
+ # Returns nil if no error.
66
79
  def error
67
80
  return nil if reply_code == "0000"
68
81
  return "#{reply_text}#{note}"
@@ -0,0 +1,9 @@
1
+ module Exlibris
2
+ module Aleph
3
+ class Railtie < Rails::Railtie
4
+ rake_tasks do
5
+ load "tasks/exlibris-aleph_tasks.rake"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,6 +1,11 @@
1
1
  module Exlibris
2
2
  module Aleph
3
+ # ==Overview
4
+ # Provides access to the Aleph Record REST API.
3
5
  class Record < Rest
6
+ attr_reader :bib_library, :record_id
7
+
8
+ # Creates an instance of Exlibris::Aleph::Record for the given :bib_library and :record_id
4
9
  def initialize(bib_library, record_id, uri)
5
10
  @record_id = record_id
6
11
  raise "Initialization error in #{self.class}. Missing record id." if @record_id.nil?
@@ -18,6 +23,7 @@ module Exlibris
18
23
  # Returns an XML string representation of a bib.
19
24
  # Every method call refreshes the data from the underlying API.
20
25
  # Raises and exception if there are errors.
26
+ # Returns a HTTParty::Response.
21
27
  def bib
22
28
  @response = self.class.get(@uri+ "?view=full")
23
29
  raise "Error getting bib from Aleph REST APIs. #{error}" unless error.nil?
@@ -27,6 +33,7 @@ module Exlibris
27
33
  # Returns an array of items. Each item is represented as an HTTParty hash.
28
34
  # Every method call refreshes the data from the underlying API.
29
35
  # Raises an exception if the response is not valid XML or there are errors.
36
+ # Returns a HTTParty::Response.
30
37
  def items
31
38
  @items = []
32
39
  self.class.format :xml
@@ -46,6 +53,7 @@ module Exlibris
46
53
  # Returns an XML string representation of holdings
47
54
  # Every method call refreshes the data from the underlying API.
48
55
  # Raises and exception if there are errors.
56
+ # Returns a HTTParty::Response.
49
57
  def holdings
50
58
  @response = self.class.get(@uri+ "/holdings?view=full")
51
59
  raise "Error getting holdings from Aleph REST APIs. #{error}" unless error.nil?
@@ -1,17 +1,27 @@
1
1
  module Exlibris
2
2
  module Aleph
3
3
  require 'httparty'
4
+ # ==Overview
5
+ # Base implementation for Aleph REST APIs.
6
+ # Not intended for use on its own, but should
7
+ # instead be extended by implementing classes.
4
8
  class Rest
5
9
  include HTTParty
6
10
  format :xml
11
+ # Create and instance of Exlibris::Aleph::Rest for the given Aleph URI.
7
12
  def initialize(uri)
8
13
  @uri = uri
9
14
  raise "Initialization error in #{self.class}. Missing URI." if @uri.nil?
10
15
  end
16
+
17
+ # Returns the error associated with the request.
18
+ # Returns nil if no error.
11
19
  def error
12
20
  return nil if reply_code == "0000"
13
21
  return "#{reply_text}"
14
22
  end
23
+
24
+ # Returns the reply code associate with the request.
15
25
  def reply_code
16
26
  return "No response." if @response.nil?
17
27
  return (not @response.first.last.kind_of?(Hash) or @response.first.last["reply_code"].nil?) ? "Unexpected response hash." : @response.first.last["reply_code"] if @response.instance_of?(Hash)
@@ -19,6 +29,8 @@ module Exlibris
19
29
  return (response_match.nil?) ? "Unexpected response string." : response_match[1] if @response.instance_of?(String)
20
30
  return "Unexpected response type."
21
31
  end
32
+
33
+ # Returns the reply text associate with the request.
22
34
  def reply_text
23
35
  return "No response." if @response.nil?
24
36
  return (not @response.first.last.kind_of?(Hash) or @response.first.last["reply_text"].nil?) ? "Unexpected response hash." : @response.first.last["reply_text"] if @response.instance_of?(Hash)
@@ -1,32 +1,51 @@
1
- # This guy is a singleton, get one with Exlibris::Aleph::TabHelper.instance
2
1
  module Exlibris
3
2
  module Aleph
4
3
  require 'singleton'
5
4
  require 'yaml'
5
+ require 'rails'
6
+ # ==Overview
7
+ # Exlibris::Aleph::TabHelper assumes a mount of Aleph tab files and provides
8
+ # a way to access the various tab settings for patrons, patron_permissions,
9
+ # items, item_permission (both by item status and by item processing status),
10
+ # collections and pickup locations.
11
+ # It also provides convenience methods for common tasks like getting the
12
+ # pickup location for a given combination of item status, item process status
13
+ # and borrower status or getting an item's web text.
14
+ # To initialize Exlibris::Aleph::TabHelper call Exlibris::Aleph::TabHelper.init
15
+ # in an initializer.
6
16
  class TabHelper
7
17
  include Singleton
8
- attr_reader :sub_libraries, :updated_at
9
- @@tabs = {
18
+ attr_reader :updated_at
19
+ @@alephe_tabs = {
20
+ :sub_libraries => :TabSubLibrary
21
+ }
22
+ @@adm_tabs = {
10
23
  :patrons => :PcTabExpFieldExtended,
11
24
  :patron_permissions => :Tab31,
12
25
  :items => :TabWwwItemDesc,
13
26
  :item_permissions_by_item_status => :Tab15ByItemStatus,
14
27
  :item_permissions_by_item_process_status => :Tab15ByItemProcessStatus,
15
28
  :collections => :Tab40,
16
- :pickup_locations => :Tab37}
29
+ :pickup_locations => :Tab37 }
30
+ @@tabs = @@alephe_tabs.keys + @@adm_tabs.keys
17
31
  @@adms = []
18
32
  @@tab_path = nil
19
33
  @@yml_path = nil
20
34
  @@log_path = nil
21
-
22
- def self.init(tab_path, yml_path, log_path, adms)
23
- @@tab_path = tab_path
24
- @@adms = adms
25
- @@yml_path = yml_path
26
- @@log_path = log_path
27
- Dir.mkdir(yml_path) unless Dir.exist?(yml_path)
28
- @@adms.each { |adm| Dir.mkdir(File.join(yml_path, adm)) unless Dir.exist?(File.join(yml_path, adm)) }
29
- Dir.mkdir(log_path) unless Dir.exist?(log_path)
35
+
36
+ # Initialize TabHelper based on path to tabs, path to store yml configs,
37
+ # path for log file, and the ADMs for the Aleph implementation
38
+ # Exlibris::Aleph::TabHelper.init("/mnt/aleph_tab", ["ADM50", "ADM51"])
39
+ def self.init(tab_path, adms, refresh_time = ->{1.day.ago})
40
+ @@tab_path, @@adms, @@refresh_time = tab_path, adms, refresh_time
41
+ # Set yml path and log path and make directories.
42
+ @@yml_path, @@log_path = File.join(Rails.root, "config/aleph"), File.join(Rails.root, "log")
43
+ Dir.mkdir(@@yml_path) unless @@yml_path.nil? or Dir.exist?(@@yml_path)
44
+ Dir.mkdir(File.join(@@yml_path, "alephe")) unless @@yml_path.nil? or Dir.exist?(File.join(@@yml_path, "alephe"))
45
+ @@adms.each { |adm|
46
+ Dir.mkdir(File.join(@@yml_path, adm)) unless @@yml_path.nil? or Dir.exist?(File.join(@@yml_path, adm))
47
+ } unless @@adms.nil?
48
+ Dir.mkdir(@@log_path) unless @@log_path.nil? or Dir.exist?(@@log_path)
30
49
  # Make readers for each class variable
31
50
  class_variables.each do |class_variable|
32
51
  define_method "#{class_variable}".sub('@@', '') do
@@ -35,58 +54,61 @@ module Exlibris
35
54
  end
36
55
  end
37
56
 
57
+ # Refreshes the yml files that are used to parse the tables.
38
58
  def self.refresh_yml
39
- tab = Exlibris::Aleph::Config::TabSubLibrary.new({
40
- :aleph_library => "ALEPHE", :aleph_mnt_path => @@tab_path}).to_h
41
- File.open(File.join(@@yml_path, "#{:sub_libraries}.yml"), 'w') { |out| YAML.dump( tab, out ) } unless tab.empty?
42
- @@tabs.each do |tab_name, tab_class|
59
+ @@alephe_tabs.each do |key, klass|
60
+ tab = Exlibris::Aleph::Config.const_get(klass).new({
61
+ :aleph_library => "ALEPHE", :aleph_mnt_path => @@tab_path}).to_h
62
+ File.open( File.join(@@yml_path, "alephe", "#{key}.yml"), 'w' ) { |out| YAML.dump( tab, out ) } unless tab.empty?
63
+ end
64
+ @@adm_tabs.each do |key, klass|
43
65
  @@adms.each do |adm|
44
- tab = Exlibris::Aleph::Config.const_get(tab_class).new({
66
+ tab = Exlibris::Aleph::Config.const_get(klass).new({
45
67
  :aleph_library => adm, :aleph_mnt_path => @@tab_path}).to_h
46
- File.open( File.join(@@yml_path, adm, "#{tab_name}.yml"), 'w' ) { |out| YAML.dump( tab, out ) } unless tab.empty?
68
+ File.open( File.join(@@yml_path, adm, "#{key}.yml"), 'w' ) { |out| YAML.dump( tab, out ) } unless tab.empty?
47
69
  end
48
70
  end
49
71
  end
50
72
 
73
+ # Private initialzize method for the singleton.
51
74
  def initialize
52
75
  raise ArgumentError.new("No tab path was specified.") if @@tab_path.nil?
53
76
  raise ArgumentError.new("No yml path was specified.") if @@yml_path.nil?
54
77
  raise ArgumentError.new("No log path was specified.") if @@log_path.nil?
55
- raise ArgumentError.new("No ADMs were specified.") if @@adms.empty?
78
+ raise ArgumentError.new("No ADMs were specified.") if @@adms.nil? or @@adms.empty?
79
+ raise ArgumentError.new("No refresh time was specified.") if @@refresh_time.nil?
56
80
  self.class.refresh_yml
57
81
  @helper_log = Logger.new(File.join(@@log_path, "tab_helper.log"))
58
82
  @helper_log.level = Logger::WARN
59
- @patrons = {}
60
- @patron_permissions = {}
61
- @items = {}
62
- @item_permissions_by_item_status = {}
63
- @item_permissions_by_item_process_status = {}
64
- @collections = {}
65
- @pickup_locations = {}
66
- @sub_libraries = {}
67
- @@tabs.each_key { |tab| self.class.send(:attr_reader, tab) }
83
+ @@tabs.each { |tab|
84
+ # Default to empty hash
85
+ instance_variable_set("@#{tab}".to_sym, {})
86
+ # Define reader w/ refresh
87
+ self.class.send(:define_method, tab) {
88
+ return instance_variable_get("@#{tab}".to_sym) unless refresh?
89
+ refresh and return instance_variable_get("@#{tab}".to_sym)
90
+ }
91
+ }
68
92
  refresh
69
93
  end
70
-
71
- def sub_library_text(params)
72
- # raise_required_parameter_error :sub_library_code if params[:sub_library_code].nil?
73
- sub_library = @sub_libraries[params[:sub_library_code]]
94
+
95
+ # Returns the sub library display text for the given sub library code
96
+ def sub_library_text(code)
97
+ sub_library = @sub_libraries[code]
74
98
  return sub_library[:text] unless sub_library.nil?
75
99
  end
76
100
 
77
- def sub_library_adm(params)
78
- # raise_required_parameter_error :sub_library_code if params[:sub_library_code].nil?
79
- sub_library = @sub_libraries[params[:sub_library_code]]
101
+ # Returns the ADM associated with the given sub library code
102
+ def sub_library_adm(code)
103
+ sub_library = @sub_libraries[code]
80
104
  return sub_library[:library] unless sub_library.nil?
81
105
  end
82
106
 
107
+ # Returns an array of pickup locations based on the given params.
108
+ # Available param keys are:
109
+ # :adm_library_code, :sub_library_code, :item_status_code,
110
+ # :item_process_status_code, :bor_status, :availability_status
83
111
  def item_pickup_locations(params)
84
- # raise_required_parameter_error :adm_library_code if params[:adm_library_code].nil?
85
- # raise_required_parameter_error :sub_library_code if params[:sub_library_code].nil?
86
- # raise_required_parameter_error :item_status_code if params[:item_status_code].nil?
87
- # raise_required_parameter_error :item_process_status_code if params[:item_process_status_code].nil?
88
- # raise_required_parameter_error :bor_status if params[:bor_status].nil?
89
- # raise_required_parameter_error :availability_status if params[:availability_status].nil?
90
112
  adm_locations = pickup_locations[params[:adm_library_code]]
91
113
  sub_locations = adm_locations[params[:sub_library_code]] unless adm_locations.nil?
92
114
 
@@ -178,25 +200,31 @@ module Exlibris
178
200
  return [params[:sub_library_code]]
179
201
  end
180
202
 
203
+ # Returns collection text for the given params.
204
+ # Available param keys are:
205
+ # :adm_library_code, :sub_library_code, :collection_code
181
206
  def collection_text(params)
182
- # raise_required_parameter_error :adm_library_code if params[:adm_library_code].nil?
183
- # raise_required_parameter_error :sub_library_code if params[:sub_library_code].nil?
184
- # raise_required_parameter_error :collection_code if params[:collection_code].nil?
185
207
  adm = collections[params[:adm_library_code]]
186
208
  sub = adm[params[:sub_library_code]] unless adm.nil?
187
209
  coll = sub[params[:collection_code]] unless sub.nil?
188
210
  return coll[:text] unless coll.nil?
189
211
  end
190
212
 
213
+ # Returns web display text for the given params.
214
+ # Available param keys are:
215
+ # :adm_library_code, :sub_library_code, :item_status_code, :item_process_status_code, :item_status, :item_process_status
191
216
  def item_web_text(params)
192
217
  adm = items[params[:adm_library_code]]
193
- item = (adm[params[:item_process_status]].nil?) ? adm[params[:item_status]] : adm[params[:item_process_status]] unless (params[:item_status].nil? and params[:item_process_status]) or adm.nil?
218
+ item = (adm[params[:item_process_status]].nil?) ? adm[params[:item_status]] : adm[params[:item_process_status]] unless (params[:item_status].nil? and params[:item_process_status].nil?) or adm.nil?
194
219
  permissions = item_permissions(params) if item.nil?
195
220
  item = adm[permissions[:text]] unless permissions.nil? or adm.nil?
196
221
  return item[:web_text] unless item.nil?
197
222
  return permissions[:text] unless permissions.nil?
198
223
  end
199
224
 
225
+ # Returns item permissions for the given params.
226
+ # Available param keys are:
227
+ # :adm_library_code, :sub_library_code, :item_status_code, :item_process_status_code
200
228
  def item_permissions(params)
201
229
  unless params[:item_process_status_code].nil?
202
230
  adm_permissions =
@@ -227,23 +255,25 @@ module Exlibris
227
255
  return {}
228
256
  end
229
257
 
258
+ private
230
259
  def refresh?
231
- return true if (@updated_at.nil? or @updated_at < 1.day.ago)
260
+ return (@updated_at.nil? or @updated_at < @@refresh_time.call)
232
261
  end
233
262
 
234
263
  def refresh
235
- @updated_at = Time.now()
236
- @sub_libraries = YAML.load_file(File.join(@@yml_path, "#{:sub_libraries}.yml"))
237
- @@tabs.each_key do |tab_name|
264
+ @@alephe_tabs.each_key do |key|
265
+ instance_variable_set("@#{key}".to_sym, YAML.load_file(File.join(@@yml_path, "alephe", "#{key}.yml")))
266
+ end
267
+ @@adm_tabs.each_key do |key|
238
268
  @@adms.each do |adm|
239
- tab = instance_variable_get("@#{tab_name}".to_sym)
240
- tab[adm] = YAML.load_file(File.join(@@yml_path, adm, "#{tab_name}.yml"))
241
- instance_variable_set("@#{tab_name}".to_sym, tab)
269
+ tab = instance_variable_get("@#{key}".to_sym)
270
+ tab[adm] = YAML.load_file(File.join(@@yml_path, adm, "#{key}.yml"))
271
+ instance_variable_set("@#{key}".to_sym, tab)
242
272
  end
243
273
  end
274
+ @updated_at = Time.now()
244
275
  end
245
276
 
246
- private
247
277
  def raise_required_parameter_error(parameter)
248
278
  raise "Initialization error in #{self.class}. Missing required parameter: #{parameter}."
249
279
  end
@@ -1,5 +1,5 @@
1
1
  module Exlibris
2
2
  module Aleph
3
- VERSION = "0.0.2"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -14,7 +14,8 @@ PATH = File.dirname(__FILE__) + "/exlibris/aleph/"
14
14
  'rest',
15
15
  'record',
16
16
  'patron',
17
- 'bor_auth'
17
+ 'bor_auth',
18
+ 'railtie'
18
19
  ].each do |library|
19
- require PATH + library
20
+ require PATH + library if defined?(Rails)
20
21
  end
@@ -1,13 +1,15 @@
1
- # desc "Explaining what the task does"
2
- # task :exlibris:aleph do
3
- # # Task goes here
4
- # end
5
1
  namespace :exlibris do
6
2
  namespace :aleph do
3
+ desc "Initialize rake environment"
4
+ task :initialize do
5
+ Dir.glob("config/initializers/*.rb").each do |initializer|
6
+ require File.expand_path(File.join(Rails.root, initializer), __FILE__)
7
+ end
8
+ end
7
9
 
8
10
  desc "Refresh Aleph YAML Config"
9
- task :refresh, [:aleph_mnt_path] => :environment do |t, args|
11
+ task :refresh => :initialize do
10
12
  Exlibris::Aleph::TabHelper.refresh_yml
11
13
  end
12
14
  end
13
- emd
15
+ end
@@ -755,6 +755,10 @@ NYHS:
755
755
  :collection_code: ADMIN
756
756
  :sub_library: NYHS
757
757
  :text: AdminOffice
758
+ ALMA:
759
+ :collection_code: ALMA
760
+ :sub_library: NYHS
761
+ :text: Almanacs
758
762
  ARCH:
759
763
  :collection_code: ARCH
760
764
  :sub_library: NYHS