Module: TT::Lib
- Defined in:
- TT_Lib2/core.rb
Overview
TT_Lib related methods.
Constant Summary
- VERSION =
Library version number.
PLUGIN_VERSION
- PREF_KEY =
Library preference key.
'TT_Lib2'.freeze
- PATH =
File.dirname( file ).freeze
- PATH_LIBS =
File.join( PATH, 'libraries' ).freeze
- PATH_LIBS_CEXT =
@cext_manager.prepare_path.freeze
Class Method Summary collapse
-
.cext_manager ⇒ Object
TT::Lib.cext_manager.
-
.compatible?(version, plugin_name = 'A plugin installed') ⇒ Boolean
Call this method to check if the installed
TT_Lib
version is the same or newer thanversion
. -
.path ⇒ String
The file path where the library is installed.
-
.reload(return_files = false) ⇒ Integer, Array
Debug method to reload the library modules.
Class Method Details
.cext_manager ⇒ Object
TT::Lib.cext_manager
127 |
# File 'TT_Lib2/core.rb', line 127 def self.cext_manager; @cext_manager; end |
.compatible?(version, plugin_name = 'A plugin installed') ⇒ Boolean
Call this method to check if the installed TT_Lib
version is
the same or newer than version
. If it's not then a
messagebox will appear informing the user that a newer TT_Lib
is required.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'TT_Lib2/core.rb', line 142 def self.compatible?(version, plugin_name = 'A plugin installed') major, minor, revision = TT::Lib::VERSION.split('.').map { |s| s.to_i } min_major, min_minor, min_revision = version.split('.').map { |s| s.to_i } return true if major > min_major return true if major == min_major && minor > min_minor return true if major == min_major && minor == min_minor && revision >= min_revision #UI.messagebox("#{plugin_name} requires a newer version, #{version}, of TT_Lib.") if TT.lib2_update.nil? url = 'http://www.thomthom.net/software/sketchup/tt_lib2/errors/outdated' = { :dialog_title => 'TT_LibĀ² Outdated', :scrollable => false, :resizable => false, :left => 200, :top => 200 } w = UI::WebDialog.new( ) w.set_size( 500, 300 ) arguments = "plugin=#{plugin_name}" arguments << "&version=#{TT::Lib::VERSION}" arguments << "&minimum=#{version}" w.set_url( "#{url}?#{arguments}" ) w.show TT.lib2_update = w end return false end |
.path ⇒ String
Returns The file path where the library is installed.
319 320 321 |
# File 'TT_Lib2/core.rb', line 319 def self.path PATH.dup end |
.reload(return_files = false) ⇒ Integer, Array
Debug method to reload the library modules.
331 332 333 334 335 336 337 338 339 340 |
# File 'TT_Lib2/core.rb', line 331 def self.reload( return_files=false ) original_verbose = $VERBOSE $VERBOSE = nil # Mute warnings caused by constant redefining. x = Dir.glob( File.join(self.path, '*.{rb,rbs}') ).each { |file| load file } (return_files) ? x : x.length ensure $VERBOSE = original_verbose end |