exlibris-aleph 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,5 +4,3 @@ require 'active_support/builder'
4
4
  require 'marc'
5
5
  require "require_all"
6
6
  require_all "#{File.dirname(__FILE__)}/exlibris/"
7
- # Install tasks
8
- Exlibris::Aleph::TaskInstaller.install_tasks
@@ -18,6 +18,8 @@ module Exlibris
18
18
  end
19
19
  end
20
20
  end
21
+ # Install tasks
22
+ Exlibris::Aleph::TaskInstaller.install_tasks
21
23
  end
22
24
  end
23
25
  end
@@ -1,5 +1,5 @@
1
1
  module Exlibris
2
2
  module Aleph
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -1,7 +1,54 @@
1
1
  namespace :exlibris do
2
2
  namespace :aleph do
3
- desc "Refresh Aleph YAML Config"
4
- task :refresh do
3
+ desc "Initialize the Exlibris::Aleph environment"
4
+ task :initialize, :config_file, :tab_path, :yml_path, :adms do |task, args|
5
+ args.with_defaults(:config_file => '', :tab_path => '', :adms => [])
6
+ # If we're in the Rails environment, use Rails initializers
7
+ if defined?(::Rails) && ::Rails.version >= '3.1.0'
8
+ Rake::Task['exlibris:aleph:initialize_via_rails_initializers'].invoke
9
+ elsif (not args[:config_file].empty?)
10
+ Rake::Task['exlibris:aleph:initialize_via_config_file'].invoke(args[:config_file])
11
+ elsif (not args[:tab_path].empty?) and (not args[:adms].empty?)
12
+ Rake::Task['exlibris:aleph:initialize_via_args'].invoke(args[:tab_path], args[:yml_path], args[:adms])
13
+ else
14
+ raise Rake::TaskArgumentError.new("Insufficient arguments.")
15
+ end
16
+ p "Configured tab path: #{Exlibris::Aleph::TabHelper.tab_path}"
17
+ p "Configured yml path: #{Exlibris::Aleph::TabHelper.yml_path}"
18
+ p "Configured ADMs: #{Exlibris::Aleph::TabHelper.adms}"
19
+ end
20
+
21
+ desc "Initialize the Exlibris::Aleph environment via the given yaml config file"
22
+ task :initialize_via_config_file, :config_file do |task, args|
23
+ config_file = args[:config_file]
24
+ # Load Aleph configuration via given config_file
25
+ Exlibris::Aleph.configure do |config|
26
+ config.load_yaml config_file
27
+ end
28
+ end
29
+
30
+ desc "Initialize the Exlibris::Aleph environment via the given args.\nADMs should be separated by semicolons."
31
+ task :initialize_via_args, :tab_path, :yml_path, :adms do |task, args|
32
+ tab_path = args[:tab_path]
33
+ yml_path = args[:yml_path]
34
+ adms = args[:adms].split(";")
35
+ # Load Aleph configuration via given config_file
36
+ Exlibris::Aleph.configure do |config|
37
+ config.tab_path = tab_path
38
+ config.yml_path = yml_path
39
+ config.adms = adms
40
+ end
41
+ end
42
+
43
+ desc "Initialize the Exlibris::Aleph environment via the Rails initializers"
44
+ task :initialize_via_rails_initializers do
45
+ Dir.glob("config/initializers/*.rb").each do |initializer|
46
+ require File.join(Rails.root, initializer)
47
+ end
48
+ end
49
+
50
+ desc "Refresh the Exlibris::Aleph tables"
51
+ task :refresh, [:config_file, :tab_path, :yml_path, :adms] => :initialize do
5
52
  Exlibris::Aleph::TabHelper.refresh_yml
6
53
  end
7
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exlibris-aleph
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -258,7 +258,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
258
258
  version: '0'
259
259
  segments:
260
260
  - 0
261
- hash: 2177863585124599412
261
+ hash: -1669963542403011197
262
262
  required_rubygems_version: !ruby/object:Gem::Requirement
263
263
  none: false
264
264
  requirements:
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  version: '0'
268
268
  segments:
269
269
  - 0
270
- hash: 2177863585124599412
270
+ hash: -1669963542403011197
271
271
  requirements: []
272
272
  rubyforge_project:
273
273
  rubygems_version: 1.8.24