Class: AMS::ExtensionManager
- Inherits:
-
Object
- Object
- AMS::ExtensionManager
- Defined in:
- RubyExtension/ams_Lib/extension_manager.rb
Overview
An extension manager for copying, loading, and removing dynamic linked libraries, C extensions, and rubies (credit to ThomThom).
Instance Method Summary collapse
-
#add_c_extension(filename) ⇒ void
Add a C extension file that must be copied/loaded.
-
#add_optional_library(filename) ⇒ void
Add a library file that will be copied/loaded in case it's there.
-
#add_required_library(filename) ⇒ void
Add a library file that must be copied/loaded.
-
#add_ruby(filename, only_register = false) ⇒ Object
Add a Ruby file that will be required and ignored from cleanup.
-
#add_ruby_no_require(filename) ⇒ Object
Add a Ruby file that will be ignored from cleanup but not required.
-
#clean_up(clean_rubies = false) ⇒ void
Erase all unused libraries, c extension files, and unregistered ruby files (if
clean_rubies
is enabled). -
#initialize(ext_path, ext_version, experimental = false) ⇒ ExtensionManager
constructor
Apply a staging technique to the dynamically linked libraries, to avoid experiencing overwrite issues that occur when attempting to update the extension while it's loaded.
-
#require_all ⇒ void
Copy and load all the required and optional files.
Constructor Details
#initialize(ext_path, ext_version, experimental = false) ⇒ ExtensionManager
When the libraries are copied, they are obtained from EXT_PATH/libraries/stage/.
When the libraries are loaded, they are obtained from EXT_PATH/libraries/VERSION/ or TEMP_EXT_PATH/libraries/VERSION/.
Rubies are loaded from EXT_PATH.
Apply a staging technique to the dynamically linked libraries, to avoid experiencing overwrite issues that occur when attempting to update the extension while it's loaded.
-
The files within EXT_PATH/libraries/stage/ folder are used as resources for copying and are not loaded. These files are the ones that get overwritten when the extension is updated.
-
Unless already created, we create an additional version-specific folder within EXT_PATH/libraries/ and copy all the necessary stage resources into the folder. The libraries within the version-specific folder are the ones that get loaded.
-
In case the extension is installed outside the user directory, where the file permissions are limited, the necessary stage resources are copied into a TEMP folder and are loaded from there.
-
An optional clean-up method removes outdated version-specific folders, and unregistered rubies, for the purpose of keeping the library clean.
Instance Method Details
#add_c_extension(filename) ⇒ void
All C extension files are be copied from EXT_PATH/libraries/stage/PLATFORM + BIT/RUBY_VERSION/.
This method returns an undefined value.
Add a C extension file that must be copied/loaded.
#add_optional_library(filename) ⇒ void
All dll/dylib files are copied from EXT_PATH/libraries/stage/PLATFORM + BIT/.
This method returns an undefined value.
Add a library file that will be copied/loaded in case it's there.
#add_required_library(filename) ⇒ void
All dll/dylib files are copied from EXT_PATH/libraries/stage/PLATFORM + BIT/.
This method returns an undefined value.
Add a library file that must be copied/loaded.
#add_ruby(filename, only_register = false) ⇒ Object
All added rubies are loaded last in the order they are added.
Add a Ruby file that will be required and ignored from cleanup.
#add_ruby_no_require(filename) ⇒ Object
Add a Ruby file that will be ignored from cleanup but not required.
#clean_up(clean_rubies = false) ⇒ void
This does not erase any files from the TEMP folder, as they may be used by other SketchUp versions.
This does not raise any errors upon failure to delete a file or a directory.
This method returns an undefined value.
Erase all unused libraries, c extension files, and unregistered ruby files
(if clean_rubies
is enabled).
#require_all ⇒ void
All .dll files are loaded first, in the order they are added, all .so or .bundle files afterwards, and all ruby files last. All .dylib files are expected to be loaded by a C extension.
This method returns an undefined value.
Copy and load all the required and optional files.