Class: FcrepoWrapper::Configuration
- Inherits:
-
Object
- Object
- FcrepoWrapper::Configuration
- Defined in:
- lib/fcrepo_wrapper/configuration.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #binary_path ⇒ Object
- #default_download_path ⇒ Object
- #default_java_options ⇒ Object
- #download_path ⇒ Object
- #download_url ⇒ Object
- #env ⇒ Object
- #fcrepo_home_dir ⇒ Object
- #fcrepo_options ⇒ Object
-
#initialize(options) ⇒ Configuration
constructor
A new instance of Configuration.
- #instance_dir ⇒ Object
-
#java_options ⇒ Object
A list of arguments to pass to the JVM.
- #managed? ⇒ Boolean
- #md5sum_path ⇒ Object
- #md5url ⇒ Object
- #port ⇒ Object
- #tmp_save_dir ⇒ Object
- #verbose? ⇒ Boolean
- #version ⇒ Object
- #version_file ⇒ Object
Constructor Details
#initialize(options) ⇒ Configuration
4 5 6 7 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 4 def initialize() = read_config([:config], [:verbose]) .merge end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 3 def end |
Instance Method Details
#binary_path ⇒ Object
41 42 43 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 41 def binary_path File.join(instance_dir, "fcrepo-webapp-#{version}-jetty-console.jar") end |
#default_download_path ⇒ Object
17 18 19 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 17 def default_download_path File.join(download_dir, File.basename(download_url)) end |
#default_java_options ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 70 def ['-Dfcrepo.log.http.api=WARN', # To avoid "WARN: The namespace of predicate: # info:fedora/fedora-system:def/relations-external#isPartOf # was possibly misinterpreted as: # info:fedora/fedora-system:def/relations-external#." '-Dfcrepo.log.kernel=ERROR', ("-Dfcrepo.home=#{fcrepo_home_dir}" if fcrepo_home_dir), ("-Dfcrepo.spring.jms.configuration=#{spring_noop_file}" unless jms_enabled?), '-Xmx512m'].compact end |
#download_path ⇒ Object
21 22 23 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 21 def download_path @download_path ||= .fetch(:download_path, default_download_path) end |
#download_url ⇒ Object
13 14 15 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 13 def download_url @download_url ||= .fetch(:url, default_download_url) end |
#env ⇒ Object
53 54 55 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 53 def env .fetch(:env, {}) end |
#fcrepo_home_dir ⇒ Object
82 83 84 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 82 def fcrepo_home_dir [:fcrepo_home_dir] end |
#fcrepo_options ⇒ Object
49 50 51 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 49 def .fetch(:fcrepo_options, headless: nil) end |
#instance_dir ⇒ Object
9 10 11 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 9 def instance_dir @instance_dir ||= .fetch(:instance_dir, File.join(Dir.tmpdir, File.basename(download_url, ".jar"))) end |
#java_options ⇒ Object
66 67 68 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 66 def .fetch(:java_options, ) + ['-jar', binary_path] end |
#managed? ⇒ Boolean
61 62 63 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 61 def managed? File.exists?(instance_dir) end |
#md5sum_path ⇒ Object
25 26 27 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 25 def md5sum_path File.join(download_dir, File.basename(md5url)) end |
#md5url ⇒ Object
45 46 47 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 45 def md5url "https://github.com/fcrepo4/fcrepo4/releases/download/fcrepo-#{version}/fcrepo-webapp-#{version}-jetty-console.jar.md5" end |
#port ⇒ Object
86 87 88 89 90 91 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 86 def port # Check if the port option has been explicitly set to nil. # this means to start fcrepo_wrapper on a random open port return nil if .key?(:port) && ![:port] [:port] || FcrepoWrapper.[:port] end |
#tmp_save_dir ⇒ Object
29 30 31 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 29 def tmp_save_dir @tmp_save_dir ||= Dir.mktmpdir end |
#verbose? ⇒ Boolean
57 58 59 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 57 def verbose? !!.fetch(:verbose, false) end |
#version ⇒ Object
33 34 35 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 33 def version @version ||= .fetch(:version, FcrepoWrapper.default_fcrepo_version) end |
#version_file ⇒ Object
37 38 39 |
# File 'lib/fcrepo_wrapper/configuration.rb', line 37 def version_file .fetch(:version_file, File.join(instance_dir, "VERSION")) end |