thomthom / bezier-surface

Bezier Surface Editor for SketchUp
https://extensions.sketchup.com/en/content/bezier-surface
MIT License
10 stars 1 forks source link

Bundle minimum required version of TT_Lib #18

Open thomthom opened 12 years ago

thomthom commented 12 years ago

Original report by me.


Bundle the minimum required version of TT_Lib, ( as RBZ? ) and install unless a newer version is present.

thomthom commented 12 years ago
#!ruby

unless defined?( TT::Lib )
  minimum = [ 2,7,0 ]
  version = TT::Lib::VERSION.to_s.split('.').map { |n| n.to_i }
  if minimum <=> version == 1
    path = File.dirname( __FILE__ )
    lib = File.join( path, 'TT_BezierSurface', 'lib', 'TT_Lib2.rbz' )
    defer_timer = UI.start_timer( 0.0, false ) {
      UI.stop_timer( defer_timer )
      message = "Bezier Surface require TT_Lib #{minimum.join('.')} or newer. This will now be installed."
      #if UI.message( message ) == 1
        Sketchup.install_from_archive( lib )
      #end
    }
  end
end