ModraUp Ruby API Documentation Ruby API Reference

Module: ModraUp::LocalExtensionManager

Overview

The underlying interface used by the host "Extension Manager" dialog: read the list of installed native extensions, uninstall them, and save preferences. Plugins should use ModraUp.extensions and SketchupExtension instead of relying on this module.

Note: ModraUp extension. SketchUp does not have this module.

Examples:

ModraUp::LocalExtensionManager.respond_to?(:inventory_json)  #=> true

Class Method Summary # collapse

  • .startup_states ⇒ Hash
    Returns an independent copy of the extension and entry script enable states for use in startup policies and management.
  • .save_preferences ⇒ Boolean
    Write back the modified preferences (including extension enabled status) to the preference file immediately, performing an atomic replacement of the entire file.
  • .inventory_json ⇒ String
    A JSON array listing installed extensions in the Plugins directory, with each item containing id, name, loaders (top-level entry scripts, relative to the Plugins directory), removable, and reason explaining why it cannot be uninstalled. When there is no host, it is "[]".
  • .uninstall(id) ⇒ Boolean
    Remove the files of an installed extension package based on the id from inventory_json. The loaded code will only disappear after a restart.

Class Method Details

ModraUp::LocalExtensionManager.startup_states ⇒ Hash

Returns an independent copy of the extension and entry script enable states for use in startup policies and management.

Returns:

  • (Hash)
Note: ModraUp extension.

ModraUp::LocalExtensionManager.save_preferences ⇒ Boolean

Write back the modified preferences (including extension enabled status) to the preference file immediately, performing an atomic replacement of the entire file.

Returns:

  • (Boolean) Writing failed as false
Note: ModraUp extension.

Examples:

ModraUp::LocalExtensionManager.save_preferences  #=> true

ModraUp::LocalExtensionManager.inventory_json ⇒ String

A JSON array listing installed extensions in the Plugins directory, with each item containing id, name, loaders (top-level entry scripts, relative to the Plugins directory), removable, and reason explaining why it cannot be uninstalled. When there is no host, it is "[]".

Returns:

  • (String)
Note: ModraUp extension.

Examples:

require 'json'
JSON.parse(ModraUp::LocalExtensionManager.inventory_json).map { |row| row['name'] }

ModraUp::LocalExtensionManager.uninstall(id) ⇒ true

Remove the files of an installed extension package based on the id from inventory_json. The loaded code will only disappear after a restart.

Parameters:

  • id (String) Extension Package id

Returns:

  • (Boolean)

Raises:

  • [RuntimeError] Package does not exist, is protected (removable is false), deletion failed, or has no host.
Note: ModraUp extension.

Examples:

require 'json'
rows = JSON.parse(ModraUp::LocalExtensionManager.inventory_json)
row = rows.find { |r| r['name'] == 'MyExtension' && r['removable'] }
ModraUp::LocalExtensionManager.uninstall(row['id']) if row