Class: AMS::ExtensionManager
- Inherits:
-
Object
- Object
- AMS::ExtensionManager
- Defined in:
- ext-ruby/ams_lib/extension_manager.rb
Overview
An extension manager for copying, loading, and removing dynamic linked libraries, C extensions, and rubies. Thanks to ThomThom for allowing me to extend his original C extension manager.
Instance Method Summary collapse
-
#add_c_extension(filename) ⇒ void
Add an
.so
/.bundle
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
.dll
/.dylib
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 (loaded).
-
#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 bypass overwrite issues when updating the loaded extension.
-
#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 required from EXT_PATH/libraries/VERSION/ or TEMP_EXT_PATH/libraries/VERSION/ or EXT_PATH/libraries/stage/ (as the last resort).
Rubies are loaded from EXT_PATH.
Apply a staging technique to the dynamically linked libraries, to bypass overwrite issues when updating the loaded extension.
- The files within EXT_PATH/libraries/stage/ folder are used as resources for copying and are usually not loaded. These files are the ones that get overwritten when the extension is updated.
- Unless already created, the manager creates an additional version-specific folder within EXT_PATH/libraries/ and copies the platform-specific, staged 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 staged resources are copied into a TEMP folder and are loaded from there.
- If all fails, as the last resort, loading is performed from the staged directory.
- An optional clean-up method removes outdated version-specific folders, and unregistered rubies, for the purpose of keeping the plugin directory 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 an .so
/.bundle
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 .dll
/.dylib
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 (loaded).
#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.