Module: Remind::Library
- Defined in:
- lib/remind/library.rb
Overview
Where the shared library is, and where the sources it is built from are.
Remind ships no shared library -- its Makefile builds two programs -- so
there is nothing installed to find. Builder compiles one out of the
vendored sources into tmp/, and this is the module that agrees with it
about where that is.
Constant Summary collapse
- ENV_VAR =
An escape hatch for a library built elsewhere: a distribution package, a Nix store path, a scratch build.
"REMIND_LIBRARY"- EXTENSION =
.soon Linux,.bundleon macOS -- whatever this Ruby loads. RbConfig::CONFIG.fetch("DLEXT")
Class Method Summary collapse
- .built? ⇒ Boolean
-
.default_path ⇒ Object
The compiled library: what
rake compilewrites, and what a precompiled gem carries. -
.path ⇒ Object
A library named in the environment is the answer, whether or not it is there: someone who names one has a particular library in mind, and quietly using a different one would be worse than saying it is missing.
-
.root ⇒ Object
The gem's own directory: two levels up from lib/remind/.
-
.shim ⇒ Object
The one C file this gem owns.
- .source_directory ⇒ Object
-
.source_root ⇒ Object
The vendored Remind release, named for its version so that the bindings cannot be vague about which one they bind.
Class Method Details
.built? ⇒ Boolean
97 98 99 |
# File 'lib/remind/library.rb', line 97 def built? File.exist?(ENV.fetch(ENV_VAR, default_path)) end |
.default_path ⇒ Object
The compiled library: what rake compile writes, and what a precompiled
gem carries. One place, so that a checkout and an installed gem look the
same to everything above this.
75 76 77 78 79 80 81 82 |
# File 'lib/remind/library.rb', line 75 def default_path File.join( root, "lib", "remind", "libremind.#{EXTENSION}", ) end |
.path ⇒ Object
A library named in the environment is the answer, whether or not it is there: someone who names one has a particular library in mind, and quietly using a different one would be worse than saying it is missing.
87 88 89 90 91 92 93 94 95 |
# File 'lib/remind/library.rb', line 87 def path candidate = ENV.fetch(ENV_VAR, default_path) if File.exist?(candidate) candidate else raise LibraryMissing, candidate end end |
.root ⇒ Object
The gem's own directory: two levels up from lib/remind/.
48 49 50 |
# File 'lib/remind/library.rb', line 48 def root File.("../..", __dir__) end |
.shim ⇒ Object
The one C file this gem owns. See ext/remind/shim.c for what it is for.
63 64 65 66 67 68 69 70 |
# File 'lib/remind/library.rb', line 63 def shim File.join( root, "ext", "remind", "shim.c", ) end |
.source_directory ⇒ Object
58 59 60 |
# File 'lib/remind/library.rb', line 58 def source_directory File.join(source_root, "src") end |
.source_root ⇒ Object
The vendored Remind release, named for its version so that the bindings cannot be vague about which one they bind.
54 55 56 |
# File 'lib/remind/library.rb', line 54 def source_root File.join(root, "remind-v#{REMIND_VERSION}") end |